YAshhh29 commented on code in PR #75916:
URL: https://github.com/apache/airflow/pull/75916#discussion_r4540848863
##########
providers/common/ai/src/airflow/providers/common/ai/durable/storage.py:
##########
@@ -107,20 +139,39 @@ def save_step(self, key: str, entry: dict[str, Any]) ->
bool:
"""
Store one journal step and rewrite the journal file.
- :return: ``True`` if the entry was written, ``False`` if it could not
be encoded.
+ :return: ``True`` if the entry was written, ``False`` if it was
skipped: it could
+ not be encoded, the write failed, or the journal file could not be
read.
"""
cache = self._load_cache()
+ if self._unreadable:
+ return False
+ previous = cache.get(key, _MISSING)
Review Comment:
Done, thanks. `save_step` now dumps `{**cache, key: entry}`, writes it, then
sets `cache[key]`, so `_MISSING` and `_restore` are gone. It also fixes main's
encode path, where `del cache[key]` dropped a step's previous value;
`test_an_entry_that_cannot_be_encoded_keeps_the_previous_value_of_a_step`
covers that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]