From 9c792a04d7e6c367b1a086cfc14373fb2ec460a6 Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Mon, 24 Jan 2022 17:25:35 -0500 Subject: [PATCH] workflow name hack (#40) --- .../app/sfn_io_helper/stage_io.py | 14 +++++++++++++- version | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/terraform/modules/sfn-io-helper-lambdas/app/sfn_io_helper/stage_io.py b/terraform/modules/sfn-io-helper-lambdas/app/sfn_io_helper/stage_io.py index 532b8c9a..dc04902d 100644 --- a/terraform/modules/sfn-io-helper-lambdas/app/sfn_io_helper/stage_io.py +++ b/terraform/modules/sfn-io-helper-lambdas/app/sfn_io_helper/stage_io.py @@ -2,6 +2,7 @@ import re import json import logging +from typing import List from botocore import xform_name @@ -62,10 +63,21 @@ def trim_batch_job_details(sfn_state): return sfn_state +def segment_path(path: str) -> List[str]: + _path = path + segments: List[str] = [] + while _path: + _path, segment = os.path.split(_path) + segments.insert(0, segment) + return segments + + def get_workflow_name(sfn_state): for k, v in sfn_state.items(): if k.endswith("_WDL_URI"): - return os.path.splitext(os.path.basename(s3_object(v).key))[0] + segments = [s for s in segment_path(v) if re.match(r"v(\d+)", s)] + name = segments[0] if segments else os.path.basename(v) + return os.path.splitext(name)[0] def link_outputs(sfn_state): diff --git a/version b/version index 2eff7d83..79e208d4 100644 --- a/version +++ b/version @@ -1 +1 @@ -v0.12.2-beta +v0.13.0-beta