Skip to content

Commit 8e24c36

Browse files
committed
Only add output files that actually exist to job_files / output files
1 parent dd4ce1c commit 8e24c36

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

jupyter_scheduler/scheduler.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,16 @@ def add_job_files(self, model: DescribeJob):
324324
for output_format in model.output_formats:
325325
filename = output_filenames[output_format]
326326
output_path = os.path.join(output_dir, filename)
327-
job_files.append(
328-
JobFile(
329-
display_name=mapping[output_format],
330-
file_format=output_format,
331-
file_path=output_path if self.file_exists(output_path) else None,
327+
file_exists = self.file_exists(output_path)
328+
# Only add job file if it exists (handles optional outputs like stdout/stderr)
329+
if file_exists:
330+
job_files.append(
331+
JobFile(
332+
display_name=mapping[output_format],
333+
file_format=output_format,
334+
file_path=output_path,
335+
)
332336
)
333-
)
334337

335338
# Add input file
336339
filename = model.input_filename

0 commit comments

Comments
 (0)