You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "phanipaladugula (via GitHub)" <gi...@apache.org> on 2026/01/13 21:03:14 UTC
[PR] Expose TaskInstance in Task SDK public API and docs (#60478) [airflow]
phanipaladugula opened a new pull request, #60485:
URL: https://github.com/apache/airflow/pull/60485
This PR resolves issue #60478 by formally integrating the TaskInstance class into the Airflow 3.0 Task SDK public interface. While the TaskInstance model was previously defined within the internal _generated.py datamodels, it lacked public exposure, which created a gap in both user-facing type hinting and the auto-generated API documentation. To fix this, I have modified the task-sdk/src/airflow/sdk/__init__.py file to include TaskInstance in the __all__ exports, the TYPE_CHECKING block for IDE support, and the __lazy_imports dictionary to maintain the SDK's performance standards. Additionally, I updated task-sdk/docs/api.rst with the autoapiclass directive, enabling Sphinx-AutoAPI to correctly resolve the path and render the class attributes—such as run_id, map_index, and dag_version_id—in the official documentation. These changes were verified by successfully importing the class via a modified PYTHONPATH in a local environment, ensuring that users can now interact with a sta
ble, documented public API for task instances.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose TaskInstance in Task SDK public API and docs (#60478) [airflow]
Posted by "phanipaladugula (via GitHub)" <gi...@apache.org>.
phanipaladugula commented on code in PR #60485:
URL: https://github.com/apache/airflow/pull/60485#discussion_r2688164578
##########
task-sdk/src/airflow/sdk/__init__.py:
##########
@@ -158,6 +160,7 @@
"literal": ".definitions.template",
"setup": ".definitions.decorators",
"task": ".definitions.decorators",
+ "TaskInstance": ".api.datamodels._generated",
Review Comment:
Hi Kaxil! Thanks for the catch. I looked at the definition in types.py, but I initially went with the one in _generated.py because it seems to be the full model from the Execution API spec, including fields like dag_version_id and context_carrier.
Since the original issue (#60478) mentioned that the available parameters weren't documented, I thought the generated model provided the most complete attribute list for the Sphinx docs to scrape.
That said, if we want types.py to be the official public entry point, I’m happy to switch the export to point there! Should I update the PR to use the types.py version instead?"
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose TaskInstance in Task SDK public API and docs (#60478) [airflow]
Posted by "phanipaladugula (via GitHub)" <gi...@apache.org>.
phanipaladugula closed pull request #60485: Expose TaskInstance in Task SDK public API and docs (#60478)
URL: https://github.com/apache/airflow/pull/60485
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose TaskInstance in Task SDK public API and docs (#60478) [airflow]
Posted by "phanipaladugula (via GitHub)" <gi...@apache.org>.
phanipaladugula commented on code in PR #60485:
URL: https://github.com/apache/airflow/pull/60485#discussion_r2688446423
##########
task-sdk/src/airflow/sdk/__init__.py:
##########
@@ -158,6 +160,7 @@
"literal": ".definitions.template",
"setup": ".definitions.decorators",
"task": ".definitions.decorators",
+ "TaskInstance": ".api.datamodels._generated",
Review Comment:
Hi Kaxil! I have completed the updates. I reverted the changes to the __init__.py file and added a new 'Data Models' section at the end of task-sdk/docs/api.rst. I used the autoclass directive for TaskInstance and ExecutionConfig to ensure their attributes are automatically documented from the source.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose TaskInstance in Task SDK public API and docs (#60478) [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #60485:
URL: https://github.com/apache/airflow/pull/60485#discussion_r2688133746
##########
task-sdk/src/airflow/sdk/__init__.py:
##########
@@ -158,6 +160,7 @@
"literal": ".definitions.template",
"setup": ".definitions.decorators",
"task": ".definitions.decorators",
+ "TaskInstance": ".api.datamodels._generated",
Review Comment:
Why is this needed? There is already: https://github.com/phanipaladugula/airflow/blob/c4128f3d6f4891c8a0c93f84a8dbd08c1da824ea/task-sdk/src/airflow/sdk/types.py#L58-L73
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose TaskInstance in Task SDK public API and docs (#60478) [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #60485:
URL: https://github.com/apache/airflow/pull/60485#discussion_r2690378706
##########
task-sdk/src/airflow/sdk/__init__.py:
##########
@@ -158,6 +160,7 @@
"literal": ".definitions.template",
"setup": ".definitions.decorators",
"task": ".definitions.decorators",
+ "TaskInstance": ".api.datamodels._generated",
Review Comment:
I meant documented https://github.com/phanipaladugula/airflow/blob/c4128f3d6f4891c8a0c93f84a8dbd08c1da824ea/task-sdk/src/airflow/sdk/types.py#L58-L73 type not the data model
##########
task-sdk/src/airflow/sdk/__init__.py:
##########
@@ -158,6 +160,7 @@
"literal": ".definitions.template",
"setup": ".definitions.decorators",
"task": ".definitions.decorators",
+ "TaskInstance": ".api.datamodels._generated",
Review Comment:
I meant document https://github.com/phanipaladugula/airflow/blob/c4128f3d6f4891c8a0c93f84a8dbd08c1da824ea/task-sdk/src/airflow/sdk/types.py#L58-L73 type not the data model
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose TaskInstance in Task SDK public API and docs (#60478) [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #60485:
URL: https://github.com/apache/airflow/pull/60485#discussion_r2688259730
##########
task-sdk/src/airflow/sdk/__init__.py:
##########
@@ -158,6 +160,7 @@
"literal": ".definitions.template",
"setup": ".definitions.decorators",
"task": ".definitions.decorators",
+ "TaskInstance": ".api.datamodels._generated",
Review Comment:
I don't think we need to add anything in this file. Maybe in SDK docs: task-sdk/docs/api.rst but not where you have added it. Maybe add a new section for type?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org