Uh oh!
There was an error while loading. Please reload this page.
Fix CloudwatchTaskHandler display error - #54054
Conversation
Just tested fixed CloudwatchTaskHandler with different airflow-core version setups and all of them display correctly. I setup the following airflow-core version matrix against fixed CloudwatchTaskHandler.
After fix, the log should be format correctly on frontend, screenshot as below |
ashb
left a comment
There was a problem hiding this comment.
This still goes and loads everything into memory for Cloudwatch doesn't it? As we call io.read() which does [x for x in self.stream()] -- I wonder if the read code in file_task_handler should check for a io.stream function and use that in preference over io.read?
That might be a bit complex, but either way I think we need a bit more thought here to not undo all the changes you had for paging/oom of logs
Yes, I'm still WIP on local for setup stream-based read with backward compatibility.
I had considered compact mechanism in #49470 by peeking the type of the So we just need to make sure the provider with airflow-core after 3.0.3 version should return stream-based. # in `version_compat` module# or maybe just use `get_base_airflow_version_tuple() >= (3, 0, 3)` directly in provider FileTaskHandlerSTREAM_BASED_READ=get_base_airflow_version_tuple() >= (3, 0, 3)
# in provider FileTaskHandlerifSTREAM_BASED_READ:
returnmessages, log_streams# generator of StructuredLogMessage or strelse:
returnmessages, log_list# list of str ( not memory efficient, but only after 3.0.3 airflow-core can support stream-based read ) |
7e5785d to
de079f2Comparejason810496
commented
Aug 10, 2025
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
de079f2 to
4832d37CompareUh oh!
There was an error while loading. Please reload this page.
ffa3797 to
5a775dfCompare30a2528 to
847a238Comparea2eb6dd to
f615e0dCompare
jason810496
left a comment
There was a problem hiding this comment.
The PR should be good to go, I just test it with both Airflow 3 and Airflow 2 with the following setup and both work well.
breeze start-airflow --backend postgres --integration localstack --db-reset --mount-sources providers-and-tests --use-airflow-version 3.1.3

breeze start-airflow --backend postgres --integration localstack --mount-sources providers-and-tests --use-airflow-version 2.11.0

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
f615e0d to
756b80fCompareLee-W
commented
Nov 28, 2025
looks like we have some compatibility issue 🤔 |
756b80f to
e0d5f74Compare4d5d055 to
ea8d041Compare- .stream method should return gen[str] but it return in gen[dict] in previous fix - Make _parse_cloudwatch_log_event return as str intead of dict can fix the problem
- consolidate str_logs - rename _event_to_dict
ea8d041 to
0e90658CompareUh oh!
There was an error while loading. Please reload this page.
* Take over ash's fix * Fix datetime serialization error * Fix 'generator is not subscriptable' error * Fix test_cloudwatch_task_handler * Fix nits in code review * Add CloudWatchLogEvent type * Correct return type of .stream method - .stream method should return gen[str] but it return in gen[dict] in previous fix - Make _parse_cloudwatch_log_event return as str intead of dict can fix the problem * Revert change in file_task_handler * Fix test_log_message * Revert file_task_handler change * Fix type annotation for CloudWatchRemoteLogIO * Fix review comments - consolidate str_logs - rename _event_to_dict
* Take over ash's fix * Fix datetime serialization error * Fix 'generator is not subscriptable' error * Fix test_cloudwatch_task_handler * Fix nits in code review * Add CloudWatchLogEvent type * Correct return type of .stream method - .stream method should return gen[str] but it return in gen[dict] in previous fix - Make _parse_cloudwatch_log_event return as str intead of dict can fix the problem * Revert change in file_task_handler * Fix test_log_message * Revert file_task_handler change * Fix type annotation for CloudWatchRemoteLogIO * Fix review comments - consolidate str_logs - rename _event_to_dict








related: #49470
Why
As noted in #49470 (comment), PR #49470 unintentionally broke the display format of
CloudWatchHandler.What
This PR fixes the display issue for
CloudWatchHandlerand ensure it will display properly across differentairflow-coreversions.