Add hint about related setting for REX concurrency#4239
Add hint about related setting for REX concurrency#4239maximiliankolb wants to merge 3 commits intotheforeman:masterfrom
Conversation
| Defines the maximum number of jobs executed at once. | ||
| This can prevent overload of system resources in a case of executing the job on a large number of hosts. | ||
| + | ||
| If `foreman_proxy_ansible_batch_size` is set, {SmartProxies} run batches of concurrent remote execution jobs. |
There was a problem hiding this comment.
Does this only work for foreman_ansible, but not for foreman_remote_execution?
There was a problem hiding this comment.
Does foreman_remote_execution "borrow" the setting from foreman-tasks? theforeman/foreman_remote_execution@8016206 & https://github.com/theforeman/foreman-tasks/blob/master/app/lib/actions/proxy_action.rb#L207
a784efe to
7407c29
Compare
MartinSpiessl
left a comment
There was a problem hiding this comment.
I had a look again and left a few comments. What the foreman actually does is on a different page entirely, it might greatly deviate from what we can deduce from the help text of the settings!
| Defines the maximum number of jobs executed at once. | ||
| This can prevent overload of system resources in a case of executing the job on a large number of hosts. | ||
| + | ||
| If a batch size is set, {SmartProxies} run batches of concurrent remote execution jobs. |
There was a problem hiding this comment.
The popup in the UI talks about "tasks", here we now seem to talk about number of "jobs". In foreman, one job can contain multiple hosts, and hence there can be multiple tasks per job, at least that is what I observed. I guess we should talk about "tasks" here in line 47 (and 45)! I just tried it by running a ansible command "uptime" on some hosts, with concurrency set to 3. It then shows me in the job the following info text:
Schedule
Concurrency level limited to: 3 tasks at a time
And I see how it starts the "uptime" command on at most 3 hosts at a time, making its way down the list of host names. These are the "tasks" corresponding to this "job", which are also listed separately on the foreman_tasks/tasks page.
There was a problem hiding this comment.
Changed jobs to tasks.
| + | ||
| If a batch size is set, {SmartProxies} run batches of concurrent remote execution jobs. | ||
| For Ansible-based remote execution jobs, change the `foreman_ansible_proxy_batch_size` setting in the {ProjectWebUI} under *Administer* > *Settings* on the *Ansible* tab. | ||
| For Script-based remote execution jobs, change the `foreman_tasks_proxy_batch_size` setting in the {ProjectWebUI} under *Administer* > *Settings* on the *Tasks* tab. |
There was a problem hiding this comment.
I finally found "foreman_tasks_proxy_batch_trigger", which is a boolean setting (default is true) which controls whether this feature is actually enabled. This information could be added here as well, as it is crucial that this is not set to false, otherwise these two options are claimed to have no effect.
There was a problem hiding this comment.
This is correct based on "master" in foreman-tasks:
$ cat lib/foreman_tasks/engine.rb | sed -n "80,89p"
setting('foreman_tasks_proxy_batch_trigger',
type: :boolean,
description: N_('Allow triggering tasks on the smart proxy in batches'),
default: true,
full_name: N_('Allow proxy batch tasks'))
setting('foreman_tasks_proxy_batch_size',
type: :integer,
description: N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'),
default: 100,
full_name: N_('Proxy tasks batch size'))
However, I don't quite understand yet a) why we should mention/explain this if the default value is correct/sane and b) I still cannot reproduce the user story behind this.
| This can prevent overload of system resources in a case of executing the job on a large number of hosts. | ||
| + | ||
| If a batch size is set, {SmartProxies} run batches of concurrent remote execution jobs. | ||
| For Ansible-based remote execution jobs, change the `foreman_ansible_proxy_batch_size` setting in the {ProjectWebUI} under *Administer* > *Settings* on the *Ansible* tab. |
There was a problem hiding this comment.
not quite, foreman_ansible_proxy_batch_size is empty by default. Then foreman_tasks_proxy_batch_size will be taken also for ansible-based remote execution jobs. If you set foreman_ansible_proxy_batch_size to some value, then this one overrides the batch size for ansible-based jobs.
There was a problem hiding this comment.
This is correct based on "master" in foreman_ansible:
$ cat lib/foreman_ansible/register.rb | sed -n "78,84p"
setting 'foreman_ansible_proxy_batch_size',
type: :integer,
description: N_('Number of tasks which should be sent to the smart proxy in one request, '\
'if foreman_tasks_proxy_batch_trigger is enabled. '\
'If set, overrides foreman_tasks_proxy_batch_size setting for Ansible jobs.'),
default: nil,
full_name: N_('Proxy tasks batch size for Ansible')
However, the downstream ticket does not mention using Ansible-based REX. I am trying to understand Script-based REX first.
The setting itself is explained under Administer > Settings > Ansible.
guides/common/modules/ref_advanced-settings-in-the-job-wizard.adoc
Outdated
Show resolved
Hide resolved
|
@adamruzicka, could you help out here in explaining what actually happens when these options are set? In theforeman/foreman_remote_execution@a5027ab#diff-a54f77c21c5cd2f600e20d3b2d82bb7bf6972ba0914916ecdae4ba48ad9d3698R102 you added the hint to the concurrency level option for remote execution hobs, stating:
In theforeman/foreman-tasks@b58b21d#diff-c8d459533136a218721813c3a97815f081d466276f1720410f092422eddd6e7dR14-R15 you elaborated on the proxy batching options: set('foreman_tasks_proxy_batch_trigger', N_('Allow triggering tasks on the smart proxy in batches'), true),
set('foreman_tasks_proxy_batch_size', N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'), 1000)
|
I think I figured this part out:
This addition is meant as a hint that concurrency level will reduce the batch size to 1 as a side effect, but it will also work if proxy batch triggering is disabled. |
None really
Correct, although this behaviour might have changed since theforeman/foreman_remote_execution#827 . It won't be hard limited to 1, but it will be something a number from 1 to |
Fixes #38247 (Missing docs on how to REX batching works)
7407c29 to
5383d34
Compare
| = Running remote execution jobs in batches | ||
|
|
||
| [role="_abstract"] | ||
| You can run remote execution jobs in batches. |
There was a problem hiding this comment.
Please elaborate on the "why" and "when" to enable this.
|
@MartinSpiessl can you please answer the last remaining questions. |
What changes are you introducing?
Why are you introducing these changes? (Explanation, links to references, issues, etc.)
Fixes #38247 (Missing docs on how to REX batching works)
Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)
Untested!
Contributor checklists
Please cherry-pick my commits into:
Review checklists
Tech review (performed by an Engineer who did not author the PR; can be skipped if tech review is unnecessary):
Style review (by a Technical Writer who did not author the PR):