Skip to content

Commit 02a08a0

Browse files
committed
Add --extra_tools option to serve.
Once Galaxy will be able to "serve" workflows - this will be useful for specifying the location of extra tools.
1 parent 0c67ad6 commit 02a08a0

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

planemo/galaxy/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ def config_join(*args):
171171
_ensure_directory(tool_dependency_dir)
172172

173173
shed_tool_conf = kwds.get("shed_tool_conf") or config_join("shed_tools_conf.xml")
174-
tool_definition = _tool_conf_entry_for(tool_paths)
174+
all_tool_paths = list(tool_paths) + list(kwds.get("extra_tools", []))
175+
tool_definition = _tool_conf_entry_for(all_tool_paths)
175176
empty_tool_conf = config_join("empty_tool_conf.xml")
176177

177178
tool_conf = config_join("tool_conf.xml")

planemo/options.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ def test_data_option():
3838
)
3939

4040

41+
def extra_tools_option():
42+
return planemo_option(
43+
"--extra_tools",
44+
type=click.Path(exists=True,
45+
file_okay=True,
46+
dir_okay=True,
47+
resolve_path=True),
48+
multiple=True,
49+
help=("Extra tool sources to include in Galaxy's tool panel (file or "
50+
"directory). These will not be linted/tested/etc... but they "
51+
"will be available to workflows and for interactive use.")
52+
)
53+
54+
4155
def tool_data_table_option():
4256
return planemo_option(
4357
"--tool_data_table",
@@ -766,6 +780,7 @@ def galaxy_serve_options():
766780
return _compose(
767781
galaxy_run_options(),
768782
galaxy_config_options(),
783+
extra_tools_option(),
769784
daemon_option(),
770785
pid_file_option(),
771786
)

tests/test_cmd_serve.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
CliTestCase,
1212
skip_if_environ,
1313
TEST_REPOS_DIR,
14+
PROJECT_TEMPLATES_DIR,
1415
)
1516

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

41+
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
42+
def test_serve_extra_tools(self):
43+
port = network_util.get_free_port()
44+
pid_file = os.path.join(self._home, "test.pid")
45+
random_lines = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "randomlines.xml")
46+
extra_args = ["--daemon", "--pid_file", pid_file, "--extra_tools", random_lines]
47+
serve = functools.partial(self._run, port, extra_args)
48+
self._launch_thread_and_wait(serve, port)
49+
admin_gi = api.gi(port)
50+
user_api_key = api.user_api_key(admin_gi)
51+
user_gi = api.gi(port, user_api_key)
52+
assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0
53+
user_gi.histories.create_history(TEST_HISTORY_NAME)
54+
assert user_gi.tools.get_tools(tool_id="random_lines1")
55+
4056
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
4157
def test_serve_profile(self):
4258
port = network_util.get_free_port()

0 commit comments

Comments
 (0)