Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Schorb
VolumeAlign
Commits
abafbc40
Commit
abafbc40
authored
Jun 22, 2022
by
Martin Schorb
Browse files
launcher tests
parent
43adabea
Changes
2
Hide whitespace changes
Inline
Side-by-side
dashUI/utils/launch_jobs.py
View file @
abafbc40
...
...
@@ -129,7 +129,7 @@ def checkstatus(run_state):
jobs
=
j_id
if
type
(
j_id
)
==
dict
:
if
type
(
j_id
)
is
dict
:
if
'par'
in
j_id
.
keys
():
runvars
=
[
job
for
job
in
j_id
[
'par'
]]
jobs
=
runvars
...
...
@@ -173,9 +173,18 @@ def checkstatus(run_state):
# parameter list for next sequential job
return
'pending'
,
''
,
logfile
,
jobs
if
type
(
j_id
)
is
list
:
el
if
type
(
j_id
)
is
list
:
runvars
=
j_id
elif
type
(
j_id
)
is
int
:
runvars
=
[
j_id
]
elif
type
(
j_id
)
is
str
:
runvars
=
[
j_id
]
if
run_state
[
'type'
]
in
[
'standalone'
,
'generic'
]:
if
run_state
[
'status'
]
in
[
'running'
,
'launch'
]:
for
runvar
in
runvars
:
...
...
@@ -201,7 +210,7 @@ def checkstatus(run_state):
outstat
.
append
(
'launch'
)
continue
el
se
:
el
if
type
(
runvar
)
is
int
:
if
psutil
.
pid_exists
(
runvar
):
p
=
psutil
.
Process
(
runvar
)
...
...
@@ -210,6 +219,8 @@ def checkstatus(run_state):
if
not
p
.
status
()
==
'zombie'
:
outstat
.
append
(
'running'
)
continue
else
:
raise
TypeError
(
'JOB ID for standalone jobs needs to be dict (host:id) or int for local call.'
)
if
os
.
path
.
exists
(
run_state
[
'logfile'
]
+
'_exit'
):
outstat
.
append
(
'error'
)
...
...
@@ -536,6 +547,9 @@ def run(target='standalone',
return
{
'par'
:
outids
}
# check target format
if
type
(
target
)
is
not
str
:
raise
TypeError
(
'Target needs to be string.'
)
my_env
=
os
.
environ
.
copy
()
logbase
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
logfile
))[
0
]
...
...
@@ -559,7 +573,8 @@ def run(target='standalone',
print
(
'launching - '
)
print
(
target
)
if
target
==
'standalone'
or
target
in
params
.
remote_compute
:
if
target
in
[
'standalone'
,
'testremote'
]
or
target
in
params
.
remote_compute
:
command
=
'bash '
+
runscriptfile
runscript
.
replace
(
'#launch message'
,
'echo "Launching Render standalone processing script on " `hostname`'
)
...
...
@@ -724,6 +739,9 @@ def run(target='standalone',
jobid
=
jobid
.
strip
(
'
\n
'
)[
jobid
.
rfind
(
' '
)
+
1
:]
return
jobid
else
:
raise
NotImplementedError
(
'This compute format is not (yet) implemented.'
)
def
remote_user
(
remotehost
):
"""
...
...
test/test_launch_jobs.py
View file @
abafbc40
...
...
@@ -38,6 +38,23 @@ def test_run():
# run launcher test
rs1
=
dict
(
run_state0
)
# check wrong script
rs1
[
'status'
]
=
'launch'
rs1
[
'logfile'
]
=
os
.
path
.
join
(
params
.
render_log_dir
,
'tests'
,
'test_render.log'
)
rs1
[
'id'
]
=
run
(
pyscript
=
'/thisscriptclearlydoesnotexist'
,
logfile
=
rs1
[
'logfile'
])
time
.
sleep
(
5
)
# check wrong compute target type
with
pytest
.
raises
(
TypeError
):
run
(
target
=
123
)
# check target not implemented
with
pytest
.
raises
(
NotImplementedError
):
run
(
target
=
'somefancycloud'
)
# check successful run of test script
rs1
[
'id'
]
=
run
()
rs1
[
'status'
]
=
'launch'
...
...
@@ -47,15 +64,15 @@ def test_run():
time
.
sleep
(
35
)
assert
status
(
rs1
)[
0
]
==
'done'
# check wrong script
rs1
[
'status'
]
=
'launch'
rs1
[
'logfile'
]
=
os
.
path
.
join
(
params
.
render_log_dir
,
'tests'
,
'test_render.log'
)
rs1
[
'id'
]
=
run
(
pyscript
=
'/thisscriptclearlydoesnotexist'
,
logfile
=
rs1
[
'logfile'
])
time
.
sleep
(
5
)
assert
status
(
rs1
)[
0
]
==
'Error while excecuting '
+
str
(
rs1
[
'id'
])
+
'.'
# check wrong ID type
# test status of local tasks
def
test_find_activejob
():
...
...
Write
Preview
Supports
Markdown
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