From 51fbc1896f30688bd27ea29b0f08b6cbd8976398 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 21 May 2024 14:43:45 +0200 Subject: [PATCH 1/2] Avoid object store path lookup when constructing JobState object This eliminates the code path that failed in https://github.com/galaxyproject/galaxy/issues/18189, and should generally be a nice performance improvement. --- lib/galaxy/jobs/runners/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/jobs/runners/__init__.py b/lib/galaxy/jobs/runners/__init__.py index e87d7c1b0091..4c4cc848ed6e 100644 --- a/lib/galaxy/jobs/runners/__init__.py +++ b/lib/galaxy/jobs/runners/__init__.py @@ -678,14 +678,16 @@ def __init__(self, job_wrapper: "JobWrapper", job_destination: "JobDestination") self.job_wrapper = job_wrapper self.job_destination = job_destination self.runner_state = None - self.exit_code_file = default_exit_code_file(job_wrapper.working_directory, job_wrapper.get_id_tag()) - self.redact_email_in_job_name = True if self.job_wrapper: self.redact_email_in_job_name = self.job_wrapper.app.config.redact_email_in_job_name self.cleanup_file_attributes = ["job_file", "output_file", "error_file", "exit_code_file"] + @property + def exit_code_file(self) -> str: + return default_exit_code_file(self.job_wrapper.working_directory, self.job_wrapper.get_id_tag()) + def set_defaults(self, files_dir): if self.job_wrapper is not None: id_tag = self.job_wrapper.get_id_tag() From 44c7bb1bdeefc5ef61fc73701203c78eb2208e1c Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 21 May 2024 16:38:48 +0200 Subject: [PATCH 2/2] Move exit_code_file to fix AsynchronousJobState --- lib/galaxy/jobs/runners/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/jobs/runners/__init__.py b/lib/galaxy/jobs/runners/__init__.py index 4c4cc848ed6e..58485fc955ec 100644 --- a/lib/galaxy/jobs/runners/__init__.py +++ b/lib/galaxy/jobs/runners/__init__.py @@ -679,6 +679,7 @@ def __init__(self, job_wrapper: "JobWrapper", job_destination: "JobDestination") self.job_destination = job_destination self.runner_state = None self.redact_email_in_job_name = True + self._exit_code_file = None if self.job_wrapper: self.redact_email_in_job_name = self.job_wrapper.app.config.redact_email_in_job_name @@ -686,7 +687,9 @@ def __init__(self, job_wrapper: "JobWrapper", job_destination: "JobDestination") @property def exit_code_file(self) -> str: - return default_exit_code_file(self.job_wrapper.working_directory, self.job_wrapper.get_id_tag()) + return self._exit_code_file or default_exit_code_file( + self.job_wrapper.working_directory, self.job_wrapper.get_id_tag() + ) def set_defaults(self, files_dir): if self.job_wrapper is not None: @@ -755,7 +758,7 @@ def __init__( self.output_file = output_file self.error_file = error_file if exit_code_file: - self.exit_code_file = exit_code_file + self._exit_code_file = exit_code_file self.job_name = job_name self.set_defaults(files_dir)