michalc commented on code in PR #31855:
URL: https://github.com/apache/airflow/pull/31855#discussion_r1229000015
##########
airflow/utils/log/file_task_handler.py:
##########
@@ -147,7 +147,7 @@ class FileTaskHandler(logging.Handler):
def __init__(self, base_log_folder: str, filename_template: str | None =
None):
super().__init__()
- self.handler: logging.FileHandler | None = None
+ self.handler: logging.Handler | None = None
Review Comment:
> What I meant was that maybe this change is not required by this PR? since
you have anyway overridden the self.handler in class RedisTaskHandler
Ah - so if I change it back to how it was before this PR, I get a type error:
```
airflow/providers/redis/log/redis_task_handler.py:61: error: Incompatible
types
in assignment (expression has type "Optional[_RedisHandler]", base class
"FileTaskHandler" defined the type as "Optional[FileHandler]") [assignment]
```
So something else would have to change too. The easiest way that I've come
up with is to de-facto disable type checking on `self.handler` by removing type
annotations in a few places, to make it more like the Cloudwatch handler, but
that seems a bit... cheat-y.
`_RedisHandler` could really inherit from `logging.FileHandler` to satisfy
type checking, but it's constructor seems to require a path to a file, which
seems odd in this case.
--
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]