Metadata-Version: 2.4
Name: haps-runtime
Version: 0.4.1
Summary: Maintainer library for HAPS runtimes: declare a runtime, run the jobs waiting on it
Author: Logica Team, Universite de Rennes / IRISA
Author-email: Benjamin De Zordo <benjamin.de-zordo@irisa.fr>
License-Expression: MIT
Project-URL: Homepage, https://www.irisa.fr/equipes/logica
Keywords: haps,hpc,api,ephemeral-buffers,microservices
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Distributed Computing
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.32
Requires-Dist: ebcommon==2.0.0a0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Provides-Extra: testing
Requires-Dist: haps-client==0.3.*; extra == "testing"
Dynamic: license-file

# haps-runtime

Maintainer library for the HAPS platform: declare a runtime, collect the jobs
waiting on it, report their status and hand their results back.

To publish applications or submit jobs, see
[`haps-client`](https://pypi.org/project/haps-client/). To run the execution
daemon, see [`haps-runtime-executor`](https://pypi.org/project/haps-runtime-executor/).

## Install

```bash
pip install haps-runtime
```

Requires Python 3.11 or newer.

## Quick start

```python
from haps_runtime import HapsClient

client = HapsClient(
    ebservice_url="https://ebservice.example.org/api/v1",
    ebuffer_url="https://ebuffer.example.org/api/v1",
    username="maintainer",
    password="secret",
)

runtime = client.runtimes.create(
    {"name": "echo", "accepted_mime_type": "application/x-echo", "tags": ["echo"]}
)

for job in runtime.list_jobs(runstatus="PENDING"):
    job.set_status("PROCESSING")
    job.push_results(["done"])
    job.set_status("COMPLETED")

client.close()
```

## Errors

Every API error is an `ebcommon` `MessageException`:

```python
from haps_runtime import MessageException

try:
    client.runtimes.get(uid)
except MessageException as e:
    print(e.status_code, e.url, e.message.name)
```

`status_code` is `None` when the server could not be reached.

## License

MIT
