ferruzzi commented on code in PR #77607:
URL: https://github.com/apache/airflow/pull/77607#discussion_r4723426998
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -1374,6 +1389,7 @@ def _get_sentry_integration(executor: BaseExecutor) ->
str:
generator=executor.jwt_generator,
sentry_integration=_get_sentry_integration(executor),
log_context=log_contexts[ti.id],
+ bundle_manifests=bundle_manifests,
Review Comment:
Ah, interesting catch I missed, sorry about that. Here is the fix I have in
mind, let me know what you think before I rework the code:
- Each stored manifest gets a SHA-256 digest, written with the manifest, and
I'll add that as a column in this migration.
- The scheduler ships only a pointer: `BundleInfo` keeps the bundle name and
version it already carries, and `version_data` becomes `{"manifest_sha256":
...}`. The prefetch reads the digests instead of the manifest bodies, so the
workload size no longer depends on the bundle's file count nd `BundleInfo`
itself doesn't change.
- Since the worker can't access the db, that means we need a new Execution
API route (`GET /bundles/{bundle_name}/manifest?version=...`) which will return
the manifest for the provided version. It only serves the bundle and version
of the calling token's own TI or callback, so a token can't read another Dag's
or another team's manifests. It returns 404 for an unknown version and 403 for
one that doesn't match the token. This means I'll have to add a a Cadwyn
version change as well.
- The Task SDK gets a matching comms message and client method, following
the `GetConnection` pattern. It would swap the pointer for the fetched
manifest before the bundle is built (in `initialize_ti_bundle` and in the
callback supervisor), checks the digest, and caches manifests per (bundle,
version) for the life of the process. A digest mismatch raises
`BundleManifestError`. The bundle classes and the store's interface don't
change, so no provider changes are needed.
Which brings us to Niko's other commend about unpinned use. As the PR
stands, unpinned use is unsupported and fails with the opaque `RuntimeError`
you mentioned. I can implement the fail-early fix that you suggested, but if
we go with the new API route above it wold actually be fairly easy to add
support. For a run with no `bundle_version`, the SDK could call the same route
without `version`, get the bundle's current release and its manifest, and build
the bundle at that release. The trade-offs I can think of:
- Authorization can only check the bundle name, since the task instance has
no version to match.
- Each task resolves "current" when it starts, so tasks in one Dag run can
run different releases if a release lands mid-run. Unversioned bundles already
behave this way, and I'd document it.
- There's no scheduler digest for these runs, so the digest check adds
little beyond what the API response already guarantees.
Either way, the store keeps a fail-early `BundleManifestError` for anything
that reaches it on a worker without going through the SDK.
**Questions:**
1. Does the route shape and scoping look right, or would you rather it lived
elsewhere in the Execution API?
2. Are you comfortable with the API server resolving the current release for
unpinned runs, or should unpinned stay unsupported for now?
3. An older Task SDK would hand the pointer to the bundle as if it were a
manifest. I'd have the bundle reject a pointer-shaped `version_data` with a
clear error and document the minimum SDK version, rather than add a
compatibility path. Does that work?
I'll hold the rework until we agree on this.
--
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]