"test/vscode:/vscode.git/clone" did not exist on "41c76a17c7a191752eada5346dc88ecfe690dcae"
Unverified Commit 3327b01b authored by Jakob Görgen's avatar Jakob Görgen
Browse files

symphony/cli: cli call to update resource group + disallow 'start_run' event

parent 71762cda
from typer import Typer
from typer import Typer, Option
from typing import Annotated
from simbricks.client.provider import client_provider
from ..utils import async_cli, print_table_generic
......@@ -8,7 +9,7 @@ app = Typer(help="Managing SimBricks resource groups used by runners.")
@app.command()
@async_cli()
async def create_rg(label: str, available_cores: int, available_memory: int):
async def create(label: str, available_cores: int, available_memory: int):
"""Create a resource group describing a runners available resources."""
rg = await client_provider.resource_group_client.create_rg(
label=label, available_cores=available_cores, available_memory=available_memory
......@@ -18,6 +19,30 @@ async def create_rg(label: str, available_cores: int, available_memory: int):
)
@app.command()
@async_cli()
async def update(
rg_id: int,
label: Annotated[str | None, Option("--label", "-l", help="Update the label.")] = None,
available_cores: Annotated[int | None, Option("--ac", help="Update the available cores.")] = None,
available_memory: Annotated[int | None, Option("--am", help="Update the available memory.")] = None,
cores_left: Annotated[int | None, Option("--cl", help="Update the cores left.")] = None,
memory_left: Annotated[int | None, Option("--ml", help="Update the memory left.")] = None,
):
"""Create a resource group describing a runners available resources."""
rg = await client_provider.resource_group_client.update_rg(
rg_id=rg_id,
label=label,
available_cores=available_cores,
available_memory=available_memory,
cores_left=cores_left,
memory_left=memory_left,
)
print_table_generic(
"Resource Group", [rg], "id", "label", "available_cores", "available_memory", "cores_left", "memory_left"
)
@app.command()
@async_cli()
async def ls_rg(rg_id: int):
......
......@@ -26,7 +26,9 @@ from simbricks.client.provider import client_provider
from ..utils import async_cli, print_table_generic
app = Typer(help="Managing SimBricks runners.")
app = Typer(
help="Managing SimBricks runners. (NOTE: some commands like listing events are relative to a specific runner. To use them properly use either the simbricks-cli commands --runner-ident parameter or a environment variable.)"
)
@app.command()
......@@ -68,7 +70,9 @@ async def create_event(
action: str,
run_id: Annotated[int | None, Option("--run", "-r", help="Set event for specific run.")] = None,
):
"""Send a run related event to a runner (Available actions: kill, heartbeat, simulation_status, start_run)."""
"""Send a run related event to a runner (Available actions: kill (reuires a run id that shall be killed), heartbeat, simulation_status)."""
if action == "kill" and not run_id:
raise Exception("when trying to create a kill action you must specify a run id")
event = await client_provider.runner_client.create_runner_event(action=action, run_id=run_id)
print_table_generic("Event", [event], "id", "runner_id", "action", "run_id", "event_status")
......
......@@ -128,14 +128,6 @@ async def submit_script(
input: Annotated[
str | None, Option("--input", "-i", help="Specify a tarball file of inputs needed for running the simulation.")
] = None,
start: Annotated[
bool,
Option(
"--start",
"-s",
help="Immediately create a start event and schedule the run to be executed on the specified runner.",
),
] = False,
):
"""Submit a SimBricks python simulation script to run."""
......@@ -149,8 +141,5 @@ async def submit_script(
if input:
await system_client.set_run_input(run_id, input)
if start:
await client_provider.runner_client.create_runner_event(action="start_run", run_id=run_id)
if follow:
await opus_base.follow_run(run_id=run_id)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment