From 84a69594d328871128772cefd6a62b494792e77a Mon Sep 17 00:00:00 2001 From: Koen van der Veen Date: Wed, 4 Oct 2023 11:08:15 +0200 Subject: [PATCH] - --- notebooks/helm/Untitled.ipynb | 6 + notebooks/helm/consumer node.ipynb | 588 ++++++++++++++++++ notebooks/helm/helm_syft.ipynb | 190 +++--- notebooks/helm/nested_syft_functions.ipynb | 134 +--- notebooks/helm/producer node.ipynb | 521 ++++++++++++++++ packages/syft/src/syft/node/node.py | 4 +- .../syft/src/syft/service/job/job_stash.py | 4 +- 7 files changed, 1260 insertions(+), 187 deletions(-) create mode 100644 notebooks/helm/Untitled.ipynb create mode 100644 notebooks/helm/consumer node.ipynb create mode 100644 notebooks/helm/producer node.ipynb diff --git a/notebooks/helm/Untitled.ipynb b/notebooks/helm/Untitled.ipynb new file mode 100644 index 00000000000..363fcab7ed6 --- /dev/null +++ b/notebooks/helm/Untitled.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebooks/helm/consumer node.ipynb b/notebooks/helm/consumer node.ipynb new file mode 100644 index 00000000000..417e016c3c1 --- /dev/null +++ b/notebooks/helm/consumer node.ipynb @@ -0,0 +1,588 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 12, + "id": "a196017f", + "metadata": {}, + "outputs": [], + "source": [ + "import syft as sy\n", + "from syft import ActionObject\n", + "from syft import syft_function, syft_function_single_use\n", + "from time import sleep\n", + "from syft.service.queue.zmq_queue import ZMQQueueConfig, ZMQClientConfig" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "830cb5cf", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "spawning thread\n", + "spawning thread\n", + "spawning thread\n" + ] + } + ], + "source": [ + "worker_node = sy.orchestra.launch(name=\"worker-node-helm1\", dev_mode=True, reset=True,\n", + " n_consumers=3,\n", + " queue_config=ZMQQueueConfig(client_config=ZMQClientConfig(\n", + " create_producer=False,\n", + " consumer_port=62249\n", + " )\n", + " )\n", + " )\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "88fb4211", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'tcp://localhost:62249'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "worker_node.python_node.queue_manager.consumers[\"api_call\"][0].address" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "d1f13284", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heartbeat failure, worker can't reach queue, reconnecting in 1sHeartbeat failure, worker can't reach queue, reconnecting in 1s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 1s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 2sHeartbeat failure, worker can't reach queue, reconnecting in 2s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 2s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 4s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 4s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 4s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 8sHeartbeat failure, worker can't reach queue, reconnecting in 8s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 8s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 16sHeartbeat failure, worker can't reach queue, reconnecting in 16s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 16s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32sHeartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n", + "Heartbeat failure, worker can't reach queue, reconnecting in 32s\n" + ] + } + ], + "source": [ + "sleep(3)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.16" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": true + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebooks/helm/helm_syft.ipynb b/notebooks/helm/helm_syft.ipynb index 8928d58a208..f815f47380b 100644 --- a/notebooks/helm/helm_syft.ipynb +++ b/notebooks/helm/helm_syft.ipynb @@ -32,14 +32,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "CREATING A PRODUCER ON 57231\n", - "CREATING A CONSUMER ON tcp://localhost:57231\n", "spawning thread\n", - "CREATING A CONSUMER ON tcp://localhost:57231\n", "spawning thread\n", - "CREATING A CONSUMER ON tcp://localhost:57231\n", "spawning thread\n", - "CREATING A CONSUMER ON tcp://localhost:57231\n", "spawning thread\n", "Logged into as \n" ] @@ -131,11 +126,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ - "# for line in input_ptr.syft_action_data[0].iter_lines():\n", + "# for line in input_files_ptr.syft_action_data[0].iter_lines():\n", "# print(line)" ] }, @@ -294,7 +289,7 @@ " N = [5, 9, 13]\n", " jobs = []\n", " for n in N[:1]:\n", - " for scenario_file in scenario_files: \n", + " for scenario_file in scenario_files:\n", " batch_job = domain.launch_job(\n", " compute_document_data_overlap,\n", " scenario_file=scenario_file,\n", @@ -321,10 +316,10 @@ { "data": { "text/html": [ - "
SyftSuccess: Request a362a0fc05e04a678f7323ad638a5375 changes applied

" + "
SyftSuccess: Request 533767b8f9bd41c78b69ea478b032472 changes applied

" ], "text/plain": [ - "SyftSuccess: Request a362a0fc05e04a678f7323ad638a5375 changes applied" + "SyftSuccess: Request 533767b8f9bd41c78b69ea478b032472 changes applied" ] }, "execution_count": 11, @@ -363,7 +358,7 @@ "text/markdown": [ "```python\n", "class Job:\n", - " id: UID = 9ac59d21db1d424d8c75e8182a564a17\n", + " id: UID = e255a2305b0b4f799ecc93a371af52d0\n", " status: created\n", " has_parent: False\n", " result: None\n", @@ -395,21 +390,14 @@ "name": "stderr", "output_type": "stream", "text": [ - "FUNCTION LOG (357baa07ea3646a394a90693dd191071): starting overlap computation\n", - "FUNCTION LOG (2157ddd1507a40fdba292bbf005d456c): starting overlap computation\n", - "FUNCTION LOG (2157ddd1507a40fdba292bbf005d456c): preparing scenarios and creating indexes\n", - "FUNCTION LOG (2157ddd1507a40fdba292bbf005d456c): preparing scenarios and creating indexes\n", - "FUNCTION LOG (2157ddd1507a40fdba292bbf005d456c): computing overlap\n", - "FUNCTION LOG (2157ddd1507a40fdba292bbf005d456c): computing overlap\n", - "FUNCTION LOG (2157ddd1507a40fdba292bbf005d456c): done\n", - "FUNCTION LOG (2157ddd1507a40fdba292bbf005d456c): done\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "E: Invalid message from worker: [b'']\n" + "FUNCTION LOG (5255e318dab149f1bdfc2f69ee743446): starting overlap computation\n", + "FUNCTION LOG (7145c863483a485e827998d7746d6afb): starting overlap computation\n", + "FUNCTION LOG (7145c863483a485e827998d7746d6afb): preparing scenarios and creating indexes\n", + "FUNCTION LOG (7145c863483a485e827998d7746d6afb): computing overlap\n", + "FUNCTION LOG (7145c863483a485e827998d7746d6afb): preparing scenarios and creating indexes\n", + "FUNCTION LOG (7145c863483a485e827998d7746d6afb): done\n", + "FUNCTION LOG (7145c863483a485e827998d7746d6afb): computing overlap\n", + "FUNCTION LOG (7145c863483a485e827998d7746d6afb): done\n" ] }, { @@ -637,7 +625,7 @@ " flex-grow: 0;\n", " }\n", "\n", - " .grid-table155a96a951b04e8b8fb79dc8218f6046 {\n", + " .grid-table504cc0a0b9ec43579deddb1905dba8bf {\n", " display:grid;\n", " grid-template-columns: 1fr repeat(24, 1fr);\n", " grid-template-rows: repeat(2, 1fr);\n", @@ -809,25 +797,25 @@ "
\n", "
\n", "
\n", - "
\n", - "
\n", + "
\n", " \n", "
\n", - " \n", + " \n", "
\n", - " \n", "
\n", "\n", - "

0

\n", + "

0

\n", "
\n", - "
\n", + "
\n", " \n", "
\n", - "
\n", + "
\n", " \n", "
\n", "
\n", @@ -1071,6 +1059,12 @@ "output_type": "stream", "text": [ "starting overlap computation\n", + "preparing scenarios and creating indexes\n", + "computing overlap\n", + "preparing scenarios and creating indexes\n", + "done\n", + "computing overlap\n", + "done\n", "\n" ] } @@ -1133,6 +1127,35 @@ "results" ] }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(defaultdict(set,\n", + " {'philosophy_test_5': {'id328'}, 'philosophy_valid_5': {'id12'}}),\n", + " defaultdict(set, {}),\n", + " defaultdict(int,\n", + " {'philosophy_train_5': 5,\n", + " 'philosophy_valid_5': 34,\n", + " 'philosophy_test_5': 311,\n", + " 'anatomy_train_5': 5,\n", + " 'anatomy_valid_5': 14,\n", + " 'anatomy_test_5': 135}))" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "results[0]" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1279,7 +1302,12 @@ "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, - "toc_position": {}, + "toc_position": { + "height": "calc(100% - 180px)", + "left": "10px", + "top": "150px", + "width": "398.22px" + }, "toc_section_display": true, "toc_window_display": true } diff --git a/notebooks/helm/nested_syft_functions.ipynb b/notebooks/helm/nested_syft_functions.ipynb index 9fe83f0a1c6..2529e7386c7 100644 --- a/notebooks/helm/nested_syft_functions.ipynb +++ b/notebooks/helm/nested_syft_functions.ipynb @@ -2,76 +2,20 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "id": "a196017f", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "kj/filesystem-disk-unix.c++:1703: warning: PWD environment variable doesn't match current directory; pwd = /Users/koen/workspace/pysyft\n" - ] - } - ], + "outputs": [], "source": [ "import syft as sy\n", "from syft import ActionObject\n", "from syft import syft_function, syft_function_single_use\n", - "from time import sleep" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "95e55a0a", - "metadata": {}, - "outputs": [], - "source": [ - "# subprocess.check_output(\n", - "# [lsof_path, \"-w\", \"-Fd\", \"-p\", str(os.getpid())]\n", - "# ).decode().split(os.linesep)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "dcd8f67c", - "metadata": {}, - "outputs": [], - "source": [ - "import os" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "151a3517", - "metadata": {}, - "outputs": [], - "source": [ - "from collections import Counter\n", - "def print_open_files():\n", - " import psutil\n", - "\n", - " files = psutil.Process(pid=os.getpid()).open_files()\n", - " print('len(files):', len(files))\n", - " print(Counter([f.path for f in files]))\n", - "# for f in files:\n", - "# print('FD:', f.fd, f.path)\n", - " " - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "ff6b7f51", - "metadata": {}, - "outputs": [], - "source": [ + "from time import sleep\n", + "import os\n", "import psutil\n", "\n", - "import inspect" + "import inspect\n", + "from syft.service.queue.zmq_queue import ZMQQueueConfig, ZMQClientConfig" ] }, { @@ -84,45 +28,7 @@ }, { "cell_type": "code", - "execution_count": 6, - "id": "4cbee0b1", - "metadata": {}, - "outputs": [], - "source": [ - "# client = sy.login(port=8800, email=\"info@openmined.org\", password=\"changethis\")" - ] - }, - { - "cell_type": "markdown", - "id": "6c9ce5a0", - "metadata": {}, - "source": [ - "Without server" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "46b2c271", - "metadata": {}, - "outputs": [], - "source": [ - "# get_open_fds()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "0e8e3591", - "metadata": {}, - "outputs": [], - "source": [ - "# node.python_node" - ] - }, - { - "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "id": "9b31c627", "metadata": {}, "outputs": [ @@ -130,7 +36,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "CREATING A PRODUCER ON tcp://127.0.0.1:54341\n", + "spawning thread\n", + "spawning thread\n", + "spawning thread\n", "Logged into as \n" ] }, @@ -148,7 +56,8 @@ } ], "source": [ - "node = sy.orchestra.launch(name=\"test-domain-helm2\", dev_mode=True, reset=True, n_consumers=0)\n", + "node = sy.orchestra.launch(name=\"test-domain-helm2\", dev_mode=True, reset=True, n_consumers=3,\n", + " queue_config=ZMQQueueConfig(client_config=ZMQClientConfig(create_producer=True)))\n", "client = node.login(email=\"info@openmined.org\", password=\"changethis\")" ] }, @@ -182,6 +91,25 @@ "# client.register(name=\"a\", email=\"A@b.org\", password=\"AVC\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "a8c342a6", + "metadata": {}, + "outputs": [], + "source": [ + "from collections import Counter\n", + "def print_open_files():\n", + " import psutil\n", + "\n", + " files = psutil.Process(pid=os.getpid()).open_files()\n", + " print('len(files):', len(files))\n", + " print(Counter([f.path for f in files]))\n", + "# for f in files:\n", + "# print('FD:', f.fd, f.path)\n", + " " + ] + }, { "cell_type": "code", "execution_count": 13, diff --git a/notebooks/helm/producer node.ipynb b/notebooks/helm/producer node.ipynb new file mode 100644 index 00000000000..a92f06c6304 --- /dev/null +++ b/notebooks/helm/producer node.ipynb @@ -0,0 +1,521 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "a196017f", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "kj/filesystem-disk-unix.c++:1703: warning: PWD environment variable doesn't match current directory; pwd = /Users/koen/workspace/pysyft\n" + ] + } + ], + "source": [ + "import syft as sy\n", + "from syft import ActionObject\n", + "from syft import syft_function, syft_function_single_use\n", + "from time import sleep\n", + "from syft.service.queue.zmq_queue import ZMQQueueConfig, ZMQClientConfig" + ] + }, + { + "cell_type": "markdown", + "id": "cb2d07de", + "metadata": {}, + "source": [ + "with server" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "4cbee0b1", + "metadata": {}, + "outputs": [], + "source": [ + "# client = sy.login(port=8800, email=\"info@openmined.org\", password=\"changethis\")" + ] + }, + { + "cell_type": "markdown", + "id": "6c9ce5a0", + "metadata": {}, + "source": [ + "Without server" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "9b31c627", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Logged into as \n" + ] + }, + { + "data": { + "text/html": [ + "
SyftWarning: You are using a default password. Please change the password using `[your_client].me.set_password([new_password])`.

" + ], + "text/plain": [ + "SyftWarning: You are using a default password. Please change the password using `[your_client].me.set_password([new_password])`." + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "node = sy.orchestra.launch(name=\"test-domain-helm2\", dev_mode=True, reset=True,\n", + " n_consumers=0,\n", + " queue_config=ZMQQueueConfig(client_config=ZMQClientConfig(create_producer=True, \n", + " producer_port=62249)))\n", + "client = node.login(email=\"info@openmined.org\", password=\"changethis\")" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "d3cf313b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "62249" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Idle worker expired: b'DD14-4495'\n", + "Idle worker expired: b'B437-278B'\n", + "Idle worker expired: b'46F1-D8E4'\n" + ] + } + ], + "source": [ + "node.python_node.queue_manager.producers[\"api_call\"].port" + ] + }, + { + "cell_type": "markdown", + "id": "176addfb", + "metadata": {}, + "source": [ + "setup: compute train-test overlap between a very large train set and a smaller test set. Small test is still to big for memory, so we split it into 54 parts. We keep 1 of those parts in memory. We dont keep the train set in memory, but read and compare with 1/54 parts line by line. Each part takes ~30 hours, but we can run 54 processes in parallel." + ] + }, + { + "cell_type": "markdown", + "id": "a0cea81b", + "metadata": {}, + "source": [ + "# Setup syft functions" + ] + }, + { + "cell_type": "markdown", + "id": "da2b114a", + "metadata": {}, + "source": [ + "## Dataset" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "83307a2f", + "metadata": {}, + "outputs": [], + "source": [ + "x = ActionObject.from_obj([1,2])\n", + "x_ptr = x.send(client)" + ] + }, + { + "cell_type": "markdown", + "id": "31bbb3ff", + "metadata": {}, + "source": [ + "## Batch function" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "5d2fd248", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
SyftSuccess: Syft function 'process_batch' successfully created. To add a code request, please create a project using `project = syft.Project(...)`, then use command `project.create_code_request`.

" + ], + "text/plain": [ + "SyftSuccess: Syft function 'process_batch' successfully created. To add a code request, please create a project using `project = syft.Project(...)`, then use command `project.create_code_request`." + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "@syft_function()\n", + "def process_batch(batch):\n", + " # takes 30 hours normally\n", + " print(f\"starting batch {batch}\")\n", + " from time import sleep\n", + " sleep(1)\n", + " print(\"done\")\n", + " return batch+1" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "9ba22655", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
SyftSuccess: User Code Submitted

" + ], + "text/plain": [ + "SyftSuccess: User Code Submitted" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "client.code.submit(process_batch)" + ] + }, + { + "cell_type": "markdown", + "id": "01319f1f", + "metadata": {}, + "source": [ + "## Main function" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "ca1b95ee", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
SyftSuccess: Syft function 'process_all' successfully created. To add a code request, please create a project using `project = syft.Project(...)`, then use command `project.create_code_request`.

" + ], + "text/plain": [ + "SyftSuccess: Syft function 'process_all' successfully created. To add a code request, please create a project using `project = syft.Project(...)`, then use command `project.create_code_request`." + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "@syft_function_single_use(x=x_ptr)\n", + "def process_all(domain, x):\n", + " jobs = []\n", + " print(\"Launching jobs\")\n", + " for elem in x:\n", + " # We inject a domain object in the scope\n", + " batch_job = domain.launch_job(process_batch, batch=elem)\n", + " jobs += [batch_job]\n", + " print(\"starting aggregation\")\n", + " print(\"Done\")\n", + "# results = [x.wait().get() for x in jobs]\n", + " return 1\n", + "# return sum(results)" + ] + }, + { + "cell_type": "markdown", + "id": "1e77c5db", + "metadata": {}, + "source": [ + "# Approve & run" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "0ab572f9", + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Request approved for domain test-domain-helm2\n" + ] + }, + { + "data": { + "text/html": [ + "
SyftSuccess: Request 268550e4db7c4ce4b81e3fd43c4c4bb3 changes applied

" + ], + "text/plain": [ + "SyftSuccess: Request 268550e4db7c4ce4b81e3fd43c4c4bb3 changes applied" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "client.code.request_code_execution(process_all)\n", + "client.requests[-1].approve()" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "375ed965", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "job = client.code.process_all(x=x_ptr, blocking=False)\n", + "sleep(5)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f5ace83", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "e7a94e1c", + "metadata": {}, + "outputs": [], + "source": [ + "# print_open_files()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "7b8b2a2e", + "metadata": {}, + "outputs": [], + "source": [ + "res = job.wait().get()" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "3cba7a2a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "22ac31a6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "starting batch 2\n", + "done\n", + "done\n", + "\n" + ] + } + ], + "source": [ + "job.subjobs[1].logs()" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "9cb2e2bf", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "starting batch 1\n", + "\n" + ] + } + ], + "source": [ + "job.subjobs[0].logs()" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "7fb84ccd", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "starting batch 2\n", + "done\n", + "done\n", + "\n" + ] + } + ], + "source": [ + "job.subjobs[1].logs()" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "c3d7476b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "job.subjobs[0].wait().get()" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "7c892dcc", + "metadata": {}, + "outputs": [], + "source": [ + "# get_open_fds()" + ] + }, + { + "cell_type": "markdown", + "id": "3d141e3b", + "metadata": {}, + "source": [ + "##### Next steps" + ] + }, + { + "cell_type": "markdown", + "id": "4e856437", + "metadata": {}, + "source": [ + "\n", + "\n", + "- [x] seaweedfs\n", + "- - [wip] merge into normal code\n", + "- [x] Multiple consumers (queues)\n", + "- - [x] implement messagequeue\n", + "- - [x] integrate messagequeue with the rest of the code\n", + "- [x] test flow with async main function\n", + "- [x] up datastructures for jobs and logs\n", + "- - [x] set up reprs\n", + "- [wip] integrate helm code\n", + "- [ ] test on large machine" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5ab56b04", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.16" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": true + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py index a5910bab326..bf6c385c47d 100644 --- a/packages/syft/src/syft/node/node.py +++ b/packages/syft/src/syft/node/node.py @@ -28,6 +28,8 @@ from result import Result from typing_extensions import Self +# first party + # relative from .. import __version__ from ..abstract_node import AbstractNode @@ -383,7 +385,7 @@ def init_queue_manager(self, queue_config: Optional[QueueConfig], n_consumers): producer.run() address = producer.address else: - port = queue_config_.client_config.producer_port + port = queue_config_.client_config.consumer_port if port is not None: address = f"tcp://localhost:{port}" else: diff --git a/packages/syft/src/syft/service/job/job_stash.py b/packages/syft/src/syft/service/job/job_stash.py index 3244d38ae11..d958d8bd953 100644 --- a/packages/syft/src/syft/service/job/job_stash.py +++ b/packages/syft/src/syft/service/job/job_stash.py @@ -101,8 +101,8 @@ def _coll_repr_(self) -> Dict[str, Any]: logs = self.logs(_print=False) log_lines = logs.split("\n") subjobs = self.subjobs - if len(log_lines) > 3: - logs = "...\n" + "\n".join(log_lines[-3:]) + if len(log_lines) > 4: + logs = "...\n" + "\n".join(log_lines[-4:]) else: logs = logs