From b6cebe8b5c997e001c0fdc1b3e0a9dc94a186120 Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Mon, 24 Jun 2024 12:09:23 -0400 Subject: [PATCH 1/8] Adding basic script for reloadable running of the uvicorn servers --- packages/syft/src/syft/node/server.py | 42 +++++++++++++++++++ scripts/reloadable_run.sh | 58 +++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 scripts/reloadable_run.sh diff --git a/packages/syft/src/syft/node/server.py b/packages/syft/src/syft/node/server.py index 43b8359a1f9..8bcd8363ef4 100644 --- a/packages/syft/src/syft/node/server.py +++ b/packages/syft/src/syft/node/server.py @@ -62,6 +62,48 @@ def make_app(name: str, router: APIRouter) -> FastAPI: NodeType.ENCLAVE: Enclave, } +def run_reloadable_app(): + # Read environment variables + name = os.getenv("NODE_NAME", "testing-node") + processes = int(os.getenv("PROCESSES", "1")) + reset = os.getenv("RESET", "False").lower() in ("true") + local_db = os.getenv("LOCAL_DB", "True").lower() in ("true") + node_type = os.getenv("NODE_TYPE", NodeType.DOMAIN) + node_side_type = os.getenv("NODE_SIDE_TYPE", NodeSideType.HIGH_SIDE) + + # Print variables for debugging + print("*" * 50) + print("Starting uvicorn app with the following settings:") + print(f"NODE_NAME: {name}") + print(f"PROCESSES: {processes}") + print(f"RESET: {reset}") + print(f"LOCAL_DB: {local_db}") + print(f"NODE_TYPE: {node_type}") + print(f"NODE_SIDE_TYPE: {node_side_type}") + print("*" * 50) + + # Assuming worker_classes, make_routes, and make_app are defined elsewhere + worker_type = worker_classes[node_type] + worker = worker_type.named( + name=name, + processes=processes, + reset=reset, + local_db=local_db, + node_type=node_type, + node_side_type=node_side_type, + enable_warnings=False, + migrate=True, + in_memory_workers=True, + queue_port=None, + create_producer=False, + n_consumers=0, + association_request_auto_approval=False, + background_tasks=False, + ) + + router = make_routes(worker=worker) + app = make_app(worker.name, router=router) + return app def run_uvicorn( name: str, diff --git a/scripts/reloadable_run.sh b/scripts/reloadable_run.sh new file mode 100644 index 00000000000..9e766dce2c0 --- /dev/null +++ b/scripts/reloadable_run.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Run the different enclave servers as follows: +# bash scripts/reloadable_run.sh --port 9081 --name "canada-domain" +# bash scripts/reloadable_run.sh --port 9082 --name "italy-domain" +# bash scripts/reloadable_run.sh --port 9083 --name "canada-enclave" --node_type "enclave" + +# And get the NodeHandlers as follows (note that the handlers point to the correct objects but are buggy in their attributes) +# canada_domain = sy.orchestra.launch(port=9081, deploy_to="remote") +# italy_domain = sy.orchestra.launch(port=9082, deploy_to="remote") +# canada_enclave = sy.orchestra.launch(port=9083, deploy_to="remote") + +# Default values +PORT=9694 +HOST="0.0.0.0" +FACTORY="--factory" +RELOAD="--reload" + +# Parse command-line arguments +while [ "$1" != "" ]; do + case $1 in + --port ) shift + PORT=$1 + ;; + --name ) shift + NAME=$1 + ;; + --processes ) shift + PROCESSES=$1 + ;; + --reset ) shift + RESET=$1 + ;; + --local_db ) shift + LOCAL_DB=$1 + ;; + --node_type ) shift + NODE_TYPE=$1 + ;; + --node_side_type ) shift + NODE_SIDE_TYPE=$1 + ;; + * ) echo "Invalid option: $1" + exit 1 + esac + shift +done + +# Set environment variables +export NODE_NAME=${NAME:-testing-node} +export PROCESSES=${PROCESSES:-1} +export RESET=${RESET:-False} +export LOCAL_DB=${LOCAL_DB:-True} +export NODE_TYPE=${NODE_TYPE:-domain} +export NODE_SIDE_TYPE=${NODE_SIDE_TYPE:-high} + +# Run uvicorn +uvicorn syft.node.server:run_reloadable_app $FACTORY --host $HOST --port $PORT $RELOAD \ No newline at end of file From 4690e9de6d04eadb87c74c6d888d10084db62abc Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Mon, 24 Jun 2024 12:23:12 -0400 Subject: [PATCH 2/8] fixing type bug and linting --- packages/syft/src/syft/node/server.py | 10 ++++++---- scripts/reloadable_run.sh | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/syft/src/syft/node/server.py b/packages/syft/src/syft/node/server.py index 8bcd8363ef4..3a3fa1e6de4 100644 --- a/packages/syft/src/syft/node/server.py +++ b/packages/syft/src/syft/node/server.py @@ -62,15 +62,16 @@ def make_app(name: str, router: APIRouter) -> FastAPI: NodeType.ENCLAVE: Enclave, } -def run_reloadable_app(): + +def run_reloadable_app() -> None: # Read environment variables name = os.getenv("NODE_NAME", "testing-node") processes = int(os.getenv("PROCESSES", "1")) reset = os.getenv("RESET", "False").lower() in ("true") local_db = os.getenv("LOCAL_DB", "True").lower() in ("true") - node_type = os.getenv("NODE_TYPE", NodeType.DOMAIN) - node_side_type = os.getenv("NODE_SIDE_TYPE", NodeSideType.HIGH_SIDE) - + node_type = NodeType(os.getenv("NODE_TYPE", NodeType.DOMAIN)) + node_side_type = NodeSideType(os.getenv("NODE_SIDE_TYPE", NodeSideType.HIGH_SIDE)) + # Print variables for debugging print("*" * 50) print("Starting uvicorn app with the following settings:") @@ -105,6 +106,7 @@ def run_reloadable_app(): app = make_app(worker.name, router=router) return app + def run_uvicorn( name: str, node_type: Enum, diff --git a/scripts/reloadable_run.sh b/scripts/reloadable_run.sh index 9e766dce2c0..f9ec7853d83 100644 --- a/scripts/reloadable_run.sh +++ b/scripts/reloadable_run.sh @@ -2,7 +2,7 @@ # Run the different enclave servers as follows: # bash scripts/reloadable_run.sh --port 9081 --name "canada-domain" -# bash scripts/reloadable_run.sh --port 9082 --name "italy-domain" +# bash scripts/reloadable_run.sh --port 9082 --name "italy-domain" # bash scripts/reloadable_run.sh --port 9083 --name "canada-enclave" --node_type "enclave" # And get the NodeHandlers as follows (note that the handlers point to the correct objects but are buggy in their attributes) From c30424e9dfca1fb5c895d4c3a48cdbab7c6c1095 Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Tue, 25 Jun 2024 10:28:15 -0400 Subject: [PATCH 3/8] Instructions modified --- scripts/reloadable_run.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/reloadable_run.sh b/scripts/reloadable_run.sh index f9ec7853d83..7d68e6156dc 100644 --- a/scripts/reloadable_run.sh +++ b/scripts/reloadable_run.sh @@ -5,10 +5,20 @@ # bash scripts/reloadable_run.sh --port 9082 --name "italy-domain" # bash scripts/reloadable_run.sh --port 9083 --name "canada-enclave" --node_type "enclave" -# And get the NodeHandlers as follows (note that the handlers point to the correct objects but are buggy in their attributes) -# canada_domain = sy.orchestra.launch(port=9081, deploy_to="remote") -# italy_domain = sy.orchestra.launch(port=9082, deploy_to="remote") -# canada_enclave = sy.orchestra.launch(port=9083, deploy_to="remote") +# And get the NodeHandlers as follows +# from syft.orchestra import NodeHandle +# canada_node = NodeHandle( +# node_type="domain", +# deployment_type="python", +# name="canada-domain", +# port=9081, +# url="localhost", +# node_side_type="high", +# ) + +# Or directly login using +# do_italy_client = sy.login(email="info@openmined.org", password="changethis", +# url="localhost", port=ITALY_DOMAIN_PORT) # Default values PORT=9694 From 05000a15d0dd328a09cfe732011f6bf27cba0d08 Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Tue, 25 Jun 2024 16:06:23 -0400 Subject: [PATCH 4/8] A potential solution --- packages/syft/src/syft/node/server.py | 90 ++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 10 deletions(-) diff --git a/packages/syft/src/syft/node/server.py b/packages/syft/src/syft/node/server.py index 3a3fa1e6de4..9814181f894 100644 --- a/packages/syft/src/syft/node/server.py +++ b/packages/syft/src/syft/node/server.py @@ -63,15 +63,15 @@ def make_app(name: str, router: APIRouter) -> FastAPI: } -def run_reloadable_app() -> None: - # Read environment variables - name = os.getenv("NODE_NAME", "testing-node") - processes = int(os.getenv("PROCESSES", "1")) - reset = os.getenv("RESET", "False").lower() in ("true") - local_db = os.getenv("LOCAL_DB", "True").lower() in ("true") - node_type = NodeType(os.getenv("NODE_TYPE", NodeType.DOMAIN)) - node_side_type = NodeSideType(os.getenv("NODE_SIDE_TYPE", NodeSideType.HIGH_SIDE)) - +process_list = [] +def create_app( + name: str, + node_type: NodeType, + node_side_type: NodeSideType, + processes: int, + reset: bool, + local_db: bool +) -> FastAPI: # Print variables for debugging print("*" * 50) print("Starting uvicorn app with the following settings:") @@ -83,7 +83,6 @@ def run_reloadable_app() -> None: print(f"NODE_SIDE_TYPE: {node_side_type}") print("*" * 50) - # Assuming worker_classes, make_routes, and make_app are defined elsewhere worker_type = worker_classes[node_type] worker = worker_type.named( name=name, @@ -106,6 +105,77 @@ def run_reloadable_app() -> None: app = make_app(worker.name, router=router) return app +def app_factory(): + name = os.getenv("NODE_NAME") + node_type = NodeType(os.getenv("NODE_TYPE", "domain")) + node_side_type = NodeSideType(os.getenv("NODE_SIDE_TYPE", "high")) + processes = int(os.getenv("PROCESSES", 1)) + local_db = os.getenv("LOCAL_DB", "True") == "True" + reset = os.getenv("RESET", "False") == "False" + + return create_app( + name=name, + node_type=node_type, + node_side_type=node_side_type, + processes=processes, + reset=reset, + local_db=local_db + ) + +def start_uvicorn_server( + name: str = "testing-node", + node_type: str = "domain", + node_side_type: str = "high", + port: int = 9081, + processes: int = 1, + local_db: bool = True, + reset: bool = False, +): + os.environ["NODE_NAME"] = name + os.environ["NODE_TYPE"] = node_type + os.environ["NODE_SIDE_TYPE"] = node_side_type + os.environ["PORT"] = str(port) + os.environ["PROCESSES"] = str(processes) + os.environ["LOCAL_DB"] = str(local_db) + os.environ["RESET"] = str(reset) + + command = ["python", "-m", "syft.node.server"] + process = subprocess.Popen(command) + process_list.append(process) + print(f"Uvicorn server running on port {port} with PID: {process.pid}") + + from syft.orchestra import NodeHandle, DeploymentType + + # Return this object: + return NodeHandle( + node_type=NodeType(node_type), + deployment_type=DeploymentType.PYTHON, + name=name, + port=port, + url="http://localhost", + node_side_type=NodeSideType(node_side_type), + # shutdown=stop, + ) + # return process + +def stop_all_uvicorn_servers(): + for process in process_list: + process.terminate() + process.wait() + process_list.clear() + print("All Uvicorn servers stopped.") + +if __name__ == "__main__": + current_file_path = os.path.dirname(os.path.abspath(__file__)) + reload_dirs = os.path.abspath(os.path.join(current_file_path, "../../")) + + uvicorn.run("syft.node.server:app_factory", + host="0.0.0.0", + port=int(os.getenv("PORT", 9081)), + reload=True, + factory=True, + reload_dirs=[reload_dirs], +) def run_uvicorn( name: str, From 6b1b66731103ac6460eda474b1138e7876590422 Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Tue, 25 Jun 2024 16:08:59 -0400 Subject: [PATCH 5/8] Linting --- packages/syft/src/syft/node/server.py | 51 +++++++++++++++------------ 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/packages/syft/src/syft/node/server.py b/packages/syft/src/syft/node/server.py index 9814181f894..2473851508f 100644 --- a/packages/syft/src/syft/node/server.py +++ b/packages/syft/src/syft/node/server.py @@ -19,6 +19,8 @@ # relative from ..abstract_node import NodeSideType from ..client.client import API_PATH +from ..orchestra import DeploymentType +from ..orchestra import NodeHandle from ..util.constants import DEFAULT_TIMEOUT from ..util.util import os_name from .domain import Domain @@ -64,13 +66,15 @@ def make_app(name: str, router: APIRouter) -> FastAPI: process_list = [] + + def create_app( name: str, node_type: NodeType, node_side_type: NodeSideType, processes: int, reset: bool, - local_db: bool + local_db: bool, ) -> FastAPI: # Print variables for debugging print("*" * 50) @@ -105,7 +109,8 @@ def create_app( app = make_app(worker.name, router=router) return app -def app_factory(): + +def app_factory() -> FastAPI: name = os.getenv("NODE_NAME") node_type = NodeType(os.getenv("NODE_TYPE", "domain")) node_side_type = NodeSideType(os.getenv("NODE_SIDE_TYPE", "high")) @@ -119,18 +124,19 @@ def app_factory(): node_side_type=node_side_type, processes=processes, reset=reset, - local_db=local_db + local_db=local_db, ) - + + def start_uvicorn_server( name: str = "testing-node", node_type: str = "domain", node_side_type: str = "high", port: int = 9081, - processes: int = 1, + processes: int = 1, local_db: bool = True, - reset: bool = False, -): + reset: bool = False, +) -> NodeHandle: os.environ["NODE_NAME"] = name os.environ["NODE_TYPE"] = node_type os.environ["NODE_SIDE_TYPE"] = node_side_type @@ -138,15 +144,13 @@ def start_uvicorn_server( os.environ["PROCESSES"] = str(processes) os.environ["LOCAL_DB"] = str(local_db) os.environ["RESET"] = str(reset) - + command = ["python", "-m", "syft.node.server"] process = subprocess.Popen(command) process_list.append(process) print(f"Uvicorn server running on port {port} with PID: {process.pid}") - - from syft.orchestra import NodeHandle, DeploymentType - - # Return this object: + + # Return this object: return NodeHandle( node_type=NodeType(node_type), deployment_type=DeploymentType.PYTHON, @@ -156,26 +160,29 @@ def start_uvicorn_server( node_side_type=NodeSideType(node_side_type), # shutdown=stop, ) - # return process -def stop_all_uvicorn_servers(): + +def stop_all_uvicorn_servers() -> None: for process in process_list: process.terminate() process.wait() process_list.clear() print("All Uvicorn servers stopped.") + if __name__ == "__main__": current_file_path = os.path.dirname(os.path.abspath(__file__)) reload_dirs = os.path.abspath(os.path.join(current_file_path, "../../")) - - uvicorn.run("syft.node.server:app_factory", - host="0.0.0.0", - port=int(os.getenv("PORT", 9081)), - reload=True, - factory=True, - reload_dirs=[reload_dirs], -) + + uvicorn.run( + "syft.node.server:app_factory", + host="0.0.0.0", + port=int(os.getenv("PORT", 9081)), + reload=True, + factory=True, + reload_dirs=[reload_dirs], + ) + def run_uvicorn( name: str, From 60270aa14300b9e170a000107e8c24f259bf028b Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Wed, 26 Jun 2024 12:02:27 -0400 Subject: [PATCH 6/8] Fixed bugs, refactoring, and adding NodeHandle.land() functionality --- packages/syft/src/syft/node/server.py | 82 +++-------------- .../syft/src/syft/node/server_management.py | 90 +++++++++++++++++++ 2 files changed, 102 insertions(+), 70 deletions(-) create mode 100644 packages/syft/src/syft/node/server_management.py diff --git a/packages/syft/src/syft/node/server.py b/packages/syft/src/syft/node/server.py index 2473851508f..6909fd883ee 100644 --- a/packages/syft/src/syft/node/server.py +++ b/packages/syft/src/syft/node/server.py @@ -19,8 +19,9 @@ # relative from ..abstract_node import NodeSideType from ..client.client import API_PATH -from ..orchestra import DeploymentType -from ..orchestra import NodeHandle + +# from ..orchestra import DeploymentType +# from ..orchestra import NodeHandle from ..util.constants import DEFAULT_TIMEOUT from ..util.util import os_name from .domain import Domain @@ -65,9 +66,6 @@ def make_app(name: str, router: APIRouter) -> FastAPI: } -process_list = [] - - def create_app( name: str, node_type: NodeType, @@ -77,15 +75,15 @@ def create_app( local_db: bool, ) -> FastAPI: # Print variables for debugging - print("*" * 50) - print("Starting uvicorn app with the following settings:") - print(f"NODE_NAME: {name}") - print(f"PROCESSES: {processes}") - print(f"RESET: {reset}") - print(f"LOCAL_DB: {local_db}") - print(f"NODE_TYPE: {node_type}") - print(f"NODE_SIDE_TYPE: {node_side_type}") - print("*" * 50) + print("*" * 50, flush=True) + print("Starting uvicorn app with the following settings:", flush=True) + print(f"NODE_NAME: {name}", flush=True) + print(f"PROCESSES: {processes}", flush=True) + print(f"RESET: {reset}", flush=True) + print(f"LOCAL_DB: {local_db}", flush=True) + print(f"NODE_TYPE: {node_type}", flush=True) + print(f"NODE_SIDE_TYPE: {node_side_type}", flush=True) + print("*" * 50, flush=True) worker_type = worker_classes[node_type] worker = worker_type.named( @@ -128,62 +126,6 @@ def app_factory() -> FastAPI: ) -def start_uvicorn_server( - name: str = "testing-node", - node_type: str = "domain", - node_side_type: str = "high", - port: int = 9081, - processes: int = 1, - local_db: bool = True, - reset: bool = False, -) -> NodeHandle: - os.environ["NODE_NAME"] = name - os.environ["NODE_TYPE"] = node_type - os.environ["NODE_SIDE_TYPE"] = node_side_type - os.environ["PORT"] = str(port) - os.environ["PROCESSES"] = str(processes) - os.environ["LOCAL_DB"] = str(local_db) - os.environ["RESET"] = str(reset) - - command = ["python", "-m", "syft.node.server"] - process = subprocess.Popen(command) - process_list.append(process) - print(f"Uvicorn server running on port {port} with PID: {process.pid}") - - # Return this object: - return NodeHandle( - node_type=NodeType(node_type), - deployment_type=DeploymentType.PYTHON, - name=name, - port=port, - url="http://localhost", - node_side_type=NodeSideType(node_side_type), - # shutdown=stop, - ) - - -def stop_all_uvicorn_servers() -> None: - for process in process_list: - process.terminate() - process.wait() - process_list.clear() - print("All Uvicorn servers stopped.") - - -if __name__ == "__main__": - current_file_path = os.path.dirname(os.path.abspath(__file__)) - reload_dirs = os.path.abspath(os.path.join(current_file_path, "../../")) - - uvicorn.run( - "syft.node.server:app_factory", - host="0.0.0.0", - port=int(os.getenv("PORT", 9081)), - reload=True, - factory=True, - reload_dirs=[reload_dirs], - ) - - def run_uvicorn( name: str, node_type: Enum, diff --git a/packages/syft/src/syft/node/server_management.py b/packages/syft/src/syft/node/server_management.py new file mode 100644 index 00000000000..b74220592e4 --- /dev/null +++ b/packages/syft/src/syft/node/server_management.py @@ -0,0 +1,90 @@ +# stdlib +import os +import subprocess + +# third party +import uvicorn + +# relative +from ..abstract_node import NodeSideType + +# from .server import app_factory +from ..orchestra import DeploymentType +from ..orchestra import NodeHandle +from .node import NodeType + +# List storing all reloadable servers launched +process_list = [] + +def start_reloadable_server( + name: str = "testing-node", + node_type: str = "domain", + node_side_type: str = "high", + port: int = 9081, + processes: int = 1, + local_db: bool = True, + reset: bool = False, +) -> NodeHandle: + os.environ["NODE_NAME"] = name + os.environ["NODE_TYPE"] = node_type + os.environ["NODE_SIDE_TYPE"] = node_side_type + os.environ["PORT"] = str(port) + os.environ["PROCESSES"] = str(processes) + os.environ["LOCAL_DB"] = str(local_db) + os.environ["RESET"] = str(reset) + + command = ["python", "-m", "syft.node.server_management"] + process = subprocess.Popen(command) + process_list.append(process) + print("*" * 50, flush=True) + print(f"Uvicorn server running on port {port} with PID: {process.pid}", flush=True) + print("*" * 50, flush=True) + + + # Since the servers take a second to run, adding this wait so + # that notebook commands can run one after the other. + # stdlib + from time import sleep + sleep(6) + + def stop() -> None: + process.terminate() + process.wait() + if process in process_list: + process_list.remove(process) + print("*" * 50, flush=True) + print(f"Uvicorn server with PID: {process.pid} stopped.", flush=True) + print("*" * 50, flush=True) + + + # Return this object: + return NodeHandle( + node_type=NodeType(node_type), + deployment_type=DeploymentType.PYTHON, + name=name, + port=port, + url="http://localhost", + node_side_type=NodeSideType(node_side_type), + shutdown=stop, + ) + +def stop_all_reloadable_servers() -> None: + for process in process_list: + process.terminate() + process.wait() + process_list.clear() + print("All Uvicorn servers stopped.") + + +if __name__ == "__main__": + current_file_path = os.path.dirname(os.path.abspath(__file__)) + reload_dirs = os.path.abspath(os.path.join(current_file_path, "../../")) + + uvicorn.run( + "syft.node.server:app_factory", + host="0.0.0.0", + port=int(os.getenv("PORT", 9081)), + reload=True, + factory=True, + reload_dirs=[reload_dirs], + ) \ No newline at end of file From 58071597ca62dea054fb001ba8932dff5b59f92f Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Wed, 26 Jun 2024 16:27:36 -0400 Subject: [PATCH 7/8] Linting --- packages/syft/src/syft/node/server_management.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/syft/src/syft/node/server_management.py b/packages/syft/src/syft/node/server_management.py index b74220592e4..eba02a18afd 100644 --- a/packages/syft/src/syft/node/server_management.py +++ b/packages/syft/src/syft/node/server_management.py @@ -16,6 +16,7 @@ # List storing all reloadable servers launched process_list = [] + def start_reloadable_server( name: str = "testing-node", node_type: str = "domain", @@ -40,13 +41,13 @@ def start_reloadable_server( print(f"Uvicorn server running on port {port} with PID: {process.pid}", flush=True) print("*" * 50, flush=True) - # Since the servers take a second to run, adding this wait so # that notebook commands can run one after the other. # stdlib - from time import sleep + from time import sleep + sleep(6) - + def stop() -> None: process.terminate() process.wait() @@ -56,7 +57,6 @@ def stop() -> None: print(f"Uvicorn server with PID: {process.pid} stopped.", flush=True) print("*" * 50, flush=True) - # Return this object: return NodeHandle( node_type=NodeType(node_type), @@ -68,6 +68,7 @@ def stop() -> None: shutdown=stop, ) + def stop_all_reloadable_servers() -> None: for process in process_list: process.terminate() @@ -87,4 +88,4 @@ def stop_all_reloadable_servers() -> None: reload=True, factory=True, reload_dirs=[reload_dirs], - ) \ No newline at end of file + ) From c06e6ee78a2527b0657232c6673ed83bf03872ff Mon Sep 17 00:00:00 2001 From: Sameer Wagh Date: Wed, 26 Jun 2024 16:34:17 -0400 Subject: [PATCH 8/8] cleanup --- packages/syft/src/syft/node/server.py | 3 -- scripts/reloadable_run.sh | 68 --------------------------- 2 files changed, 71 deletions(-) delete mode 100644 scripts/reloadable_run.sh diff --git a/packages/syft/src/syft/node/server.py b/packages/syft/src/syft/node/server.py index 6909fd883ee..d257b4fc017 100644 --- a/packages/syft/src/syft/node/server.py +++ b/packages/syft/src/syft/node/server.py @@ -19,9 +19,6 @@ # relative from ..abstract_node import NodeSideType from ..client.client import API_PATH - -# from ..orchestra import DeploymentType -# from ..orchestra import NodeHandle from ..util.constants import DEFAULT_TIMEOUT from ..util.util import os_name from .domain import Domain diff --git a/scripts/reloadable_run.sh b/scripts/reloadable_run.sh deleted file mode 100644 index 7d68e6156dc..00000000000 --- a/scripts/reloadable_run.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -# Run the different enclave servers as follows: -# bash scripts/reloadable_run.sh --port 9081 --name "canada-domain" -# bash scripts/reloadable_run.sh --port 9082 --name "italy-domain" -# bash scripts/reloadable_run.sh --port 9083 --name "canada-enclave" --node_type "enclave" - -# And get the NodeHandlers as follows -# from syft.orchestra import NodeHandle -# canada_node = NodeHandle( -# node_type="domain", -# deployment_type="python", -# name="canada-domain", -# port=9081, -# url="localhost", -# node_side_type="high", -# ) - -# Or directly login using -# do_italy_client = sy.login(email="info@openmined.org", password="changethis", -# url="localhost", port=ITALY_DOMAIN_PORT) - -# Default values -PORT=9694 -HOST="0.0.0.0" -FACTORY="--factory" -RELOAD="--reload" - -# Parse command-line arguments -while [ "$1" != "" ]; do - case $1 in - --port ) shift - PORT=$1 - ;; - --name ) shift - NAME=$1 - ;; - --processes ) shift - PROCESSES=$1 - ;; - --reset ) shift - RESET=$1 - ;; - --local_db ) shift - LOCAL_DB=$1 - ;; - --node_type ) shift - NODE_TYPE=$1 - ;; - --node_side_type ) shift - NODE_SIDE_TYPE=$1 - ;; - * ) echo "Invalid option: $1" - exit 1 - esac - shift -done - -# Set environment variables -export NODE_NAME=${NAME:-testing-node} -export PROCESSES=${PROCESSES:-1} -export RESET=${RESET:-False} -export LOCAL_DB=${LOCAL_DB:-True} -export NODE_TYPE=${NODE_TYPE:-domain} -export NODE_SIDE_TYPE=${NODE_SIDE_TYPE:-high} - -# Run uvicorn -uvicorn syft.node.server:run_reloadable_app $FACTORY --host $HOST --port $PORT $RELOAD \ No newline at end of file