move status update to job class
This commit is contained in:
@@ -55,6 +55,21 @@ sub summary {
|
|||||||
# ($job->subaction ? (q{'}. $job->subaction .q{'}) : '');
|
# ($job->subaction ? (q{'}. $job->subaction .q{'}) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=head2 update_status
|
||||||
|
|
||||||
|
Passed an L<App::Netdisco::Worker::Status> will update this job's C<log> and
|
||||||
|
C<status> slots.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub update_status {
|
||||||
|
my $job = shift;
|
||||||
|
my $status = shift or return;
|
||||||
|
$job->status( $status->status );
|
||||||
|
$job->log( $status->log );
|
||||||
|
return $job;
|
||||||
|
}
|
||||||
|
|
||||||
=head1 ADDITIONAL COLUMNS
|
=head1 ADDITIONAL COLUMNS
|
||||||
|
|
||||||
=head2 extra
|
=head2 extra
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ has 'jobstat' => (
|
|||||||
|
|
||||||
after 'run', 'run_workers' => sub {
|
after 'run', 'run_workers' => sub {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->jobstat->update_job($self->job);
|
$self->job->update_status($self->jobstat);
|
||||||
};
|
};
|
||||||
|
|
||||||
# mixin code to run workers loaded via plugins
|
# mixin code to run workers loaded via plugins
|
||||||
|
|||||||
@@ -67,17 +67,4 @@ sub status {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
=head2 update_job
|
|
||||||
|
|
||||||
Updates an L<App::Netdisco::Backend::Job> with status and log.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub update_job {
|
|
||||||
my $self = shift;
|
|
||||||
my $job = shift or return;
|
|
||||||
$job->status( $self->status );
|
|
||||||
$job->log( $self->log );
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
Reference in New Issue
Block a user