anandhimurali commented on code in PR #38982:
URL: https://github.com/apache/airflow/pull/38982#discussion_r1666320760
##########
airflow/providers/openlineage/utils/utils.py:
##########
@@ -78,11 +78,38 @@ def get_job_name(task: TaskInstance) -> str:
def get_custom_facets(task_instance: TaskInstance | None = None) -> dict[str,
Any]:
+ from airflow.providers.openlineage.extractors.manager import
try_import_from_string
+
custom_facets = {}
# check for -1 comes from SmartSensor compatibility with dynamic task
mapping
# this comes from Airflow code
if hasattr(task_instance, "map_index") and getattr(task_instance,
"map_index") != -1:
custom_facets["airflow_mappedTask"] =
AirflowMappedTaskRunFacet.from_task_instance(task_instance)
+
+ # Append custom run facets by executing the custom_run_facets.
+ for custom_facet_func in conf.custom_run_facets():
+ func: type[function] | None = try_import_from_string(custom_facet_func)
+ if not func:
+ log.warning(
+ "OpenLineage is unable to import custom facet function `%s`;
will ignore it.",
+ custom_facet_func,
+ )
+ continue
+ facet: dict[str, BaseFacet] = func(task_instance)
Review Comment:
>I noticed that in examples here we are using attrs.asdict(), so we are
providing the facets as dicts, but here we actually expect type[BaseFacet].
Could you adjust the typing and examples so that it matches?
We expect that the functions return `dict` or `None`. Addressed the typing
error in 3790b7410a667b2cfe691b8a775d3ac0e31c6fc8.
--
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]