Skip to content

Commit

Permalink
feat: semaphores: backwards compatibility by falling back to `run_wor…
Browse files Browse the repository at this point in the history
…ker`
  • Loading branch information
dodamih committed Nov 8, 2023
1 parent 5470773 commit cf5b2f1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions zetta_utils/cloud_management/resource_allocation/k8s/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,23 @@ def get_mazepa_worker_command(
num_procs: int = 1,
semaphores_spec: dict[SemaphoreType, int] | None = None,
):
if num_procs == 1 and semaphores_spec is None:
command = "mazepa.run_worker"
else:
command = "mazepa.run_worker_manager"
if semaphores_spec is None:
semaphores_line = ""
else:
semaphores_line = f"semaphores_spec: {json.dumps(semaphores_spec)}\n"
result = (
"""
zetta -vv -l try run -s '{
"@type": "mazepa.run_worker_manager"
"""
+ f'"@type": "{command}"\n'
+ f"task_queue: {json.dumps(task_queue_spec)}\n"
+ f"outcome_queue: {json.dumps(outcome_queue_spec)}\n"
+ f"semaphores_spec: {json.dumps(semaphores_spec)}\n"
+ f"num_procs: {num_procs}\n"
+ semaphores_line
+ """
sleep_sec: 5
}'
Expand Down

0 comments on commit cf5b2f1

Please sign in to comment.