-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Thread version_data to callbacks #69185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ | |
|
|
||
| import logging | ||
| from datetime import datetime | ||
| from typing import TYPE_CHECKING | ||
| from typing import TYPE_CHECKING, Any | ||
| from uuid import UUID | ||
|
|
||
| import sqlalchemy as sa | ||
|
|
@@ -235,3 +235,21 @@ def get_version( | |
| def version(self) -> str: | ||
| """A human-friendly representation of the version.""" | ||
| return f"{self.dag_id}-{self.version_number}" | ||
|
|
||
|
|
||
| def resolve_pinned_version_data( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor nit: should this be |
||
| dag_version: DagVersion | None, bundle_version: str | None | ||
| ) -> dict[str, Any] | None: | ||
| """ | ||
| Return a bundle version's ``version_data`` manifest, but only for pinned runs. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sam here. I would keep the first line. Leave any detailed explanations for the comments. |
||
|
|
||
| Mirrors the bundle-version pinning rule used when building task and callback | ||
| workloads: ``version_data`` is exposed only when the run is pinned | ||
| (``bundle_version`` is set) and a ``DagVersion`` is available, so the worker | ||
| initializes the bundle against the exact version the run used. Returns ``None`` | ||
| for unpinned runs (which should follow the latest bundle state) and for legacy | ||
| rows without a ``DagVersion``. | ||
| """ | ||
| if dag_version is not None and bundle_version is not None: | ||
| return dag_version.version_data | ||
| return None | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep only the first line. The docstring under each parameter is only intended to explain what the field is. Not its inner workings.