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
c9ab808d
Unverified
Commit
c9ab808d
authored
Dec 11, 2024
by
Antoine Kaufmann
Browse files
symphony/client: use console for incremental output
parent
801523fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
symphony/client/simbricks/client/client.py
symphony/client/simbricks/client/client.py
+11
-5
No files found.
symphony/client/simbricks/client/client.py
View file @
c9ab808d
...
...
@@ -328,24 +328,26 @@ class SimBricksClient:
console
=
Console
()
with
console
.
status
(
f
"[bold green]Waiting for run
{
run_id
}
to finish..."
)
as
status
:
last_run
=
None
output
=
[]
prev_len
=
0
while
True
:
run
=
await
self
.
get_run
(
run_id
)
output
=
await
self
.
get_run_console
(
run_id
)
if
not
last_run
or
last_run
[
"state"
]
!=
run
[
"state"
]:
console
.
log
(
f
"Run State:"
,
run
[
"state"
])
if
not
last_run
or
(
len
(
last_run
[
"
output
"
]
)
!=
len
(
run
[
"output"
])
and
len
(
run
[
"output"
])
!=
0
)
:
prev_len
=
len
(
last_run
[
"output"
])
if
last_run
else
0
#
console.log(
run["output"][prev_len:
])
console
.
log
(
run
[
"output"
])
# TODO: FIXME
if
len
(
output
)
!=
prev_len
:
for
l
in
output
[
prev_len
]:
console
.
log
(
l
[
"simulator"
]
+
':'
+
l
[
"output"
])
prev_len
=
len
(
output
)
# did we finish?
if
run
[
"state"
]
!=
"pending"
and
run
[
"state"
]
!=
"running"
:
break
last_run
=
run
await
asyncio
.
sleep
(
1
5
)
await
asyncio
.
sleep
(
1
)
console
.
log
(
"Run {run_id} finished"
)
...
...
@@ -373,6 +375,10 @@ class SimBricksClient:
with
open
(
store_path
,
"wb"
)
as
f
:
f
.
write
(
content
)
async
def
get_run_console
(
self
,
rid
:
int
)
->
list
[
dict
]:
async
with
self
.
_ns_client
.
get
(
url
=
f
"/runs/
{
rid
}
/console"
)
as
resp
:
return
await
resp
.
json
()
class
RunnerClient
:
...
...
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