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 configuring Pulpcore worker timeout #230

Merged
merged 2 commits into from
Oct 7, 2021
Merged
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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ This results into the following structure, using `tree -pug`:
└── [drwxr-x--- pulp pulp ] tmp ($cache_dir)
```

## Pulpcore settings

The application will load settings from Django's defaults, Pulpcore's defaults, plus any overrides defined in the settings file at `${config_dir}/settings.py` (default: `/etc/pulp/settings.py`). The Django `diffsettings` tool is useful to check settings which are different from Django's defaults (i.e. all of the Pulpcore defaults which are not present in Django, plus any overrides defined in the settings file):

```shell
PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings
```

For example, to check the current value of a Pulpcore setting such as `WORKER_TTL`:

```shell
PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings | grep WORKER_TTL
```

This is useful for module parameter which configure Pulpcore settings but have an `undef` default, such as `$worker_ttl`. When the param value is `undef`, the setting is omitted from `settings.py` and therefore Pulpcore's default is used.

## Service setup

The module deploys a few systemd services:
Expand Down
8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@
# 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
# Configure Pulpcore's WORKER_TTL setting. This is the number of seconds before a Pulpcore worker should be considered lost.
# If undefined, the setting will be omitted from the configuration file and Pulpcore will use its default value.
# To determine the current value in Pulpcore, see instructions about the diffsettings tool in this module's README.
# You should not need to modify this setting unless the application reports workers timing out while they are busy completing tasks.
# Modification should be performed incrementally to determine the least value that prevents false positive worker timeouts.
#
# @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 +218,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,
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
.with_content(%r{REDIS_URL = "redis://localhost:6379/8"})
.with_content(%r{CACHE_ENABLED = False})
.without_content(%r{sslmode})
.without_content(%r{WORKER_TTL})
is_expected.to contain_file('/etc/pulp')
is_expected.to contain_file('/var/lib/pulp')
is_expected.to contain_file('/var/lib/pulp/sync_imports')
Expand Down Expand Up @@ -513,6 +514,17 @@
.with_content(%r{\s'level': 'DEBUG',})
end
end

context 'with parameter worker_ttl = 60' do
let :params do
{ worker_ttl: 60 }
end

it 'configures pulpcore with setting WORKER_TTL = 60' do
is_expected.to contain_concat__fragment('base')
.with_content(%r{^WORKER_TTL = 60$})
wbclark marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
end
end
3 changes: 3 additions & 0 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ DATABASES = {
REDIS_URL = "redis://localhost:<%= scope['redis::port'] %>/<%= scope['pulpcore::redis_db'] %>"

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'] %>"
Expand Down