Metadata-Version: 2.4
Name: haps-client
Version: 0.5.0
Summary: Python client for the Ephemeral Buffers and Application Microservices APIs
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.*
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Dynamic: license-file

# haps-client

Python client for the HAPS platform: publish an application, submit jobs to it,
and read the results, without an HPC account of your own.

For **users** and **developers**. To run jobs as a maintainer, see
[`haps-runtime`](https://pypi.org/project/haps-runtime/).

## Install

```bash
pip install haps-client
```

Requires Python 3.11 or newer.

## Quick start

```python
from haps_client import HapsClient, MessageException

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

app = client.mservices.find(name="echo")[0]

data = client.buffers.create(reserved_size=1024, lifespan=3600)
data.fill(b"hello")
out = client.buffers.create(reserved_size=1024, lifespan=3600)

job = app.submit_job({"arguments": [], "ebin": [data.uuid], "ebout": [out.uuid]})
print(job.get_run_status())

client.close()
```

## Errors

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

```python
try:
    client.buffers.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
