Skip to content

Commit

Permalink
workflow name hack (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
morsecodist authored Jan 24, 2022
1 parent 5e36b92 commit 9c792a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
import json
import logging
from typing import List

from botocore import xform_name

Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.12.2-beta
v0.13.0-beta

0 comments on commit 9c792a0

Please sign in to comment.