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 Try::Tiny;
use App::Netdisco::Util::MCE;
use Role::Tiny;
use namespace::clean;
use Time::HiRes 'sleep';
use App::Netdisco::JobQueue qw/jq_defer jq_complete/;
use Role::Tiny;
use namespace::clean;
# add dispatch methods for poller tasks
with 'App::Netdisco::Worker::Runner';
@@ -29,9 +29,9 @@ sub worker_body {
try {
$job->started(scalar localtime);
prctl sprintf 'nd2: #%s poll: #%s: %s',
$wid, $job->job, $job->summary;
$wid, $job->id, $job->summary;
info sprintf "pol (%s): starting %s job(%s) at %s",
$wid, $job->action, $job->job, $job->started;
$wid, $job->action, $job->id, $job->started;
$self->run($job);
}
catch {
@@ -51,7 +51,7 @@ sub close_job {
my $now = scalar localtime;
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->id, $job->status, $now;
try {
if ($job->status eq 'defer') {