Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy package

Galaxy root package – this is a namespace package.

Subpackages

Submodules

galaxy.app module

class galaxy.app.HaltableContainer[source]

Bases: Container

__init__() None[source]
Parameters

container – Optional container if provided the existing definitions will be copied

:param log_undefined_deps indicates if a log message should be emmited when an undefined dep is loaded

haltables: List[Tuple[str, Callable]]
shutdown()[source]
class galaxy.app.SentryClientMixin[source]

Bases: object

configure_sentry_client()[source]
class galaxy.app.ConfiguresGalaxyMixin[source]

Bases: object

Shared code for configuring Galaxy-like app objects.

config: GalaxyAppConfiguration
tool_cache: ToolCache
job_config: JobConfiguration
toolbox: ToolBox
container_finder: ContainerFinder
wait_for_toolbox_reload(old_toolbox)[source]
property tool_dependency_dir
class galaxy.app.MinimalGalaxyApplication(fsmon=False, **kwargs)[source]

Bases: BasicSharedApp, ConfiguresGalaxyMixin, HaltableContainer, SentryClientMixin

Encapsulates the state of a minimal Galaxy application

__init__(fsmon=False, **kwargs) None[source]
Parameters

container – Optional container if provided the existing definitions will be copied

:param log_undefined_deps indicates if a log message should be emmited when an undefined dep is loaded

configure_fluent_log()[source]
application_stack: ApplicationStack
model: SharedModelMapping
security: IdEncodingHelper
auth_manager: AuthManager
toolbox: Any
security_agent: Any
quota_agent: QuotaAgent
class galaxy.app.GalaxyManagerApplication(configure_logging=True, use_converters=True, use_display_applications=True, **kwargs)[source]

Bases: MinimalManagerApp, MinimalGalaxyApplication

Extends the MinimalGalaxyApplication with most managers that are not tied to a web or job handling context.

__init__(configure_logging=True, use_converters=True, use_display_applications=True, **kwargs)[source]
Parameters

container – Optional container if provided the existing definitions will be copied

:param log_undefined_deps indicates if a log message should be emmited when an undefined dep is loaded

job_metrics: JobMetrics
job_config: JobConfiguration
user_manager: Any
hda_manager: Any
history_manager: Any
dataset_collection_manager: Any
workflow_manager: Any
workflow_contents_manager: Any
library_folder_manager: Any
library_manager: Any
role_manager: Any
job_manager: Any
file_sources: ConfiguredFileSources
installed_repository_manager: Any
genome_builds: GenomeBuilds
class galaxy.app.UniverseApplication(**kwargs)[source]

Bases: StructuredApp, GalaxyManagerApplication

Encapsulates the state of a Universe application

__init__(**kwargs) None[source]
Parameters

container – Optional container if provided the existing definitions will be copied

:param log_undefined_deps indicates if a log message should be emmited when an undefined dep is loaded

amqp_internal_connection_obj: Optional[Connection]
queue_worker: Any
dependency_resolvers_view: DependencyResolversView
test_data_resolver: TestDataResolver
dynamic_tool_manager: Any
api_keys_manager: Any
genomes: Any
data_provider_registry: Any
error_reports: Any
tool_cache: Any
watchers: Any
visualizations_registry: Any
webhooks_registry: WebhooksRegistry
workflow_scheduling_manager: Any
trs_proxy: TrsProxy
interactivetool_manager: Any
tool_shed_repository_cache: Optional[Any]
property is_job_handler: bool
is_webapp: bool
tag_handler: GalaxyTagHandler
file_sources: ConfiguredFileSources
genome_builds: GenomeBuilds
job_metrics: JobMetrics
model: GalaxyModelMapping
install_model: ModelMapping
security_agent: GalaxyRBACAgent
host_security_agent: HostAgent
vault: Vault
history_manager: Any
hda_manager: Any
workflow_manager: WorkflowsManager
workflow_contents_manager: Any
library_folder_manager: Any
library_manager: Any
role_manager: Any
tool_data_tables: ToolDataTableManager
installed_repository_manager: Any
job_config: JobConfiguration
job_manager: Any
user_manager: Any
class galaxy.app.StatsdStructuredExecutionTimer(galaxy_statsd_client, *args, **kwds)[source]

