move status update to job class

This commit is contained in:
Oliver Gorwits
2017-09-05 20:41:05 +01:00
parent c8e5cea4ed
commit cd71a0b7a8
3 changed files with 16 additions and 14 deletions

View File

@@ -55,6 +55,21 @@ sub summary {
# ($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
=head2 extra

View File

@@ -22,7 +22,7 @@ has 'jobstat' => (
after 'run', 'run_workers' => sub {
my $self = shift;
$self->jobstat->update_job($self->job);
$self->job->update_status($self->jobstat);
};
# mixin code to run workers loaded via plugins

View File

@@ -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;