Skip to content

Commit

Permalink
Update param docs and tests for WORKER_TTL feature
Browse files Browse the repository at this point in the history
  • Loading branch information
wbclark committed Oct 5, 2021
1 parent 18a6588 commit 3273438
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
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
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@
# 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.
# 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.
Expand Down
5 changes: 0 additions & 5 deletions spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ 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 /) }
Expand Down
11 changes: 5 additions & 6 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 @@ -514,16 +515,14 @@
end
end

context 'can change the worker_ttl to 60' do
context 'with parameter worker_ttl = 60' do
let :params do
{
worker_ttl: 60
}
{ worker_ttl: 60 }
end

it do
it 'configures pulpcore with setting WORKER_TTL = 60' do
is_expected.to contain_concat__fragment('base')
.with_content(%r{\sWORKER_TTL = 60})
.with_content(%r{^WORKER_TTL = 60$})
end
end
end
Expand Down
1 change: 0 additions & 1 deletion templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ 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 -%>
Expand Down

0 comments on commit 3273438

Please sign in to comment.