-
Notifications
You must be signed in to change notification settings - Fork 101
Allow selection of python version when starting managed Galaxy #874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
fd0d1c0
9b56506
84d58bc
ec16ee7
bc5113d
f76e9d5
9cef47e
5675c8e
c784925
57578e3
37f8588
a402de1
a7824ee
f3ad9df
6e4d964
dbfec70
496ded7
d540aed
d99275b
fd1a9e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| from galaxy.containers.docker_model import DockerVolume | ||
| from galaxy.tools.deps import docker_util | ||
| from galaxy.tools.deps.commands import argv_to_str | ||
| from pkg_resources import parse_version | ||
| from six import ( | ||
| add_metaclass, | ||
| iteritems | ||
|
|
@@ -34,6 +35,7 @@ | |
| ) | ||
| from planemo.mulled import build_involucro_context | ||
| from planemo.shed import tool_shed_url | ||
| from planemo.virtualenv import DEFAULT_PYTHON_VERSION | ||
| from .api import ( | ||
| DEFAULT_MASTER_API_KEY, | ||
| gi, | ||
|
|
@@ -397,6 +399,10 @@ def config_join(*args): | |
| ) | ||
| _ensure_directory(shed_tool_path) | ||
| port = _get_port(kwds) | ||
| if not parse_version(kwds.get('galaxy_python_version', DEFAULT_PYTHON_VERSION)) < parse_version('3'): | ||
| # on python 3 we use gunicorn, | ||
| # which requires 'main' as server name | ||
| server_name = 'main' | ||
| template_args = dict( | ||
| port=port, | ||
| host=kwds.get("host", "127.0.0.1"), | ||
|
|
@@ -941,6 +947,14 @@ def startup_command(self, ctx, **kwds): | |
| run_script += " --server-name %s" % shlex_quote(self.server_name) | ||
| server_ini = os.path.join(self.config_directory, "galaxy.ini") | ||
| self.env["GALAXY_CONFIG_FILE"] = server_ini | ||
| if parse_version(kwds.get('galaxy_python_version', DEFAULT_PYTHON_VERSION)) >= parse_version('3'): | ||
| # We need to start under gunicorn | ||
| self.env['APP_WEBSERVER'] = 'gunicorn' | ||
| self.env['GUNICORN_CMD_ARGS'] = "--bind={host}:{port} --name={server_name}".format( | ||
| host=kwds['host'], | ||
| port=kwds['port'], | ||
| server_name=self.server_name, | ||
| ) | ||
| cd_to_galaxy_command = ['cd', self.galaxy_root] | ||
| return shell_join( | ||
| cd_to_galaxy_command, | ||
|
|
@@ -1240,6 +1254,7 @@ def _install_with_command(ctx, config_directory, command, env, kwds): | |
| else: | ||
| pip_install_command = "" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed that, since commit 9867e56, |
||
| setup_venv_command = setup_venv(ctx, kwds) | ||
| env['__PYVENV_LAUNCHER__'] = '' | ||
|
nsoranzo marked this conversation as resolved.
|
||
| install_cmd = shell_join( | ||
| ['cd', config_directory], | ||
| command, | ||
|
|
@@ -1255,15 +1270,20 @@ def _install_with_command(ctx, config_directory, command, env, kwds): | |
| def _ensure_galaxy_repository_available(ctx, kwds): | ||
| workspace = ctx.workspace | ||
| cwl = kwds.get("cwl", False) | ||
| gx_repo = os.path.join(workspace, "gx_repo") | ||
| galaxy_source = kwds.get('galaxy_source') | ||
| if galaxy_source and galaxy_source != DEFAULT_GALAXY_SOURCE: | ||
| sanitized_repo_name = "".join(c if c.isalnum() else '_' for c in kwds['galaxy_source']).rstrip()[:255] | ||
| gx_repo = os.path.join(workspace, "gx_repo_%s" % sanitized_repo_name) | ||
| else: | ||
| gx_repo = os.path.join(workspace, "gx_repo") | ||
| if cwl: | ||
| gx_repo += "_cwl" | ||
| if os.path.exists(gx_repo): | ||
| # Attempt fetch - but don't fail if not interweb, etc... | ||
| shell("git --git-dir %s fetch >/dev/null 2>&1" % gx_repo) | ||
| shell("git --git-dir %s remote update >/dev/null 2>&1" % gx_repo) | ||
| else: | ||
| remote_repo = _galaxy_source(kwds) | ||
| command = git.command_clone(ctx, remote_repo, gx_repo, bare=True) | ||
| command = git.command_clone(ctx, remote_repo, gx_repo, mirror=True) | ||
| shell(command) | ||
| return gx_repo | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,6 +182,7 @@ def kill_pid_file(pid_file): | |
|
|
||
| pid = int(open(pid_file, "r").read()) | ||
| kill_posix(pid) | ||
| os.unlink(pid_file) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be in a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, thanks! |
||
|
|
||
|
|
||
| def kill_posix(pid): | ||
|
|
@@ -323,7 +324,7 @@ def path_startswith(p): | |
| norm_p = norm(p) | ||
| norm_exclude_path = norm(exclude_path) | ||
| if norm_p.startswith(norm_exclude_path): | ||
| return norm_p[len(norm_exclude_path):len(norm_exclude_path)+1] in ['', os.sep] | ||
| return norm_p[len(norm_exclude_path):len(norm_exclude_path) + 1] in ['', os.sep] | ||
| return False | ||
| return path_startswith | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.