Lee-W commented on code in PR #68713:
URL: https://github.com/apache/airflow/pull/68713#discussion_r3490885272
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:
##########
@@ -198,6 +198,60 @@ def start(self) -> None:
scheduler_job_id=self.scheduler_job_id,
)
+ def _coordinator_extra(self, queue: str | None) -> dict[str, Any] | None:
+ """
+ Return the ``extra`` mapping a coordinator declares for *queue*, if
any.
+
+ Read from the coordinator's declarative ``[sdk]`` config without
importing
+ or instantiating the coordinator. The coordinator manager only exists
on
+ Airflow 3.3+; on older Task SDKs the import fails and we fall back to
no
+ extra. A malformed ``[sdk] coordinators`` / ``queue_to_coordinator``
config
+ must not crash the scheduler on this first lookup either, so an invalid
+ config also falls back to no extra. The exception types are imported
from
+ ``airflow.sdk`` so they match whatever Task SDK actually raised them.
+ """
+ if not queue:
+ return None
+ try:
+ from airflow.sdk.exceptions import AirflowConfigException
+ from airflow.sdk.execution_time.coordinator import
get_coordinator_manager
+ except ImportError:
+ return None
+ try:
+ return get_coordinator_manager().extra_for_queue(queue)
+ except (AirflowConfigException, ValueError):
+ self.log.warning(
+ "Ignoring coordinator config for queue %s: invalid [sdk]
coordinator config",
+ queue,
+ exc_info=True,
+ )
+ return None
+
+ def _coordinator_pod_template_file(self, extra: dict[str, Any]) -> str |
None:
Review Comment:
why do we need a dedicate function for this insetad of just using `get`?
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:
##########
@@ -198,6 +198,60 @@ def start(self) -> None:
scheduler_job_id=self.scheduler_job_id,
)
+ def _coordinator_extra(self, queue: str | None) -> dict[str, Any] | None:
Review Comment:
nit: these look like properties to me. Should we make it properties or
rename these?
--
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]