Bases: StructuredExecutionTimer

__init__(galaxy_statsd_client, *args, **kwds)[source]
to_str(**kwd)[source]
class galaxy.app.ExecutionTimerFactory(config)[source]

Bases: object

__init__(config)[source]
get_timer(*args, **kwd)[source]

galaxy.config_watchers module

class galaxy.config_watchers.ConfigWatchers(app: StructuredApp)[source]

Bases: object

Contains ToolConfWatcher, ToolWatcher and ToolDataWatcher objects.

__init__(app: StructuredApp)[source]
property watchers
change_state(active)[source]
start()[source]
shutdown()[source]
update_watch_data_table_paths()[source]
property data_manager_configs
property tool_data_paths
property tool_config_paths
property job_rules_paths

galaxy.di module

Dependency injection framework for Galaxy-type apps.

class galaxy.di.Container(container: Optional[Container] = None, log_undefined_deps: Union[bool, Logger] = False)[source]

Bases: Container

Abstraction around lagom to provide a dependency injection context.

Abstractions used by Galaxy should come through this interface so we can swap out the backend as needed. For instance https://punq.readthedocs.io/en/latest/ containers look very nice and would allow us to also inject by name (e.g. for config variables for instance).

resolve_or_none(dep_type: Type[T]) Optional[T][source]

Resolve the dependent type or just return None.

If resolution is impossible assume caller has a backup plan for constructing the desired object. Used to construct controllers that may or may not be resolvable (some have upgraded but legacy framework still works).

galaxy.main module

Entry point for starting Galaxy without starting as part of a web server.

Example Usage: Start a job/workflow handler without a web server and with a given name using.

galaxy-main –server-name handler0

Start as a daemon with (requires daemonized - install with ‘pip install daemonize’):

galaxy-main -d –daemon-log-file=handler0-daemon.log –pid-file handler0.pid –server-name handler0

In daemon mode logging of Galaxy (as opposed to this script) is configured via a loggers section in Galaxy’s ini file - this can be overridden with sensible defaults logging to a single file with the following:

galaxy-main -d –server-name handler0 –daemon-log-file=handler0-daemon.log –pid-file handler0.pid –log-file handler0.log

galaxy.main.load_galaxy_app(config_builder, config_env=False, log=None, attach_to_pools=None, **kwds)[source]
galaxy.main.handle_signal(signum, frame)[source]
galaxy.main.register_signals()[source]
galaxy.main.app_loop(args, log)[source]
class galaxy.main.GalaxyConfigBuilder(args=None, **kwds)[source]

Bases: object

Generate paste-like configuration from supplied command-line arguments.

__init__(args=None, **kwds)[source]
classmethod populate_options(arg_parser)[source]
property config_is_ini
app_kwds()[source]
global_conf()[source]
setup_logging()[source]
galaxy.main.main(func=<function app_loop>)[source]

galaxy.main_config module

Utilities for finding Galaxy’s configuration file.

This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py).

galaxy.main_config.default_relative_config_paths_for(app_name: str) List[str][source]
galaxy.main_config.absolute_config_path(path, galaxy_root)[source]
galaxy.main_config.config_is_ini(config_file)[source]
galaxy.main_config.find_config(supplied_config, galaxy_root, app_name='galaxy')[source]
class galaxy.main_config.WebappSetupProps(app_name: str, default_section_name: str, env_config_file: str, env_config_section: Optional[str] = None, check_galaxy_root: bool = False)[source]

Bases: tuple

Basic properties to provide information about the App and the environment variables used to resolve the App configuration.

property app_name

Alias for field number 0

property default_section_name

Alias for field number 1

property env_config_file

Alias for field number 2

