Commit f52f009c authored by Christoph Arthofer's avatar Christoph Arthofer
Browse files

solve wait_for issue

parent 9622caec
......@@ -416,6 +416,7 @@ def applyWarpWrapper(img_path, ref_path, warped_path, warp_path, interp='spline'
applywarp(src=img_nib, ref=ref_path, out=warped_path, warp=warp_path, interp=interp)
# https://git.fmrib.ox.ac.uk/fsl/fsl_sub
# def submitJob_fsl_sub(name, log_dir, queue, wait_for=[], script=None, command=None, coprocessor_class=None, export_var=None,
# debug=False):
# """! Wrapper for fslsub - submits a job to the cluster. This function can be easily extended to work with other workload managers.
......@@ -492,14 +493,16 @@ def submitJob(name, log_dir, queue, wait_for=[], script=None, command=None, copr
@return The job ID.
"""
cmd = 'fsl_sub'
if wait_for and any(job != '' for job in wait_for):
cmd = 'fsl_sub -n'
job_ids_bool = [job != '' for job in wait_for]
if wait_for and any(job_ids_bool):
cmd += ' -j '
for j, job in enumerate(wait_for):
if job != '':
cmd += job.replace("\n", "")
if j < len(wait_for) - 1:
cmd += ','
wait_for_arr = np.array(wait_for)
wait_for_arr = wait_for_arr[job_ids_bool]
for j, job in enumerate(wait_for_arr):
cmd += job.replace("\n", "")
if j < len(wait_for_arr) - 1:
cmd += ','
cmd += ' -N ' + name + \
' -l ' + log_dir + \
......@@ -1383,10 +1386,9 @@ if __name__ == "__main__":
export_var_str[key] = '"' + key + '=' + ','.join([common_path]) + '"'
job_ids[28] = submitJob(tag+'_'+task_name, log_dir, script=script_path, queue=gpuq,
wait_for=list(
itemgetter(*[21, 23, 24, 25, 26, 27, 28, 44, 45, 46, 47, 48, 50])(
job_ids)), coprocessor_class='P',
export_var=export_var_str['SINGULARITY_BIND'], debug=False)
wait_for=list(itemgetter(*[21, 23, 24, 25, 26, 27, 28, 44, 45, 46, 47, 48, 50])(job_ids)),
coprocessor_class='P',
export_var=export_var_str['SINGULARITY_BIND'], debug=False)
print('submitted: ' + task_name)
# Averaging warps
......
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