You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "josh-fell (via GitHub)" <gi...@apache.org> on 2023/02/09 15:49:20 UTC

[GitHub] [airflow] josh-fell commented on issue #29435: TaskFlow API `multiple_outputs` inferral causes import errors when using TYPE_CHECKING

josh-fell commented on issue #29435:
URL: https://github.com/apache/airflow/issues/29435#issuecomment-1424411783

   Full stack trace:
   ```
   [2023-02-09 15:48:34,330] {dagbag.py:343} ERROR - Failed to import: /usr/local/airflow/dags/mo_inferral.py
   Traceback (most recent call last):
     File "/usr/local/lib/python3.9/site-packages/airflow/models/dagbag.py", line 339, in parse
       loader.exec_module(new_module)
     File "<frozen importlib._bootstrap_external>", line 850, in exec_module
     File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
     File "/usr/local/airflow/dags/mo_inferral.py", line 21, in <module>
       multiple_outputs()
     File "/usr/local/lib/python3.9/site-packages/airflow/models/dag.py", line 3555, in factory
       f(**f_kwargs)
     File "/usr/local/airflow/dags/mo_inferral.py", line 16, in multiple_outputs
       def transform(df: "DataFrame" = None) -> dict[str, Any]:
     File "/usr/local/lib/python3.9/site-packages/airflow/decorators/base.py", line 583, in decorator_factory
       return _TaskDecorator(
     File "<attrs generated init airflow.decorators.base._TaskDecorator>", line 8, in __init__
       _setattr('multiple_outputs', __attr_factory_multiple_outputs(self))
     File "/usr/local/lib/python3.9/site-packages/airflow/decorators/base.py", line 299, in _infer_multiple_outputs
       return_type = typing_extensions.get_type_hints(self.function).get("return", Any)
     File "/usr/local/lib/python3.9/site-packages/typing_extensions.py", line 929, in get_type_hints
       hint = typing.get_type_hints(
     File "/usr/local/lib/python3.9/typing.py", line 1497, in get_type_hints
       value = _eval_type(value, globalns, localns)
     File "/usr/local/lib/python3.9/typing.py", line 292, in _eval_type
       return t._evaluate(globalns, localns, recursive_guard)
     File "/usr/local/lib/python3.9/typing.py", line 554, in _evaluate
       eval(self.__forward_code__, globalns, localns),
     File "<string>", line 1, in <module>
   NameError: name 'DataFrame' is not defined
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org