kaxil commented on code in PR #76833:
URL: https://github.com/apache/airflow/pull/76833#discussion_r4649164501
##########
task-sdk/src/airflow/sdk/bases/resumablejobmixin.py:
##########
@@ -225,6 +263,74 @@ def persist_job_id(self, context: Context, external_id:
JsonValue) -> None:
external_id=external_id,
)
+ def _record_reconnect_outcome(self, context: Context, external_id:
JsonValue) -> None:
+ """Record the reconnected job's status once polling returns, which may
be before the job ends."""
+ try:
+ job_status = self.get_job_status(external_id, context)
+ except Exception:
+ self.log.warning("Could not read job status for durable execution
history", exc_info=True)
+ return
+ if self.is_job_succeeded(job_status):
+ self._record_try(context, DurableDecision.RECONNECTED,
external_id, status="success")
+ elif not self.is_job_active(job_status):
Review Comment:
This also fires when the poll returned normally on a terminal state the
operator treats as done. SageMaker training with `print_log=False` accepts
`Stopped`, and SparkSubmit on K8s returns once the driver pod is gone. The task
goes green but the banner says the job failed. Should a normal return with an
inactive job count as `success` here?
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state_store.py:
##########
@@ -193,6 +196,10 @@ def list_task_state_store(
limit: QueryLimit,
offset: QueryOffset,
session: SessionDep,
+ include_reserved: Annotated[
Review Comment:
I missed this earlier, sorry. As a plain query param this lands ahead of
`map_index`, `region_id` and `region_index` in the generated spec, and this
endpoint shipped in 3.3, so a generated-client call passing `map_index`
positionally now sets `include_reserved`. Could it go after the scope params
and into `test_released_query_parameters_keep_their_order`?
##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.tsx:
##########
@@ -285,6 +286,7 @@ export const Logs = () => {
return (
<Box display="flex" flexDirection="column" h="100%" p={2}>
+ {historical ? undefined : <DurableBanner taskInstance={taskInstance}
tryNumber={tryNumber} />}
Review Comment:
I missed this earlier, sorry. `historical` is true whenever the URL has
`try_number`, `region_id` and `region_index` and the try isn't the live one,
which is every earlier try of a task in a loop or a region-mapped expansion. So
for those tasks try 2's reconnect banner disappears once try 3 exists, while
plain tasks keep it. The record is already matched by `tryNumber`, so is this
guard needed?
##########
task-sdk/src/airflow/sdk/bases/resumablejobmixin.py:
##########
@@ -132,12 +151,31 @@ def execute_resumable(self, context: Context) -> Any:
decision = self.get_resume_decision(context)
if decision.action == "reconnect":
- return self.poll_until_complete(decision.external_id, context)
+ self._record_try(context, DurableDecision.RECONNECTED,
decision.external_id, status="running")
Review Comment:
Same for ADF, dbt Cloud and the Databricks Notebook/Task operators with
`deferrable=True`: their `poll_until_complete` defers and none of their
`execute_complete` touches the record. So it's every deferrable adopter, not
only PowerBI, that leaves a reconnected try on `running`.
--
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]