Skip to content
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

Update Gravity version to 1.0.0 pre-release #15017

Merged
merged 7 commits into from
Dec 7, 2022
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
165 changes: 158 additions & 7 deletions lib/galaxy/config/sample/galaxy.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,55 @@
# ``uwsgi:`` section will be ignored if Galaxy is started via Gravity commands (e.g ``./run.sh``, ``galaxy`` or ``galaxyctl``).
gravity:

# Process manager to use.
# ``supervisor`` is the default process manager when Gravity is invoked as a non-root user.
# ``systemd`` is the default when Gravity is invoked as root.
# Valid options are: supervisor, systemd
# process_manager:

# What command to write to the process manager configs
# `gravity` (`galaxyctl exec <service-name>`) is the default
# `direct` (each service's actual command) is also supported.
# Valid options are: gravity, direct
# service_command_style: gravity

# Use the process manager's *service instance* functionality for services that can run multiple instances.
# Presently this includes services like gunicorn and Galaxy dynamic job handlers. Service instances are only supported if
# ``service_command_style`` is ``gravity``, and so this option is automatically set to ``false`` if
# ``service_command_style`` is set to ``direct``.
# use_service_instances: true

# umask under which services should be executed. Setting ``umask`` on an individual service overrides this value.
# umask: '022'

# Memory limit (in GB), processes exceeding the limit will be killed. Default is no limit. If set, this is default value
# for all services. Setting ``memory_limit`` on an individual service overrides this value. Ignored if ``process_manager``
# is ``supervisor``.
# memory_limit:

# Specify Galaxy config file (galaxy.yml), if the Gravity config is separate from the Galaxy config. Assumed to be the
# same file as the Gravity config if a ``galaxy`` key exists at the root level, otherwise, this option is required.
# galaxy_config_file:

# Specify Galaxy's root directory.
# Gravity will attempt to find the root directory, but you can set the directory explicitly with this option.
# galaxy_root:

# User to run Galaxy as, required when using the systemd process manager as root.
# Ignored if ``process_manager`` is ``supervisor`` or user-mode (non-root) ``systemd``.
# galaxy_user:

# Group to run Galaxy as, optional when using the systemd process manager as root.
# Ignored if ``process_manager`` is ``supervisor`` or user-mode (non-root) ``systemd``.
# galaxy_group:

# Set to a directory that should contain log files for the processes controlled by Gravity.
# If not specified defaults to ``<state_dir>/log``.
# If not specified defaults to ``<galaxy_data_dir>/gravity/log``.
# log_dir:

# Set to Galaxy's virtualenv directory.
# If not specified, Gravity assumes all processes are on PATH.
# If not specified, Gravity assumes all processes are on PATH. This option is required in most circumstances when using
# the ``systemd`` process manager.
# virtualenv:

# Select the application server.
Expand All @@ -43,7 +82,7 @@ gravity:
# this is hidden from you when running a single instance.
# instance_name: _default_

# Configuration for Gunicorn.
# Configuration for Gunicorn. Can be a list to run multiple gunicorns for rolling restarts.
gunicorn:

# Enable Galaxy gunicorn server.
Expand All @@ -70,6 +109,23 @@ gravity:
# Consumes less memory when multiple processes are configured. Default is ``false`` if using unicornherder, else ``true``.
# preload:

# umask under which service should be executed
# umask:

# Value of supervisor startsecs, systemd TimeoutStartSec
# start_timeout: 15

# Value of supervisor stopwaitsecs, systemd TimeoutStopSec
# stop_timeout: 65

# Amount of time to wait for a server to become alive when performing rolling restarts.
# restart_timeout: 300

# Memory limit (in GB). If the service exceeds the limit, it will be killed. Default is no limit or the value of the
# ``memory_limit`` setting at the top level of the Gravity configuration, if set. Ignored if ``process_manager`` is
# ``supervisor``.
# memory_limit:

# Extra environment variables and their values to set when running the service. A dictionary where keys are the variable
# names.
# environment: {}
Expand Down Expand Up @@ -100,6 +156,20 @@ gravity:
# Extra arguments to pass to Celery command line.
# extra_args:

# umask under which service should be executed
# umask:

# Value of supervisor startsecs, systemd TimeoutStartSec
# start_timeout: 10

# Value of supervisor stopwaitsecs, systemd TimeoutStopSec
# stop_timeout: 10

# Memory limit (in GB). If the service exceeds the limit, it will be killed. Default is no limit or the value of the
# ``memory_limit`` setting at the top level of the Gravity configuration, if set. Ignored if ``process_manager`` is
# ``supervisor``.
# memory_limit:

# Extra environment variables and their values to set when running the service. A dictionary where keys are the variable
# names.
# environment: {}
Expand All @@ -117,7 +187,8 @@ gravity:
# port: 4002

