Skip to content

Commit

Permalink
Rename arg name to pool_name in worker_pool_service.launch
Browse files Browse the repository at this point in the history
to be consistent with other endpoints
  • Loading branch information
kiendang committed May 24, 2024
1 parent 31c6e78 commit 341d33f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/syft/src/syft/service/request/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _run(

result = worker_pool_service.launch(
context=service_context,
name=self.pool_name,
pool_name=self.pool_name,
image_uid=self.image_uid,
num_workers=self.num_workers,
reg_username=context.extra_kwargs.get("reg_username", None),
Expand Down
12 changes: 7 additions & 5 deletions packages/syft/src/syft/service/worker/worker_pool_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, store: DocumentStore) -> None:
def launch(
self,
context: AuthedServiceContext,
name: str,
pool_name: str,
image_uid: UID | None,
num_workers: int,
reg_username: str | None = None,
Expand All @@ -83,13 +83,15 @@ def launch(
num_workers (int): the number of SyftWorker that needs to be created in the pool
"""

result = self.stash.get_by_name(context.credentials, pool_name=name)
result = self.stash.get_by_name(context.credentials, pool_name=pool_name)

if result.is_err():
return SyftError(message=f"{result.err()}")

if result.ok() is not None:
return SyftError(message=f"Worker Pool with name: {name} already exists !!")
return SyftError(
message=f"Worker Pool with name: {pool_name} already exists !!"
)

# If image uid is not passed, then use the default worker image
# to create the worker pool
Expand Down Expand Up @@ -118,7 +120,7 @@ def launch(
# and with the desired number of workers
result = _create_workers_in_pool(
context=context,
pool_name=name,
pool_name=pool_name,
existing_worker_cnt=0,
worker_cnt=num_workers,
worker_image=worker_image,
Expand All @@ -134,7 +136,7 @@ def launch(

# Update the Database with the pool information
worker_pool = WorkerPool(
name=name,
name=pool_name,
max_count=num_workers,
image_id=worker_image.id,
worker_list=worker_list,
Expand Down

0 comments on commit 341d33f

Please sign in to comment.