From 617ef14a3f2fac4dad5f699af7000187143ebbe3 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 20 Oct 2016 16:08:52 -0400 Subject: [PATCH] 10172: crunch_script only updates task record on error, will normally be updated in set_crunch_output(). --- sdk/cwl/arvados_cwl/crunch_script.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sdk/cwl/arvados_cwl/crunch_script.py b/sdk/cwl/arvados_cwl/crunch_script.py index e5c6d67ac9..9b0680bc83 100644 --- a/sdk/cwl/arvados_cwl/crunch_script.py +++ b/sdk/cwl/arvados_cwl/crunch_script.py @@ -21,6 +21,7 @@ import functools from arvados.api import OrderedJsonModel from cwltool.process import shortname, adjustFileObjs, adjustDirObjs, getListing, normalizeFilesDirs from cwltool.load_tool import load_tool +from cwltool.errors import WorkflowException logger = logging.getLogger('arvados.cwl-runner') @@ -32,6 +33,7 @@ def run(): arvados_cwl.add_arv_hints() + runner = None try: job_order_object = arvados.current_job()['script_parameters'] @@ -80,23 +82,18 @@ def run(): args.basedir = os.getcwd() args.cwl_runner_job={"uuid": arvados.current_job()["uuid"], "state": arvados.current_job()["state"]} outputObj = runner.arv_executor(t, job_order_object, **vars(args)) - - if runner.final_output_collection: + except Exception as e: + if isinstance(e, WorkflowException): + logging.info("Workflow error %s", e) + else: + logging.exception("Unhandled exception") + if runner and runner.final_output_collection: outputCollection = runner.final_output_collection.portable_data_hash() else: outputCollection = None - api.job_tasks().update(uuid=arvados.current_task()['uuid'], body={ 'output': outputCollection, - 'success': True, - 'progress':1.0 - }).execute() - except Exception as e: - logging.exception("Unhandled exception") - api.job_tasks().update(uuid=arvados.current_task()['uuid'], - body={ - 'output': None, 'success': False, 'progress':1.0 }).execute() -- 2.30.2