Skip to content
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

feat: add job run logs retrieval to DbtCloudHook and enhance logging in DbtCloudRunJobOperator #46946

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gavin-burns-US
Copy link

@gavin-burns-US gavin-burns-US commented Feb 21, 2025

This pull request introduces several enhancements to the dbt Cloud provider in Airflow, focusing on improving the logging and monitoring of job runs. The most important changes include adding a new method to retrieve job run logs, modifying the execution process to stream logs in real-time, and updating the execute_complete method to log final job run logs.

Enhancements to logging and monitoring:

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.
This pull request introduces new functionality to stream and log job run outputs for dbt Cloud jobs in Airflow, as well as some minor documentation improvements. The most important changes include adding a method to retrieve job run logs, modifying the execution flow to stream logs during job runs, and updating the execute_complete method to log final job run outputs.

New functionality for logging and streaming:

Documentation improvements:

These changes enhance the monitoring capabilities for dbt Cloud jobs by providing real-time log streaming and better visibility into job execution status.

…in DbtCloudRunJobOperator

- Implemented `get_job_run_logs` method in `DbtCloudHook` to retrieve logs for specific dbt Cloud job runs.
- Updated `execute_complete` method in `DbtCloudRunJobOperator` to log final job run logs.
- Enhanced job run monitoring by streaming logs during job execution, improving visibility into job status.

*Relates to apache#46923*
Surfacing of DBT Cloud Logs to the logs of the DBTCloudRunJobOperator

Signed-off-by: Gavin Burns <[email protected]>
…p logs

- Modified `get_job_run_logs` method to fetch and aggregate logs from each step of a dbt Cloud job run, improving log detail and usability.
- Updated `DbtCloudRunJobOperator` to ensure `account_id` is passed when retrieving logs, ensuring correct context for log retrieval.
- Added unit tests to verify the new log aggregation functionality and ensure `account_id` is correctly utilized, enhancing test coverage.

Signed-off-by: Gavin Burns <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant