Metadata-Version: 2.4
Name: hadoku-execlog
Version: 0.1.0
Summary: Execution-log reporter — self-report scheduled-job runs to hadoku monitoring-api (unified contract).
Home-page: https://github.com/WolffM/hadoku_site
Author: WolffM
License: ISC
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: ISC License (ISCL)
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# hadoku-execlog

The Python execution-log reporter — the twin of `@wolffm/logger/jobs`. One client
that posts the unified execution-log contract to monitoring-api's
`POST /health/api/jobs`, so every scheduled job (Python or TypeScript) self-reports
a single truthful run record.

Part of the execution-log unification —
`docs/planning/execution-log-unification-2026-07-21.md` in hadoku_site.

- **Zero runtime dependencies** (stdlib `urllib` only) — a run-and-exit systemd job
  can adopt it without pulling a dependency tree.
- **Fail-soft** — a monitoring outage never poisons the job. The exception is
  `tracked()`, where the wrapped work's own error always propagates.
- **Unified 5-state vocabulary**: `started` / `succeeded` / `failed` / `killed` / `skipped`.

## Use

Run-and-exit job (the common case for dataplatform / writeOutPrompts):

```python
from execlog import create_job_reporter

reporter = create_job_reporter(url="https://hadoku.me/health/api/jobs", user_key=SERVICE_KEY)
with reporter.tracked("dataplatform:daily-pipeline"):
    run_daily_pipeline()   # raises on failure -> recorded `failed`; else `succeeded`
```

Manual start/finish (e.g. a fire-and-forget job that mints its run_id for a 202 body):

```python
run_id = reporter.start("scraper:oss-recon")       # posts a `started` row
...                                                  # background work
reporter.finish(run_id, "scraper:oss-recon", "succeeded", duration_ms=elapsed_ms)
```
