rename pollers to tasks
This commit is contained in:
@@ -47,9 +47,13 @@ prctl 'netdisco-daemon: master';
|
|||||||
# shared local job queue
|
# shared local job queue
|
||||||
my $queue = MCE::Queue->new;
|
my $queue = MCE::Queue->new;
|
||||||
|
|
||||||
|
# support a scheduler-only node
|
||||||
|
setting('workers')->{'no_manager'} = 1
|
||||||
|
if setting('workers')->{tasks} eq '0';
|
||||||
|
|
||||||
mce_flow {
|
mce_flow {
|
||||||
task_name => [qw/ scheduler manager poller /],
|
task_name => [qw/ scheduler manager poller /],
|
||||||
max_workers => [ 1, 1, setting('workers')->{pollers} ],
|
max_workers => [ 1, 1, setting('workers')->{tasks} ],
|
||||||
tmp_dir => $tmp_dir,
|
tmp_dir => $tmp_dir,
|
||||||
on_post_exit => sub { MCE->restart_worker },
|
on_post_exit => sub { MCE->restart_worker },
|
||||||
}, _mk_wkr('Scheduler'), _mk_wkr('Manager'), _mk_wkr('Poller');
|
}, _mk_wkr('Scheduler'), _mk_wkr('Manager'), _mk_wkr('Poller');
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ setting('workers')->{queue} ||= 'PostgreSQL';
|
|||||||
if (exists setting('workers')->{interactives}
|
if (exists setting('workers')->{interactives}
|
||||||
or exists setting('workers')->{pollers}) {
|
or exists setting('workers')->{pollers}) {
|
||||||
|
|
||||||
setting('workers')->{pollers} = (
|
setting('workers')->{tasks} =
|
||||||
(setting('workers')->{pollers} || 0)
|
(setting('workers')->{pollers} || 0)
|
||||||
.' + '. (setting('workers')->{interactives} || 0)
|
+ (setting('workers')->{interactives} || 0);
|
||||||
) if setting('workers')->{interactives};
|
|
||||||
|
|
||||||
|
delete setting('workers')->{pollers};
|
||||||
delete setting('workers')->{interactives};
|
delete setting('workers')->{interactives};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ sub worker_body {
|
|||||||
if setting('workers')->{'no_manager'};
|
if setting('workers')->{'no_manager'};
|
||||||
|
|
||||||
my $num_slots =
|
my $num_slots =
|
||||||
MCE::Util::_parse_max_workers( setting('workers')->{pollers} )
|
MCE::Util::_parse_max_workers( setting('workers')->{tasks} )
|
||||||
- $self->{queue}->pending();
|
- $self->{queue}->pending();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ sub worker_begin {
|
|||||||
my $wid = $self->wid;
|
my $wid = $self->wid;
|
||||||
|
|
||||||
return debug "mgr ($wid): no need for scheduler... skip begin"
|
return debug "mgr ($wid): no need for scheduler... skip begin"
|
||||||
unless setting('scheduler');
|
unless setting('schedule');
|
||||||
|
|
||||||
debug "entering Scheduler ($wid) worker_begin()";
|
debug "entering Scheduler ($wid) worker_begin()";
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ sub worker_body {
|
|||||||
my $wid = $self->wid;
|
my $wid = $self->wid;
|
||||||
|
|
||||||
return debug "mgr ($wid): no need for scheduler... quitting"
|
return debug "mgr ($wid): no need for scheduler... quitting"
|
||||||
unless setting('scheduler');
|
unless setting('schedule');
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
# sleep until some point in the next minute
|
# sleep until some point in the next minute
|
||||||
|
|||||||
@@ -879,14 +879,17 @@ or remove any entries.
|
|||||||
Value: Settings Tree. Default:
|
Value: Settings Tree. Default:
|
||||||
|
|
||||||
workers:
|
workers:
|
||||||
pollers: 'AUTO * 2'
|
tasks: 'AUTO * 2'
|
||||||
sleep_time: 1
|
sleep_time: 1
|
||||||
|
|
||||||
Control the activity of the backend daemon with this configuration setting.
|
Control the activity of the backend daemon with this configuration setting.
|
||||||
|
|
||||||
C<pollers> sets how many workers are started for interactive jobs (port
|
C<tasks> sets how many worker processes are started for interactive jobs (port
|
||||||
control) and polling jobs (discover, macsuck, arpnip) on this node. Other
|
control) and polling jobs (discover, macsuck, arpnip) on this node. Other
|
||||||
nodes can have different settings. "C<AUTO>" is the number of CPU cores.
|
nodes can have different settings.
|
||||||
|
|
||||||
|
"C<AUTO>" is the number of CPU cores. Set C<tasks> to "C<0>" to disable all
|
||||||
|
workers (which allows you to have a scheduler-only node).
|
||||||
|
|
||||||
C<sleep_time> is the number of seconds between polling the database to find
|
C<sleep_time> is the number of seconds between polling the database to find
|
||||||
new jobs. This is a balance between responsiveness and database load.
|
new jobs. This is a balance between responsiveness and database load.
|
||||||
@@ -918,9 +921,9 @@ If set, then this node's backend daemon will schedule polling jobs (discover,
|
|||||||
macsuck, arpnip, etc) in the central database. It's fine to have multiple
|
macsuck, arpnip, etc) in the central database. It's fine to have multiple
|
||||||
nodes scheduling work for redundancy (but make sure they all have good NTP).
|
nodes scheduling work for redundancy (but make sure they all have good NTP).
|
||||||
|
|
||||||
Note that this is independent of the Pollers configured in C<workers>. It's
|
Note that this is independent of the Tasks configured in C<workers>. It's
|
||||||
okay to have this node schedule schedule but not do any of the polling
|
okay to have this node schedule schedule but not do any of the polling
|
||||||
itself (C<pollers: 0>).
|
itself (C<tasks: 0>).
|
||||||
|
|
||||||
Work can be scheduled using C<cron> style notation, or a simple weekday and
|
Work can be scheduled using C<cron> style notation, or a simple weekday and
|
||||||
hour fields (which accept same types as C<cron> notation). For example:
|
hour fields (which accept same types as C<cron> notation). For example:
|
||||||
|
|||||||
@@ -48,6 +48,15 @@ web interface. We advise that you back up the database prior to upgrade:
|
|||||||
|
|
||||||
=head2 General Notices
|
=head2 General Notices
|
||||||
|
|
||||||
|
The backend polling daemon has been rewritten and as a result your
|
||||||
|
configuration can be simplified. Some keys have also been renamed. Our advice
|
||||||
|
is to remove (or comment out) the complete C<workers> configuration which
|
||||||
|
enables auto-tuning. If you do wish to control the number of worker
|
||||||
|
processes, follow this pattern:
|
||||||
|
|
||||||
|
workers:
|
||||||
|
tasks: 'AUTO * 2' # this is the default, twice the number of CPUs
|
||||||
|
|
||||||
The configuration item C<reports> is now a list (used to be a dictionary).
|
The configuration item C<reports> is now a list (used to be a dictionary).
|
||||||
Each item in the list must have a C<tag> entry which was previously the
|
Each item in the list must have a C<tag> entry which was previously the
|
||||||
dictionary key. For example, now use:
|
dictionary key. For example, now use:
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ port_control_reasons:
|
|||||||
# --------------
|
# --------------
|
||||||
|
|
||||||
workers:
|
workers:
|
||||||
pollers: 'AUTO * 2'
|
tasks: 'AUTO * 2'
|
||||||
sleep_time: 1
|
sleep_time: 1
|
||||||
queue: PostgreSQL
|
queue: PostgreSQL
|
||||||
|
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ discover_no_type:
|
|||||||
- '(?i)phone'
|
- '(?i)phone'
|
||||||
- '(?i)(?:wap|wireless)'
|
- '(?i)(?:wap|wireless)'
|
||||||
|
|
||||||
# number of SNMP pollers to run in parallel (in netdisco-daemon).
|
# number of SNMP workers to run in parallel (in netdisco-daemon).
|
||||||
# the default is twice the number of CPU cores
|
# the default is twice the number of CPU cores
|
||||||
# ```````````````````````````````````````````````````````````````
|
# ```````````````````````````````````````````````````````````````
|
||||||
#workers:
|
#workers:
|
||||||
# pollers: 'AUTO * 2'
|
# tasks: 'AUTO * 2'
|
||||||
|
|
||||||
# amount parallel DNS resolution for node names
|
# amount parallel DNS resolution for node names
|
||||||
# `````````````````````````````````````````````
|
# `````````````````````````````````````````````
|
||||||
|
|||||||
Reference in New Issue
Block a user