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
b4eb3796
".github/git@developer.sourcefind.cn:change/sglang.git" did not exist on "6e13b650a98275750835ce7999890052d01d1c45"
Unverified
Commit
b4eb3796
authored
Jan 08, 2025
by
Jakob Görgen
Browse files
symphony/client: runner event api fixes + fetch and filter for runs
parent
84117926
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
10 deletions
+42
-10
symphony/client/simbricks/client/client.py
symphony/client/simbricks/client/client.py
+42
-10
No files found.
symphony/client/simbricks/client/client.py
View file @
b4eb3796
...
...
@@ -362,7 +362,7 @@ class SimBricksClient:
break
last_run
=
run
await
asyncio
.
sleep
(
0.5
)
await
asyncio
.
sleep
(
3
)
console
.
log
(
f
"Run
{
run_id
}
finished"
)
...
...
@@ -411,6 +411,13 @@ class RunnerClient:
async
with
self
.
_ns_client
.
post
(
url
=
self
.
_build_prefix
(
url
=
url
),
data
=
data
,
**
kwargs
)
as
resp
:
yield
resp
@
contextlib
.
asynccontextmanager
async
def
delete
(
self
,
url
:
str
,
data
:
typing
.
Any
=
None
,
**
kwargs
:
typing
.
Any
)
->
typing
.
AsyncIterator
[
aiohttp
.
ClientResponse
]:
async
with
self
.
_ns_client
.
delete
(
url
=
self
.
_build_prefix
(
url
=
url
),
data
=
data
,
**
kwargs
)
as
resp
:
yield
resp
@
contextlib
.
asynccontextmanager
async
def
put
(
self
,
url
:
str
,
data
:
typing
.
Any
=
None
,
**
kwargs
:
typing
.
Any
...
...
@@ -431,31 +438,35 @@ class RunnerClient:
async
with
self
.
_ns_client
.
post
(
url
=
f
"/runners"
,
json
=
obj
)
as
resp
:
return
await
resp
.
json
()
async
def
create_runner_event
(
self
,
runner_id
:
int
,
action
:
str
,
run_id
:
int
|
None
)
->
dict
:
obj
=
{
"runner_id"
:
runner_id
,
"action"
:
action
,
"run_id"
:
run_id
}
async
with
self
.
_ns_client
.
post
(
url
=
f
"/runners/
{
runner_id
}
/events"
,
json
=
obj
)
as
resp
:
async
def
create_runner_event
(
self
,
action
:
str
,
run_id
:
int
|
None
)
->
dict
:
obj
=
{
"runner_id"
:
self
.
_
runner_id
,
"action"
:
action
,
"run_id"
:
run_id
}
async
with
self
.
post
(
url
=
f
"
/events"
,
json
=
obj
)
as
resp
:
return
await
resp
.
json
()
async
def
delete_runner_event
(
self
,
event_id
:
int
)
->
None
:
async
with
self
.
delete
(
url
=
f
"/events/
{
event_id
}
"
)
as
resp
:
await
resp
.
json
()
async
def
update_runner_event
(
self
,
runner_id
:
int
,
event_id
:
int
,
action
:
str
|
None
,
run_id
:
int
|
None
,
event_status
:
str
|
None
self
,
event_id
:
int
,
action
:
str
|
None
,
run_id
:
int
|
None
,
event_status
:
str
|
None
)
->
dict
:
obj
=
{
"id"
:
event_id
,
"runner_id"
:
runner_id
,
"runner_id"
:
self
.
_
runner_id
,
"action"
:
action
,
"run_id"
:
run_id
,
"event_status"
:
event_status
,
}
obj
=
utils_base
.
filter_None_dict
(
to_filter
=
obj
)
async
with
self
.
_ns_client
.
put
(
url
=
f
"/runners/
{
runner_id
}
/events"
,
json
=
obj
)
as
resp
:
async
with
self
.
put
(
url
=
f
"
/events"
,
json
=
obj
)
as
resp
:
return
await
resp
.
json
()
async
def
get_events
(
self
,
runner_id
:
int
,
action
:
str
|
None
,
run_id
:
int
|
None
,
limit
:
int
|
None
,
event_status
:
str
|
None
self
,
action
:
str
|
None
,
run_id
:
int
|
None
,
limit
:
int
|
None
,
event_status
:
str
|
None
)
->
dict
:
params
=
{
"action"
:
action
,
"run_id"
:
run_id
,
"event_status"
:
event_status
,
"limit"
:
limit
}
params
=
utils_base
.
filter_None_dict
(
to_filter
=
params
)
async
with
self
.
_ns_client
.
get
(
url
=
f
"/runners/
{
runner_id
}
/events"
,
params
=
params
)
as
resp
:
async
with
self
.
get
(
url
=
f
"
/events"
,
params
=
params
)
as
resp
:
return
await
resp
.
json
()
async
def
update_runner
(
self
,
updates
:
dict
[
str
,
typing
.
Any
])
->
dict
:
...
...
@@ -474,6 +485,27 @@ class RunnerClient:
async
with
self
.
_ns_client
.
get
(
url
=
f
"/runners"
)
as
resp
:
return
await
resp
.
json
()
async
def
send_heartbeat
(
self
)
->
None
:
async
with
self
.
put
(
url
=
"/heartbeat"
)
as
resp
:
await
resp
.
json
()
async
def
filter_get_runs
(
self
,
run_id
:
int
|
None
=
None
,
instantiation_id
:
int
|
None
=
None
,
state
:
str
|
None
=
None
,
limit
:
int
|
None
=
None
,
):
obj
=
{
"id"
:
run_id
,
"instantiation_id"
:
instantiation_id
,
"state"
:
state
,
"limit"
:
limit
,
}
utils_base
.
filter_None_dict
(
to_filter
=
obj
)
async
with
self
.
post
(
url
=
"/filter_get_run"
,
json
=
obj
)
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
:
...
...
@@ -496,7 +528,7 @@ class RunnerClient:
"instantiation_id"
:
42
,
}
async
with
self
.
put
(
url
=
f
"/update_run/
{
run_id
}
"
,
json
=
obj
)
as
resp
:
ret
=
await
resp
.
json
()
await
resp
.
json
()
async
def
send_out
(
self
,
...
...
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