rowmonitor-runcheck 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. rowmonitor_runcheck-0.1.0/.github/workflows/ci.yml +42 -0
  2. rowmonitor_runcheck-0.1.0/.github/workflows/e2e.yml +58 -0
  3. rowmonitor_runcheck-0.1.0/.github/workflows/publish.yml +29 -0
  4. rowmonitor_runcheck-0.1.0/.gitignore +18 -0
  5. rowmonitor_runcheck-0.1.0/LICENSE +21 -0
  6. rowmonitor_runcheck-0.1.0/PKG-INFO +264 -0
  7. rowmonitor_runcheck-0.1.0/README.md +233 -0
  8. rowmonitor_runcheck-0.1.0/pyproject.toml +55 -0
  9. rowmonitor_runcheck-0.1.0/scripts/dbt-fixture/dbt_project.yml +5 -0
  10. rowmonitor_runcheck-0.1.0/scripts/dbt-fixture/generate.sh +26 -0
  11. rowmonitor_runcheck-0.1.0/scripts/dbt-fixture/models/after_broken.sql +1 -0
  12. rowmonitor_runcheck-0.1.0/scripts/dbt-fixture/models/broken.sql +1 -0
  13. rowmonitor_runcheck-0.1.0/scripts/dbt-fixture/models/orders.sql +1 -0
  14. rowmonitor_runcheck-0.1.0/scripts/dbt-fixture/models/schema.yml +20 -0
  15. rowmonitor_runcheck-0.1.0/scripts/dbt-fixture/profiles.yml +7 -0
  16. rowmonitor_runcheck-0.1.0/scripts/e2e/check_dbt_fixture.py +75 -0
  17. rowmonitor_runcheck-0.1.0/scripts/e2e/dags/runcheck_fail.py +20 -0
  18. rowmonitor_runcheck-0.1.0/scripts/e2e/dags/runcheck_ok.py +20 -0
  19. rowmonitor_runcheck-0.1.0/scripts/e2e/run_airflow.sh +495 -0
  20. rowmonitor_runcheck-0.1.0/scripts/e2e/webhook_catcher.py +47 -0
  21. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/__init__.py +3 -0
  22. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/__main__.py +4 -0
  23. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/airflow.py +411 -0
  24. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/cli.py +279 -0
  25. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/dbt_results.py +116 -0
  26. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/dedupe.py +58 -0
  27. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/errors.py +21 -0
  28. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/notify.py +136 -0
  29. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/problems.py +23 -0
  30. rowmonitor_runcheck-0.1.0/src/rowmonitor_runcheck/timeutil.py +71 -0
  31. rowmonitor_runcheck-0.1.0/tests/__init__.py +0 -0
  32. rowmonitor_runcheck-0.1.0/tests/conftest.py +38 -0
  33. rowmonitor_runcheck-0.1.0/tests/fakes.py +134 -0
  34. rowmonitor_runcheck-0.1.0/tests/fixtures/airflow/v1_dag_runs.json +21 -0
  35. rowmonitor_runcheck-0.1.0/tests/fixtures/airflow/v2_dag_runs.json +30 -0
  36. rowmonitor_runcheck-0.1.0/tests/fixtures/dbt/run_results.json +276 -0
  37. rowmonitor_runcheck-0.1.0/tests/server.py +72 -0
  38. rowmonitor_runcheck-0.1.0/tests/test_airflow.py +609 -0
  39. rowmonitor_runcheck-0.1.0/tests/test_dbt.py +193 -0
  40. rowmonitor_runcheck-0.1.0/tests/test_docs.py +45 -0
