Skip to content

Commit a05cade

Browse files
committed
WIP: Planemo workflow edit.
1 parent 1e1cfa4 commit a05cade

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Module describing the planemo ``workflow_edit`` command."""
2+
import json
3+
import os
4+
5+
import click
6+
7+
from planemo import options
8+
from planemo.cli import command_function
9+
from planemo.config import planemo_option
10+
from planemo.engine import (
11+
engine_context,
12+
is_galaxy_engine,
13+
)
14+
from planemo.io import write_file
15+
from planemo.runnable import (
16+
for_path,
17+
)
18+
19+
20+
@click.command('workflow_edit')
21+
@options.required_workflow_arg()
22+
@options.galaxy_serve_options()
23+
@command_function
24+
def cli(ctx, workflow_path, output=None, force=False, **kwds):
25+
"""Open a synchronized Galaxy workflow editor.
26+
"""
27+
assert is_galaxy_engine(**kwds)
28+
29+
kwds["workflows_from_path"] = True
30+
31+
runnable = for_path(workflow_path)
32+
with engine_context(ctx, **kwds) as galaxy_engine:
33+
with galaxy_engine.serve_runnables([runnable]) as config:
34+
workflow_id = config.workflow_id(workflow_path)
35+
url = "%s/workflow/editor?id=%s" % (config.galaxy_url, workflow_id)
36+
click.launch(path)

planemo/galaxy/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,10 @@ def _install_workflow(self, runnable):
752752
if self._kwds["shed_install"]:
753753
install_shed_repos(runnable, self.gi, self._kwds.get("ignore_dependency_problems", False))
754754

755+
default_from_path = kwds.get("workflows_from_path", False)
755756
# TODO: Allow serialization so this doesn't need to assume a
756757
# shared filesystem with Galaxy server.
757-
from_path = runnable.type.name == "cwl_workflow"
758+
from_path = default_from_path or (runnable.type.name == "cwl_workflow")
758759
workflow = import_workflow(
759760
runnable.path, admin_gi=self.gi, user_gi=self.user_gi, from_path=from_path
760761
)

0 commit comments

Comments
 (0)