# Routes file to monitor.
# Should be set to the same path as ``interactivetools_map`` in the ``galaxy:`` section.
# Should be set to the same path as ``interactivetools_map`` in the ``galaxy:`` section. This is ignored if
# ``interactivetools_map is set``.
# sessions: database/interactivetools_map.sqlite

# Include verbose messages in gx-it-proxy
Expand All @@ -135,6 +206,20 @@ gravity:
# This is an advanced option that is only needed when proxying to remote interactive tool container that cannot be reached through the local network.
# reverse_proxy: false

# umask under which service should be executed
# umask:

# Value of supervisor startsecs, systemd TimeoutStartSec
# start_timeout: 10

# Value of supervisor stopwaitsecs, systemd TimeoutStopSec
# stop_timeout: 10

# Memory limit (in GB). If the service exceeds the limit, it will be killed. Default is no limit or the value of the
# ``memory_limit`` setting at the top level of the Gravity configuration, if set. Ignored if ``process_manager`` is
# ``supervisor``.
# memory_limit:

# Extra environment variables and their values to set when running the service. A dictionary where keys are the variable
# names.
# environment: {}
Expand All @@ -161,20 +246,86 @@ gravity:
# upload_dir:

# Comma-separated string of enabled tusd hooks.
#
#
# Leave at the default value to require authorization at upload creation time.
# This means Galaxy's web process does not need to be running after creating the initial
# upload request.
#
#
# Set to empty string to disable all authorization. This means data can be uploaded (but not processed)
# without the Galaxy web process being available.
#
#
# You can find a list of available hooks at https://github.com/tus/tusd/blob/master/docs/hooks.md#list-of-available-hooks.
# hooks_enabled_events: pre-create

# Extra arguments to pass to tusd command line.
# extra_args:

# umask under which service should be executed
# umask:

# Value of supervisor startsecs, systemd TimeoutStartSec
# start_timeout: 10

# Value of supervisor stopwaitsecs, systemd TimeoutStopSec
# stop_timeout: 10

# Memory limit (in GB). If the service exceeds the limit, it will be killed. Default is no limit or the value of the
# ``memory_limit`` setting at the top level of the Gravity configuration, if set. Ignored if ``process_manager`` is
# ``supervisor``.
# memory_limit:

# Extra environment variables and their values to set when running the service. A dictionary where keys are the variable
# names.
# environment: {}

# Configuration for Galaxy Reports.
reports:

# Enable Galaxy Reports server.
# enable: false

# Path to reports.yml, relative to galaxy.yml if not absolute
# config_file: reports.yml

# The socket to bind. A string of the form: ``HOST``, ``HOST:PORT``, ``unix:PATH``, ``fd://FD``. An IP is a valid HOST.
# bind: localhost:9001

# Controls the number of Galaxy Reports application processes Gunicorn will spawn.
# It is not generally necessary to increase this for the low-traffic Reports server.
# workers: 1

# Gunicorn workers silent for more than this many seconds are killed and restarted.
# Value is a positive number or 0. Setting it to 0 has the effect of infinite timeouts by disabling timeouts for all workers entirely.
# timeout: 300

# URL prefix to serve from.
# The corresponding nginx configuration is (replace <url_prefix> and <bind> with the values from these options):
#
# location /<url_prefix>/ {
# proxy_pass http://<bind>/;
# }
#
# If <bind> is a unix socket, you will need a ``:`` after the socket path but before the trailing slash like so:
# proxy_pass http://unix:/run/reports.sock:/;
# url_prefix:

# Extra arguments to pass to Gunicorn command line.
# extra_args:

# umask under which service should be executed
# umask:

# Value of supervisor startsecs, systemd TimeoutStartSec
# start_timeout: 10

# Value of supervisor stopwaitsecs, systemd TimeoutStopSec
# stop_timeout: 10

# Memory limit (in GB). If the service exceeds the limit, it will be killed. Default is no limit or the value of the
# ``memory_limit`` setting at the top level of the Gravity configuration, if set. Ignored if ``process_manager`` is
# ``supervisor``.
# memory_limit:

# Extra environment variables and their values to set when running the service. A dictionary where keys are the variable
# names.
# environment: {}
Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy/config/sample/job_conf.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,15 @@ handling:
# most of them). If unset, the default is any untagged handlers plus any handlers in the `job-handlers` (no tag) pool.
#default: handler0

# Static handler configurations - Configuring these is generally not desirable, fully dynamic handlers are preferable
# unless you need to control plugin loading on a per-handler basis. See the scaling documentation linked above for
# instructions on configuring dynamic handlers.

