lazy processing EOFError
Bug
Error description
It might happen that an available lazy file is somehow corrupt and cannot be loaded.
Error message
Traceback (most recent call last):
File "/p/software/hdfml/stages/2020/software/Python/3.8.5-GCCcore-10.3.0/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/run_modules/pre_processing.py", line 385, in f_proc
res = data_handler.build(station, name_affix=name_affix, store_processed_data=store, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_mixed_sampling.py", line 362, in build
sp_meteo = cls.data_handler_fir[cls.data_handler_fir_pos](station, **sp_keys)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_mixed_sampling.py", line 213, in __init__
super().__init__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_with_filter.py", line 372, in __init__
super().__init__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_mixed_sampling.py", line 167, in __init__
super().__init__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_mixed_sampling.py", line 101, in __init__
super().__init__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_mixed_sampling.py", line 36, in __init__
super().__init__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_with_filter.py", line 156, in __init__
super().__init__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_with_filter.py", line 49, in __init__
super().__init__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_single_station.py", line 121, in __init__
self.setup_samples()
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/helpers/time_tracking.py", line 40, in __call__
return self.__wrapped__(*args, **kwargs)
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_single_station.py", line 269, in setup_samples
self.load_lazy()
File "/p/home/jusers/leufen1/juwels/intelliaq/mlair_tf2/mlair/mlair/data_handler/data_handler_single_station.py", line 292, in load_lazy
lazy_data = dill.load(pickle_file)
File "/p/software/hdfml/stages/2020/software/TensorFlow/2.5.0-gcccoremkl-10.3.0-2021.2.0-Python-3.8.5/lib/python3.8/site-packages/dill/_dill.py", line 278, in load
return Unpickler(file, ignore=ignore, **kwds).load()
File "/p/software/hdfml/stages/2020/software/TensorFlow/2.5.0-gcccoremkl-10.3.0-2021.2.0-Python-3.8.5/lib/python3.8/site-packages/dill/_dill.py", line 481, in load
obj = StockUnpickler.load(self)
EOFError: Ran out of input
First guess on error origin
Maybe the file is broken. Add EOFError exception to re-process lazy data.
Would look like this:
class DataHandlerSingleStation(AbstractDataHandler):
...
def load_lazy(self):
hash = self._get_hash()
filename = os.path.join(self.lazy_path, hash + ".pickle")
try:
if self.overwrite_lazy_data is True:
os.remove(filename)
raise FileNotFoundError
with open(filename, "rb") as pickle_file:
lazy_data = dill.load(pickle_file)
self._extract_lazy(lazy_data)
logging.debug(f"{self.station[0]}: used lazy data")
+ except (FileNotFoundError, EOFError):
logging.debug(f"{self.station[0]}: could not use lazy data")
self.make_input_target()
Error origin
Solution
Edited by Ghost User