Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/certifi-2024.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ahenroid authored Aug 14, 2024
2 parents b4b9218 + 97f921a commit cd1e457
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions omics/cli/rerun/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ def get_run_resources(logs, run):
return sorted(resources, key=lambda x: x.get("creationTime"))


def get_workflow_type(run):
"""Get workflow type"""
if not run.get("workflow", None) or len(run["workflow"].split(":")) < 5:
die(f"Failed to retrieve workflow type from run {run['arn']}")
return "READY2RUN" if not run["workflow"].split(":")[4] else "PRIVATE"


def start_run_request(run, opts={}):
"""Build StartRun request"""

Expand All @@ -178,18 +185,17 @@ def set_param(rqst, key, key0, val=None):
rqst = {}
if opts.get("--workflow-id"):
set_param(rqst, "workflowId", "--workflow-id")
if opts.get("--workflow-type"):
rqst["workflowType"] = opts["--workflow-type"]
elif opts.get("--run-id"):
set_param(rqst, "runId", "--run-id")
elif run.get("run"):
set_param(rqst, "runId", None, run["run"].split("/")[-1])
else:
set_param(rqst, "workflowId", None, run["workflow"].split("/")[-1])
if opts.get("--workflow-type"):
rqst["workflowType"] = opts["--workflow-type"]
elif not run["workflow"].split(":")[4]:
rqst["workflowType"] = "READY2RUN"

if opts.get("--workflow-type"):
set_param(rqst, "workflowType", "--workflow-type")
else:
rqst["workflowType"] = get_workflow_type(run)

set_param(rqst, "roleArn", "--role-arn")
set_param(rqst, "name", "--name")
Expand Down

0 comments on commit cd1e457

Please sign in to comment.