Repository navigation
Show provider version, default setting for durable operators on registry - #76575
amoghrajesh wants to merge 7 commits into
Conversation
|
|
||
| providers_payload = validate_providers_catalog({"providers": merged_providers}) | ||
| modules_payload = validate_modules_catalog({"modules": merged_modules}) | ||
| modules_payload = validate_extracted_modules_catalog({"modules": merged_modules}) |
There was a problem hiding this comment.
Could this stay on validate_modules_catalog? In CI, fill_durable_versions.py has already stripped the two internal fields by the time merge runs, so the extracted contract only drops the extra="forbid" check on what we publish, and nothing else calls validate_modules_catalog now.
There was a problem hiding this comment.
Back on validate_modules_catalog. Added a test that merge rejects durable_mechanism and durable_gating_class.
|
Could you refresh the PR description before merge? It still describes the first version:
|
|
@kaxil Updated the description: fields table, the dating section, and git failures. |
|
Do you want to try around the thing we discussed on Slack about a Operators page with filter for various things? |
|
Yes, I am on it |
|
@kaxil gentle bump on this one. I've addressed the last round: the merge step now runs from the workflow's checkout so older waves can still re-publish, plus the tests you asked for. Mind taking another look when you get a chance? Heads up: this overlaps with #77143. Happy to rebase whichever lands second and move the badges onto the new Operators page. |
| DURABLE_SOURCE = "\n".join( | ||
| f"class {name}:\n def execute(self, task_state_store):\n return self.execute_resumable()\n" | ||
| for name in ("Op", "KubernetesPodOperator") | ||
| ) | ||
|
|
There was a problem hiding this comment.
| DURABLE_SOURCE = "\n".join( | |
| f"class {name}:\n def execute(self, task_state_store):\n return self.execute_resumable()\n" | |
| for name in ("Op", "KubernetesPodOperator") | |
| ) | |
| _DURABLE_CLASS_TEMPLATE = textwrap.dedent( | |
| """\ | |
| class {name}: | |
| def execute(self, task_state_store): | |
| return self.execute_resumable() | |
| """ | |
| ) | |
| DURABLE_SOURCE = "\n".join( | |
| _DURABLE_CLASS_TEMPLATE.format(name=name) for name in ("Op", "KubernetesPodOperator") | |
| ) |
I think it's easier to read this way
|
|
||
| return _execute_chain_calls_resumable(cls, _MAX_DEFERRAL_WALK_DEPTH) | ||
|
|
||
| def _repo_relative_source(cls: type) -> Path | None: |
There was a problem hiding this comment.
| def _repo_relative_source(cls: type) -> Path | None: | |
| def _find_source_path_in_repo(cls: type) -> Path | None: |
| return None | ||
|
|
||
|
|
||
| def _provider_id_from_source(rel_path: Path) -> str | None: |
There was a problem hiding this comment.
| def _provider_id_from_source(rel_path: Path) -> str | None: | |
| def _find_provider_id(rel_path: Path) -> str | None: |
| return first_releases | ||
|
|
||
|
|
||
| def durable_group(module: dict) -> tuple[str, str, str, str] | None: |
There was a problem hiding this comment.
| def durable_group(module: dict) -> tuple[str, str, str, str] | None: | |
| def find_durable_group(module: dict) -> tuple[str, str, str, str] | None: |
also making it a named tuple will be easier to read
class DurableGroup(NamedTuple):
provider_id: str
token: str
source_path: str
class_name: str
What
The Registry marks an operator as supporting durable execution, and stops there. A Dag author still cannot tell which provider version they need, or whether the operator ships with durable execution switched off. Both facts are already derivable from the sources the extraction pipeline reads, so nobody should have to open a changelog for them.
Current behaviour
listModulescarries one durable field,supports_durable_execution. The/durable/page shows a badge and a hardcoded sentence in the legend saying durability is "on by default for most, opt-in for the AI agent operators", which has to be edited by hand every time that stops being true.Proposed change
Three derived fields on each module entry:
durable_gating_providerdurable_since_versiondurable_opt_intrueonly where the operator declaresdurable: bool = False, so you have to passdurable=TrueyourselfNothing here is declared by a provider maintainer. It is all read from the classes at extraction time.
The extraction also emits
durable_mechanism(markerorresumable_mixin) anddurable_gating_class, which tell the dating step which file to search.fill_durable_versions.pydrops both once it has the version, so they never reach/api/modules.jsonor the published OpenAPI schema.The
/durable/page shows the version and the opt-in state as badges beside the existing Durable one, and the hardcoded legend sentence is gone.Changes of Note
Why a gating provider. Four operators inherit durability from a base class in another provider.
EksPodOperatorships inamazonand gets durability fromKubernetesPodOperatorincncf-kubernetes, so an amazon version number says nothing about it. Its badge readscncf-kubernetes 10.20.0+, and the provider name appears only when it differs from the one the module ships in.How the version is found. One
git grepacross a provider's release tags returns every release whose copy of the gating class's file contains the mechanism, and the lowest wins. I tried two other alternatives and dropped them.a) Parsing changelogs gets 6 of 9 providers right: Livy's entry reads "Reconnect to the running Livy batch on retry instead of resubmitting" and never says durable
b) Broader keyword matching hits 2021 entries about
reattach_on_restartand dates Kubernetes to 2.0.3. Bisecting withgit showper release works but costs seven calls per operator and assumes the capability was added once and kept.Why the mechanism and not the marker. Dating a marker operator by its
__supports_durable_executiondeclaration reports when it was advertised, not when it worked.KubernetesPodOperatorreconnected throughtask_state_storein 10.20.0 and only declared the marker in 10.21.0. The marker pattern also matchesdurable: bool, since an operator can take the flag before it moves totask_state_store:AgentOperatorhaddurablein common-ai 0.1.0, keeping its journal in ObjectStorage, and only moved totask_state_storein 0.7.0. Whichever appears first dates it.ResumableJobMixinoperators are dated byexecute_resumable.Why
durable_opt_inand not the declared default. "On by default" is written two ways:durable: bool = True(PowerBIDatasetRefreshOperator, throughResumableJobMixin) anddurable: bool | None = Noneresolved in__init__(KubernetesPodOperator). Exposing the raw default would give API readerstrueandnullfor the same answer, so the field is a plain bool that istrueonly for an explicitFalse.Why the version lookup runs on the host. Breeze does not mount
.git, so a git command inside the container sees nothing.fill_durable_versions.pyruns after the container step andbreeze registry extract-datadrives both. A failed container run stops before the dating step, so it never dates a stalemodules.json. A checkout with noproviders-*tags leavesdurable_since_versionnull and says so. Any other git failure raises with git's stderr and exits 1.User implications / backcompat
All three fields default to null or false, so previously generated
modules.jsonfrom S3 still validates against the contract and the incremental build path is unaffected. No provider API changes.Re-publishing a wave tagged before this merges would otherwise fail: its merge step validates the S3 catalog, which main has written with the new fields, against the tag's own
extra="forbid"contract, and a failed registry step also skips the docs sync. The merge step now runs from the workflow's checkout rather than the tag, the same waymake_mnt_writeable.shalready does, so the contract always matches the data in the bucket. Re-publishing an old wave writes that wave's modules without the new fields, and their badges come back on the next publish from main.Testing and some screenshots
Extraction run through Breeze across
cncf-kubernetes,amazon,common-ai,apache-livyand
microsoft-azure(654 modules, 12 durable). Every version below was then checkedagainst
git show <tag>:<file>independently of the new code:related: #67236
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.