Skip to content

Commit 4e21123

Browse files
committed
Extract functionality from k8s runner for reuse.
1 parent 7ebb964 commit 4e21123

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/galaxy/jobs/runners/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,13 @@ def register_cleanup_file_attribute(self, attribute):
818818
if attribute not in self.cleanup_file_attributes:
819819
self.cleanup_file_attributes.append(attribute)
820820

821+
def init_job_stream_files(self):
822+
"""For runners that don't create explicit job scripts - create job stream files."""
823+
with open(self.output_file, "w"):
824+
pass
825+
with open(self.error_file, "w"):
826+
pass
827+
821828

822829
class AsynchronousJobRunner(BaseJobRunner, Monitors):
823830
"""Parent class for any job runner that runs jobs asynchronously (e.g. via

lib/galaxy/jobs/runners/kubernetes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,8 @@ def queue_job(self, job_wrapper):
173173
job_wrapper=job_wrapper,
174174
job_destination=job_wrapper.job_destination,
175175
)
176-
# Kubernetes doesn't really produce meaningful "job stdout", but file needs to be present
177-
with open(ajs.output_file, "w"):
178-
pass
179-
with open(ajs.error_file, "w"):
180-
pass
181-
176+
# Kubernetes doesn't really produce a "job script", but job stream files needs to be present
177+
ajs.init_job_stream_files()
182178
if not self.prepare_job(
183179
job_wrapper,
184180
include_metadata=False,

0 commit comments

Comments
 (0)