Permalink
Browse files

Refactor galaxy modules ....

 - planemo.galaxy_test -> planemo.galaxy.test
 - planemo.galaxy_config -> planemo.galaxy.config
 - planemo.galaxy_run -> planemo.galaxy.run
 - planemo.galaxy_serve -> planemo.galaxy.serve
  • Loading branch information...
jmchilton committed Apr 11, 2016
1 parent 2cf30e3 commit 8e968643f9bf965e5fb81a5933f1b1f64126b9d7
@@ -0,0 +1,53 @@
planemo.galaxy package
======================

Subpackages
-----------

.. toctree::

planemo.galaxy.test

Submodules
----------

planemo.galaxy.config module
----------------------------

.. automodule:: planemo.galaxy.config
:members:
:undoc-members:
:show-inheritance:

planemo.galaxy.profiles module
------------------------------

.. automodule:: planemo.galaxy.profiles
:members:
:undoc-members:
:show-inheritance:

planemo.galaxy.run module
-------------------------

.. automodule:: planemo.galaxy.run
:members:
:undoc-members:
:show-inheritance:

planemo.galaxy.serve module
---------------------------

.. automodule:: planemo.galaxy.serve
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: planemo.galaxy
:members:
:undoc-members:
:show-inheritance:
@@ -1,21 +1,21 @@
planemo.galaxy_test package
planemo.galaxy.test package
===========================

Submodules
----------

planemo.galaxy_test.actions module
planemo.galaxy.test.actions module
----------------------------------

.. automodule:: planemo.galaxy_test.actions
.. automodule:: planemo.galaxy.test.actions
:members:
:undoc-members:
:show-inheritance:

planemo.galaxy_test.structures module
planemo.galaxy.test.structures module
-------------------------------------

.. automodule:: planemo.galaxy_test.structures
.. automodule:: planemo.galaxy.test.structures
:members:
:undoc-members:
:show-inheritance:
@@ -24,7 +24,7 @@ planemo.galaxy_test.structures module
Module contents
---------------

.. automodule:: planemo.galaxy_test
.. automodule:: planemo.galaxy.test
:members:
:undoc-members:
:show-inheritance:
@@ -8,7 +8,7 @@ Subpackages

planemo.commands
planemo.cwl
planemo.galaxy_test
planemo.galaxy
planemo.linters
planemo.reports
planemo.shed
@@ -58,30 +58,6 @@ planemo.exit_codes module
:undoc-members:
:show-inheritance:

planemo.galaxy_config module
----------------------------

.. automodule:: planemo.galaxy_config
:members:
:undoc-members:
:show-inheritance:

planemo.galaxy_run module
-------------------------

.. automodule:: planemo.galaxy_run
:members:
:undoc-members:
:show-inheritance:

planemo.galaxy_serve module
---------------------------

.. automodule:: planemo.galaxy_serve
:members:
:undoc-members:
:show-inheritance:

planemo.git module
------------------

@@ -1,7 +1,7 @@
import click

from planemo.cli import pass_context
from planemo import galaxy_serve
from planemo.galaxy import galaxy_serve
from planemo import options


@@ -34,4 +34,4 @@ def cli(ctx, paths, **kwds):
proof yet so please careful and do not try this against production Galaxy
instances.
"""
galaxy_serve.serve(ctx, paths, **kwds)
galaxy_serve(ctx, paths, **kwds)
@@ -5,7 +5,7 @@

from planemo.cli import pass_context
from planemo import options
from planemo import galaxy_serve
from planemo.galaxy import shed_serve
from planemo import shed
from planemo import io

@@ -29,7 +29,7 @@ def cli(ctx, paths, **kwds):
logged into and explored interactively.
"""
install_args_list = shed.install_arg_lists(ctx, paths, **kwds)
with galaxy_serve.shed_serve(ctx, install_args_list, **kwds) as config:
with shed_serve(ctx, install_args_list, **kwds) as config:
gx_url = "http://localhost:%d/" % config.port
io.info("Galaxy running with tools installed at %s" % gx_url)
time.sleep(1000000)
@@ -7,9 +7,9 @@

