# Persistent compute service

Exposes a simple endpoints for checking whether or not persistent compute is enabled.

OpenAPI file: [`PersistentComputeService.json`](https://dev.nominal.io/api/_downloads/34adae41503c4f259169293d4f46a29c/PersistentComputeService.json)

## Endpoints

### Is enabled

GET `/persistent-compute/enabled`

Simple “ping” like endpoint to see if the service is enabled (and available).

Request

No parameters and no body.

Response

An empty JSON object, `{}`.

Request

**curl**

```shell
curl "https://api.gov.nominal.io/api/persistent-compute/enabled" \
  -H "Authorization: Bearer <api key>"
```

**requests**

```python
import requests

response = requests.get(
    "https://api.gov.nominal.io/api/persistent-compute/enabled",
    headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
```

**httpx**

```python
import httpx

response = httpx.get(
    "https://api.gov.nominal.io/api/persistent-compute/enabled",
    headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
```

**aiohttp**

```python
import asyncio

import aiohttp

async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.get(
            "https://api.gov.nominal.io/api/persistent-compute/enabled",
            headers={"Authorization": "Bearer <api key>"},
        ) as response:
            response.raise_for_status()
            print(await response.json())

asyncio.run(main())
```

Response: `200`

```json
{}
```

## Errors

[Errors](https://dev.nominal.io/api/legacy.md#errors) shows how these errors are sent.

Each error’s `errorName` is `PersistentCompute:` followed by its name below.

| Status | Name | Notes |
| --- | --- | --- |
| 400 | `InvalidClientMessage` | Could not parse client message. |
| 400 | `InvalidComputation` |  |
| 400 | `NonNominalStorageLocator` |  |
| 400 | `PollingOnlyComputation` | The requested compute contains nodes that support streaming but only via polling (not WebSocket). The frontend should use polling mode (HTTP requests) instead of WebSocket streaming for this query. |
| 400 | `TooManyPoints` | The subscription is operating on too many points. |
| 400 | `TooManyPointsForSingleSeries` | The subscription is operating on a series that has too many points. |
| 400 | `UnavailableResultConfiguration` | ResultConfiguration is incompatible with the requested compute. |
| 400 | `UnsupportedGranularity` |  |
| 400 | `WindowNegative` |  |
| 400 | `WindowTooLarge` |  |
| 400 | `WindowWithLookBackTooLarge` |  |
| 403 | `PermissionDenied` |  |
| 403 | `SubscriptionAuthExpired` | The websocket subscription auth token expired. Clients should refresh credentials and re-establish the subscription. |
| 500 | `JobInvalidState` | The streaming compute job entered a terminal state unexpectedly. This can indicate a transient issue with the compute engine. |

Page design based on [Scalar](https://scalar.com), MIT License.
