Commit 39a1e223 authored by Martin Schorb's avatar Martin Schorb
Browse files

launcher target tests

parent 87d7a750
......@@ -149,7 +149,8 @@ def checkstatus(run_state):
if 'done' in checkstatus(newrunstate)[0][0]:
if 'logfile' not in runjob.keys():
runjob['logfile'] = os.path.splitext(logfile)[0] + '_' + str(idx) + os.path.splitext(logfile)[-1]
runjob['logfile'] = os.path.splitext(logfile)[0] + '_' + str(idx) \
+ os.path.splitext(logfile)[-1]
# start next job with these parameters
......@@ -182,9 +183,6 @@ def checkstatus(run_state):
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:
......@@ -548,14 +546,16 @@ def run(target='standalone',
return {'par': outids}
# check target format
if type(target) is not str: raise TypeError('Target needs to be string.')
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]
logdir = os.path.dirname(logfile)
if errfile == '': errfile = os.path.join(logdir,logbase + '.err')
if errfile == '':
errfile = os.path.join(logdir, logbase + '.err')
runscriptfile = os.path.join(logdir, logbase + '.sh')
......@@ -573,8 +573,7 @@ def run(target='standalone',
print('launching - ')
print(target)
if target in ['standalone','testremote'] or target in params.remote_compute:
if target in ['standalone', 'localhost'] or target in params.remote_compute:
command = 'bash ' + runscriptfile
runscript.replace('#launch message', 'echo "Launching Render standalone processing script on " `hostname`')
......@@ -585,10 +584,10 @@ def run(target='standalone',
print(command)
if target in params.remote_compute:
if target in params.remote_compute or target == 'localhost':
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy)
ssh.connect(target, username=remote_user(target))
ssh.connect(target, username=remote_user(target), timeout=10)
command = "'echo $$ && " + command + "'"
......@@ -720,7 +719,7 @@ def run(target='standalone',
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy)
ssh.connect(remotehost, username=remote_user(remotehost))
ssh.connect(remotehost, username=remote_user(remotehost), timeout=10)
stdin, stdout, stderr = ssh.exec_command(command)
time.sleep(3)
......
......@@ -48,8 +48,11 @@ def test_run():
with pytest.raises(NotImplementedError):
run(target='somefancycloud')
c_options = params.comp_options
c_options.append({'label':'Dummy remote launch and status.','value':'localhost'})
# check all available target types
for computeoption in params.comp_options:
for computeoption in c_options:
target = computeoption['value']
......
Supports Markdown
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