from planemo.cli import pass_context
from planemo import options
from planemo import galaxy_serve
from planemo.galaxy.serve import shed_serve
from planemo import shed
from planemo import galaxy_test
from planemo.galaxy.test import run_in_config


@click.command("shed_test")
@@ -36,9 +36,9 @@ def cli(ctx, paths, **kwds):
port = get_free_port()
kwds["port"] = port
return_code = 1
with galaxy_serve.shed_serve(ctx, install_args_list, **kwds) as config:
with shed_serve(ctx, install_args_list, **kwds) as config:
config.kill()
return_code = galaxy_test.run_in_config(
return_code = run_in_config(
ctx,
config,
installed=True,
@@ -4,9 +4,9 @@

from planemo.cli import pass_context
from planemo import options
from planemo import galaxy_config
from planemo.galaxy import galaxy_config

from planemo.galaxy_test import (
from planemo.galaxy.test import (
run_in_config,
)

@@ -55,7 +55,7 @@ def cli(ctx, paths, **kwds):
please careful and do not try this against production Galaxy instances.
"""
kwds["for_tests"] = True
with galaxy_config.galaxy_config(ctx, paths, **kwds) as config:
with galaxy_config(ctx, paths, **kwds) as config:
return_value = run_in_config(ctx, config, **kwds)
if return_value:
sys.exit(return_value)
@@ -5,7 +5,7 @@
from planemo.cli import pass_context
from planemo import io
from planemo import options
from planemo.galaxy_test import StructuredData, handle_reports
from planemo.galaxy.test import StructuredData, handle_reports


@click.command('test_reports')
@@ -3,7 +3,7 @@
import click
from planemo.cli import pass_context
from planemo import options
from planemo import galaxy_serve
from planemo.galaxy import serve


@click.command('tool_factory')
@@ -19,4 +19,4 @@ def cli(ctx, **kwds):
"""
mod_dir = os.path.dirname(__file__)
tf_dir = os.path.join(mod_dir, '..', '..', 'planemo_ext', 'tool_factory_2')
galaxy_serve.serve(ctx, [os.path.abspath(tf_dir)], **kwds)
serve(ctx, [os.path.abspath(tf_dir)], **kwds)
@@ -1,6 +1,7 @@
""" Planemo specific utilities for dealing with conda, extending Galaxy's
features with planemo specific idioms.
"""
from __future__ import absolute_import

from galaxy.tools.deps import conda_util
from planemo.io import shell
@@ -1,5 +1,5 @@
from planemo.io import conditionally_captured_io
from planemo import galaxy_serve
from planemo.galaxy.serve import serve_daemon
from .client import run_cwl_tool
from planemo import io

@@ -15,7 +15,7 @@ def run_galaxy(ctx, path, job_path, **kwds):
kwds["cwl"] = True
conformance_test = kwds.get("conformance_test", False)
with conditionally_captured_io(conformance_test):
with galaxy_serve.serve_daemon(ctx, [path], **kwds) as config:
with serve_daemon(ctx, [path], **kwds) as config:
try:
cwl_run = run_cwl_tool(path, job_path, config, **kwds)
except Exception:
@@ -0,0 +1,19 @@
"""Entry-point for Galaxy specific functionality in Planemo."""

from __future__ import absolute_import

from .config import galaxy_config
from .run import (
setup_venv,
run_galaxy_command,
)
from .serve import shed_serve
from .serve import serve as galaxy_serve

__all__ = [
"galaxy_config",
"setup_venv",
"run_galaxy_command",
"galaxy_serve",
"shed_serve",
]
@@ -13,7 +13,11 @@

import click

from planemo import galaxy_run
from .run import (
setup_common_startup_args,
setup_venv,
DOWNLOAD_GALAXY,
)
from planemo.conda import build_conda_context
from planemo.io import warn
from planemo.io import shell
@@ -547,7 +551,7 @@ def _install_galaxy(ctx, config_directory, env, kwds):
def _install_galaxy_via_download(ctx, config_directory, env, kwds):
branch = _galaxy_branch(kwds)
tar_cmd = "tar -zxvf %s" % branch
command = galaxy_run.DOWNLOAD_GALAXY + "; %s | tail" % tar_cmd
command = DOWNLOAD_GALAXY + "; %s | tail" % tar_cmd
_install_with_command(ctx, config_directory, command, env, kwds)


@@ -599,14 +603,14 @@ def _install_with_command(ctx, config_directory, command, env, kwds):
pip_install_command = PIP_INSTALL_CMD % " ".join(pip_installs)
else:
pip_install_command = ""
setup_venv_command = galaxy_run.setup_venv(ctx, kwds)
setup_venv_command = setup_venv(ctx, kwds)
install_cmd = shell_join(
"cd %s" % config_directory,
command,
"cd galaxy-dev",
setup_venv_command,
pip_install_command,
galaxy_run.setup_common_startup_args(),
setup_common_startup_args(),
COMMAND_STARTUP_COMMAND,
)
shell(install_cmd, env=env)
@@ -97,3 +97,10 @@ def run_galaxy_command(ctx, command, env, action, daemon=False):
ctx.vlog('%s="%s"' % (key, value))
ctx.vlog("============================")
return shell(command, env=env)

__all__ = [
"setup_venv",
"run_galaxy_command",
"DOWNLOAD_GALAXY",
"setup_common_startup_args",
]
@@ -1,8 +1,11 @@
import contextlib
import os

from planemo import galaxy_config
from planemo import galaxy_run
from .config import galaxy_config
from .run import (
setup_venv,
run_galaxy_command,
)
from planemo import io


@@ -15,9 +18,9 @@ def serve(ctx, paths, **kwds):
if daemon:
kwds["no_cleanup"] = True

with galaxy_config.galaxy_config(ctx, paths, **kwds) as config:
with galaxy_config(ctx, paths, **kwds) as config:
# TODO: Allow running dockerized Galaxy here instead.
setup_venv_command = galaxy_run.setup_venv(ctx, kwds)
setup_venv_command = setup_venv(ctx, kwds)
run_script = os.path.join(config.galaxy_root, "run.sh")
run_script += " $COMMON_STARTUP_ARGS"
if daemon:
@@ -34,7 +37,7 @@ def serve(ctx, paths, **kwds):
run_script,
)
action = "Starting galaxy"
galaxy_run.run_galaxy_command(
run_galaxy_command(
ctx,
cmd,
config.env,
@@ -4,7 +4,10 @@

from . import structures as test_structures
from planemo.io import info, warn, shell_join
from planemo import galaxy_run
from planemo.galaxy.run import (
run_galaxy_command,
setup_venv,
)
from planemo.reports import build_report


@@ -58,15 +61,15 @@ def run_in_config(ctx, config, **kwds):
'export COMMON_STARTUP_ARGS; '
'echo "Set COMMON_STARTUP_ARGS to ${COMMON_STARTUP_ARGS}"'
)
setup_venv_command = galaxy_run.setup_venv(ctx, kwds)
setup_venv_command = setup_venv(ctx, kwds)
cmd = shell_join(
cd_to_galaxy_command,
setup_common_startup_args,
setup_venv_command,
test_cmd,
)
action = "Testing tools"
return_code = galaxy_run.run_galaxy_command(
return_code = run_galaxy_command(
ctx,
cmd,
config.env,
@@ -1,6 +1,8 @@
""" Click definitions for various shared options and arguments.
"""

from __future__ import absolute_import

import functools
import os

Oops, something went wrong.

0 comments on commit 8e96864

Please sign in to comment.