Commit 5e1be799 authored by Martin Schorb's avatar Martin Schorb
Browse files

test launcher

parent f7a13b92
......@@ -484,8 +484,8 @@ def run(target='standalone',
run_args='',
target_args=None,
special_args=None,
logfile=os.path.join(params.render_log_dir, 'render.out'),
errfile=os.path.join(params.render_log_dir, 'render.err'),
logfile=os.path.join(params.render_log_dir, 'render.log'),
errfile='',
inputs={}):
"""
Launcher of a processing task.
......@@ -538,9 +538,11 @@ def run(target='standalone',
my_env = os.environ.copy()
logbase = os.path.basename(logfile).split('.log')[0]
logbase = os.path.splitext(os.path.basename(logfile))[0]
logdir = os.path.dirname(logfile)
if errfile == '': errfile = os.path.join(logdir,logbase + '.err')
runscriptfile = os.path.join(logdir, logbase + '.sh')
if run_args is None:
......
......@@ -5,6 +5,7 @@ tests for functionality in dashUI.utils.launch_jobs
import os
import pytest
import time
from dashUI.utils.launch_jobs import *
run_state0 = dict(status='',
......@@ -32,17 +33,43 @@ def test_args2string():
assert args2string(indict) == expectedargs
# test launcher
def test_run():
# run launcher test
rs1 = dict(run_state0)
rs1['id'] = run()
rs1['status'] = 'launch'
time.sleep(5)
assert status(rs1)[0] == 'running'
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'
# test status of local tasks
def test_find_activejob():
rs1 = dict(run_state0)
rs1['id'] = {'par':[1,2,3,4]}
rs1['status'] = ['done','running','done','pending']
rs1['status'] = 'launch'
# check for sequential jobs
with pytest.raises(TypeError):
find_activejob(rs1)
rs1['id'] = run()
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