kyupark opened a new pull request, #66698: URL: https://github.com/apache/airflow/pull/66698
## What Fix the TaskFlow context examples so they use attributes available on the runtime context objects. The current examples reference: - `task_instance.duration` - `dag_run.queued_at` Those fields are not available on the Task SDK runtime `TaskInstance` / Dag Run context objects and can raise `AttributeError` when users copy the example. ## How - Use `airflow.sdk.TaskInstance` and `airflow.sdk.types.DagRunProtocol` in the example type hints. - Keep `task_instance.run_id`. - Replace `task_instance.duration` with `task_instance.start_date`. - Replace `dag_run.queued_at` with `dag_run.logical_date`. Closes #53637. ## Tests - `defuddle parse https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/taskflow.html --md -o /tmp/airflow-taskflow-doc.md` - Extracted and compiled the Python code blocks from: - `devel-common/src/docs/shared/template-examples/taskflow.rst` - `devel-common/src/docs/shared/template-examples/taskflow-kwargs.rst` - `grep -R "task_instance.duration\|dag_run.queued_at\|ti.duration\|dr.queued_at" -n devel-common/src/docs/shared/template-examples/taskflow*.rst airflow-core/docs/core-concepts/taskflow.rst airflow-core/docs/templates-ref.rst` - `git diff --check` - `prek run --files devel-common/src/docs/shared/template-examples/taskflow.rst devel-common/src/docs/shared/template-examples/taskflow-kwargs.rst` - `breeze build-docs --docs-only --one-pass-only apache-airflow` Result: documentation build finished successfully. -- 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]