processes:
handler0:
# Set environment variables that only apply to this handler
#environment:
# FOO: foo
handler1:
sge_handler:
# Restrict a handler to load specific runners, by default they will load all.
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/dependencies/pinned-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ funcsigs==1.0.2 ; python_version >= "3.7" and python_version < "3.11"
future==0.18.2 ; python_version >= "3.7" and python_version < "3.11"
galaxy-sequence-utils==1.1.5 ; python_version >= "3.7" and python_version < "3.11"
galaxy2cwl==0.1.4 ; python_version >= "3.7" and python_version < "3.11"
gravity==0.13.5 ; python_version >= "3.7" and python_version < "3.11"
gravity @ git+https://github.com/galaxyproject/gravity.git@release_1.x ; python_version >= "3.7" and python_version < "3.11"
greenlet==2.0.1 ; python_version >= "3.7" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version < "3.11"
gunicorn==20.1.0 ; python_version >= "3.7" and python_version < "3.11"
gxformat2==0.16.0 ; python_version >= "3.7" and python_version < "3.11"
Expand Down
10 changes: 5 additions & 5 deletions lib/galaxy_test/driver/driver_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,10 @@ def launch_gravity(port, gxit_port=None, galaxy_config=None):
galaxy_config["interactivetools_proxy_host"] = f"localhost:{gxit_port}"
# Can't use in-memory celery broker, just fall back to sqlalchemy
galaxy_config.update({"celery_conf": {"broker_url": None}})
state_dir = tempfile.mkdtemp(suffix="state")
config = {
"gravity": {
"log_dir": os.path.join(state_dir, "log"),
"gunicorn": {"bind": f"localhost:{port}", "preload": "false"},
"gx_it_proxy": {
"enable": galaxy_config.get("interactivetools_enable", False),
Expand All @@ -755,18 +757,16 @@ def launch_gravity(port, gxit_port=None, galaxy_config=None):
},
"galaxy": galaxy_config,
}
state_dir = tempfile.mkdtemp(suffix="state")
with tempfile.NamedTemporaryFile("w", dir=state_dir, delete=False, suffix=".galaxy.yml") as config_fh:
json.dump(config, config_fh)
with tempfile.NamedTemporaryFile(delete=True) as socket:
supervisord_socket = socket.name
gravity_env = os.environ.copy()
gravity_env["SUPERVISORD_SOCKET"] = supervisord_socket
subprocess.check_output(["galaxyctl", "--state-dir", state_dir, "register", config_fh.name], env=gravity_env)
subprocess.check_output(["galaxyctl", "--state-dir", state_dir, "update"], env=gravity_env)
subprocess.check_output(["galaxyctl", "--state-dir", state_dir, "start"], env=gravity_env)
subprocess.check_output(["galaxyctl", "--config-file", config_fh.name, "update"], env=gravity_env)
subprocess.check_output(["galaxyctl", "--config-file", config_fh.name, "start"], env=gravity_env)
return state_dir, lambda: subprocess.check_output(
["galaxyctl", "--state-dir", state_dir, "shutdown"], env=gravity_env
["galaxyctl", "--config-file", config_fh.name, "shutdown"], env=gravity_env
)


Expand Down
1 change: 0 additions & 1 deletion scripts/common_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ if [ $SET_VENV -eq 1 ] && [ $CREATE_VENV -eq 1 ]; then
fi
fi
fi
setup_gravity_state_dir
fi

# activate virtualenv or conda env, sets $GALAXY_VIRTUAL_ENV and $GALAXY_CONDA_ENV
Expand Down
11 changes: 0 additions & 11 deletions scripts/common_startup_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,6 @@ setup_python() {
"$GALAXY_PYTHON" ./scripts/check_python.py || exit 1
}

setup_gravity_state_dir() {
# $GALAXY_VIRTUAL_ENV is expected to be set, and cwd must be galaxy root
if ! grep -q '^GRAVITY_STATE_DIR=' "${GALAXY_VIRTUAL_ENV}/bin/activate"; then
echo "Setting \$GRAVITY_STATE_DIR in ${GALAXY_VIRTUAL_ENV}/bin/activate"
echo '' >> "${GALAXY_VIRTUAL_ENV}/bin/activate"
echo '# Galaxy Gravity per-instance state directory configured by Galaxy common_startup.sh' >> "${GALAXY_VIRTUAL_ENV}/bin/activate"
echo "GRAVITY_STATE_DIR=\${GRAVITY_STATE_DIR:-'$(pwd)/database/gravity'}" >> "${GALAXY_VIRTUAL_ENV}/bin/activate"
echo 'export GRAVITY_STATE_DIR' >> "${GALAXY_VIRTUAL_ENV}/bin/activate"
fi
}

set_galaxy_config_file_var() {
if [ -z "$GALAXY_CONFIG_FILE" ]; then
GALAXY_CONFIG_FILE=$(PYTHONPATH=lib python -c "from __future__ import print_function; from galaxy.util.properties import find_config_file; print(find_config_file(['galaxy', 'universe_wsgi']) or '')")
Expand Down