X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9b16a843a641159867ea390c4c2384b320183b15..3fa6aa4043286ad61e5f29c136d3cc2942e8750d:/sdk/cwl/arvados_cwl/util.py diff --git a/sdk/cwl/arvados_cwl/util.py b/sdk/cwl/arvados_cwl/util.py index 7dafedac28..a0dfb290c1 100644 --- a/sdk/cwl/arvados_cwl/util.py +++ b/sdk/cwl/arvados_cwl/util.py @@ -5,15 +5,20 @@ import datetime from arvados.errors import ApiError -def get_intermediate_collection_info(current_container, intermediate_output_ttl): - name = "Intermediate collection" +collectionUUID = "http://arvados.org/cwl#collectionUUID" + +def get_intermediate_collection_info(workflow_step_name, current_container, intermediate_output_ttl): + if workflow_step_name: + name = "Intermediate collection for step %s" % (workflow_step_name) + else: + name = "Intermediate collection" trash_time = None if intermediate_output_ttl > 0: trash_time = datetime.datetime.utcnow() + datetime.timedelta(seconds=intermediate_output_ttl) container_uuid = None + props = {"type": "intermediate"} if current_container: - container_uuid = current_container['uuid'] - props = {"type": "intermediate", "container": container_uuid} + props["container"] = current_container['uuid'] return {"name" : name, "trash_at" : trash_time, "properties" : props} @@ -23,6 +28,9 @@ def get_current_container(api, num_retries=0, logger=None): current_container = api.containers().current().execute(num_retries=num_retries) except ApiError as e: # Status code 404 just means we're not running in a container. - if e.resp.status != 404 and logger: - logger.info("Getting current container: %s", e) - return current_container; + if e.resp.status != 404: + if logger: + logger.info("Getting current container: %s", e) + raise e + + return current_container