Skip to content

Commit

Permalink
Merge branch 'dev' into yash/k8s-worker
Browse files Browse the repository at this point in the history
  • Loading branch information
rasswanth-s authored Jan 31, 2024
2 parents b68470d + ce8978f commit 4e2f173
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-tests-enclave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
docker system prune --all --force
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-tests-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
docker system prune --all --force
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-tests-hagrid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-tests-stack-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
docker system prune --all --force
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-tests-stack-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-tests-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
docker system prune --all --force
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down Expand Up @@ -333,7 +333,7 @@ jobs:
docker system prune --all --force
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down Expand Up @@ -529,7 +529,7 @@ jobs:
sudo chown -R $USER:$USER $HOME
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-tests-syft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
docker system prune --all --force
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs:
# sudo chown -R $USER:$USER $HOME
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion packages/hagrid/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.105
current_version = 0.3.106
tag = False
tag_name = {new_version}
commit = True
Expand Down
4 changes: 2 additions & 2 deletions packages/hagrid/hagrid/manifest_template.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
manifestVersion: 0.1
hagrid_version: 0.3.105
hagrid_version: 0.3.106
syft_version: 0.8.4-beta.14
dockerTag: 0.8.4-beta.14
baseUrl: https://raw.githubusercontent.com/OpenMined/PySyft/
hash: 3cc4e4a80f433f6dfe2dd1ad1596fc31c11ff6eb
hash: a5864c3584a2a81cf7b18ae3aafd075a9da24b22
target_dir: ~/.hagrid/PySyft/
files:
grid:
Expand Down
79 changes: 29 additions & 50 deletions packages/hagrid/hagrid/orchestra.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Python Level API to launch Docker Containers using Hagrid"""

# future
from __future__ import annotations

Expand Down Expand Up @@ -255,38 +256,34 @@ def deploy_to_python(
print("Staging Protocol Changes...")
stage_protocol_changes()

kwargs = {
"name": name,
"host": host,
"port": port,
"reset": reset,
"processes": processes,
"dev_mode": dev_mode,
"tail": tail,
"node_type": node_type_enum,
"node_side_type": node_side_type,
"enable_warnings": enable_warnings,
# new kwargs
"queue_port": queue_port,
"n_consumers": n_consumers,
"create_producer": create_producer,
}

if port:
kwargs["in_memory_workers"] = True
if port == "auto":
# dont use default port to prevent port clashes in CI
port = find_available_port(host="localhost", port=None, search=True)
kwargs["port"] = port

sig = inspect.signature(sy.serve_node)
if "node_type" in sig.parameters.keys():
start, stop = sy.serve_node(
name=name,
host=host,
port=port,
reset=reset,
processes=processes,
queue_port=queue_port,
n_consumers=n_consumers,
create_producer=create_producer,
dev_mode=dev_mode,
tail=tail,
node_type=node_type_enum,
node_side_type=node_side_type,
enable_warnings=enable_warnings,
in_memory_workers=True, # Only in-memory workers supported for python mode
)
else:
# syft <= 0.8.1
start, stop = sy.serve_node(
name=name,
host=host,
port=port,
reset=reset,
dev_mode=dev_mode,
tail=tail,
)
supported_kwargs = {k: v for k, v in kwargs.items() if k in sig.parameters}

start, stop = sy.serve_node(**supported_kwargs)
start()
return NodeHandle(
node_type=node_type_enum,
Expand All @@ -298,33 +295,15 @@ def deploy_to_python(
node_side_type=node_side_type,
)
else:
kwargs["local_db"] = local_db
kwargs["thread_workers"] = thread_workers
if node_type_enum in worker_classes:
worker_class = worker_classes[node_type_enum]
sig = inspect.signature(worker_class.named)
supported_kwargs = {k: v for k, v in kwargs.items() if k in sig.parameters}
if "node_type" in sig.parameters.keys():
worker = worker_class.named(
dev_mode=dev_mode,
name=name,
processes=processes,
reset=reset,
local_db=local_db,
node_type=node_type_enum,
node_side_type=node_side_type,
enable_warnings=enable_warnings,
n_consumers=n_consumers,
thread_workers=thread_workers,
create_producer=create_producer,
queue_port=queue_port,
migrate=True,
)
else:
# syft <= 0.8.1
worker = worker_class.named(
name=name,
processes=processes,
reset=reset,
local_db=local_db,
)
supported_kwargs["migrate"] = True
worker = worker_class.named(**supported_kwargs)
else:
raise NotImplementedError(f"node_type: {node_type_enum} is not supported")

Expand Down
2 changes: 1 addition & 1 deletion packages/hagrid/hagrid/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# HAGrid Version
__version__ = "0.3.105"
__version__ = "0.3.106"

if __name__ == "__main__":
print(__version__)
2 changes: 1 addition & 1 deletion packages/hagrid/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from setuptools import find_packages
from setuptools import setup

__version__ = "0.3.105"
__version__ = "0.3.106"

DATA_FILES = {"img": ["hagrid/img/*.png"], "hagrid": ["*.yml"]}

Expand Down
37 changes: 26 additions & 11 deletions packages/syft/src/syft/node/run.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# stdlib
import argparse
from typing import Optional

# relative
from ..client.deploy import Orchestra


def str_to_bool(bool_str: Optional[str]) -> bool:
result = False
bool_str = str(bool_str).lower()
if bool_str == "true" or bool_str == "1":
result = True
return result


def run():
parser = argparse.ArgumentParser()
parser.add_argument("command", help="command: launch", type=str, default="none")
Expand All @@ -28,43 +37,43 @@ def run():
parser.add_argument(
"--dev-mode",
help="developer mode",
type=bool,
default=True,
type=str,
default="True",
dest="dev_mode",
)
parser.add_argument(
"--reset",
help="reset",
type=bool,
default=True,
type=str,
default="True",
dest="reset",
)
parser.add_argument(
"--local-db",
help="reset",
type=bool,
default=False,
type=str,
default="False",
dest="local_db",
)
parser.add_argument(
"--processes",
help="processing mode",
type=int,
default=False,
default=0,
dest="processes",
)
parser.add_argument(
"--tail",
help="tail mode",
type=bool,
default=True,
type=str,
default="True",
dest="tail",
)
parser.add_argument(
"--cmd",
help="cmd mode",
type=bool,
default=False,
type=str,
default="False",
dest="cmd",
)

Expand All @@ -73,6 +82,12 @@ def run():
if args.command != "launch":
print("syft launch is the only command currently supported")

args.dev_mode = str_to_bool(args.dev_mode)
args.reset = str_to_bool(args.reset)
args.local_db = str_to_bool(args.local_db)
args.tail = str_to_bool(args.tail)
args.cmd = str_to_bool(args.cmd)

node = Orchestra.launch(
name=args.name,
node_type=args.node_type,
Expand Down
2 changes: 1 addition & 1 deletion scripts/hagrid_hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0971435a180fb97a187e0271e9342863
55fa40104063afa8e52213b1c8d29634

0 comments on commit 4e2f173

Please sign in to comment.