amoghrajesh commented on code in PR #76575:
URL: https://github.com/apache/airflow/pull/76575#discussion_r4546563100


##########
dev/breeze/src/airflow_breeze/commands/registry_commands.py:
##########
@@ -145,7 +145,28 @@ def extract_data(python: str, provider: str | None, 
allow_unreleased: bool):
         bring_compose_project_down(preserve_volumes=False, 
shell_params=shell_params)
         remove_docker_networks([f"{unique_project_name}_default"])
         fix_ownership_using_docker()
-    sys.exit(result.returncode)
+    if result.returncode:

Review Comment:
   Added it. The container returns 5, the command exits 5, and `run_command` 
runs once.
   Fails if the early exit goes.



##########
dev/registry/extract_parameters.py:
##########
@@ -566,17 +572,77 @@ def is_durable_capable(cls: type, resumable_mixin: type | 
None) -> bool:
     2. Genuinely implementing ResumableJobMixin's contract, where `execute()` 
(or a class it
     delegates to) calls `execute_resumable()`.
     """
+    return find_durable_source(cls, resumable_mixin) is not None
+
+
+def find_durable_source(cls: type, resumable_mixin: type | None) -> 
tuple[type, str] | None:
+    """Return the class a durable capability comes from and the mechanism it 
uses, or None."""
     declaring_cls = _find_marker_declaring_class(cls)
     if declaring_cls is not None and _delegates_execute_to(cls, declaring_cls, 
_MAX_DEFERRAL_WALK_DEPTH):
-        return True
+        return declaring_cls, DURABLE_MECHANISM_MARKER
 
     if resumable_mixin is None or resumable_mixin not in cls.__mro__:
-        return False
+        return None
 
     if inspect.isabstract(cls):
-        return False
+        return None
+
+    owner = _execute_chain_calls_resumable(cls, _MAX_DEFERRAL_WALK_DEPTH)
+    return (owner, DURABLE_MECHANISM_MIXIN) if owner is not None else None
 
-    return _execute_chain_calls_resumable(cls, _MAX_DEFERRAL_WALK_DEPTH)
+
+def _repo_relative_source(cls: type) -> Path | None:
+    try:
+        source_file = inspect.getsourcefile(cls)
+    except TypeError:
+        return None
+    if source_file is None:
+        return None
+    try:
+        return Path(source_file).resolve().relative_to(AIRFLOW_ROOT.resolve())
+    except ValueError:
+        return None
+
+
+def _provider_id_from_source(rel_path: Path) -> str | None:
+    parts = rel_path.parts
+    if not parts or parts[0] != "providers" or "src" not in parts:
+        return None
+    return "-".join(parts[1 : parts.index("src")])
+
+
+def get_durable_metadata(cls: type, resumable_mixin: type | None) -> dict:
+    """Build the durable-execution fields of a module entry."""
+    source = find_durable_source(cls, resumable_mixin)
+    if source is None:
+        return {
+            "supports_durable_execution": False,
+            "durable_mechanism": None,
+            "durable_gating_provider": None,
+            "durable_gating_class": None,
+            "durable_since_version": None,
+            "durable_opt_in": False,
+        }
+
+    declaring_cls, mechanism = source
+    # Gated by whoever ships the declaring class, not by `cls`'s own provider: 
EksPodOperator
+    # ships in amazon but inherits durability from KubernetesPodOperator in 
cncf-kubernetes.
+    rel_path = _repo_relative_source(declaring_cls)

Review Comment:
   Added it. The parent resolves under `providers/cncf/kubernetes`, the 
subclass under `providers/amazon`, and the subclass gets `cncf-kubernetes`. 
Fails with `cls`.



-- 
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]

Reply via email to