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


##########
task-sdk/src/airflow/sdk/bases/resumablejobmixin.py:
##########
@@ -225,6 +254,51 @@ def persist_job_id(self, context: Context, external_id: 
JsonValue) -> None:
             external_id=external_id,
         )
 
+    def _record_try(
+        self,
+        context: Context,
+        decision: DurableDecision,
+        external_id: JsonValue,
+        *,
+        job_finished: bool = False,
+        previous_external_id: JsonValue = None,
+    ) -> None:
+        """Record this try for the logs banner; a finished reconnect stores 
the job's run time as saved."""
+        task_state_store = context.get("task_state_store")
+        if task_state_store is None:
+            return
+        try:
+            now = datetime.now(tz=UTC)
+            stored = task_state_store.get(DURABLE_RECORD_KEY)
+            record: dict[str, Any] = stored if isinstance(stored, dict) else {}
+            if decision in (DurableDecision.SUBMITTED, 
DurableDecision.RESUBMITTED):
+                record["submitted_at"] = now.isoformat()

Review Comment:
   Yes, good catch. Moved `submitted_at` onto each try entry. A reconnect or 
already-succeeded try copies it from the try that submitted the same job, so 
try 3 submitting B leaves try 2 with A's time. Test covers that sequence.



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