Skip to main content

A CLI utility to poll dbt Cloud jobs and send macOS notifications

Project description

dbt Cloud Job Poller

A Python CLI tool to poll dbt Cloud jobs and send system (macOS) notifications about their status.

Why This Exists

When working with large dbt projects, developers often need to wait for CI jobs to complete after syncing their branches with main. This tool solves two key problems:

  1. Manual Monitoring: Instead of repeatedly checking job status, get notified when your specific job completes
  2. Notification Control: Since Slack/email notifications are either unavailable for notifs specific to a run (job_id) or too noisy if set for all CI alerts, this provides targeted notifications just for your target jobs.

Simply provide your dbt Cloud PAT and Job ID, and get notified on your laptop when the job finishes.

Features

  • Poll dbt Cloud jobs and monitor their status
  • Cute terminal output with color-coded status updates
  • System notifications for job completion (aka terminal sends alerts to macOS notification center)
  • Configurable polling interval
  • Somewhat detailed job status information once complete

Project Structure

dbt-heartrate/
├── src/
│   ├── dbt_heartbeat.py      # Main Python module/entrypoint   └── utils/
│       ├── __init__.py
│       ├── dbt_cloud_api.py  # dbt Cloud API interactions       └── os_notifs.py      # macOS notifs
├── pyproject.toml
└── README.md

Prerequisites

  • Python 3.8 or higher
  • dbt Cloud account with API access (via developer PAT)
  • macOS (for system notifications)

Installation

  1. Clone the repository:
git clone git remote add origin git@github.com:jairus-m/dbt-heartbeat.git
cd dbt-heartrate
  1. Create and activate a virtual environment:
uv sync
source .venv/bin/activate
  1. Install the package in development mode:
uv pip install -e .

Configuration

Create a .env file in the project root with your dbt Cloud credentials:

DBT_CLOUD_API_KEY=your_api_key
DBT_CLOUD_ACCOUNT_ID=your_account_id

Or export them directly in your terminal session:

export DBT_CLOUD_API_KEY=your_dbt_cloud_api_key
export DBT_CLOUD_ACCOUNT_ID=your_dbt_cloud_account_id

Usage

For help:

dh --help

Poll a dbt Cloud job:

dh <job_run_id> [--log-level LEVEL] [--poll-interval SECONDS]

Arguments

  • job_run_id: The ID of the dbt Cloud job run to monitor
  • --log-level: Set the logging level (default: INFO)
    • Choices: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • --poll-interval: Time in seconds between polls (default: 30)

Example

# Poll job with default settings
dh 123456

# Poll job with debug logging and 15-second interval
dh 123456 --log-level DEBUG --poll-interval 15

Bash Output

macOS Notification

Future Work & Limitations

  1. The dbt CLoud API has a runs/ endpoint that's supposed to have a run_steps key within the data dict.
    • This would allow for dynamic output of which dbt command is running
    • Unforunately, with dbt Cloud API v2, that endpoint has been unstable and is no longer populated leading to missing functionality for a better CLI status output
  2. I focused the notifications for my MacBook and thus, have used pync which is a wrapper for terminal-notifer for macOS system notifications
    • So unfortuntaely, the current version does not support notifications for other OS systems (the CLI output should still work!)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_heartbeat-0.1.3.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_heartbeat-0.1.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file dbt_heartbeat-0.1.3.tar.gz.

File metadata

  • Download URL: dbt_heartbeat-0.1.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for dbt_heartbeat-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e4f6523c4de27cdb6a6b7c82721e54fbda78709e6fe9dd24fe5b988a5e5a3e68
MD5 90de70e417f3fea055b91468196c8a51
BLAKE2b-256 c8fb278853d9b85678aa6d6da515177f57842786f5525d4e6eb16cccdb1383f5

See more details on using hashes here.

File details

Details for the file dbt_heartbeat-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for dbt_heartbeat-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 089e493d0ec5689ef7dd6b308d7e7ee6f33fda9620d9fd3686885029a71e00ad
MD5 c78129d2a4e200b3860ea9c77b063380
BLAKE2b-256 e273e2f55a46f74563df77bfed16e0fa80015a31a34bf9d57e8ce0684629d1c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page