uranusjr commented on code in PR #71757:
URL: https://github.com/apache/airflow/pull/71757#discussion_r4346990387
##########
scripts/ci/prek/lang_sdk_compat_matrix.py:
##########
@@ -88,54 +100,136 @@ class Capability(NamedTuple):
Capability("asset-state-store", "MAY", "runtime", False),
Capability("asset-event-emit", "MAY", "runtime", False),
Capability("asset-event-read", "MAY", "runtime", False),
- Capability(NATIVE_DAG_GATE, "SHOULD", "native", False),
- Capability("task-args", "MUST", "native", True),
- Capability("dag-params", "MUST", "native", True),
- Capability("taskflow-dependencies", "MUST", "native", True),
- Capability("branching", "SHOULD", "native", True),
- Capability("dag-test", "SHOULD", "native", True),
- Capability("task-group", "MAY", "native", True),
- Capability("dynamic-task-mapping", "MAY", "native", True),
- Capability("asset-inlets-outlets", "MAY", "native", True),
- Capability("asset-scheduling", "MAY", "native", True),
- Capability("object-store", "MAY", "native", True),
+ Capability("object-store", "MAY", "runtime", False),
+ Capability(DAG_DEFINITION_GATE, "SHOULD", "dag-definition", False),
+ Capability("dag-args", "MUST", "dag-definition", True),
+ Capability("task-args", "MUST", "dag-definition", True),
+ Capability("dag-params", "MUST", "dag-definition", True),
+ Capability("explicit-dependencies", "MUST", "dag-definition", True),
+ Capability("edge-labels", "MAY", "dag-definition", True),
+ Capability("taskflow-dependencies", "MUST", "dag-definition", True),
+ Capability("task-group", "MAY", "dag-definition", True),
+ Capability("task-loops", "MAY", "dag-definition", True),
+ Capability("if-else-branching", "SHOULD", "dag-definition", True),
+ Capability("switch-case-branching", "SHOULD", "dag-definition", True),
+ Capability("trigger-dag-run", "MAY", "dag-definition", True),
+ Capability("dynamic-dag-generation", "MAY", "dag-definition", True),
+ Capability("human-in-the-loop", "MAY", "dag-definition", True),
+ Capability("dag-test", "SHOULD", "dag-definition", True),
+ Capability("asset-definition", "MAY", "dag-definition", True),
+ Capability("asset-scheduling", "MAY", "dag-definition", True),
+ Capability("mixed-lang-stub-target", "MUST", "stub-task-handler", False),
+ Capability("taskflow-binding", "MUST", "stub-task-handler", False),
+ Capability("dynamic-task-mapping", "MAY", "shared", True),
+ Capability("asset-inlets-outlets", "MAY", "shared", True),
]
CAPABILITY_NAMES = {cap.name for cap in CAPABILITY_DIMENSIONS}
-
-GROUP_LABELS = {"runtime": "Runtime capabilities", "native": "Native-Dag
authoring"}
-STATES_GROUP_LABEL = "TaskInstance states"
+SHARED_CAPABILITY_NAMES = {cap.name for cap in CAPABILITY_DIMENSIONS if
cap.group == "shared"}
LEGEND = (
f"Marks: {SUPPORTED_MARK} supported · {UNSUPPORTED_MARK} not supported · "
- f"{NA_MARK} not applicable. A tier marked † applies only when
`{NATIVE_DAG_GATE}` is supported."
+ f"{NA_MARK} not applicable. A tier marked † applies only when
`{DAG_DEFINITION_GATE}` is supported."
)
+class MatrixRow(NamedTuple):
+ kind: RowKind
+ name: str
+ tier: Tier
+ gated: bool
+ mode: Mode | None # the authoring mode whose entry a shared capability
shows
+
+ @property
+ def entry_key(self) -> EntryKey:
+ # Only a shared capability carries one entry per authoring mode; every
other dimension is
+ # declared once, so its mode is dropped from the key.
+ return self.name, (self.mode if self.name in SHARED_CAPABILITY_NAMES
else None)
+
+
+GATE_KEY: Final[EntryKey] = (DAG_DEFINITION_GATE, None)
+
+
+class MatrixGroup(NamedTuple):
+ label: str
+ rows: list[MatrixRow]
+
+
+class MatrixPart(NamedTuple):
+ title: str
+ groups: list[MatrixGroup]
+
+
+def _build_capability_rows(groups: tuple[Group, ...], mode: Mode | None) ->
list[MatrixRow]:
+ return [
+ MatrixRow("capability", cap.name, cap.tier, cap.gated and mode !=
STUB_TASK_HANDLER_MODE, mode)
Review Comment:
Only shared capabilities need a mode on their entry key, so set it only for
them here:
```suggestion
MatrixRow(
"capability",
cap.name,
cap.tier,
cap.gated and mode != STUB_TASK_HANDLER_MODE,
mode if cap.group == "shared" else None,
)
```
Then `entry_key` (L144–147) can just be `return self.name, self.mode`, and
it doesn’t need the `SHARED_CAPABILITY_NAMES` check.
--
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]