'todo' => 1,
'running' => 0,
'done' => 0 };
- unless ($Job->save() && $Job->{'is_locked_by'} == $User->{'uuid'}) {
- croak("Error while updating / locking job");
+ if ($job_has_uuid) {
+ unless ($Job->save() && $Job->{'is_locked_by'} == $User->{'uuid'}) {
+ croak("Error while updating / locking job");
+ }
}
}
Log (undef, "Using commit $commit for tree-ish $treeish");
if ($commit ne $treeish) {
$Job->{'script_version'} = $commit;
- $Job->save() or croak("Error while updating job");
+ !$job_has_uuid or $Job->save() or croak("Error while updating job");
}
}
}
freeze();
$Job->{'output'} = &collate_output();
$Job->{'success'} = $Job->{'output'} && $success;
-$Job->save;
+$Job->save if $job_has_uuid;
if ($Job->{'output'})
{
$Job->{'tasks_summary'}->{'todo'} = $todo;
$Job->{'tasks_summary'}->{'done'} = $done;
$Job->{'tasks_summary'}->{'running'} = $running;
- $Job->save;
+ $Job->save if $job_has_uuid;
Log (undef, "status: $done done, $running running, $todo todo");
$progress_is_dirty = 0;
}
{
Log (undef, "output $joboutput");
$Job->{'output'} = $joboutput;
- $Job->save;
+ $Job->save if $job_has_uuid;
}
else
{
sub cleanup
{
return if !$job_has_uuid;
- $Job->reload;
+ $Job->reload if $job_has_uuid;
$Job->{'running'} = 0;
$Job->{'success'} = 0;
$Job->{'finished_at'} = gmtime;
- $Job->save;
+ $Job->save if $job_has_uuid;
}
undef $metastream if !$justcheckpoint; # otherwise Log() will try to use it
Log (undef, "meta key is $loglocator");
$Job->{'log'} = $loglocator;
- $Job->save;
+ $Job->save if $job_has_uuid;
}
{
$Job->{$_} = $frozenjob->{$_};
}
- $Job->save;
+ $Job->save if $job_has_uuid;
}