Skip to content

Commit

Permalink
Remove CWL conformance test code.
Browse files Browse the repository at this point in the history
The conformance tests no longer need to be flagged in a special way and cwltool no longer implements this either.
  • Loading branch information
jmchilton committed Mar 15, 2017
1 parent 04238d3 commit 9ab4a0d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 83 deletions.
32 changes: 10 additions & 22 deletions planemo/commands/cmd_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from planemo import options
from planemo.cli import command_function
from planemo.engine import engine_context
from planemo.io import conditionally_captured_io, warn
from planemo.io import warn
from planemo.tools import uri_to_path


Expand All @@ -18,7 +18,6 @@
@options.galaxy_run_options()
@options.galaxy_config_options()
@options.galaxy_cwl_root_option()
@options.cwl_conformance_test()
@options.run_output_directory_option()
@options.run_output_json_option()
@options.engine_options()
Expand All @@ -29,32 +28,21 @@ def cli(ctx, uri, job_path, **kwds):
\b
% planemo run cat1-tool.cwl cat-job.json
"""
path = DEFAULT_TOOL_LOCATION_FETCHER.to_tool_path(uri)
path = uri_to_path(ctx, uri)
kwds["cwl"] = path.endswith(".cwl")
conformance_test = kwds.get("conformance_test", False)

with conditionally_captured_io(conformance_test):
with engine_context(ctx, **kwds) as engine:
run_result = engine.run(path, job_path)
with engine_context(ctx, **kwds) as engine:
run_result = engine.run(path, job_path)

if not run_result.was_successful:
warn("Run failed [%s]" % str(run_result))
ctx.exit(1)

if conformance_test:
if hasattr(run_result, "cwl_command_state"):
command_state = run_result.cwl_command_state
dumped_json = json.dumps(command_state)
if hasattr(run_result, "galaxy_paths"):
for (local_path, galaxy_path) in run_result.galaxy_paths:
dumped_json = dumped_json.replace(galaxy_path, local_path)
print(dumped_json)
else:
outputs_dict = run_result.outputs_dict
print(outputs_dict)
output_json = kwds.get("output_json", None)
if output_json:
with open(output_json, "w") as f:
json.dump(outputs_dict, f)
outputs_dict = run_result.outputs_dict
print(outputs_dict)
output_json = kwds.get("output_json", None)
if output_json:
with open(output_json, "w") as f:
json.dump(outputs_dict, f)

return 0
25 changes: 2 additions & 23 deletions planemo/cwl/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
class CwlToolRunResponse(SuccessfulRunResponse):
"""Describe the resut of a cwltool invocation."""

def __init__(self, log, cwl_command_state=None, outputs=None):
def __init__(self, log, outputs=None):
self._log = log
self._cwl_command_state = cwl_command_state
self._outputs = outputs

@property
Expand All @@ -38,19 +37,8 @@ def log(self):
def job_info(self):
return None

@property
def cwl_command_state(self):
if self._cwl_command_state is None:
message = "Can only call cwl_command_state if running conformance_test."
raise NotImplementedError(message)

return self._cwl_command_state

@property
def outputs_dict(self):
if self._outputs is None:
message = "Can not call outputs if running conformance_test."
raise NotImplementedError(message)
return self._outputs


Expand All @@ -59,9 +47,6 @@ def run_cwltool(ctx, path, job_path, **kwds):
ensure_cwltool_available()

args = []
conformance_test = kwds.get("conformance_test", False)
if conformance_test:
args.append("--conformance-test")
if ctx.verbose:
args.append("--verbose")
output_directory = kwds.get("output_directory", None)
Expand Down Expand Up @@ -105,15 +90,9 @@ def run_cwltool(ctx, path, job_path, **kwds):

if ret_code != 0:
return ErrorRunResponse("Error running cwltool", log=log)
if conformance_test:
cwl_command_state = result
outputs = None
else:
cwl_command_state = None
outputs = result
outputs = result
return CwlToolRunResponse(
log,
cwl_command_state=cwl_command_state,
outputs=outputs,
)

Expand Down
7 changes: 0 additions & 7 deletions planemo/galaxy/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,6 @@ def job_info(self):
)
return None

@property
def cwl_command_state(self):
cwl_command_state = None
if self._job_info is not None:
cwl_command_state = self._job_info["cwl_command_state"]
return cwl_command_state

@property
def outputs_dict(self):
return self._outputs_dict
Expand Down
11 changes: 0 additions & 11 deletions planemo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,6 @@ def run_output_json_option():
)


def cwl_conformance_test():
return planemo_option(
"--conformance_test",
"--conformance-test",
is_flag=True,
help=("Generate CWL conformance test object describing job. "
"Required by CWL conformance test suite and implemented "
"by cwltool reference implementation."),
)


def no_dependency_resolution():
return planemo_option(
"--no_dependency_resolution",
Expand Down
4 changes: 0 additions & 4 deletions planemo/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,6 @@ def was_successful(self):
"""Return `True` to indicate this run was successful."""
return True

@abc.abstractproperty
def cwl_command_state(self):
"""JSON result of command state for an execution."""

@abc.abstractproperty
def outputs_dict(self):
"""Return a dict of output descriptions."""
Expand Down
16 changes: 0 additions & 16 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def test_run_cat_cwltool_more_options(self):
"run",
"--engine", "cwltool",
"--no_container",
"--conformance-test",
tool_path,
job_path,
]
Expand Down Expand Up @@ -78,21 +77,6 @@ def test_run_cat(self):
]
self._check_exit_code(test_cmd)

# Conformance test option is deprecated in CWL land and obsecures errors.
# @skip_unless_python_2_7()
# @skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
# def test_run_cat_conformance(self):
# with self._isolate():
# tool_path = _cwl_file("cat1-tool.cwl")
# job_path = _cwl_file("cat-job.json")
# test_cmd = [
# "run",
# "--conformance-test",
# tool_path,
# job_path,
# ]
# self._check_exit_code(test_cmd)

@skip_unless_python_2_7()
@skip_if_environ("PLANEMO_SKIP_CWLTOOL_TESTS")
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
Expand Down

0 comments on commit 9ab4a0d

Please sign in to comment.