# mlflow_plugins

Python API: `luxonis_ml.tracker.mlflow_plugins`

MLflow request headers for servers behind Cloudflare Access.

[LuxonisRequestHeaderProvider](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/tracker/mlflow_plugins.md)
adds the Cloudflare Access credentials to every MLflow request, so a tracker can reach an MLflow server that Cloudflare protects.

> **See Also**
> [luxonis_ml.tracker.tracker](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/tracker/tracker.md) for the tracker that logs to MLflow.

## Classes

### LuxonisRequestHeaderProvider

Add Cloudflare Access headers to every MLflow request.

The provider reports itself as always in context, so it contributes its headers to each MLflow request. It reads the credentials
from the environment:

 * `MLFLOW_CLOUDFLARE_ID` becomes the `CF-Access-Client-Id` header;
 * `MLFLOW_CLOUDFLARE_SECRET` becomes the `CF-Access-Client-Secret` header.

Set both variables when your MLflow endpoint sits behind Cloudflare Access. The provider keeps the default MLflow user agent as
well.

> **Note**
> MLflow finds request header providers through the `mlflow.request_header_provider` entry point group. LuxonisML declares no such entry point, so the two environment variables alone do not change MLflow requests. Register the provider in your own application first.

> **Warning**
> `environ.MLFLOW_CLOUDFLARE_SECRET` is a `SecretStr`, and [request_headers](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/tracker/mlflow_plugins.md) puts that object into the header without a call to `get_secret_value()`. The header therefore carries the masked text, not the secret. Cloudflare Access rejects such a request.

#### Methods

##### in_context

```python
def in_context(self) -> bool:
```

Return True, because the provider always applies.

##### request_headers

```python
def request_headers(self) -> dict:
```

Return the default headers with the Cloudflare credentials.