property env_config_section

Alias for field number 3

property check_galaxy_root

Alias for field number 4

class galaxy.main_config.WebappConfig(global_conf: dict, load_app_kwds: dict, wsgi_preflight: bool = False)[source]

Bases: tuple

The resolved configuration values for a Webapp.

property global_conf

Alias for field number 0

property load_app_kwds

Alias for field number 1

property wsgi_preflight

Alias for field number 2

class galaxy.main_config.WebappConfigResolver(props: WebappSetupProps)[source]

Bases: object

__init__(props: WebappSetupProps) None[source]
resolve_config() WebappConfig[source]

galaxy.queue_worker module

Galaxy control queue and worker. This is used to handle ‘app’ control like reloading the toolbox, etc., across multiple processes.

galaxy.queue_worker.send_local_control_task(app, task, get_response=False, kwargs=None)[source]

This sends a message to the process-local control worker, which is useful for one-time asynchronous tasks like recalculating user disk usage.

galaxy.queue_worker.send_control_task(app, task, noop_self=False, get_response=False, routing_key='control.*', kwargs=None)[source]

This sends a control task out to all processes, useful for things like reloading a data table, which needs to happen individually in all processes. Set noop_self to True to not run task for current process. Set get_response to True to wait for and return the task results as a list.

class galaxy.queue_worker.ControlTask(queue_worker)[source]

Bases: object

__init__(queue_worker)[source]
property connection
property control_queues
property exchange
property declare_queues
on_response(message)[source]
send_task(payload, routing_key, local=False, get_response=False, timeout=10)[source]
galaxy.queue_worker.reconfigure_watcher(app, **kwargs)[source]
galaxy.queue_worker.create_panel_section(app, **kwargs)[source]

Updates in memory toolbox dictionary.

galaxy.queue_worker.reload_tool(app, **kwargs)[source]
galaxy.queue_worker.reload_toolbox(app, save_integrated_tool_panel=True, **kwargs)[source]
galaxy.queue_worker.reload_data_managers(app, **kwargs)[source]
galaxy.queue_worker.reload_display_application(app, **kwargs)[source]
galaxy.queue_worker.reload_sanitize_allowlist(app)[source]
galaxy.queue_worker.recalculate_user_disk_usage(app, **kwargs)[source]
galaxy.queue_worker.reload_tool_data_tables(app, **kwargs)[source]
galaxy.queue_worker.rebuild_toolbox_search_index(app, **kwargs)[source]
galaxy.queue_worker.reload_job_rules(app, **kwargs)[source]
galaxy.queue_worker.reload_core_config(app, **kwargs)[source]
galaxy.queue_worker.reload_tour(app, **kwargs)[source]
galaxy.queue_worker.job_rule_modules(app)[source]
galaxy.queue_worker.admin_job_lock(app, **kwargs)[source]
class galaxy.queue_worker.GalaxyQueueWorker(app, task_mapping=None)[source]

Bases: ConsumerProducerMixin, Thread

This is a flexible worker for galaxy’s queues. Each process, web or handler, will have one of these used for dispatching so called ‘control’ tasks.

__init__(app, task_mapping=None)[source]
send_control_task(task, noop_self=False, get_response=False, routing_key='control.*', kwargs=None)[source]
send_local_control_task(task, get_response=False, kwargs=None)[source]
property declare_queues
bind_and_start()[source]
get_consumers(Consumer, channel)[source]
process_task(body, message)[source]
shutdown()[source]

galaxy.queues module

All message queues used by Galaxy

galaxy.queues.all_control_queues_for_declare(application_stack)[source]

For in-memory routing (used by sqlalchemy-based transports), we need to be able to build the entire routing table in producers.

galaxy.queues.control_queues_from_config(config)[source]

Returns a Queue instance with the correct name and routing key for this galaxy process’s config

galaxy.queues.connection_from_config(config) Optional[Connection][source]

galaxy.structured_app module

Typed description of Galaxy’s app object.

class galaxy.structured_app.BasicApp(container: Optional[Container] = None, log_undefined_deps: Union[bool, Logger] = False)[source]

Bases: Container

name: str
config: Any
datatypes_registry: Registry
class galaxy.structured_app.BasicSharedApp(container: Optional[Container] = None, log_undefined_deps: Union[bool, Logger] = False)[source]

Bases: BasicApp

Stripped down version of the app shared between Galaxy and ToolShed.

Code that is shared between Galaxy and the Tool Shed should be annotated as using BasicSharedApp instead of StructuredApp below.

application_stack: ApplicationStack
model: SharedModelMapping
security: IdEncodingHelper
auth_manager: AuthManager
toolbox: Any
security_agent: Any
quota_agent: QuotaAgent
class galaxy.structured_app.MinimalToolApp(container: Optional[Container] = None, log_undefined_deps: Union[bool, Logger] = False)[source]

Bases: BasicApp

sa_session: Union[galaxy_scoped_session, SessionlessContext]
datatypes_registry: Registry
object_store: ObjectStore
tool_data_tables: ToolDataTableManager
file_sources: ConfiguredFileSources
security: IdEncodingHelper
class galaxy.structured_app.MinimalApp(container: Optional[Container] = None, log_undefined_deps: Union[bool, Logger] = False)[source]

Bases: BasicSharedApp

is_webapp: bool
tag_handler: GalaxyTagHandler
model: GalaxyModelMapping
install_model: ModelMapping
security_agent: GalaxyRBACAgent
host_security_agent: HostAgent
object_store: ObjectStore
class galaxy.structured_app.MinimalManagerApp(container: Optional[Container] = None, log_undefined_deps: Union[bool, Logger] = False)[source]

Bases: MinimalApp

file_sources: ConfiguredFileSources
genome_builds: GenomeBuilds
dataset_collection_manager: Any
history_manager: Any
hda_manager: Any
workflow_manager: Any
workflow_contents_manager: Any
library_folder_manager: Any
library_manager: Any
role_manager: Any
installed_repository_manager: Any
user_manager: Any
job_config: JobConfiguration
job_manager: Any
job_metrics: JobMetrics
property is_job_handler: bool
class galaxy.structured_app.StructuredApp(container: Optional[Container] = None, log_undefined_deps: Union[bool, Logger] = False)[source]

Bases: MinimalManagerApp

Interface defining typed description of the Galaxy UniverseApplication.

Ideally nothing that depends on StructuredApp should require StructuredApp so we can have a clean import dag. This will require setting up a lot more distinction between interfaces and implementations in Galaxy though. In the meantime, for imports that would bring in StructuredApp if properly type (cyclical imports), we’re just setting the class attributes to Any.

is_webapp: bool
tag_handler: GalaxyTagHandler
amqp_internal_connection_obj: Optional[Connection]
dependency_resolvers_view: DependencyResolversView
test_data_resolver: TestDataResolver
file_sources: ConfiguredFileSources
genome_builds: GenomeBuilds
job_metrics: JobMetrics
model: GalaxyModelMapping
install_model: ModelMapping
security_agent: GalaxyRBACAgent
host_security_agent: HostAgent
trs_proxy: TrsProxy
vault: Vault
webhooks_registry: WebhooksRegistry
queue_worker: Any
history_manager: Any
hda_manager: Any
workflow_manager: WorkflowsManager
workflow_contents_manager: Any
library_folder_manager: Any
library_manager: Any
role_manager: Any
dynamic_tool_manager: Any
data_provider_registry: Any
tool_data_tables: ToolDataTableManager
genomes: Any
error_reports: Any
tool_cache: Any
tool_shed_repository_cache: Optional[Any]
watchers: Any
installed_repository_manager: Any
workflow_scheduling_manager: Any
interactivetool_manager: Any
job_config: JobConfiguration
job_manager: Any
user_manager: Any
api_keys_manager: Any
visualizations_registry: Any

galaxy.version module