Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/commands/run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Planemo command for running tools and jobs.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/serve.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Galaxy instance.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/shed_serve.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ logged into and explored interactively.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/shed_test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ This command requires the target to be version 15.07 or newer.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ please careful and do not try this against production Galaxy instances.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/tool_factory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ http://www.ncbi.nlm.nih.gov/pubmed/23024011.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/training_generate_from_wf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Create tutorial skeleton from workflow.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/training_init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Build training template from workflow.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/workflow_convert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Convert Format 2 workflow to a native Galaxy workflow.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
1 change: 0 additions & 1 deletion docs/commands/workflow_edit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Open a synchronized Galaxy workflow editor.
execute command with.
--galaxy_python_version [2|2.7|3|3.5|3.6|3.7|3.8]
Python version to start Galaxy under
--galaxy_database_seed PATH Preseeded Galaxy sqlite database to target.
--extra_tools PATH Extra tool sources to include in Galaxy's tool
panel (file or directory). These will not be
linted/tested/etc... but they will be
Expand Down
104 changes: 0 additions & 104 deletions planemo/galaxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,6 @@ class = StreamHandler
"wget -q https://codeload.github.com/galaxyproject/galaxy/tar.gz/"
)

DOWNLOADS_URL = ("https://raw.githubusercontent.com/"
"jmchilton/galaxy-downloads/master/")
DOWNLOADABLE_MIGRATION_VERSIONS = [141, 127, 120, 117]
MIGRATION_PER_VERSION = {
"dev": 145,
"master": 142,
"18.09": 142,
"18.05": 141,
"18.01": 140,
"17.09": 135,
"17.05": 134,
"17.01": 133,
}
OLDEST_SUPPORTED_VERSION = 127

DATABASE_LOCATION_TEMPLATE = "sqlite:///%s?isolation_level=IMMEDIATE"

