Skip to content

Commit

Permalink
Fixed assertion error uncovered by Vasiliki Panagi on RO-Crate genera…
Browse files Browse the repository at this point in the history
…tion.

It happened on cases where there is no effective checkout because the workflow did not come from a source code repository
  • Loading branch information
jmfernandez committed Jun 23, 2023
1 parent 0bf7b5f commit 79e45d6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions wfexs_backend/ro_crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ def create_workflow_crate(
else:
matWf_local_path = matWf.dir

assert (
matWf.effectiveCheckout is not None
), "The effective checkout should be available"

parsed_repo_url = urllib.parse.urlparse(repoURL)
if parsed_repo_url.netloc == "github.com":
assert (
matWf.effectiveCheckout is not None
), "The effective checkout should be available"

parsed_repo_path = parsed_repo_url.path.split("/")
repo_name = parsed_repo_path[2]
# TODO: should we urldecode repo_name?
Expand Down Expand Up @@ -541,7 +541,8 @@ def create_workflow_crate(
gen_cwl=False,
)
local_wf_file["codeRepository"] = repoURL
local_wf_file["version"] = materializedEngine.workflow.effectiveCheckout
if materializedEngine.workflow.effectiveCheckout is not None:
local_wf_file["version"] = materializedEngine.workflow.effectiveCheckout
local_wf_file["description"] = "Unconsolidated Workflow Entrypoint"
local_wf_file["contentUrl"] = wf_entrypoint_url
local_wf_file["url"] = wf_url
Expand All @@ -564,7 +565,8 @@ def create_workflow_crate(
wf_consolidate_action["instrument"] = wf_wfexs
else:
wf_file["codeRepository"] = repoURL
wf_file["version"] = materializedEngine.workflow.effectiveCheckout
if materializedEngine.workflow.effectiveCheckout is not None:
wf_file["version"] = materializedEngine.workflow.effectiveCheckout
wf_file["description"] = "Workflow Entrypoint"
wf_file["url"] = wf_url
wf_file["hasPart"] = rel_entities
Expand Down

0 comments on commit 79e45d6

Please sign in to comment.