(prefect-dbt)Fix source freshness logs routing to flow instead of enclosing task - #22989
Open
vyagubov wants to merge 2 commits into
Open
(prefect-dbt)Fix source freshness logs routing to flow instead of enclosing task#22989vyagubov wants to merge 2 commits into
vyagubov wants to merge 2 commits into
Conversation
…ad of enclosing task
Contributor
Author
|
Tested in local environment manually. I ran One CI test failed — it appears unrelated to this change (a |
vyagubov
marked this pull request as ready for review
August 31, 2026 13:58
vyagubov
requested review from
chrisguidry,
desertaxle and
zzstoatzz
as code owners
August 31, 2026 13:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
<link to issue>"mint.json.closes #22990
When
PrefectDbtRunner.invoke(['source', 'freshness', ...])is called inside a Prefect task, logs from source node events were routed to the flow run instead of the enclosing task.Root cause:
_process_logging_syncalways calledtask_state.get_task_logger(node_id, ...)for any event withnode_info. Fordbt buildthis works fine — a Prefect task is registered per model node via_process_node_started_sync. But_get_manifest_node_and_configonly looks inmanifest.nodes, notmanifest.sources, so source nodes duringsource freshnessnever get a task registered.get_task_run_id(node_id)returnsNone, the logger is created withtask_run_id=None, and Prefect routes those logs to the flow.Meanwhile events without
node_info(e.g. dbt startup lines) already fell back tohydrated_context(context) + get_run_logger(), which correctly restores the caller's task run context — that's whydbt depslogs appeared in the task butsource freshnessper-source logs did not.