Skip to content

Commit

Permalink
Merge pull request #5225 from perlpunk/tempdir-template
Browse files Browse the repository at this point in the history
Use a unique template for worker tempdir
  • Loading branch information
mergify[bot] authored Jun 27, 2023
2 parents 11afc2a + 6606ad8 commit b529d16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/OpenQA/Scheduler/Model/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ sub _assign_multiple_jobs_to_worker ($self, $jobs, $worker, $directly_chained_jo
if (my $tmpdir = $worker->get_property('WORKER_TMPDIR')) {
File::Path::rmtree($tmpdir);
}
my %worker_properties = (JOBTOKEN => random_string(), WORKER_TMPDIR => tempdir());
my %worker_properties = (
JOBTOKEN => random_string(),
WORKER_TMPDIR => tempdir(sprintf('webui.worker-%d.XXXXXXXX', $worker_id), TMPDIR => 1));
$worker->set_property(WORKER_TMPDIR => $worker_properties{WORKER_TMPDIR});
$job_data{$_->id} = $_->prepare_for_work($worker, \%worker_properties) for @$jobs;
return OpenQA::WebSockets::Client->singleton->send_jobs(\%job_info);
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/Schema/Result/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ sub prepare_for_work ($self, $worker = undef, $worker_properties = {}) {
if (my $tmpdir = $worker->get_property('WORKER_TMPDIR')) {
File::Path::rmtree($tmpdir);
}
$worker->set_property(WORKER_TMPDIR => tempdir());
$worker->set_property(WORKER_TMPDIR => tempdir(sprintf('webui.worker-%d.XXXXXXXX', $worker->id), TMPDIR => 1));
}
return $job_hashref;
}
Expand Down

0 comments on commit b529d16

Please sign in to comment.