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

Fixes #33446: Allow setting the time until a worker is considered lost #227

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
wbclark marked this conversation as resolved.
Show resolved Hide resolved
Boolean $use_rq_tasking_system = false,
Boolean $service_enable = true,
Boolean $service_ensure = true,
Expand Down
5 changes: 5 additions & 0 deletions spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this in the diffsettings command above? That makes the execution faster since it doesn't need to call diffsettings multiple times.

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 /) }
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>
wbclark marked this conversation as resolved.
Show resolved Hide resolved

MEDIA_ROOT = "<%= scope['pulpcore::media_root'] %>"
STATIC_ROOT = "<%= scope['pulpcore::static_root'] %>"
STATIC_URL = "<%= scope['pulpcore::static_url'] %>"
Expand Down