Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
950a3bb0
"driver/src/driver.cpp" did not exist on "24d2f034fac9ec797477baee9fd36f4a930db068"
Unverified
Commit
950a3bb0
authored
Jan 14, 2025
by
Jakob Görgen
Browse files
symphony/cli: added commands to create and retrieve resource groups
parent
35ca047f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
symphony/cli/simbricks/cli/__main__.py
symphony/cli/simbricks/cli/__main__.py
+12
-1
symphony/cli/simbricks/cli/commands/resource_groups.py
symphony/cli/simbricks/cli/commands/resource_groups.py
+38
-0
No files found.
symphony/cli/simbricks/cli/__main__.py
View file @
950a3bb0
...
@@ -22,7 +22,17 @@
...
@@ -22,7 +22,17 @@
from
typer
import
Typer
,
Option
from
typer
import
Typer
,
Option
from
typing_extensions
import
Annotated
from
typing_extensions
import
Annotated
from
simbricks.cli.commands
import
audit
,
admin
,
namespaces
,
runs
,
systems
,
simulations
,
instantiations
,
runners
from
simbricks.cli.commands
import
(
audit
,
admin
,
namespaces
,
resource_groups
,
runs
,
systems
,
simulations
,
instantiations
,
runners
,
)
from
simbricks.client.provider
import
client_provider
from
simbricks.client.provider
import
client_provider
from
simbricks.cli.utils
import
async_cli
from
simbricks.cli.utils
import
async_cli
...
@@ -35,6 +45,7 @@ app.add_typer(systems.app, name="systems")
...
@@ -35,6 +45,7 @@ app.add_typer(systems.app, name="systems")
app
.
add_typer
(
simulations
.
app
,
name
=
"sims"
)
app
.
add_typer
(
simulations
.
app
,
name
=
"sims"
)
app
.
add_typer
(
instantiations
.
app
,
name
=
"insts"
)
app
.
add_typer
(
instantiations
.
app
,
name
=
"insts"
)
app
.
add_typer
(
runners
.
app
,
name
=
"runners"
)
app
.
add_typer
(
runners
.
app
,
name
=
"runners"
)
app
.
add_typer
(
resource_groups
.
app
,
name
=
"resource_groups"
)
@
app
.
callback
()
@
app
.
callback
()
...
...
symphony/cli/simbricks/cli/commands/resource_groups.py
0 → 100644
View file @
950a3bb0
from
typer
import
Typer
from
simbricks.client.provider
import
client_provider
from
..utils
import
async_cli
,
print_table_generic
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
):
"""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
)
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
):
"""List a resource group."""
rg
=
await
client_provider
.
resource_group_client
.
get_rg
(
rg_id
=
rg_id
)
print_table_generic
(
"Resource Group"
,
[
rg
],
"id"
,
"label"
,
"available_cores"
,
"available_memory"
,
"cores_left"
,
"memory_left"
)
@
app
.
command
()
@
async_cli
()
async
def
ls
():
"""List available resource groups."""
rgs
=
await
client_provider
.
resource_group_client
.
filter_get_rg
()
print_table_generic
(
"Resource Group"
,
rgs
,
"id"
,
"label"
,
"available_cores"
,
"available_memory"
,
"cores_left"
,
"memory_left"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment