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

Clean Up CWL Conformance Test Execution. #753

Merged
merged 3 commits into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ push-release: ## Push a tagged release to github
git push $(UPSTREAM) master
git push --tags $(UPSTREAM)

release: release-local push-release release-brew ## package, review, and upload a release
release: release-local push-release ## package, review, and upload a release

add-history: ## Reformat HISTORY.rst with data from Github's API
$(IN_VENV) python $(BUILD_SCRIPTS_DIR)/bootstrap_history.py $(ITEM)
Expand Down
8 changes: 5 additions & 3 deletions cwl-runner/cwl-runner
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ done
# TODO: Do something with USE_CONTAINER
if [ -n USE_CONTAINER ];
then
PLANEMO_ARGS="$PLANEMO_ARGS --docker --cwl"
PLANEMO_ARGS="$PLANEMO_ARGS --docker --cwl --output_json outputs.json"
fi

echo "$PLANEMO_ARGS"
# echo "$PLANEMO_ARGS"

"$PLANEMO_BIN" --verbose run $PLANEMO_ARGS
"$PLANEMO_BIN" $VERBOSE_ARG run $PLANEMO_ARGS >planemo_run.log 2>&1

cat outputs.json
1 change: 0 additions & 1 deletion planemo/commands/cmd_shed_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@options.shed_read_options()
@options.galaxy_run_options()
@options.galaxy_config_options()
@options.pid_file_option()
@click.option(
"--skip_dependencies",
is_flag=True,
Expand Down
6 changes: 2 additions & 4 deletions planemo/galaxy/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,16 @@ def get_dataset(dataset_details, filename=None):
ctx.vlog("collecting outputs to directory %s" % output_directory)
for runnable_output in get_outputs(self._runnable):
output_id = runnable_output.get_id()

output_dict_value = None
if self._runnable.type in [RunnableType.cwl_workflow, RunnableType.cwl_tool]:
galaxy_output = self.to_galaxy_output(runnable_output)

cwl_output = output_to_cwl_json(
galaxy_output,
self._get_metadata,
get_dataset,
self._get_extra_files,
pseduo_location=True,
)

output_dict_value = cwl_output
else:
# TODO: deprecate this route for finding workflow outputs,
Expand All @@ -389,8 +387,8 @@ def get_dataset(dataset_details, filename=None):

outputs_dict[output_id] = output_dict_value

ctx.vlog("collected outputs [%s]" % self._outputs_dict)
self._outputs_dict = outputs_dict
ctx.vlog("collected outputs [%s]" % self._outputs_dict)

@property
def log(self):
Expand Down
15 changes: 7 additions & 8 deletions planemo/galaxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,6 @@ def config_join(*args):

write_file(shed_data_manager_config_file, SHED_DATA_MANAGER_CONF_TEMPLATE)

pid_file = kwds.get("pid_file") or config_join("galaxy.pid")

yield LocalGalaxyConfig(
config_directory,
env,
Expand All @@ -525,7 +523,6 @@ def config_join(*args):
master_api_key,
runnables,
galaxy_root,
pid_file,
)


Expand Down Expand Up @@ -827,7 +824,6 @@ def __init__(
master_api_key,
runnables,
galaxy_root,
pid_file,
):
super(LocalGalaxyConfig, self).__init__(
config_directory,
Expand All @@ -839,10 +835,9 @@ def __init__(
runnables,
)
self.galaxy_root = galaxy_root
self._pid_file = pid_file

def kill(self):
kill_pid_file(self._pid_file)
kill_pid_file(self.pid_file)

def startup_command(self, ctx, **kwds):
"""Return a shell command used to startup this instance.
Expand All @@ -851,13 +846,12 @@ def startup_command(self, ctx, **kwds):
``daemon`` keyword.
"""
daemon = kwds.get("daemon", False)
pid_file = self._pid_file
# TODO: Allow running dockerized Galaxy here instead.
setup_venv_command = setup_venv(ctx, kwds)
run_script = os.path.join(self.galaxy_root, "run.sh")
run_script += " $COMMON_STARTUP_ARGS"
if daemon:
run_script += " --pid-file '%s' --daemon" % pid_file
run_script += "--daemon"
self.env["GALAXY_RUN_ALL"] = "1"
else:
run_script += " --server-name '%s' --reload" % self.server_name
Expand All @@ -876,6 +870,11 @@ def log_file(self):
file_name = "%s.log" % self.server_name
return os.path.join(self.galaxy_root, file_name)

@property
def pid_file(self):
pid_file_name = "%s.pid" % self.server_name
return os.path.join(self.galaxy_root, pid_file_name)

@property
def log_contents(self):
if not os.path.exists(self.log_file):
Expand Down
4 changes: 3 additions & 1 deletion planemo/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@ def ps1_for_path(path, base="PS1"):

def kill_pid_file(pid_file):
if not os.path.exists(pid_file):
print("No pid file...")
return

pid = int(open(pid_file, "r").read())
kill_posix(pid)
killed = kill_posix(pid)
print("killed? s" % killed)


def kill_posix(pid):
Expand Down
9 changes: 0 additions & 9 deletions planemo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,14 +969,6 @@ def galaxy_target_options():
)


def pid_file_option():
return planemo_option(
"--pid_file",
default=None,
help="Location of pid file is executed with --daemon."
)


def daemon_option():
return planemo_option(
"--daemon",
Expand All @@ -1002,7 +994,6 @@ def galaxy_serve_options():
docker_galaxy_image_option(),
galaxy_config_options(),
daemon_option(),
pid_file_option(),
)


Expand Down
3 changes: 2 additions & 1 deletion planemo/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ def get_outputs(runnable):
tool_source = get_tool_source(runnable.path)
# TODO: do something with collections at some point
output_datasets, _ = tool_source.parse_outputs(None)
return [ToolOutput(o) for o in output_datasets.values()]
outputs = [ToolOutput(o) for o in output_datasets.values()]
return outputs
elif runnable.type == RunnableType.galaxy_workflow:
workflow_outputs = describe_outputs(runnable.path)
return [GalaxyWorkflowOutput(o) for o in workflow_outputs]
Expand Down
7 changes: 0 additions & 7 deletions scripts/test_conformance_cwl.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
# Run all conformance tests:
# bash scripts/test_conformance_cwl.bash
#
# This script installs planemo and a Galaxy/planemo cwl-runner implementation
# in the current virtualenv, clones down CWL spec, and runs a configuration test.
# Very few tests will pass - tests which don't have actual data (specify fake jobs)
# will not work, nor will tests which depend on the cwl-runner preserving filenames
# instead of output IDs (this isn't implemented in Galaxy/planemo and I'm not convinced
# it should be), finally any tests of workflows at all or tools using features not
# yet implemented in the CWL will not pass.

set -e
# Ensure working directory is planemo project.
Expand Down