Permalink
Browse files

Remove CWL conformance test code.

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 9ab4a0d54a748fd47f560094aaff79917129c7f9
Showing with 12 additions and 83 deletions.
  1. +10 −22 planemo/commands/cmd_run.py
  2. +2 −23 planemo/cwl/run.py
  3. +0 −7 planemo/galaxy/activity.py
  4. +0 −11 planemo/options.py
  5. +0 −4 planemo/runnable.py
  6. +0 −16 tests/test_run.py
@@ -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


@@ -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()
@@ -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,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
@@ -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


@@ -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)
@@ -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,
)

@@ -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
@@ -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",
@@ -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."""
@@ -45,7 +45,6 @@ def test_run_cat_cwltool_more_options(self):
"run",
"--engine", "cwltool",
"--no_container",
"--conformance-test",
tool_path,
job_path,
]
@@ -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")

0 comments on commit 9ab4a0d

Please sign in to comment.