Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
59bbe7e7
Commit
59bbe7e7
authored
Mar 18, 2020
by
Flavio TARSETTI
Browse files
Merge branch '66_fix_monitor_command' into 'master'
Fix experiment monitor command Closes
#66
See merge request
!89
parents
6237ba29
9c954944
Pipeline
#38182
passed with stages
in 5 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/experiments.py
View file @
59bbe7e7
...
...
@@ -61,6 +61,8 @@ from beat.core.hash import hashDataset
from
.
import
common
from
.
import
commands
from
.webapi
import
WebAPIError
from
.plotters
import
plot_impl
as
plotters_plot
from
.plotters
import
pull_impl
as
plotters_pull
...
...
@@ -983,22 +985,22 @@ class ExperimentMonitor(threading.Thread):
0
if
first_run
else
self
.
interval
.
total_seconds
()
):
status
,
answer
=
webapi
.
get
(
"/api/v1/experiments/{}/?fields={}"
.
format
(
self
.
name
,
fields
)
)
if
status
!=
six
.
moves
.
http_client
.
OK
:
try
:
answer
=
webapi
.
get
(
"/api/v1/experiments/{}/?fields={}"
.
format
(
self
.
name
,
fields
)
)
except
WebAPIError
as
error
:
logger
.
error
(
"failed to get current state of {} on `{}', reason: {}"
.
format
(
self
.
name
,
webapi
.
platform
,
six
.
moves
.
http_client
.
responses
[
status
]
,
error
,
)
)
self
.
stop_event
.
set
()
self
.
queue
.
put
({
"error"
:
status
})
self
.
queue
.
put
({
"error"
:
error
})
else
:
data
=
simplejson
.
loads
(
answer
)
self
.
queue
.
put
(
data
)
self
.
queue
.
put
(
answer
)
if
first_run
:
first_run
=
False
...
...
@@ -1137,16 +1139,17 @@ def monitor(ctx, name):
if
not
killed
:
line
+=
1
pad
.
timeout
(
-
1
)
pad
.
addstr
(
line
,
0
,
textwrap
.
shorten
(
"Experiment done, press any key to leave"
,
width
=
width
),
curses
.
A_BOLD
,
)
pad
.
move
(
line
,
0
)
pad
.
refresh
(
pad_height
-
height
,
0
,
0
,
0
,
height
-
1
,
width
-
1
)
pad
.
getkey
()
if
pad
:
pad
.
timeout
(
-
1
)
pad
.
addstr
(
line
,
0
,
textwrap
.
shorten
(
"Experiment done, press any key to leave"
,
width
=
width
),
curses
.
A_BOLD
,
)
pad
.
move
(
line
,
0
)
pad
.
refresh
(
pad_height
-
height
,
0
,
0
,
0
,
height
-
1
,
width
-
1
)
pad
.
getkey
()
curses
.
echo
()
curses
.
nocbreak
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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