FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit a0ccc79b authored by J.W. Smith's avatar J.W. Smith
Browse files

Leave INPROGRESS jobs alone.

parent 8f8eeaa9
No related branches found
No related tags found
No related merge requests found
......@@ -384,9 +384,9 @@ def run_Process():
# check for a status file in job directory
if status.had_initial_status:
logger.error(f"Job path already exists and has status {status.status}")
logger.info(f"Job path already exists and has status {status.status}")
endJob(status,premature = status.status != 'SUCCESS')
endJob(status,ignore_inprogress=True,premature = status.status != 'SUCCESS')
logger.info(f"Current status of job directory is {status.status}")
......
......@@ -132,19 +132,30 @@ def subprocess_and_log(cmd,description_short,description_long,check=True,**kwarg
return process
def endScript(premature=True):
if not premature:
logger.info(f'Script finished!')
else:
logger.info(f'Script finished prematurely')
logger.info(f'--------')
sys.exit()
def endJob(status,**kwargs):
def endJob(status,ignore_inprogress=False,**kwargs):
# get status file fresh, and ensure one exists
status.status = status.get()
assert status.has_status
if status.is_inprogress():
logger.warning(f'Workflow problem: {script_name} status is {status.status} but endJob called, forcing error status')
if status.is_inprogress() & (ignore_inprogress == False):
logger.warning(f'Workflow problem: status is {status.status} but endJob called, forcing error status')
status.reset('ERROR')
endScript(**kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment