From 33a3a203f4db23fbd7c1b2ae0cf2fc929a76c039 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 4 Apr 2022 22:21:03 +0200 Subject: [PATCH] Decrease monitor sleep in tests --- doc/source/admin/galaxy_options.rst | 15 +++++++++++++++ lib/galaxy/config/sample/galaxy.yml.sample | 8 ++++++++ lib/galaxy/config/schemas/config_schema.yml | 11 +++++++++++ lib/galaxy/workflow/scheduling_manager.py | 2 +- lib/galaxy_test/driver/driver_util.py | 3 +++ test/integration/test_config_defaults.py | 3 +++ 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/doc/source/admin/galaxy_options.rst b/doc/source/admin/galaxy_options.rst index ad5b307a420..e1eb037ca21 100644 --- a/doc/source/admin/galaxy_options.rst +++ b/doc/source/admin/galaxy_options.rst @@ -4175,6 +4175,21 @@ :Type: float +~~~~~~~~~~~~~~~~~~~~~~~~~~ +``workflow_monitor_sleep`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:Description: + Each Galaxy workflow handler process runs one thread responsible + for checking the state of active workflow invocations. This + thread operates in a loop and sleeps for the given number of + seconds at the end of each iteration. This can be decreased if + extremely high job throughput is necessary, but doing so can + increase CPU usage of handler processes. Float values are allowed. +:Default: ``1.0`` +:Type: float + + ~~~~~~~~~~~~~~~~~~~~~ ``metadata_strategy`` ~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/galaxy/config/sample/galaxy.yml.sample b/lib/galaxy/config/sample/galaxy.yml.sample index 8a8940065d5..0534c4bf30e 100644 --- a/lib/galaxy/config/sample/galaxy.yml.sample +++ b/lib/galaxy/config/sample/galaxy.yml.sample @@ -2066,6 +2066,14 @@ galaxy: # allowed. #job_runner_monitor_sleep: 1.0 + # Each Galaxy workflow handler process runs one thread responsible for + # checking the state of active workflow invocations. This thread + # operates in a loop and sleeps for the given number of seconds at the + # end of each iteration. This can be decreased if extremely high job + # throughput is necessary, but doing so can increase CPU usage of + # handler processes. Float values are allowed. + #workflow_monitor_sleep: 1.0 + # Determines how metadata will be set. Valid values are `directory`, # `extended`, `directory_celery` and `extended_celery`. In extended # mode jobs will decide if a tool run failed, the object stores diff --git a/lib/galaxy/config/schemas/config_schema.yml b/lib/galaxy/config/schemas/config_schema.yml index 82df7200fc0..aab3faedb99 100644 --- a/lib/galaxy/config/schemas/config_schema.yml +++ b/lib/galaxy/config/schemas/config_schema.yml @@ -3053,6 +3053,17 @@ mapping: decreased if extremely high job throughput is necessary, but doing so can increase CPU usage of handler processes. Float values are allowed. + workflow_monitor_sleep: + type: float + default: 1.0 + required: false + desc: | + Each Galaxy workflow handler process runs one thread responsible for + checking the state of active workflow invocations. This thread operates in a loop and + sleeps for the given number of seconds at the end of each iteration. This can be + decreased if extremely high job throughput is necessary, but doing so can increase CPU + usage of handler processes. Float values are allowed. + metadata_strategy: type: str required: false diff --git a/lib/galaxy/workflow/scheduling_manager.py b/lib/galaxy/workflow/scheduling_manager.py index 4b981a144b4..7518e87c3fe 100644 --- a/lib/galaxy/workflow/scheduling_manager.py +++ b/lib/galaxy/workflow/scheduling_manager.py @@ -314,7 +314,7 @@ class WorkflowRequestMonitor(Monitors): log.trace(monitor_step_timer.to_str()) except Exception: log.exception("An exception occured scheduling while scheduling workflows") - self._monitor_sleep(1) + self._monitor_sleep(self.app.config.workflow_monitor_sleep) def __schedule(self, workflow_scheduler_id, workflow_scheduler): invocation_ids = self.__active_invocation_ids(workflow_scheduler_id) diff --git a/lib/galaxy_test/driver/driver_util.py b/lib/galaxy_test/driver/driver_util.py index 59fe6104357..163e87bbe35 100644 --- a/lib/galaxy_test/driver/driver_util.py +++ b/lib/galaxy_test/driver/driver_util.py @@ -255,6 +255,9 @@ def setup_galaxy_config( monitor_thread_join_timeout=5, object_store_store_by="uuid", fetch_url_allowlist="127.0.0.1", + job_handler_monitor_sleep=0.2, + job_runner_monitor_sleep=0.2, + workflow_monitor_sleep=0.2, ) if default_shed_tool_data_table_config: config["shed_tool_data_table_config"] = default_shed_tool_data_table_config diff --git a/test/integration/test_config_defaults.py b/test/integration/test_config_defaults.py index 5f2265827be..c9a64834b4a 100644 --- a/test/integration/test_config_defaults.py +++ b/test/integration/test_config_defaults.py @@ -188,7 +188,9 @@ DO_NOT_TEST = [ "id_secret", # broken: default overridden "job_config", # no obvious testable defaults "job_config_file", # broken: remove 'config/' prefix from schema + "job_handler_monitor_sleep", # configured in driver_util "job_metrics_config_file", + "job_runner_monitor_sleep", # configured in driver_util "job_working_directory", # broken; may or may not be able to test "library_import_dir", # broken: default overridden "logging", # mapping loaded in config/ @@ -218,6 +220,7 @@ DO_NOT_TEST = [ "user_tool_label_filters", # broken: default overridden "user_tool_section_filters", # broken: default overridden "webhooks_dir", # broken; also remove 'config/' prefix from schema + "workflow_monitor_sleep", # configured in driver_util "workflow_resource_params_mapper", # broken: remove 'config/' prefix from schema ]