Commit 2e24ff76 authored by Mykhailo Dalchenko's avatar Mykhailo Dalchenko
Browse files

Fix bug with wrapper script getting only the latest job inputs update

parent ba20918f
Pipeline #3743370 passed with stages
in 26 minutes and 10 seconds
......@@ -527,6 +527,9 @@ def submit_jobs(config, job_commands):
else:
tool = config['environment']['submission']['tool']
LOGGER.info("%s jobs will be submitted with %s", len(job_commands), tool.upper())
job_name = f"job_{config['process']['stage']}_"\
f"{config['process']['production_type']}_{_+1}.job"
job_file_path = run_directory + job_name
try:
with open(config['environment']['submission']['job_template'], 'r') as template_file:
template = template_file.read()
......@@ -534,21 +537,17 @@ def submit_jobs(config, job_commands):
LOGGER.warning("Job template %s is missing, using default one", err)
template = pkg_resources.read_text(templates, f'{stage}_{tool}.job')
if config['environment']['submission']['tool'] == 'htcondor':
script_file_path = f'{job_file_path[:-3]}sh'
split_command = shlex.split(cmd)
#template = template.replace('__executable__', split_command[0])
#template = template.replace('__arguments__', " ".join(split_command[1:]))
template = template.replace('__run_dir__', run_directory)
template = template.replace('__executable__', script_file_path)
condor_sim_telarray_script = f'#!/bin/bash\n{split_command[0]} {" ".join(split_command[1:])}'
with open(f'{run_directory}/condor_sim_telarray.sh', 'w') as f:
with open(script_file_path, 'w') as f:
f.write(condor_sim_telarray_script)
template = template.replace('__outputdir__', config['environment'][stage]['output_path'])
template = template.replace('__input_file__',
f"{config['environment'][stage]['input_path']}/{split_command[-1]}")
else:
template = template.replace('__command__', cmd)
job_name = f"job_{config['process']['stage']}_"\
f"{config['process']['production_type']}_{_+1}.job"
job_file_path = run_directory + job_name
if stage == 'dl1':
log_file_path = run_directory + '/log/' + job_name[:-4] + '-%A-%a' + '.log'
error_file_path = run_directory + '/error/' + job_name[:-4] + '-%A-%a' + '.err'
......
executable = __run_dir__/condor_sim_telarray.sh
executable = __executable__
output = __stdoutput__
error = __stderror__
initialdir = __outputdir__
......
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