COMMAND_STARTUP_COMMAND = "./scripts/common_startup.sh ${COMMON_STARTUP_ARGS}"
Expand Down Expand Up @@ -403,12 +388,6 @@ def config_join(*args):
database_location = config_join("galaxy.sqlite")
master_api_key = _get_master_api_key(kwds)
dependency_dir = os.path.join(config_directory, "deps")
preseeded_database = attempt_database_preseed(
ctx,
galaxy_root,
database_location,
**kwds
)
_ensure_directory(shed_tool_path)
port = _get_port(kwds)
template_args = dict(
Expand Down Expand Up @@ -483,10 +462,6 @@ def config_join(*args):
_build_test_env(properties, env)
env['GALAXY_TEST_SHED_TOOL_CONF'] = shed_tool_conf

# No need to download twice - would GALAXY_TEST_DATABASE_CONNECTION
# work?
if preseeded_database:
env["GALAXY_TEST_DB_TEMPLATE"] = os.path.abspath(database_location)
env["GALAXY_TEST_UPLOAD_ASYNC"] = "false"
env["GALAXY_TEST_LOGGING_CONFIG"] = config_join("logging.ini")
env["GALAXY_DEVELOPMENT_ENVIRONMENT"] = "1"
Expand Down Expand Up @@ -1003,84 +978,6 @@ def _database_connection(database_location, **kwds):
return database_connection


def attempt_database_preseed(
ctx, effective_galaxy_root, database_location, **kwds
):
"""If database location is unset, attempt to seed the database."""
if os.path.exists(database_location):
# Can't seed an existing database.
return False

if not _database_connection(database_location, **kwds).startswith("sqlite"):
# Not going to use an sqlite database, don't preseed.
return False

preseeded_database = True
galaxy_sqlite_database = kwds.get("galaxy_database_seed", None)
galaxy_branch = kwds.get("galaxy_branch", None)
try:
_download_database_template(
ctx,
effective_galaxy_root,
database_location,
galaxy_sqlite_database=galaxy_sqlite_database,
galaxy_branch=galaxy_branch
)
except Exception as e:
print(e)
# No network access - just roll forward from null.
preseeded_database = False
return preseeded_database


def _download_database_template(
ctx,
galaxy_root,
database_location,
galaxy_sqlite_database=None,
galaxy_branch=None,
):

if galaxy_sqlite_database is not None:
shutil.copyfile(galaxy_sqlite_database, database_location)
return True

download_migration = None
newest_migration = _newest_migration_version(galaxy_root, galaxy_branch)
for migration in DOWNLOADABLE_MIGRATION_VERSIONS:
if newest_migration >= migration:
download_migration = migration
break

if download_migration:
download_name = "db_gx_rev_0%d.sqlite" % download_migration
download_url = DOWNLOADS_URL + download_name
ctx.cache_download(download_url, database_location)
Comment thread
nsoranzo marked this conversation as resolved.
return True
else:
return False


def _newest_migration_version(galaxy_root, galaxy_branch):
versions_dir = galaxy_root and os.path.join(galaxy_root, "lib/galaxy/model/migrate/versions")
if versions_dir and os.path.exists(versions_dir):
version = max(map(_file_name_to_migration_version, os.listdir(versions_dir)))
elif galaxy_branch:
for branch in MIGRATION_PER_VERSION:
if branch in galaxy_branch:
version = MIGRATION_PER_VERSION[branch]
else:
version = OLDEST_SUPPORTED_VERSION
return version


def _file_name_to_migration_version(name):
try:
return int(name[0:4])
except ValueError:
return -1


def _find_galaxy_root(ctx, **kwds):
root_prop = "galaxy_root"
cwl = kwds.get("cwl", False)
Expand Down Expand Up @@ -1375,7 +1272,6 @@ def _ensure_directory(path):


__all__ = (
"attempt_database_preseed",
"DATABASE_LOCATION_TEMPLATE",
"galaxy_config",
)
6 changes: 1 addition & 5 deletions planemo/galaxy/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
OptionSource,
)
from planemo.database import create_database_source
from .config import (
attempt_database_preseed,
DATABASE_LOCATION_TEMPLATE,
)
from .config import DATABASE_LOCATION_TEMPLATE

PROFILE_OPTIONS_JSON_NAME = "planemo_profile_options.json"
ALREADY_EXISTS_EXCEPTION = "Cannot create profile with name [%s], directory [%s] already exists."
Expand Down Expand Up @@ -93,7 +90,6 @@ def _create_profile_local(ctx, profile_directory, profile_name, kwds):
database_connection = database_source.sqlalchemy_url(database_identifier)
else:
database_location = os.path.join(profile_directory, "galaxy.sqlite")
attempt_database_preseed(ctx, None, database_location, **kwds)
database_connection = DATABASE_LOCATION_TEMPLATE % database_location

return {
Expand Down
12 changes: 0 additions & 12 deletions planemo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,6 @@ def galaxy_root_option():
)


def galaxy_database_seed_option():
return planemo_option(
"--galaxy_database_seed",
default=None,
use_global_config=True,
use_env_var=True,
type=click.Path(exists=True, file_okay=True, resolve_path=True),
help="Preseeded Galaxy sqlite database to target.",
)


def galaxy_cwl_root_option():
return planemo_option(
"--cwl_galaxy_root",
Expand Down Expand Up @@ -1070,7 +1059,6 @@ def galaxy_target_options():
return _compose(
galaxy_root_option(),
galaxy_python_version(),
galaxy_database_seed_option(),
extra_tools_option(),
install_galaxy_option(),
galaxy_branch_option(),
Expand Down
1 change: 0 additions & 1 deletion tests/test_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
'file_path': None,
'galaxy_api_key': None,
'galaxy_branch': None,
'galaxy_database_seed': None,
'galaxy_email': 'planemo@galaxyproject.org',
'galaxy_root': None,
'galaxy_single_user': True,
Expand Down