/usr/share/perl5/TheSchwartz/JobHandle.pm is in libtheschwartz-perl 1.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # $Id$
package TheSchwartz::JobHandle;
use strict;
use base qw( Class::Accessor::Fast );
__PACKAGE__->mk_accessors(qw( dsn_hashed jobid client ));
use TheSchwartz::ExitStatus;
use TheSchwartz::Job;
sub new_from_string {
my $class = shift;
my ($hstr) = @_;
my ( $hashdsn, $jobid ) = split /\-/, $hstr, 2;
return TheSchwartz::JobHandle->new(
{ dsn_hashed => $hashdsn,
jobid => $jobid,
}
);
}
sub as_string {
my $handle = shift;
return join '-', $handle->dsn_hashed, $handle->jobid;
}
sub driver {
my $handle = shift;
unless ( exists $handle->{__driver} ) {
$handle->{__driver}
= $handle->client->driver_for( $handle->dsn_hashed );
}
return $handle->{__driver};
}
sub job {
my $handle = shift;
my $job = $handle->client->lookup_job( $handle->as_string ) or return;
$job->handle($handle);
return $job;
}
sub is_pending {
my $handle = shift;
return $handle->job ? 1 : 0;
}
sub exit_status {
my $handle = shift;
my $status
= $handle->driver->lookup(
'TheSchwartz::ExitStatus' => $handle->jobid )
or return;
return $status->status;
}
sub failure_log {
my $handle = shift;
my @failures = $handle->driver->search(
'TheSchwartz::Error' => { jobid => $handle->jobid }, );
return map { $_->message } @failures;
}
sub failures {
my $handle = shift;
return scalar $handle->failure_log;
}
1;
|