Metadata-Version: 2.5
Name: cronguard-sdk
Version: 0.1.0
Summary: Report scheduled job runs to Cronguard heartbeat monitoring
Project-URL: Homepage, https://github.com/Abhishek-Mallick/Cronguard
Project-URL: Source, https://github.com/Abhishek-Mallick/Cronguard/tree/main/sdk/python
Project-URL: Issues, https://github.com/Abhishek-Mallick/Cronguard/issues
License-Expression: MIT
Keywords: cron,cronguard,heartbeat,monitoring,scheduled-jobs
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# cronguard (Python)

Report scheduled job runs to [Cronguard](https://github.com/Abhishek-Mallick/Cronguard).
Standard library only; Python 3.9+.

```bash
pip install cronguard-sdk
```

The package is published as `cronguard-sdk` and imported as `cronguard`.

```python
from cronguard import Monitor

monitor = Monitor("https://ping.cronguard.dev/ping/<key>")  # or set CRONGUARD_PING_URL

with monitor.run() as run:        # start ping now; success, or fail with the traceback
    run.log("exported 1,204 rows")
    export()

@monitor.job                      # decorator form
def nightly_cleanup():
    ...

run = monitor.start()             # manual form
code = subprocess.call(["./backup.sh"])
run.exit(code)                    # 0 is success, anything else a failure
```

Each run gets a run ID, so overlapping runs are timed correctly. Pings retry three times and
never raise: if Cronguard is unreachable, a warning is logged on the `cronguard` logger.

Run the tests with `python -m unittest discover -s tests` from this directory.
