# wandb.apis.public.Run

[![](https://www.tensorflow.org/images/GitHub-Mark-32px.png)View source on GitHub](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L849-L1407)

A single run associated with an entity and project.

```python
Run(
    client, entity, project, run_id, attrs={}
)
```

| Attributes |   |
| ---------- | - |

## Methods

### `create` <a href="#create" id="create"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L931-L971)

```python
@classmethod
create(
    api, run_id=None, project=None, entity=None
)
```

Create a run for the given project

### `delete` <a href="#delete" id="delete"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1067-L1101)

```python
delete(
    delete_artifacts=(False)
)
```

Deletes the given run from the wandb backend.

### `file` <a href="#file" id="file"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1163-L1172)

```python
file(
    name
)
```

Arguments: name (str): name of requested file.

| Returns                              |   |
| ------------------------------------ | - |
| A `File` matching the name argument. |   |

### `files` <a href="#files" id="files"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1151-L1161)

```python
files(
    names=[], per_page=50
)
```

Arguments: names (list): names of the requested files, if empty returns all files per\_page (int): number of results per page

| Returns                                                     |   |
| ----------------------------------------------------------- | - |
| A `Files` object, which is an iterator over `File` obejcts. |   |

### `history` <a href="#history" id="history"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1197-L1236)

```python
history(
    samples=500, keys=None, x_axis="_step", pandas=(True), stream="default"
)
```

Returns sampled history metrics for a run. This is simpler and faster if you are ok with the history records being sampled.

| Arguments                                                                                                                                                                                                                                                                                                                     |   |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| samples (int, optional): The number of samples to return pandas (bool, optional): Return a pandas dataframe keys (list, optional): Only return metrics for specific keys x\_axis (str, optional): Use this metric as the xAxis defaults to \_step stream (str, optional): "default" for metrics, "system" for machine metrics |   |

| Returns                                                                                                                     |   |
| --------------------------------------------------------------------------------------------------------------------------- | - |
| If pandas=True returns a `pandas.DataFrame` of history metrics. If pandas=False returns a list of dicts of history metrics. |   |

### `load` <a href="#load" id="load"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L973-L1035)

```python
load(
    force=(False)
)
```

### `log_artifact` <a href="#log_artifact" id="log_artifact"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1329-L1361)

```python
log_artifact(
    artifact, aliases=None
)
```

Declare an artifact as output of a run.

| Arguments                                                                                                                                 |   |
| ----------------------------------------------------------------------------------------------------------------------------------------- | - |
| artifact (`Artifact`): An artifact returned from `wandb.Api().artifact(name)` aliases (list, optional): Aliases to apply to this artifact |   |

| Returns              |   |
| -------------------- | - |
| A `Artifact` object. |   |

### `logged_artifacts` <a href="#logged_artifacts" id="logged_artifacts"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1294-L1296)

```python
logged_artifacts(
    per_page=100
)
```

### `save` <a href="#save" id="save"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1103-L1104)

```python
save()
```

### `scan_history` <a href="#scan_history" id="scan_history"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1238-L1292)

```python
scan_history(
    keys=None, page_size=1000, min_step=None, max_step=None
)
```

Returns an iterable collection of all history records for a run.

#### Example:

Export all the loss values for an example run

```python
run = api.run("l2k2/examples-numpy-boston/i0wt6xua")
history = run.scan_history(keys=["Loss"])
losses = [row["Loss"] for row in history]
```

| Arguments                                                                                                                                                          |   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | - |
| keys (\[str], optional): only fetch these keys, and only fetch rows that have all of keys defined. page\_size (int, optional): size of pages to fetch from the api |   |

| Returns                                             |   |
| --------------------------------------------------- | - |
| An iterable collection over history records (dict). |   |

### `snake_to_camel` <a href="#snake_to_camel" id="snake_to_camel"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L567-L569)

```python
snake_to_camel(
    string
)
```

### `update` <a href="#update" id="update"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1037-L1065)

```python
update()
```

Persists changes to the run object to the wandb backend.

### `upload_file` <a href="#upload_file" id="upload_file"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1174-L1195)

```python
upload_file(
    path, root="."
)
```

Arguments: path (str): name of file to upload. root (str): the root path to save the file relative to. i.e. If you want to have the file saved in the run as "my\_dir/file.txt" and you're currently in "my\_dir" you would set root to "../"

| Returns                              |   |
| ------------------------------------ | - |
| A `File` matching the name argument. |   |

### `use_artifact` <a href="#use_artifact" id="use_artifact"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1302-L1327)

```python
use_artifact(
    artifact
)
```

Declare an artifact as an input to a run.

| Arguments                                                                     |   |
| ----------------------------------------------------------------------------- | - |
| artifact (`Artifact`): An artifact returned from `wandb.Api().artifact(name)` |   |

| Returns              |   |
| -------------------- | - |
| A `Artifact` object. |   |

### `used_artifacts` <a href="#used_artifacts" id="used_artifacts"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/apis/public.py#L1298-L1300)

```python
used_artifacts(
    per_page=100
)
```
