Andreas Tsangarides
01/25/2022, 10:55 AMLocalResult
and S3Result
?File "/Users/tsangis/Projects/uk-prefect-flows/.venv/lib/python3.8/site-packages/prefect/engine/task_runner.py", line 876, in get_task_run_state
value = prefect.utilities.executors.run_task_with_timeout(
File "/Users/tsangis/Projects/uk-prefect-flows/.venv/lib/python3.8/site-packages/prefect/utilities/executors.py", line 454, in run_task_with_timeout
return task.run(*args, **kwargs) # type: ignore
File "/Users/tsangis/Projects/uk-prefect-flows/src/flows/price_predictions/day_ahead_hourly/tasks.py", line 80, in update_model
model = latest_ml_model.read(latest_ml_model_loc).value
File "/Users/tsangis/Projects/uk-prefect-flows/.venv/lib/python3.8/site-packages/prefect/engine/results/local_result.py", line 86, in read
new.value = self.serializer.deserialize(value)
File "/Users/tsangis/Projects/uk-prefect-flows/src/common/results/serializers.py", line 83, in deserialize
return pickle.load(value)
TypeError: file must have 'read' and 'readline' attributes
Anna Geller
Andreas Tsangarides
01/25/2022, 11:08 AM# local_result.py
with open(os.path.join(self.dir, location), "rb") as f:
value = f.read()
Anna Geller
Andreas Tsangarides
01/25/2022, 12:03 PMclass MLPickleSerializer(Serializer):
"""custom serializer for saving/retrieving Ml models"""
def deserialize(self, value: bytes) -> Any:
# recover a Python object from bytes
return pickle.load(io.BytesIO(value))
Anna Geller
Marco Barbero Mota
05/17/2023, 6:31 PM.pkl
files that cant be read when attempting using the module pickle
or pandas.read_pickle
Andreas Tsangarides
05/25/2023, 9:23 AM