more succint proctitles

This commit is contained in:
Oliver Gorwits
2017-06-27 22:33:32 +01:00
parent 828fee2d9f
commit f64f69bb83
4 changed files with 10 additions and 12 deletions

View File

@@ -59,7 +59,7 @@ my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($home, 'tmp'));
mkdir $tmp_dir if ! -d $tmp_dir; mkdir $tmp_dir if ! -d $tmp_dir;
# process-table text # process-table text
prctl 'netdisco-backend: master'; prctl 'nd2: master';
# shared local job queue # shared local job queue
my $queue = MCE::Queue->new; my $queue = MCE::Queue->new;
@@ -85,7 +85,7 @@ sub _mk_wkr {
my $self = shift; my $self = shift;
$self->{queue} = $queue; $self->{queue} = $queue;
prctl sprintf 'netdisco-backend: worker #%s %s: init', MCE->wid, lc($role); prctl sprintf 'nd2: #%s %s: init', MCE->wid, lc($role);
info sprintf 'applying role %s to worker %s', $role, MCE->wid; info sprintf 'applying role %s to worker %s', $role, MCE->wid;
# post-fork, become manager, scheduler, poller, etc # post-fork, become manager, scheduler, poller, etc

View File

@@ -18,7 +18,7 @@ sub worker_body {
my $wid = $self->wid; my $wid = $self->wid;
while (1) { while (1) {
prctl sprintf 'netdisco-backend: worker #%s poller: idle', $wid; prctl sprintf 'nd2: #%s poll: idle', $wid;
my $job = $self->{queue}->dequeue(1); my $job = $self->{queue}->dequeue(1);
next unless defined $job; next unless defined $job;
@@ -26,7 +26,7 @@ sub worker_body {
try { try {
$job->started(scalar localtime); $job->started(scalar localtime);
prctl sprintf 'netdisco-backend: worker #%s poller: working on #%s: %s', prctl sprintf 'nd2: #%s poll: #%s: %s',
$wid, $job->job, $job->summary; $wid, $job->job, $job->summary;
info sprintf "pol (%s): starting %s job(%s) at %s", info sprintf "pol (%s): starting %s job(%s) at %s",
$wid, $action, $job->job, $job->started; $wid, $action, $job->job, $job->started;
@@ -50,8 +50,6 @@ sub close_job {
my ($self, $job) = @_; my ($self, $job) = @_;
my $now = scalar localtime; my $now = scalar localtime;
prctl sprintf 'netdisco-backend: worker #%s poller: wrapping up %s #%s: %s',
$self->wid, $job->action, $job->job, $job->status;
info sprintf "pol (%s): wrapping up %s job(%s) - status %s at %s", info sprintf "pol (%s): wrapping up %s job(%s) - status %s at %s",
$self->wid, $job->action, $job->job, $job->status, $now; $self->wid, $job->action, $job->job, $job->status, $now;

View File

@@ -39,12 +39,12 @@ sub worker_body {
my $wid = $self->wid; my $wid = $self->wid;
if (setting('workers')->{'no_manager'}) { if (setting('workers')->{'no_manager'}) {
prctl sprintf 'netdisco-backend: worker #%s manager: inactive', $wid; prctl sprintf 'nd2: #%s mgr: inactive', $wid;
return debug "mgr ($wid): no need for manager... quitting" return debug "mgr ($wid): no need for manager... quitting"
} }
while (1) { while (1) {
prctl sprintf 'netdisco-backend: worker #%s manager: gathering', $wid; prctl sprintf 'nd2: #%s mgr: gathering', $wid;
my $num_slots = 0; my $num_slots = 0;
$num_slots = parse_max_workers( setting('workers')->{tasks} ) $num_slots = parse_max_workers( setting('workers')->{tasks} )
@@ -82,7 +82,7 @@ sub worker_body {
} }
debug "mgr ($wid): sleeping now..."; debug "mgr ($wid): sleeping now...";
prctl sprintf 'netdisco-backend: worker #%s manager: idle', $wid; prctl sprintf 'nd2: #%s mgr: idle', $wid;
sleep( setting('workers')->{sleep_time} || 1 ); sleep( setting('workers')->{sleep_time} || 1 );
} }
} }

View File

@@ -39,7 +39,7 @@ sub worker_body {
my $wid = $self->wid; my $wid = $self->wid;
unless (setting('schedule')) { unless (setting('schedule')) {
prctl sprintf 'netdisco-backend: worker #%s scheduler: inactive', $wid; prctl sprintf 'nd2: #%s sched: inactive', $wid;
return debug "sch ($wid): no need for scheduler... quitting" return debug "sch ($wid): no need for scheduler... quitting"
} }
@@ -47,11 +47,11 @@ sub worker_body {
# sleep until some point in the next minute # sleep until some point in the next minute
my $naptime = 60 - (time % 60) + int(rand(45)); my $naptime = 60 - (time % 60) + int(rand(45));
prctl sprintf 'netdisco-backend: worker #%s scheduler: idle', $wid; prctl sprintf 'nd2: #%s sched: idle', $wid;
debug "sched ($wid): sleeping for $naptime seconds"; debug "sched ($wid): sleeping for $naptime seconds";
sleep $naptime; sleep $naptime;
prctl sprintf 'netdisco-backend: worker #%s scheduler: queueing', $wid; prctl sprintf 'nd2: #%s sched: queueing', $wid;
# NB next_time() returns the next *after* win_start # NB next_time() returns the next *after* win_start
my $win_start = time - (time % 60) - 1; my $win_start = time - (time % 60) - 1;