Skip to content

Commit

Permalink
Add --extra_tools option to serve.
Browse files Browse the repository at this point in the history
Once Galaxy will be able to "serve" workflows - this will be useful for specifying the location of extra tools.
  • Loading branch information
jmchilton committed May 3, 2016
1 parent 0c67ad6 commit 02a08a0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion planemo/galaxy/config.py
Expand Up @@ -171,7 +171,8 @@ def config_join(*args):
_ensure_directory(tool_dependency_dir)

shed_tool_conf = kwds.get("shed_tool_conf") or config_join("shed_tools_conf.xml")
tool_definition = _tool_conf_entry_for(tool_paths)
all_tool_paths = list(tool_paths) + list(kwds.get("extra_tools", []))
tool_definition = _tool_conf_entry_for(all_tool_paths)
empty_tool_conf = config_join("empty_tool_conf.xml")

tool_conf = config_join("tool_conf.xml")
Expand Down
15 changes: 15 additions & 0 deletions planemo/options.py
Expand Up @@ -38,6 +38,20 @@ def test_data_option():
)


def extra_tools_option():
return planemo_option(
"--extra_tools",
type=click.Path(exists=True,
file_okay=True,
dir_okay=True,
resolve_path=True),
multiple=True,
help=("Extra tool sources to include in Galaxy's tool panel (file or "
"directory). These will not be linted/tested/etc... but they "
"will be available to workflows and for interactive use.")
)


def tool_data_table_option():
return planemo_option(
"--tool_data_table",
Expand Down Expand Up @@ -766,6 +780,7 @@ def galaxy_serve_options():
return _compose(
galaxy_run_options(),
galaxy_config_options(),
extra_tools_option(),
daemon_option(),
pid_file_option(),
)
Expand Down
16 changes: 16 additions & 0 deletions tests/test_cmd_serve.py
Expand Up @@ -11,6 +11,7 @@
CliTestCase,
skip_if_environ,
TEST_REPOS_DIR,
PROJECT_TEMPLATES_DIR,
)

TEST_HISTORY_NAME = "Cool History 42"
Expand All @@ -37,6 +38,21 @@ def test_serve_daemon(self):
assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0
user_gi.histories.create_history(TEST_HISTORY_NAME)

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_serve_extra_tools(self):
port = network_util.get_free_port()
pid_file = os.path.join(self._home, "test.pid")
random_lines = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "randomlines.xml")
extra_args = ["--daemon", "--pid_file", pid_file, "--extra_tools", random_lines]
serve = functools.partial(self._run, port, extra_args)
self._launch_thread_and_wait(serve, port)
admin_gi = api.gi(port)
user_api_key = api.user_api_key(admin_gi)
user_gi = api.gi(port, user_api_key)
assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0
user_gi.histories.create_history(TEST_HISTORY_NAME)
assert user_gi.tools.get_tools(tool_id="random_lines1")

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_serve_profile(self):
port = network_util.get_free_port()
Expand Down

0 comments on commit 02a08a0

Please sign in to comment.