diff --git a/manifests/init.pp b/manifests/init.pp index 91bfeef8..0f170a88 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -132,6 +132,9 @@ # available, likely results in performance degradation due to I/O blocking and is not recommended in most cases. Modifying this parameter should # be done incrementally with benchmarking at each step to determine an optimal value for your deployment. # +# @param worker_ttl +# The number of seconds before a pulpcore worker should be considered lost. +# # @param use_rq_tasking_system # Use the older RQ workers tasking system instead of the newer PostgreSQL tasking system introduced in Pulpcore 3.14. # Any benchmarking you did to optimize worker_count or other tasking related parameters will no longer be accurate after changing the tasking system. @@ -211,6 +214,7 @@ Pulpcore::ChecksumTypes $allowed_content_checksums = ['sha224', 'sha256', 'sha384', 'sha512'], String[1] $remote_user_environ_name = 'HTTP_REMOTE_USER', Integer[0] $worker_count = min(8, $facts['processors']['count']), + Optional[Integer[0]] $worker_ttl = undef, Boolean $use_rq_tasking_system = false, Boolean $service_enable = true, Boolean $service_ensure = true, diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index c5d89c2e..28940cc0 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -79,6 +79,11 @@ class { 'pulpcore': its(:exit_status) { is_expected.to eq 0 } end + describe command("PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings") do + its(:stdout) { is_expected.to match(/^WORKER_TTL = 30/) } + its(:exit_status) { is_expected.to eq 0 } + end + describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py rq info -c pulpcore.rqconfig") do its(:stdout) { is_expected.to match(/^0 workers, /) } its(:stdout) { is_expected.not_to match(/^resource-manager /) } diff --git a/spec/classes/pulpcore_spec.rb b/spec/classes/pulpcore_spec.rb index fe5f64b6..17d5d7bb 100644 --- a/spec/classes/pulpcore_spec.rb +++ b/spec/classes/pulpcore_spec.rb @@ -513,6 +513,19 @@ .with_content(%r{\s'level': 'DEBUG',}) end end + + context 'can change the worker_ttl to 60' do + let :params do + { + worker_ttl: 60 + } + end + + it do + is_expected.to contain_concat__fragment('base') + .with_content(%r{\sWORKER_TTL = 60}) + end + end end end end diff --git a/templates/settings.py.erb b/templates/settings.py.erb index db79d87e..bdf7dc96 100644 --- a/templates/settings.py.erb +++ b/templates/settings.py.erb @@ -23,6 +23,10 @@ REDIS_URL = "redis://localhost:<%= scope['redis::port'] %>/<%= scope['pulpcore:: USE_NEW_WORKER_TYPE = <%= scope['pulpcore::use_rq_tasking_system'] ? "False" : "True" %> +<% if scope['pulpcore::worker_ttl'] -%> +WORKER_TTL = <%= scope['pulpcore::worker_ttl'] %> +<% end -%> + MEDIA_ROOT = "<%= scope['pulpcore::media_root'] %>" STATIC_ROOT = "<%= scope['pulpcore::static_root'] %>" STATIC_URL = "<%= scope['pulpcore::static_url'] %>"