Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use output json instead of metadata for Cromwell #123

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions pytest_wdl/executors/cromwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ def run_workflow(
java_args = kwargs.get("java_args", self.java_args) or ""
cromwell_args = kwargs.get("cromwell_args", self._cromwell_args) or ""
metadata_file = Path.cwd() / "metadata.json"
output_file = Path.cwd() / "output.json"


cmd = (
f"{self.java_bin} {java_args} -jar {self._cromwell_jar_file} run "
f"-m {metadata_file} {cromwell_args} {inputs_arg} {imports_zip_arg} "
f"-m {metadata_file} -w {output_file} {cromwell_args} {inputs_arg} {imports_zip_arg} "
f"{wdl_path}"
)
LOG.info(
Expand All @@ -201,18 +203,22 @@ def run_workflow(
exe = subby.run(cmd, raise_on_error=False)

metadata = None
output = None

if metadata_file.exists():
with open(metadata_file, "rt") as inp:
metadata = json.load(inp)

if output_file.exists():
with open(output_file, "rt") as inp:
output = json.load(inp)

if exe.ok:
if metadata:
assert metadata["status"] == "Succeeded"
outputs = metadata["outputs"]
if output:
outputs = output
else:
LOG.warning(
f"Cromwell command completed successfully but did not generate "
f"a metadata file at {metadata_file}"
LOG.warning(f"Cromwell command completed successfully but did not generate "
f"an outputs file at {output_file}"
)
outputs = self._get_cromwell_outputs(exe.output)
else:
Expand Down