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
b1a2af0c
Unverified
Commit
b1a2af0c
authored
Dec 21, 2024
by
Jakob Görgen
Browse files
symphony/client: add functions to create,delete,retrieve runners
parent
787267c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
symphony/client/simbricks/client/client.py
symphony/client/simbricks/client/client.py
+23
-2
No files found.
symphony/client/simbricks/client/client.py
View file @
b1a2af0c
...
...
@@ -348,7 +348,7 @@ class SimBricksClient:
if
len
(
output
)
!=
prev_len
:
for
l
in
output
[
prev_len
:]:
console
.
log
(
l
[
"simulator"
]
+
':'
+
l
[
"output"
])
console
.
log
(
l
[
"simulator"
]
+
":"
+
l
[
"output"
])
prev_len
=
len
(
output
)
# did we finish?
...
...
@@ -420,6 +420,28 @@ class RunnerClient:
async
with
self
.
_ns_client
.
get
(
url
=
self
.
_build_prefix
(
url
=
url
),
data
=
data
,
**
kwargs
)
as
resp
:
yield
resp
async
def
create_runner
(
self
,
label
:
str
,
tags
:
list
[
str
])
->
dict
:
obj
=
{
"label"
:
label
,
"tags"
:
list
(
map
(
lambda
t
:
{
"label"
:
t
,
"runner_id"
:
None
},
tags
))}
print
(
obj
)
async
with
self
.
_ns_client
.
post
(
url
=
f
"/runners"
,
json
=
obj
)
as
resp
:
return
await
resp
.
json
()
async
def
update_runner
(
self
,
updates
:
dict
[
str
,
typing
.
Any
])
->
dict
:
async
with
self
.
post
(
url
=
""
,
json
=
updates
)
as
resp
:
return
await
resp
.
json
()
async
def
delete_runner
(
self
,
runner_id
:
int
)
->
dict
:
async
with
self
.
_ns_client
.
delete
(
url
=
f
"/runners/
{
runner_id
}
"
)
as
resp
:
return
await
resp
.
json
()
async
def
get_runner
(
self
,
runner_id
:
int
)
->
dict
:
async
with
self
.
_ns_client
.
get
(
url
=
f
"/runners/
{
runner_id
}
"
)
as
resp
:
return
await
resp
.
json
()
async
def
list_runners
(
self
)
->
dict
:
async
with
self
.
_ns_client
.
get
(
url
=
f
"/runners"
)
as
resp
:
return
await
resp
.
json
()
async
def
next_run
(
self
)
->
dict
|
None
:
async
with
self
.
get
(
f
"/next_run"
)
as
resp
:
if
resp
.
status
==
200
:
...
...
@@ -444,7 +466,6 @@ class RunnerClient:
async
with
self
.
put
(
url
=
f
"/update_run/
{
run_id
}
"
,
json
=
obj
)
as
resp
:
ret
=
await
resp
.
json
()
async
def
send_out
(
self
,
run_id
:
int
,
...
...
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