-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement option to build mulled containers for tools: ``` planemo mull [/path/to/tools]* ``` Implement option to force tool serving and execution to occur in mulled containers. ``` planemo test --mulled_containers ``` This includes fixes for support or tools in Docker, something that has been around since the early days but seemingly broken the whole time. xref #583
- Loading branch information
Showing
6 changed files
with
143 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Module describing the planemo ``mull`` command.""" | ||
import click | ||
|
||
from galaxy.tools.deps.mulled.mulled_build import mull_targets | ||
from galaxy.tools.deps.mulled.util import build_target | ||
|
||
from planemo import options | ||
from planemo.cli import command_function | ||
from planemo.conda import collect_conda_target_lists | ||
from planemo.mulled import build_mull_target_kwds | ||
|
||
|
||
@click.command('mull') | ||
@options.optional_tools_arg(multiple=True) | ||
@options.recursive_option() | ||
@command_function | ||
def cli(ctx, paths, **kwds): | ||
"""Build containers for specified tools. | ||
Supplied tools will be inspected for referenced requirement packages. For | ||
each combination of requirements a "mulled" container will be built. Galaxy | ||
can automatically discover this container and subsequently use it to run | ||
or test the tool. | ||
For this to work, the tool's requirements will need to be present in a known | ||
Conda channel such as bioconda (https://github.com/bioconda/bioconda-recipes). | ||
This can be verified by running ``planemo lint --conda_requirements`` on the | ||
target tool(s). | ||
""" | ||
for conda_targets in collect_conda_target_lists(ctx, paths): | ||
mulled_targets = map(lambda c: build_target(c.package, c.version), conda_targets) | ||
mull_target_kwds = build_mull_target_kwds(ctx, **kwds) | ||
mull_targets(mulled_targets, command="build", **mull_target_kwds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Planemo specific utilities for dealing with mulled containers. | ||
The extend Galaxy/galaxy-lib's features with planemo specific idioms. | ||
""" | ||
from __future__ import absolute_import | ||
|
||
import os | ||
|
||
from galaxy.tools.deps.mulled.mulled_build import ( | ||
DEFAULT_CHANNELS, | ||
ensure_installed, | ||
InvolucroContext, | ||
) | ||
|
||
from planemo.io import shell | ||
|
||
|
||
def build_involucro_context(ctx, **kwds): | ||
"""Build a galaxy-lib CondaContext tailored to planemo use. | ||
Using planemo's common command-line/global config options. | ||
""" | ||
involucro_path_default = os.path.join(ctx.workspace, "involucro") | ||
involucro_path = kwds.get("involucro_path", involucro_path_default) | ||
use_planemo_shell = kwds.get("use_planemo_shell_exec", True) | ||
shell_exec = shell if use_planemo_shell else None | ||
involucro_context = InvolucroContext(involucro_bin=involucro_path, | ||
shell_exec=shell_exec) | ||
if not ensure_installed(involucro_context, True): | ||
raise Exception("Failed to install involucro for Planemo.") | ||
return involucro_context | ||
|
||
|
||
def build_mull_target_kwds(ctx, **kwds): | ||
"""Adapt Planemo's CLI and workspace configuration to galaxy-lib's mulled_build options.""" | ||
involucro_context = build_involucro_context(ctx, **kwds) | ||
channels = kwds.get("conda_ensure_channels", ",".join(DEFAULT_CHANNELS)) | ||
|
||
return { | ||
'involucro_context': involucro_context, | ||
'channels': channels.split(","), | ||
} | ||
|
||
__all__ = [ | ||
"build_involucro_context", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters