Skip to content

Commit 1c6cfbb

Browse files
committed
Use ephemeris to handle shed tools for workflows.
1 parent 72f6740 commit 1c6cfbb

File tree

8 files changed

+54
-1
lines changed

8 files changed

+54
-1
lines changed

planemo/commands/cmd_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def cli(ctx, paths, **kwds):
6464
against that same Galaxy root - but this may not be bullet proof yet so
6565
please careful and do not try this against production Galaxy instances.
6666
"""
67-
kwds["for_tests"] = True
6867
runnables = for_paths(paths)
6968
enable_beta_test = any([r.type not in [RunnableType.galaxy_tool, RunnableType.directory] for r in runnables])
7069
enable_beta_test = enable_beta_test or not is_galaxy_engine(**kwds)
@@ -74,6 +73,7 @@ def cli(ctx, paths, **kwds):
7473
test_data = engine.test(runnables)
7574
return_value = handle_reports_and_summary(ctx, test_data.structured_data, kwds=kwds)
7675
else:
76+
kwds["for_tests"] = True
7777
with galaxy_config(ctx, runnables, **kwds) as config:
7878
return_value = run_in_config(ctx, config, **kwds)
7979

planemo/galaxy/activity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def _execute(config, runnable, job_path, **kwds):
8181
history_id=history_id,
8282
inputs=job_dict,
8383
inputs_by="name",
84+
allow_tool_state_corrections=True,
8485
)
8586
invocations_url = "%s/%s/invocations" % (
8687
user_gi._make_url(user_gi.workflows),

planemo/galaxy/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
)
3030
from .workflows import (
3131
import_workflow,
32+
install_shed_repos,
3233
)
3334
from planemo.conda import build_conda_context
3435
from planemo.docker import docker_host_args
@@ -610,6 +611,7 @@ def install_workflows(self):
610611
self._install_workflow(runnable.path)
611612

612613
def _install_workflow(self, path):
614+
install_shed_repos(path, self.gi)
613615
workflow = import_workflow(path, admin_gi=self.gi, user_gi=self.user_gi)
614616
self._workflow_ids[path] = workflow["id"]
615617

planemo/galaxy/workflows.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,32 @@
1212
BioBlendImporterGalaxyInterface = None
1313
ImporterGalaxyInterface = object
1414

15+
try:
16+
from ephemeris import shed_install
17+
except ImportError:
18+
shed_install = None
19+
1520
import yaml
1621

1722

23+
def load_shed_repos(path):
24+
# TODO: This is crap - doesn't have nested repositories at all.
25+
if path.endswith(".ga"):
26+
with open(path, "r") as f:
27+
workflow = json.load(f)
28+
else:
29+
with open(path, "r") as f:
30+
workflow = yaml.load(f)
31+
32+
return workflow.get("tools", [])
33+
34+
35+
def install_shed_repos(path, admin_gi):
36+
tools_info = load_shed_repos(path)
37+
if tools_info:
38+
shed_install.install_tools(tools_info, admin_gi, path, default_install_tool_dependencies=False)
39+
40+
1841
def import_workflow(path, admin_gi, user_gi):
1942
"""Import a workflow path to specified Galaxy instance."""
2043
importer = BioBlendImporterGalaxyInterface(

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ jinja2
88
glob2
99
virtualenv
1010
gxformat2
11+
ephemeris
1112
galaxy-lib>=16.7.9
1213
cwltool>=1.0.20160511162129 ; python_version == '2.7'

tests/data/hello_sed_cut.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello!

tests/data/shed-wf2.gxwf-test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- doc: Simple test replacing some text.
2+
job:
3+
input1:
4+
class: File
5+
path: hello.txt
6+
outputs:
7+
wf_output_1:
8+
checksum: "sha1$a8d191538209e335154750d2df575b9ddfb16fc7"

tests/data/shed-wf2.gxwf.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class: GalaxyWorkflow
2+
name: "Test Workflow Shed Stuffs"
3+
tools:
4+
- name: text_processing
5+
owner: bgruening
6+
inputs:
7+
- id: input1
8+
outputs:
9+
- id: wf_output_1
10+
source: sed#output
11+
steps:
12+
- tool_id: tp_sed_tool
13+
label: sed
14+
state:
15+
infile:
16+
$link: input1
17+
code: "s/ World//g"

0 commit comments

Comments
 (0)