diff --git a/etc/openqa/workers.ini b/etc/openqa/workers.ini index b1c631e5180..28685760ecc 100644 --- a/etc/openqa/workers.ini +++ b/etc/openqa/workers.ini @@ -76,7 +76,10 @@ # Specifies the threshold to consider the load on the machine critical. If the # average load (over the last 15 minutes) exceeds the specified value the worker # will not accept new jobs (until the load decreases again). -#CRITICAL_LOAD_AVG_THRESHOLD = 10 +# The default value is 40 to prevent system overload based on experiences with +# system stability so far. +# Set to 0 to disable. +#CRITICAL_LOAD_AVG_THRESHOLD = 40 # The section ids are the instance of the workers. # The key/value pairs will appear in vars.json diff --git a/lib/OpenQA/Worker/Settings.pm b/lib/OpenQA/Worker/Settings.pm index 74d3b37ee9c..fa0587509e1 100644 --- a/lib/OpenQA/Worker/Settings.pm +++ b/lib/OpenQA/Worker/Settings.pm @@ -65,6 +65,10 @@ sub new ($class, $instance_number = undef, $cli_options = {}) { } } + # Select sensible system CPU load15 threshold to prevent system overload + # based on experiences with system stability so far + $global_settings{CRITICAL_LOAD_AVG_THRESHOLD} //= 40; + # set some environment variables # TODO: This should be sent to the scheduler to be included in the worker's table. if (defined $instance_number) { diff --git a/t/24-worker-settings.t b/t/24-worker-settings.t index 6646ba5c0d2..d7d300b4f89 100644 --- a/t/24-worker-settings.t +++ b/t/24-worker-settings.t @@ -20,6 +20,7 @@ my $settings = OpenQA::Worker::Settings->new; is_deeply( $settings->global_settings, { + CRITICAL_LOAD_AVG_THRESHOLD => 40, GLOBAL => 'setting', WORKER_HOSTNAME => '127.0.0.1', LOG_LEVEL => 'test', @@ -82,6 +83,7 @@ subtest 'instance-specific settings' => sub { is_deeply( $settings1->global_settings, { + CRITICAL_LOAD_AVG_THRESHOLD => 40, GLOBAL => 'setting', WORKER_HOSTNAME => '127.0.0.1', WORKER_CLASS => 'qemu_i386,qemu_x86_64', @@ -96,6 +98,7 @@ subtest 'instance-specific settings' => sub { is_deeply( $settings2->global_settings, { + CRITICAL_LOAD_AVG_THRESHOLD => 40, GLOBAL => 'setting', WORKER_HOSTNAME => '127.0.0.1', WORKER_CLASS => 'qemu_aarch64',