Replies: 3 comments 23 replies
|
I'm not convinced. All our tests do But that's my subjective feeling 😄 |
|
I'd say far better solution would be to have empty dict as default if not https://stackoverflow.com/questions/26320899/why-is-the-empty-dictionary-a-dangerous-default-value-in-python . I think The problem with setting it as Optional would mean that the mutlitude of operators (the custom ones) would have to be prepared to accept 'execute' without context, which is not backwards-incompatible I am afraid. Of course we can make sure that Airflow itself does not do it and always passes a context. So this is limited to only manual execution in tests and some custom code. I am a bit on the fence with this one. |
right but what if someone wanted to contribute an operator in airflow where context is never used inside that is the question here. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Many operators don't use it.
And when developing locally, if your operator does not use it, it's very convenient to call
task.execute()to test your task.So that type would be
Union[Optional[dict], dict]in essence.WDYT?
All reactions