potiuk commented on code in PR #51153:
URL: https://github.com/apache/airflow/pull/51153#discussion_r2132336826
##########
providers/openlineage/src/airflow/providers/openlineage/utils/utils.py:
##########
@@ -68,9 +68,8 @@
from openlineage.client.event_v2 import Dataset as OpenLineageDataset
from openlineage.client.facet_v2 import RunFacet, processing_engine_run
- from airflow.models import TaskInstance
+ from airflow.models import DAG, MappedOperator, TaskInstance
from airflow.providers.common.compat.assets import Asset
- from airflow.sdk import DAG, MappedOperator
Review Comment:
I think you should copy the try/except from the else clause. Looks like
Openlineage provider is prepared to read MappedOperators from task.sdk when
it's there and falls back to read both DAG an MappedOperator from the models -
it does not do it for TYPE_CHECKING though.
````
if TYPE_CHECKING:
from openlineage.client.event_v2 import Dataset as OpenLineageDataset
from openlineage.client.facet_v2 import RunFacet, processing_engine_run
from airflow.models import TaskInstance
from airflow.sdk import DAG, MappedOperator
from airflow.sdk.execution_time.secrets_masker import (
Redactable,
Redacted,
SecretsMasker,
should_hide_value_for_key,
)
from airflow.utils.state import DagRunState, TaskInstanceState
else:
try:
from airflow.sdk import DAG, MappedOperator
except ImportError:
from airflow.models import DAG, MappedOperator
```
And yeah - usually in such cases we separate such changes to a new PR (and
it is fixed after rebasing the original one).
--
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]