move status tracking and checking inside job instance

This commit is contained in:
Oliver Gorwits
2017-11-06 21:26:01 +00:00
parent 4436150bf4
commit 25907d3544
8 changed files with 165 additions and 100 deletions

View File

@@ -5,12 +5,12 @@ use Dancer qw/:moose :syntax :script/;
use List::Util 'sum';
use App::Netdisco::Util::MCE;
use Role::Tiny;
use namespace::clean;
use App::Netdisco::JobQueue
qw/jq_locked jq_getsome jq_getsomep jq_lock jq_warm_thrusters/;
use Role::Tiny;
use namespace::clean;
sub worker_begin {
my $self = shift;
my $wid = $self->wid;
@@ -58,7 +58,7 @@ sub worker_body {
# mark job as running
next unless jq_lock($job);
info sprintf "mgr (%s): job %s booked out for this processing node",
$wid, $job->job;
$wid, $job->id;
# copy job to local queue
$self->{queue}->enqueuep(100, $job);
@@ -75,7 +75,7 @@ sub worker_body {
# mark job as running
next unless jq_lock($job);
info sprintf "mgr (%s): job %s booked out for this processing node",
$wid, $job->job;
$wid, $job->id;
# copy job to local queue
$self->{queue}->enqueue($job);