@@ -0,0 +1,42 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ # ubuntu-latest is 26.04, and actions/setup-python has no CPython 3.9
14
+ # build for that image. 3.9 is still published for 24.04.
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ include:
20
+ - python-version: "3.9"
21
+ os: ubuntu-24.04
22
+ - python-version: "3.12"
23
+ os: ubuntu-latest
24
+ - python-version: "3.13"
25
+ os: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Install
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ python -m pip install -e ".[dev]"
35
+ - name: Lint
36
+ run: |
37
+ ruff check .
38
+ ruff format --check .
39
+ - name: Unit tests
40
+ run: pytest
41
+ - name: Console script
42
+ run: rowmonitor-runcheck --help
@@ -0,0 +1,58 @@
1
+ name: e2e
2
+
3
+ on:
4
+ pull_request:
5
+ workflow_dispatch:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ concurrency:
11
+ group: e2e-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ airflow:
16
+ name: airflow (${{ matrix.name }})
17
+ runs-on: ubuntu-latest
18
+ timeout-minutes: 30
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ include:
23
+ - name: "2.10.5"
24
+ script_arg: "2"
25
+ image: apache/airflow:2.10.5
26
+ - name: "3.4.0"
27
+ script_arg: "3"
28
+ image: apache/airflow:3.4.0
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: actions/setup-python@v5
32
+ with:
33
+ python-version: "3.12"
34
+ - name: Install
35
+ run: |
36
+ python -m pip install --upgrade pip
37
+ python -m pip install -e .
38
+ - name: Live Airflow check
39
+ env:
40
+ AIRFLOW2_IMAGE: ${{ matrix.image }}
41
+ AIRFLOW3_IMAGE: ${{ matrix.image }}
42
+ run: bash scripts/e2e/run_airflow.sh "${{ matrix.script_arg }}"
43
+
44
+ dbt-fixture:
45
+ name: dbt fixture
46
+ runs-on: ubuntu-latest
47
+ timeout-minutes: 10
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+ - uses: actions/setup-python@v5
51
+ with:
52
+ python-version: "3.12"
53
+ - name: Install
54
+ run: |
55
+ python -m pip install --upgrade pip
56
+ python -m pip install -e .
57
+ - name: Check the dbt Core fixture
58
+ run: python scripts/e2e/check_dbt_fixture.py
@@ -0,0 +1,29 @@
1
+ # Manual PyPI publish. CI does not call this workflow.
2
+ # Trigger it with workflow_dispatch only after an explicit decision to publish.
3
+ name: Publish to PyPI
4
+
5
+ on:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ publish:
13
+ name: Publish
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+ permissions:
17
+ id-token: write
18
+ contents: read
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+ - name: Build
25
+ run: |
26
+ python -m pip install --upgrade pip build
27
+ python -m build
28
+ - name: Publish
29
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,18 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ dist/
8
+ build/
9
+ .coverage
10
+ htmlcov/
11
+ *.duckdb
12
+ target/
13
+ logs/
14
+ dbt_packages/
15
+ runcheck-state.json
16
+ scripts/dbt-fixture/target/
17
+ scripts/dbt-fixture/logs/
18
+ scripts/dbt-fixture/dbt_packages/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kharipara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.5
2
+ Name: rowmonitor-runcheck
3
+ Version: 0.1.0
4
+ Summary: Check the last Airflow DAG run or dbt Core invocation and send a short alert.
5
+ Project-URL: Homepage, https://github.com/kharipara/rowmonitor-runcheck
6
+ Project-URL: Documentation, https://github.com/kharipara/rowmonitor-runcheck#readme
7
+ Project-URL: Airflow, https://rowmonitor.com/airflow?utm_source=runcheck&utm_medium=readme
8
+ Project-URL: Signup, https://rowmonitor.com/signup?utm_source=runcheck&utm_medium=readme
9
+ Author: kharipara
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: airflow,alerts,dbt
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: System :: Monitoring
25
+ Requires-Python: >=3.9
26
+ Requires-Dist: requests<3,>=2.31
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.4; extra == 'dev'
29
+ Requires-Dist: ruff>=0.6; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # rowmonitor-runcheck
33
+
34
+ A free, open-source Python CLI that answers one question: did my last pipeline run work?
35
+
36
+ It checks the latest run of named Airflow DAGs over the Airflow REST API, or reads a dbt Core `target/run_results.json`, and can post a short alert to a Slack incoming webhook or any endpoint that accepts a JSON POST.
37
+
38
+ There is no account and no telemetry. Network calls go only to the Airflow base URL you pass and the webhooks you configure. An optional local state file remembers the last alert so the same problem is not posted on every run. That file is dedupe state, not a run history.
39
+
40
+ ## Install
41
+
42
+ Python 3.9 or newer. The only runtime dependency is `requests`.
43
+
44
+ ```bash
45
+ pip install .
46
+ rowmonitor-runcheck --help
47
+ ```
48
+
49
+ Install from a checkout of this repository. Publishing to PyPI is a separate manual workflow and is not part of CI.
50
+
51
+ ## Check Airflow
52
+
53
+ ```bash
54
+ export AIRFLOW_USERNAME="admin"
55
+ export AIRFLOW_PASSWORD="..."
56
+ rowmonitor-runcheck airflow \
57
+ --url https://airflow.example.com \
58
+ --dag orders_daily \
59
+ --dag billing_hourly \
60
+ --max-age 26h \
61
+ --slack-webhook "$SLACK_WEBHOOK_URL"
62
+ ```
63
+
64
+ The command alerts when:
65
+
66
+ - the latest DAG run has state `failed`
67
+ - `--max-age` is set and the last successful run is older than that cutoff, or the DAG has never succeeded
68
+ - the API is unreachable, authentication fails, or the DAG is not found
69
+
70
+ `--max-age` takes one cutoff such as `30s`, `45m`, `26h`, or `2d`. A run that finished exactly that long ago is still inside the window. Omit `--max-age` to alert only on a failed latest run, an unreachable API, an authentication failure, or a missing DAG.
71
+
72
+ ### Airflow 2.6 and newer
73
+
74
+ Uses `GET /api/v1/dags/{dag_id}/dagRuns` with HTTP basic auth from `AIRFLOW_USERNAME` and `AIRFLOW_PASSWORD`.
75
+
76
+ The Airflow API has to accept basic auth:
77
+
78
+ ```text
79
+ AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.basic_auth
80
+ ```
81
+
82
+ ```bash
83
+ rowmonitor-runcheck airflow \
84
+ --url https://airflow.example.com \
85
+ --api-version v1 \
86
+ --dag orders_daily \
87
+ --max-age 26h
88
+ ```
89
+
90
+ ### Airflow 3
91
+
92
+ Uses `GET /api/v2/dags/{dag_id}/dagRuns` with a bearer JWT.
93
+
94
+ With a username and password, the CLI calls `POST /auth/token` and sends the returned `access_token`. With `AIRFLOW_TOKEN` already set, that token is sent as `Authorization: Bearer` and `/auth/token` is not called. When both are set, the pre-issued token wins.
95
+
96
+ ```bash
97
+ export AIRFLOW_TOKEN="..."
98
+ rowmonitor-runcheck airflow \
99
+ --url https://airflow.example.com \
100
+ --api-version v2 \
101
+ --dag orders_daily \
102
+ --max-age 26h \
103
+ --webhook "$RUNCHECK_WEBHOOK_URL"
104
+ ```
105
+
106
+ `--api-version` is `auto` by default, or `v1` / `v2` (the leading `v` is optional). Auto-detect requests `/api/v2/version`, then `/api/v1/version`. A v1 server that answers 401 on the version route and has no v2 version route is treated as v1.
107
+
108
+ Pass the webserver origin as `--url`. A trailing `/api/v1` or `/api/v2` is stripped. Credentials belong in the environment, not in the URL. The CLI does not write the username, password, token, or webhook URL into logs, alert bodies, or the state file.
109
+
110
+ ### Managed Airflow
111
+
112
+ These products use their own login. This CLI does not call AWS, Google, or Astronomer APIs. If you already hold a bearer token, pass it as `AIRFLOW_TOKEN`.
113
+
114
+ **Amazon MWAA.** MWAA does not accept Airflow basic auth or `POST /auth/token` with an Airflow username and password. Access is the `airflow:InvokeRestApi` AWS API, or a short-lived web login token exchanged for a session JWT. Airflow 3 on MWAA expects `Authorization: Bearer <jwt>` on `/api/v2`. Mint that token with AWS, then pass it as `AIRFLOW_TOKEN` and set `--api-version v2`.
115
+
116
+ **Google Cloud Composer.** Composer uses its own auth backend. Airflow 2 speaks REST v1 and Airflow 3 speaks REST v2, and the credential is a Google OAuth or OIDC bearer token. Pass a token you already have as `AIRFLOW_TOKEN` for an Airflow 3 environment. Composer 2's default auth is not Airflow basic auth.
117
+
118
+ **Astronomer.** Astronomer Software and Astro use a deployment API key or token. Airflow 3 on Astro is `/api/v2`. Pass that token as `AIRFLOW_TOKEN`.
119
+
120
+ Self-hosted Airflow 2.6 or newer with basic auth, and self-hosted Airflow 3 whose auth manager implements `POST /auth/token`, are the setups this command is built for.
121
+
122
+ ## Check dbt Core
123
+
124
+ dbt Cloud is not supported. The command reads a `run_results.json` that dbt Core has already written:
125
+
126
+ ```bash
127
+ rowmonitor-runcheck dbt \
128
+ --run-results target/run_results.json \
129
+ --slack-webhook "$SLACK_WEBHOOK_URL"
130
+ ```
131
+
132
+ A node whose status is `error`, `fail`, or `runtime error` raises an alert. `--fail-on warn` also alerts on `warn`.
133
+
134
+ A node skipped because an upstream node failed is included. dbt Core 1.12 records that skip with status `skipped`, an empty `message`, and `compiled: false`. Older artifacts that describe the upstream failure in `message`, including an ephemeral-model failure, are included too, as is a `--fail-fast` skip (`Skipping due to fail_fast`). A skip that carries some other message is left alone. `pass`, `success`, and `no-op` are quiet.
135
+
136
+ Compiled SQL is not copied into the alert. The node id, status, and dbt's message are.
137
+
138
+ ### Run it after dbt build
139
+
140
+ dbt's `on-run-end` hook runs SQL inside the warehouse. It cannot start this process. The working pattern is a shell wrapper immediately after `dbt build`, `dbt run`, or `dbt test`.
141
+
142
+ `dbt build && rowmonitor-runcheck ...` skips the alert whenever dbt exits non-zero, which is the run you most want to hear about. dbt still writes `run_results.json` when a model or test fails, as long as the invocation gets far enough to execute nodes. If dbt cannot start, there may be no new file and this CLI exits 2.
143
+
144
+ ```bash
145
+ #!/bin/sh
146
+ set -u
147
+ dbt build "$@"
148
+ dbt_status=$?
149
+ rowmonitor-runcheck dbt --run-results target/run_results.json
150
+ check_status=$?
151
+ if [ "$dbt_status" -ne 0 ]; then
152
+ exit "$dbt_status"
153
+ fi
154
+ exit "$check_status"
155
+ ```
156
+
157
+ `tests/fixtures/dbt/run_results.json` is a real artifact from dbt Core 1.12.7 and dbt-duckdb 1.11.1, produced by `scripts/dbt-fixture`. That project has a model that errors, a downstream model skipped because of it, a failing `accepted_values` test, a warning test, and two passing tests. Regenerate the fixture with `scripts/dbt-fixture/generate.sh` when those packages are installed. `dbt build` there exits 1 on purpose.
158
+
159
+ ## Alerts
160
+
161
+ `--dry-run` prints one JSON document and does not POST. `slack` is the exact `{"text": ...}` body when a Slack webhook is configured and a problem was found, otherwise null. `webhook` is the exact generic body when a generic webhook is configured and a problem was found, otherwise null. `preview` is always the generic body, so a dry run with no destination still shows the alert. `would_post` is true only when a real run would POST. `deduped` means the state file already holds this problem set, so a real run would not POST.
162
+
163
+ A real run prints one summary line per problem. When every check passes it prints a short ok line and does not POST. A success is not sent as a recovery message.
164
+
165
+ Slack text from the CLI looks like this:
166
+
167
+ ```text
168
+ rowmonitor-runcheck: 2 problems
169
+ • orders_daily: latest run failed (run scheduled__2026-11-24T00:00:00+00:00, ended 2026-11-24T00:12:00+00:00)
170
+ • billing_hourly: no successful run
171
+
172
+ Want run history, late vs never-arrived detection and table-level checks? Row Monitor watches the data itself: https://rowmonitor.com/airflow?utm_source=runcheck&utm_medium=cli
173
+ Sign up: https://rowmonitor.com/signup?utm_source=runcheck&utm_medium=cli
174
+ ```
175
+
176
+ The generic webhook receives:
177
+
178
+ ```json
179
+ {
180
+ "source": "rowmonitor-runcheck",
181
+ "version": "0.1.0",
182
+ "check": "airflow",
183
+ "ok": false,
184
+ "generated_at": "2026-11-25T12:00:00+00:00",
185
+ "base_url": "https://airflow.example.com",
186
+ "api_version": "v2",
187
+ "problems": [
188
+ {
189
+ "code": "latest_failed",
190
+ "summary": "orders_daily: latest run failed (run scheduled__2026-11-24T00:00:00+00:00, ended 2026-11-24T00:12:00+00:00)",
191
+ "check": "airflow",
192
+ "dag_id": "orders_daily",
193
+ "dag_run_id": "scheduled__2026-11-24T00:00:00+00:00",
194
+ "state": "failed",
195
+ "start_date": "2026-11-24T00:00:02+00:00",
196
+ "end_date": "2026-11-24T00:12:00+00:00",
197
+ "logical_date": "2026-11-24T00:00:00+00:00"
198
+ }
199
+ ]
200
+ }
201
+ ```
202
+
203
+ A dbt problem carries `unique_id`, `status`, and `message`, plus `run_results` and `invocation_id` on the document. Problem codes are `latest_failed`, `success_too_old`, `no_success`, `api_unreachable`, `auth_failed`, `dag_not_found`, `api_error`, `dbt_failed`, `dbt_warn`, and `dbt_skipped_upstream`.
204
+
205
+ ## Exit codes
206
+
207
+ | Code | Meaning |
208
+ | --- | --- |
209
+ | 0 | Every check passed. |
210
+ | 1 | One or more problems were found. The alert was sent, suppressed as a duplicate, or skipped because no webhook was configured. |
211
+ | 2 | Usage or configuration is wrong, or a configured webhook could not be delivered. |
212
+
213
+ ## Environment
214
+
215
+ | Variable | Purpose |
216
+ | --- | --- |
217
+ | `AIRFLOW_USERNAME` | Basic auth on Airflow 2, or the `/auth/token` exchange on Airflow 3. |
218
+ | `AIRFLOW_PASSWORD` | Paired with the username. |
219
+ | `AIRFLOW_TOKEN` | Pre-issued bearer token for Airflow 3. |
220
+ | `SLACK_WEBHOOK_URL` | Used when `--slack-webhook` is omitted. |
221
+ | `RUNCHECK_WEBHOOK_URL` | Used when `--webhook` is omitted. |
222
+ | `RUNCHECK_STATE_FILE` | Used when `--state-file` is omitted. |
223
+
224
+ A flag wins over the matching environment variable. `--timeout` defaults to 30 seconds.
225
+
226
+ ## Dedupe
227
+
228
+ `--state-file path` writes the fingerprints of the last alert to a JSON file created with mode `0600`. The same set on the next run is not posted again. The process still exits 1, and stderr says the alert was suppressed. A later clean run clears the file. Delete the file to force the next problem to send.
229
+
230
+ The file stores those fingerprints only. It does not store credentials, webhook URLs, or a history of runs.
231
+
232
+ ## Outside this tool
233
+
234
+ Run history, late versus never-arrived detection, slow-run baselines, table or row checks, a dashboard, team alert routing, DAG-to-table mapping, and plain-English explanations are outside this CLI.
235
+
236
+ Want run history, late vs never-arrived detection and table-level checks? Row Monitor watches the data itself: https://rowmonitor.com/airflow?utm_source=runcheck&utm_medium=readme
237
+
238
+ Sign up: https://rowmonitor.com/signup?utm_source=runcheck&utm_medium=readme
239
+
240
+ ## Live Airflow check
241
+
242
+ Pull requests run `scripts/e2e/run_airflow.sh` on GitHub-hosted runners, which have Docker. The matrix is the official `apache/airflow:2.10.5` and `apache/airflow:3.4.0` images, each started with `airflow standalone`. The script triggers `runcheck_ok` and `runcheck_fail`, then checks this CLI: the failing DAG exits 1 and names that DAG, the passing DAG exits 0, a wrong password reports an authentication failure, and a stopped server reports the API as unreachable. It also posts once to a local webhook catcher and checks that a second run is deduped. The same workflow runs `scripts/e2e/check_dbt_fixture.py` against `tests/fixtures/dbt/run_results.json`.
243
+
244
+ Run the same Airflow check on your own machine with Docker:
245
+
246
+ ```bash
247
+ pip install -e .
248
+ bash scripts/e2e/run_airflow.sh
249
+ ```
250
+
251
+ Override the images with `AIRFLOW2_IMAGE` and `AIRFLOW3_IMAGE`.
252
+
253
+ ## Development
254
+
255
+ ```bash
256
+ pip install -e ".[dev]"
257
+ ruff check .
258
+ ruff format --check .
259
+ pytest
260
+ ```
261
+
262
+ ## License
263
+
264
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,233 @@
1
+ # rowmonitor-runcheck
2
+
3
+ A free, open-source Python CLI that answers one question: did my last pipeline run work?
4
+
5
+ It checks the latest run of named Airflow DAGs over the Airflow REST API, or reads a dbt Core `target/run_results.json`, and can post a short alert to a Slack incoming webhook or any endpoint that accepts a JSON POST.
6
+
7
+ There is no account and no telemetry. Network calls go only to the Airflow base URL you pass and the webhooks you configure. An optional local state file remembers the last alert so the same problem is not posted on every run. That file is dedupe state, not a run history.
8
+
9
+ ## Install
10
+
11
+ Python 3.9 or newer. The only runtime dependency is `requests`.
12
+
13
+ ```bash
14
+ pip install .
15
+ rowmonitor-runcheck --help
16
+ ```
17
+
18
+ Install from a checkout of this repository. Publishing to PyPI is a separate manual workflow and is not part of CI.
19
+
20
+ ## Check Airflow
21
+
22
+ ```bash
23
+ export AIRFLOW_USERNAME="admin"
24
+ export AIRFLOW_PASSWORD="..."
25
+ rowmonitor-runcheck airflow \
26
+ --url https://airflow.example.com \
27
+ --dag orders_daily \
28
+ --dag billing_hourly \
29
+ --max-age 26h \
30
+ --slack-webhook "$SLACK_WEBHOOK_URL"
31
+ ```
32
+
33
+ The command alerts when:
34
+
35
+ - the latest DAG run has state `failed`
36
+ - `--max-age` is set and the last successful run is older than that cutoff, or the DAG has never succeeded
37
+ - the API is unreachable, authentication fails, or the DAG is not found
38
+
39
+ `--max-age` takes one cutoff such as `30s`, `45m`, `26h`, or `2d`. A run that finished exactly that long ago is still inside the window. Omit `--max-age` to alert only on a failed latest run, an unreachable API, an authentication failure, or a missing DAG.
40
+
41
+ ### Airflow 2.6 and newer
42
+
43
+ Uses `GET /api/v1/dags/{dag_id}/dagRuns` with HTTP basic auth from `AIRFLOW_USERNAME` and `AIRFLOW_PASSWORD`.
44
+
45
+ The Airflow API has to accept basic auth:
46
+
47
+ ```text
48
+ AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.basic_auth
49
+ ```
50
+
51
+ ```bash
52
+ rowmonitor-runcheck airflow \
53
+ --url https://airflow.example.com \
54
+ --api-version v1 \
55
+ --dag orders_daily \
56
+ --max-age 26h
57
+ ```
58
+
59
+ ### Airflow 3
60
+
61
+ Uses `GET /api/v2/dags/{dag_id}/dagRuns` with a bearer JWT.
62
+
63
+ With a username and password, the CLI calls `POST /auth/token` and sends the returned `access_token`. With `AIRFLOW_TOKEN` already set, that token is sent as `Authorization: Bearer` and `/auth/token` is not called. When both are set, the pre-issued token wins.
64
+
65
+ ```bash
66
+ export AIRFLOW_TOKEN="..."
67
+ rowmonitor-runcheck airflow \
68
+ --url https://airflow.example.com \
69
+ --api-version v2 \
70
+ --dag orders_daily \
71
+ --max-age 26h \
72
+ --webhook "$RUNCHECK_WEBHOOK_URL"
73
+ ```
74
+
75
+ `--api-version` is `auto` by default, or `v1` / `v2` (the leading `v` is optional). Auto-detect requests `/api/v2/version`, then `/api/v1/version`. A v1 server that answers 401 on the version route and has no v2 version route is treated as v1.
76
+
77
+ Pass the webserver origin as `--url`. A trailing `/api/v1` or `/api/v2` is stripped. Credentials belong in the environment, not in the URL. The CLI does not write the username, password, token, or webhook URL into logs, alert bodies, or the state file.
78
+
79
+ ### Managed Airflow
80
+
81
+ These products use their own login. This CLI does not call AWS, Google, or Astronomer APIs. If you already hold a bearer token, pass it as `AIRFLOW_TOKEN`.
82
+
83
+ **Amazon MWAA.** MWAA does not accept Airflow basic auth or `POST /auth/token` with an Airflow username and password. Access is the `airflow:InvokeRestApi` AWS API, or a short-lived web login token exchanged for a session JWT. Airflow 3 on MWAA expects `Authorization: Bearer <jwt>` on `/api/v2`. Mint that token with AWS, then pass it as `AIRFLOW_TOKEN` and set `--api-version v2`.
84
+
85
+ **Google Cloud Composer.** Composer uses its own auth backend. Airflow 2 speaks REST v1 and Airflow 3 speaks REST v2, and the credential is a Google OAuth or OIDC bearer token. Pass a token you already have as `AIRFLOW_TOKEN` for an Airflow 3 environment. Composer 2's default auth is not Airflow basic auth.
86
+
87
+ **Astronomer.** Astronomer Software and Astro use a deployment API key or token. Airflow 3 on Astro is `/api/v2`. Pass that token as `AIRFLOW_TOKEN`.
88
+
89
+ Self-hosted Airflow 2.6 or newer with basic auth, and self-hosted Airflow 3 whose auth manager implements `POST /auth/token`, are the setups this command is built for.
90
+
91
+ ## Check dbt Core
92
+
93
+ dbt Cloud is not supported. The command reads a `run_results.json` that dbt Core has already written:
94
+
95
+ ```bash
96
+ rowmonitor-runcheck dbt \
97
+ --run-results target/run_results.json \
98
+ --slack-webhook "$SLACK_WEBHOOK_URL"
99
+ ```
100
+
101
+ A node whose status is `error`, `fail`, or `runtime error` raises an alert. `--fail-on warn` also alerts on `warn`.
102
+
103
+ A node skipped because an upstream node failed is included. dbt Core 1.12 records that skip with status `skipped`, an empty `message`, and `compiled: false`. Older artifacts that describe the upstream failure in `message`, including an ephemeral-model failure, are included too, as is a `--fail-fast` skip (`Skipping due to fail_fast`). A skip that carries some other message is left alone. `pass`, `success`, and `no-op` are quiet.
104
+
105
+ Compiled SQL is not copied into the alert. The node id, status, and dbt's message are.
106
+
107
+ ### Run it after dbt build
108
+
109
+ dbt's `on-run-end` hook runs SQL inside the warehouse. It cannot start this process. The working pattern is a shell wrapper immediately after `dbt build`, `dbt run`, or `dbt test`.
110
+
111
+ `dbt build && rowmonitor-runcheck ...` skips the alert whenever dbt exits non-zero, which is the run you most want to hear about. dbt still writes `run_results.json` when a model or test fails, as long as the invocation gets far enough to execute nodes. If dbt cannot start, there may be no new file and this CLI exits 2.
112
+
113
+ ```bash
114
+ #!/bin/sh
115
+ set -u
116
+ dbt build "$@"
117
+ dbt_status=$?
118
+ rowmonitor-runcheck dbt --run-results target/run_results.json
119
+ check_status=$?
120
+ if [ "$dbt_status" -ne 0 ]; then
121
+ exit "$dbt_status"
122
+ fi
123
+ exit "$check_status"
124
+ ```
125
+
126
+ `tests/fixtures/dbt/run_results.json` is a real artifact from dbt Core 1.12.7 and dbt-duckdb 1.11.1, produced by `scripts/dbt-fixture`. That project has a model that errors, a downstream model skipped because of it, a failing `accepted_values` test, a warning test, and two passing tests. Regenerate the fixture with `scripts/dbt-fixture/generate.sh` when those packages are installed. `dbt build` there exits 1 on purpose.
127
+
128
+ ## Alerts
129
+
130
+ `--dry-run` prints one JSON document and does not POST. `slack` is the exact `{"text": ...}` body when a Slack webhook is configured and a problem was found, otherwise null. `webhook` is the exact generic body when a generic webhook is configured and a problem was found, otherwise null. `preview` is always the generic body, so a dry run with no destination still shows the alert. `would_post` is true only when a real run would POST. `deduped` means the state file already holds this problem set, so a real run would not POST.
131
+
132
+ A real run prints one summary line per problem. When every check passes it prints a short ok line and does not POST. A success is not sent as a recovery message.
133
+
134
+ Slack text from the CLI looks like this:
135
+
136
+ ```text
137
+ rowmonitor-runcheck: 2 problems
138
+ • orders_daily: latest run failed (run scheduled__2026-11-24T00:00:00+00:00, ended 2026-11-24T00:12:00+00:00)
139
+ • billing_hourly: no successful run
140
+
141
+ Want run history, late vs never-arrived detection and table-level checks? Row Monitor watches the data itself: https://rowmonitor.com/airflow?utm_source=runcheck&utm_medium=cli
142
+ Sign up: https://rowmonitor.com/signup?utm_source=runcheck&utm_medium=cli
143
+ ```
144
+
145
+ The generic webhook receives:
146
+
147
+ ```json
148
+ {
149
+ "source": "rowmonitor-runcheck",
150
+ "version": "0.1.0",
151
+ "check": "airflow",
152
+ "ok": false,
153
+ "generated_at": "2026-11-25T12:00:00+00:00",
154
+ "base_url": "https://airflow.example.com",
155
+ "api_version": "v2",
156
+ "problems": [
157
+ {
158
+ "code": "latest_failed",
159
+ "summary": "orders_daily: latest run failed (run scheduled__2026-11-24T00:00:00+00:00, ended 2026-11-24T00:12:00+00:00)",
160
+ "check": "airflow",
161
+ "dag_id": "orders_daily",
162
+ "dag_run_id": "scheduled__2026-11-24T00:00:00+00:00",
163
+ "state": "failed",
164
+ "start_date": "2026-11-24T00:00:02+00:00",
165
+ "end_date": "2026-11-24T00:12:00+00:00",
166
+ "logical_date": "2026-11-24T00:00:00+00:00"
167
+ }
168
+ ]
169
+ }
170
+ ```
171
+
172
+ A dbt problem carries `unique_id`, `status`, and `message`, plus `run_results` and `invocation_id` on the document. Problem codes are `latest_failed`, `success_too_old`, `no_success`, `api_unreachable`, `auth_failed`, `dag_not_found`, `api_error`, `dbt_failed`, `dbt_warn`, and `dbt_skipped_upstream`.
173
+
174
+ ## Exit codes
175
+
176
+ | Code | Meaning |
177
+ | --- | --- |
178
+ | 0 | Every check passed. |
179
+ | 1 | One or more problems were found. The alert was sent, suppressed as a duplicate, or skipped because no webhook was configured. |
180
+ | 2 | Usage or configuration is wrong, or a configured webhook could not be delivered. |
181
+
182
+ ## Environment
183
+
184
+ | Variable | Purpose |
185
+ | --- | --- |
186
+ | `AIRFLOW_USERNAME` | Basic auth on Airflow 2, or the `/auth/token` exchange on Airflow 3. |
187
+ | `AIRFLOW_PASSWORD` | Paired with the username. |
188
+ | `AIRFLOW_TOKEN` | Pre-issued bearer token for Airflow 3. |
189
+ | `SLACK_WEBHOOK_URL` | Used when `--slack-webhook` is omitted. |
190
+ | `RUNCHECK_WEBHOOK_URL` | Used when `--webhook` is omitted. |
191
+ | `RUNCHECK_STATE_FILE` | Used when `--state-file` is omitted. |
192
+
193
+ A flag wins over the matching environment variable. `--timeout` defaults to 30 seconds.
194
+
195
+ ## Dedupe
196
+
197
+ `--state-file path` writes the fingerprints of the last alert to a JSON file created with mode `0600`. The same set on the next run is not posted again. The process still exits 1, and stderr says the alert was suppressed. A later clean run clears the file. Delete the file to force the next problem to send.
198
+
199
+ The file stores those fingerprints only. It does not store credentials, webhook URLs, or a history of runs.
200
+
201
+ ## Outside this tool
202
+
203
+ Run history, late versus never-arrived detection, slow-run baselines, table or row checks, a dashboard, team alert routing, DAG-to-table mapping, and plain-English explanations are outside this CLI.
204
+
205
+ Want run history, late vs never-arrived detection and table-level checks? Row Monitor watches the data itself: https://rowmonitor.com/airflow?utm_source=runcheck&utm_medium=readme
206
+
207
+ Sign up: https://rowmonitor.com/signup?utm_source=runcheck&utm_medium=readme
208
+
209
+ ## Live Airflow check
210
+
211
+ Pull requests run `scripts/e2e/run_airflow.sh` on GitHub-hosted runners, which have Docker. The matrix is the official `apache/airflow:2.10.5` and `apache/airflow:3.4.0` images, each started with `airflow standalone`. The script triggers `runcheck_ok` and `runcheck_fail`, then checks this CLI: the failing DAG exits 1 and names that DAG, the passing DAG exits 0, a wrong password reports an authentication failure, and a stopped server reports the API as unreachable. It also posts once to a local webhook catcher and checks that a second run is deduped. The same workflow runs `scripts/e2e/check_dbt_fixture.py` against `tests/fixtures/dbt/run_results.json`.
212
+
213
+ Run the same Airflow check on your own machine with Docker:
214
+
215
+ ```bash
216
+ pip install -e .
217
+ bash scripts/e2e/run_airflow.sh
218
+ ```
219
+
220
+ Override the images with `AIRFLOW2_IMAGE` and `AIRFLOW3_IMAGE`.
221
+
222
+ ## Development
223
+
224
+ ```bash
225
+ pip install -e ".[dev]"
226
+ ruff check .
227
+ ruff format --check .
228
+ pytest
229
+ ```
230
+
231
+ ## License
232
+
233
+ MIT. See [LICENSE](LICENSE).