Skip to content

spark_on_k8s.airflow.ui_config

Implementation reference. These symbols describe how the project works; their presence here does not make them supported application imports. Use the documented entry points and support policy.

UISettings dataclass

Source code in spark_on_k8s/airflow/ui_config.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@dataclass(frozen=True)
class UISettings:
    service_url: str
    allow_writes: bool = False
    public_url: str | None = None
    # Display scoping only: the backend verifies each task's operator lineage itself.
    operator_subclasses: tuple[str, ...] = ()
    snapshot_ttl: float = DEFAULT_SNAPSHOT_TTL

    @classmethod
    def from_environment(cls) -> UISettings:
        return cls(
            service_url=normalize_service_url(getenv("SPARK_ON_K8S_AIRFLOW_SERVICE_URL", "")),
            public_url=normalize_service_url(getenv("SPARK_ON_K8S_AIRFLOW_PUBLIC_URL"))
            if getenv("SPARK_ON_K8S_AIRFLOW_PUBLIC_URL")
            else None,
            allow_writes=getenv("SPARK_ON_K8S_AIRFLOW_ALLOW_WRITES", "false").lower() == "true",
            operator_subclasses=parse_operator_subclasses(getenv("SPARK_ON_K8S_AIRFLOW_OPERATOR_SUBCLASSES")),
            snapshot_ttl=parse_snapshot_ttl(getenv("SPARK_ON_K8S_AIRFLOW_SNAPSHOT_TTL")),
        )

    @property
    def task_operators(self) -> list[str]:
        """Operator class names whose task instances show the native tab."""
        return [*PROVIDER_OPERATORS, *self.operator_subclasses]

task_operators property

Operator class names whose task instances show the native tab.