Report handbrake failure to client
Added check on return status of handbrake process, and reports failure to cluster client. Fixed a bug whereby handbrake processes were not reaped after the rip completes
This commit is contained in:
@@ -133,6 +133,8 @@ $taskset->wait;
|
|||||||
sub on_complete_handler {
|
sub on_complete_handler {
|
||||||
my $result_ref = shift or die;
|
my $result_ref = shift or die;
|
||||||
|
|
||||||
|
return on_fail_handler() unless defined $$result_ref;
|
||||||
|
|
||||||
if ($options{report_email}) {
|
if ($options{report_email}) {
|
||||||
my $email = MIME::Lite::TT::HTML->new(
|
my $email = MIME::Lite::TT::HTML->new(
|
||||||
From => $options{report_email},,
|
From => $options{report_email},,
|
||||||
@@ -179,7 +181,6 @@ sub parse_config {
|
|||||||
foreach my $job (@{ $config->{jobs} }) {
|
foreach my $job (@{ $config->{jobs} }) {
|
||||||
if ($job->{presets}) {
|
if ($job->{presets}) {
|
||||||
foreach my $preset_name (@{ $job->{presets} }) {
|
foreach my $preset_name (@{ $job->{presets} }) {
|
||||||
print "Copying values for preset $preset_name into job\n";
|
|
||||||
foreach my $preset_key (keys %{$config->{presets}->{$preset_name}}) {
|
foreach my $preset_key (keys %{$config->{presets}->{$preset_name}}) {
|
||||||
$job->{$preset_key} = $config->{presets}->{$preset_name}->{$preset_key} unless $job->{$preset_key};
|
$job->{$preset_key} = $config->{presets}->{$preset_name}->{$preset_key} unless $job->{$preset_key};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,16 @@ sub do_rip {
|
|||||||
while ($line = <$child_out>) {
|
while ($line = <$child_out>) {
|
||||||
$log->debug($line);
|
$log->debug($line);
|
||||||
}
|
}
|
||||||
|
close($child_out);
|
||||||
|
|
||||||
|
# If the rip process failed, report an error status here
|
||||||
|
waitpid($child_pid, 0);
|
||||||
|
my $child_exit_status = $? >> 8;
|
||||||
|
|
||||||
|
if (!$child_exit_status) {
|
||||||
|
$log->warning("Ripping process returned error status: $child_exit_status");
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
$log->notice("Finished rip to $rip_filename");
|
$log->notice("Finished rip to $rip_filename");
|
||||||
return $rip_filename;
|
return $rip_filename;
|
||||||
|
|||||||
Reference in New Issue
Block a user