# subprocess

Python API: `hubai_sdk.utils.subprocess`

## Classes

| Name | Description |
| --- | --- |
| [`SubprocessResult`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/subprocess.md)
| Extension of subprocess.CompletedProcess that also carries peak memory usage. |

### class `SubprocessResult`

```python
class SubprocessResult(subprocess.CompletedProcess)
```

Extension of subprocess.CompletedProcess that also carries peak memory usage.

Attributes

| Name | Description |
| --- | --- |
| `peak_memory` |  |
| `total_time` |  |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/subprocess.md) |
Initialize a subprocess result with memory and timing data. |

#### method `__init__`

```python
def __init__(*args, peak_memory: int, total_time: float, **kwargs)
```

Initialize a subprocess result with memory and timing data.

## Functions

| Name | Description |
| --- | --- |
| [`subprocess_run`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/subprocess.md) |
Wrapper around subprocess.run that logs, raises on error, and tracks peak RAM usage without hanging on stdout/stderr. |

### function `subprocess_run`

```python
def subprocess_run(cmd: str | list[str], *, silent: bool = False) -> SubprocessResult
```

Wrapper around subprocess.run that logs, raises on error, and tracks peak RAM usage without hanging on stdout/stderr.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `cmd` | `str | list[str]` | Command to execute. String or list of arguments. | required |
| `silent` | `bool` | If True, suppress logs. | `False` |

Returns

| Type | Description |
| --- | --- |
| `SubprocessResult` | SubprocessResult with .peak_memory attribute. |
