Skip to content

Commit

Permalink
Check signature of __init__ not class
Browse files Browse the repository at this point in the history
  • Loading branch information
turbaszek committed Jun 9, 2020
1 parent 60e87b9 commit 745d0a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion airflow/models/baseoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,8 @@ def get_serialized_fields(cls):
if not cls.__serialized_fields:
cls.__serialized_fields = frozenset(
vars(BaseOperator(task_id='test')).keys() - {
'inlets', 'outlets', '_upstream_task_ids', 'default_args', 'dag', '_dag'
'inlets', 'outlets', '_upstream_task_ids', 'default_args', 'dag', '_dag',
'_BaseOperator__instantiated',
} | {'_task_type', 'subdag', 'ui_color', 'ui_fgcolor', 'template_fields'})

return cls.__serialized_fields
Expand Down
4 changes: 2 additions & 2 deletions airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class SerializedBaseOperator(BaseOperator, BaseSerialization):
_decorated_fields = {'executor_config'}

_CONSTRUCTOR_PARAMS = {
k: v.default for k, v in signature(BaseOperator).parameters.items()
k: v.default for k, v in signature(BaseOperator.__init__).parameters.items()
if v.default is not v.empty
}

Expand Down Expand Up @@ -535,7 +535,7 @@ def __get_constructor_defaults(): # pylint: disable=no-method-argument
'access_control': '_access_control',
}
return {
param_to_attr.get(k, k): v.default for k, v in signature(DAG).parameters.items()
param_to_attr.get(k, k): v.default for k, v in signature(DAG.__init__).parameters.items()
if v.default is not v.empty
}
_CONSTRUCTOR_PARAMS = __get_constructor_defaults.__func__() # type: ignore
Expand Down

0 comments on commit 745d0a3

Please sign in to comment.