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:
Ben Roberts
2010-02-17 01:41:46 +00:00
parent 3ea5aa5706
commit fd0e1f4777
2 changed files with 12 additions and 1 deletions

View File

@@ -133,6 +133,8 @@ $taskset->wait;
sub on_complete_handler {
my $result_ref = shift or die;
return on_fail_handler() unless defined $$result_ref;
if ($options{report_email}) {
my $email = MIME::Lite::TT::HTML->new(
From => $options{report_email},,
@@ -179,7 +181,6 @@ sub parse_config {
foreach my $job (@{ $config->{jobs} }) {
if ($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}}) {
$job->{$preset_key} = $config->{presets}->{$preset_name}->{$preset_key} unless $job->{$preset_key};
}

View File

@@ -125,6 +125,16 @@ sub do_rip {
while ($line = <$child_out>) {
$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");
return $rip_filename;