wolfier commented on issue #74009: URL: https://github.com/apache/airflow/issues/74009#issuecomment-5934820921
The task runner using the supervisor to fetch the first reschedule event can return `None`. The task runner uses the supervisor to send a message to the Task SDK. ([source](https://github.com/apache/airflow/blob/3.2.2/task-sdk/src/airflow/sdk/execution_time/task_runner.py#L503-L522)) ``` response = SUPERVISOR_COMMS.send( msg=GetTaskRescheduleStartDate(ti_id=self.id, try_number=first_try_number) ) ... return response.start_date ``` The supervisor then uses the API client to fetch the information. ([source](https://github.com/apache/airflow/blob/3.2.2/task-sdk/src/airflow/sdk/api/client.py#L303-L306)) ``` elif isinstance(msg, GetTaskRescheduleStartDate): resp = self.client.task_instances.get_reschedule_start_date(msg.ti_id, msg.try_number) ``` The actual implementation is a a database query where the return datatype can be either `UtcDateTime` or `None`. ([source](https://github.com/apache/airflow/blob/3.2.2/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_reschedules.py#L37C14-L45)) ``` @router.get("/{task_instance_id}/start_date") def get_start_date(task_instance_id: UUID, session: SessionDep) -> UtcDateTime | None: """Get the first reschedule date if found, None if no records exist.""" start_date = session.scalar( select(TaskReschedule.start_date) .where(TaskReschedule.ti_id == task_instance_id) .order_by(TaskReschedule.id.asc()) .limit(1) ) return start_date ``` The strange part that I do not understand, which I think Hem may have clarified now, is that why the call stack was missing the reference to `client.py`. I think in this case, that response / consumption of the message may have been lost and the supervisor ate up the response of another request. ``` [2026-09-18T01:16:22.215735Z] ERROR - Task failed with exception source=task loc=task_runner.py:1381 AttributeError: 'NoneType' object has no attribute 'start_date' File /usr/local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py, line 1287 in run File /usr/local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py, line 1745 in _execute_task File /usr/local/lib/python3.12/site-packages/airflow/sdk/bases/operator.py, line 443 in wrapper File /usr/local/lib/python3.12/site-packages/airflow/providers/sftp/sensors/sftp.py, line 200 in execute File /usr/local/lib/python3.12/site-packages/airflow/sdk/bases/sensor.py, line 186 in execute File /usr/local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py, line 522 in get_first_reschedule_date ``` -- 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]
