ericdelorefice commented on code in PR #74996:
URL: https://github.com/apache/airflow/pull/74996#discussion_r4681539609
##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/log/wasb_task_handler.py:
##########
@@ -229,10 +229,24 @@ def write(self, log: str, remote_log_location: str,
append: bool = True) -> bool
:param log: the log to write to the remote_log_location
:param remote_log_location: the log's location in remote storage
:param append: if False, any existing log file is overwritten. If True,
- the new log is appended to any existing logs.
+ the new log is appended to any existing logs; if the existing log
cannot be
+ read, nothing is written and ``False`` is returned.
"""
- if append and self.wasb_log_exists(remote_log_location):
- old_log = self.wasb_read(remote_log_location)
+ if append:
+ try:
+ old_log = ""
+ if self.hook.check_for_blob(self.wasb_container,
remote_log_location):
Review Comment:
Thanks, that is cleaner. Done in 409672b: one `read_file`, with
`ResourceNotFoundError` as no log yet, like the GCS handler's `no_log_found`;
`azure-storage-blob` 12.28.0 and 12.30.3 raise it on download for a missing
blob or container, which is what `check_for_blob` caught.
`test_write_when_remote_log_does_not_exist` now sets it as the `read_file` side
effect.
---
Drafted-by: Claude Code (Claude Opus 5.5) (no human review before posting)
##########
providers/microsoft/azure/tests/unit/microsoft/azure/log/test_wasb_task_handler.py:
##########
@@ -314,22 +315,18 @@ def test_wasb_read_raises(self, mock_hook, caplog):
assert rec.exc_info is not None
@mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook")
Review Comment:
Done in the same commit: the five tests you listed use `autospec=True`. With
no HEAD left I also dropped the `existence-check-fails` case and the fake
hook's `check_for_blob`. On the handler from before this PR (099c03e4) the read
failure and upload sequence tests fail, and with the change all 34 pass.
---
Drafted-by: Claude Code (Claude Opus 5.5) (no human review before posting)
--
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]