Skip to content

Commit b6dec5e

Browse files
committed
Extract functionality from k8s runner for reuse.
1 parent 6f4ea54 commit b6dec5e

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
@@ -817,6 +817,13 @@ def register_cleanup_file_attribute(self, attribute):
817817
if attribute not in self.cleanup_file_attributes:
818818
self.cleanup_file_attributes.append(attribute)
819819

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

821828
class AsynchronousJobRunner(BaseJobRunner, Monitors):
822829
"""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
@@ -172,12 +172,8 @@ def queue_job(self, job_wrapper):
172172
job_wrapper=job_wrapper,
173173
job_destination=job_wrapper.job_destination,
174174
)
175-
# Kubernetes doesn't really produce meaningful "job stdout", but file needs to be present
176-
with open(ajs.output_file, "w"):
177-
pass
178-
with open(ajs.error_file, "w"):
179-
pass
180-
175+
# Kubernetes doesn't really produce a "job script", but job stream files needs to be present
176+
ajs.init_job_stream_files()
181177
if not self.prepare_job(
182178
job_wrapper,
183179
include_metadata=False,

0 commit comments

Comments
 (0)