X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1cf946bc2ac7370431c193463ab865d71bc32ed3..8722cd175d66ae707ba1ce2efa15b572678f545c:/sdk/cli/bin/crunch-job diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job index ca2e8c49a5..462b78c5f8 100755 --- a/sdk/cli/bin/crunch-job +++ b/sdk/cli/bin/crunch-job @@ -82,6 +82,7 @@ use IPC::Open2; use IO::Select; use File::Temp; use Fcntl ':flock'; +use File::Path qw( make_path ); $ENV{"TMPDIR"} ||= "/tmp"; unless (defined $ENV{"CRUNCH_TMP"}) { @@ -91,6 +92,12 @@ unless (defined $ENV{"CRUNCH_TMP"}) { $ENV{"CRUNCH_TMP"} .= "-$<"; } } + +# Create the tmp directory if it does not exist +if ( ! -d $ENV{"CRUNCH_TMP"} ) { + make_path $ENV{"CRUNCH_TMP"} or die "Failed to create temporary working directory: " . $ENV{"CRUNCH_TMP"}; +} + $ENV{"JOB_WORK"} = $ENV{"CRUNCH_TMP"} . "/work"; $ENV{"CRUNCH_INSTALL"} = "$ENV{CRUNCH_TMP}/opt"; $ENV{"CRUNCH_WORK"} = $ENV{"JOB_WORK"}; # deprecated @@ -985,27 +992,29 @@ sub reapchildren push @freeslot, $proc{$pid}->{slot}; delete $proc{$pid}; - # Load new tasks - my $newtask_list = []; - my $newtask_results; - do { - $newtask_results = $arv->{'job_tasks'}->{'list'}->execute( - 'where' => { - 'created_by_job_task_uuid' => $Jobstep->{'arvados_task'}->{uuid} - }, - 'order' => 'qsequence', - 'offset' => scalar(@$newtask_list), - ); - push(@$newtask_list, @{$newtask_results->{items}}); - } while (@{$newtask_results->{items}}); - foreach my $arvados_task (@$newtask_list) { - my $jobstep = { - 'level' => $arvados_task->{'sequence'}, - 'failures' => 0, - 'arvados_task' => $arvados_task - }; - push @jobstep, $jobstep; - push @jobstep_todo, $#jobstep; + if ($task_success) { + # Load new tasks + my $newtask_list = []; + my $newtask_results; + do { + $newtask_results = $arv->{'job_tasks'}->{'list'}->execute( + 'where' => { + 'created_by_job_task_uuid' => $Jobstep->{'arvados_task'}->{uuid} + }, + 'order' => 'qsequence', + 'offset' => scalar(@$newtask_list), + ); + push(@$newtask_list, @{$newtask_results->{items}}); + } while (@{$newtask_results->{items}}); + foreach my $arvados_task (@$newtask_list) { + my $jobstep = { + 'level' => $arvados_task->{'sequence'}, + 'failures' => 0, + 'arvados_task' => $arvados_task + }; + push @jobstep, $jobstep; + push @jobstep_todo, $#jobstep; + } } $progress_is_dirty = 1;