Commit a8a22f6d authored by Martin Schorb's avatar Martin Schorb
Browse files

WIP check remote jobs

parent e7ff8cc8
......@@ -219,7 +219,7 @@ def checkstatus(run_state):
"""
outstat = []
runvars = [run_state['id']]
# runvars = [run_state['id']]
j_id = run_state['id']
logfile = run_state['logfile']
......@@ -284,7 +284,9 @@ def checkstatus(run_state):
if run_state['type'] in ['standalone', 'generic', 'localhost'] or run_state['type'] in params.remote_hosts:
if run_state['status'] in ['running', 'launch']:
for runvar in runvars:
print('this----------',runvar)
if type(runvar) is dict:
# remote check
......@@ -301,11 +303,11 @@ def checkstatus(run_state):
if len(res) > 0:
outstat.append('running')
print('running')
continue
elif run_state['status'] == 'launch':
outstat.append('launch')
continue
elif type(runvar) is int:
if psutil.pid_exists(runvar):
......@@ -320,6 +322,7 @@ def checkstatus(run_state):
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'):
print('error!')
outstat.append('error')
else:
outstat.append('done')
......
......@@ -8,7 +8,7 @@ import pytest
import time
from dashUI.utils.launch_jobs import *
run_state0 = dict(status='',
run_state0 = dict(status='running',
type='standalone',
logfile='log.log',
id=0)
......@@ -34,7 +34,7 @@ def test_args2string():
assert args2string(indict) == expectedargs
# test launcher
# test launcher and status calls
def test_run():
# run launcher test
......@@ -46,7 +46,12 @@ def test_run():
# check target not implemented
with pytest.raises(NotImplementedError):
run(target='somefancycloud')
run(target='somefancycloudthatdoesnotexits')
# test wrong compute target type check
rs1['id'] = ['this is an invalid jobID']
with pytest.raises(TypeError):
checkstatus(rs1)
c_options = params.comp_options
c_options.append({'label':'Dummy remote launch and status.','value':'localhost'})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment