Metadata-Version: 2.4
Name: endurasolution-rob
Version: 1.0.0
Summary: ROB (Run On Background) by EnduraSolution - Python SDK and CLI for the ROB process manager: logs, crash reports, auto-restart, cron jobs, timers, health checks and an optional web dashboard.
Author: EnduraSolution (Alappuzha, Kerala, India)
License-Expression: MIT
Project-URL: npm package (daemon), https://www.npmjs.com/package/@endurasolution/rob
Keywords: process-manager,pm2,daemon,supervisor,background,cron,endurasolution
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# ROB for Python (endurasolution-rob)

Python SDK and CLI for **ROB, Run On Background**: a lightweight, secure process manager for Python, Node.js and any executable, by EnduraSolution.

Use it to keep apps alive, capture and rotate logs, record crashes, run jobs on cron or timers, restart on memory/CPU limits or failed health checks, start everything at boot and (optionally) watch it all in a web dashboard.

## Install

```bash
npm install -g @endurasolution/rob   # the ROB daemon (needs Node.js >= 18), once per machine
pip install endurasolution-rob       # this package
```

This package has no dependencies. It talks to the ROB daemon over a local socket that only your user can access, with a token on every request. The SDK starts the daemon automatically when needed.

## Manage processes

```python
from rob_pm import Rob

with Rob() as rob:
    rob.start("worker.py", name="worker", venv=".venv", max_memory="300M")
    rob.start("report.py", name="report", cron="0 2 * * *", stop_after="1h")
    rob.start("poll.py", name="poller", every="5m")
    rob.start_config("rob.config.json")

    for p in rob.list():
        print(p["name"], p["status"], p["cpu"], p["memory"])

    print(rob.crashes("worker"))
    for entry in rob.stream_logs("worker"):
        print(entry["type"], entry["line"])
```

## Inside your app

These helpers do nothing when the app is not run by ROB, so they are safe to leave in:

```python
import rob_pm

rob_pm.on_shutdown(cleanup)       # graceful stop, Windows included
rob_pm.metric("processed", 1200)  # custom metric shown in `rob describe` and the web UI
rob_pm.ready()                    # with wait_ready=True
```

## CLI

```bash
rob-py ls
rob-py start app.py --name api --max-memory 300M
rob-py start job.py --cron "*/10 * * * *"
rob-py logs api
rob-py crashes api
rob-py web on
```

`python -m rob_pm` works too. Every option is documented on the [npm package page](https://www.npmjs.com/package/@endurasolution/rob).

## License

MIT © EnduraSolution, Alappuzha, Kerala, India
