@@ -57,6 +57,9 @@ def generate_filepaths(self):
5757 """A generator that produces filepaths"""
5858 output_formats = self .output_formats + ["input" ]
5959 for output_format in output_formats :
60+ # Skip if this format is not in staging_paths (e.g., input file for CronJob jobs)
61+ if output_format not in self .staging_paths :
62+ continue
6063 input_filepath = self .staging_paths [output_format ]
6164 output_filepath = os .path .join (self .output_dir , self .output_filenames [output_format ])
6265 if not os .path .exists (output_filepath ) or self .redownload :
@@ -79,8 +82,19 @@ def generate_filepaths(self):
7982 yield input_filepath , output_filepath
8083
8184 if self .include_staging_files :
82- staging_dir = os .path .dirname (self .staging_paths ["input" ])
83- for file_relative_path in self .output_filenames ["files" ]:
85+ # Handle missing "input" key gracefully - it may not exist for CronJob jobs
86+ if "input" in self .staging_paths :
87+ staging_dir = os .path .dirname (self .staging_paths ["input" ])
88+ elif self .staging_paths :
89+ # Fall back to any available staging path directory
90+ staging_dir = os .path .dirname (next (iter (self .staging_paths .values ())))
91+ else :
92+ # No staging paths available, skip
93+ return
94+
95+ # Handle missing "files" key gracefully - it may not exist if packaged_files was empty
96+ files_list = self .output_filenames .get ("files" , [])
97+ for file_relative_path in files_list :
8498 input_filepath = os .path .join (staging_dir , file_relative_path )
8599 output_filepath = os .path .join (self .output_dir , file_relative_path )
86100 if not os .path .exists (output_filepath ) or self .redownload :
0 commit comments