|
1 | 1 | --- |
2 | 2 | title: Delete runs |
3 | | -description: Learn how to delete runs from a W&B project using the W&B App. |
| 3 | +description: Delete runs from a W&B project using the W&B App or the Public API, and learn how deleted run data is removed from storage on Dedicated Cloud and Self-Managed deployments. |
4 | 4 | --- |
5 | 5 |
|
6 | | -Delete one or more runs from a project with the W&B App. |
| 6 | +## Delete runs |
| 7 | +Delete runs from a project with the W&B App or the Python API. |
7 | 8 |
|
| 9 | +<Tabs> |
| 10 | +<Tab title="W&B App" value="ui"> |
8 | 11 | 1. Navigate to the project that contains the runs you want to delete. |
9 | 12 | 2. Select the **Runs** tab. |
10 | 13 | 3. Select the checkbox next to the runs you want to delete. |
11 | 14 | 4. Choose the **Delete** button (trash can icon) above the table. |
12 | 15 | 5. From the drawer that appears, choose **Delete**. |
13 | 16 |
|
14 | | -<Note> |
| 17 | +For projects that contain a large number of runs, you can use either the search bar to filter runs you want to delete using Regex or the filter button to filter runs based on their status, tags, or other properties. |
| 18 | +</Tab> |
| 19 | + |
| 20 | +<Tab title="Python" value="python"> |
| 21 | +You can delete runs programmatically with [`Run.delete()`](/models/ref/python/public-api/run#method-run-delete). Set `delete_artifacts=True` if you also want to remove artifacts associated with the run. |
| 22 | + |
| 23 | +```python |
| 24 | +import wandb |
| 25 | + |
| 26 | +api = wandb.Api() |
| 27 | +runs = api.runs("<entity>/<project>") |
| 28 | +for run in runs: |
| 29 | + if run.state == "finished": # Replace with your own condition |
| 30 | + run.delete(delete_artifacts=False) |
| 31 | +``` |
| 32 | + |
| 33 | +For the full method signature and behavior, see the [`Run.delete` reference](/models/ref/python/public-api/run#method-run-delete). |
| 34 | + |
| 35 | +To remove individual files attached to a run, like logged media: |
| 36 | +1. Obtain the relevant file handles with [`Run.files()`](/models/ref/python/public-api/run#method-run-files). |
| 37 | +1. Use [`File.delete()`](/models/ref/python/public-api/file#method-file-delete) to delete individual files. |
| 38 | + |
| 39 | +</Tab> |
| 40 | +</Tabs> |
| 41 | + |
15 | 42 | A run ID cannot be reused, even after the run is deleted. Instead, the run will fail with an error. |
16 | | -</Note> |
17 | 43 |
|
18 | | -<Note> |
19 | | -For projects that contain a large number of runs, you can use either the search bar to filter runs you want to delete using Regex or the filter button to filter runs based on their status, tags, or other properties. |
20 | | -</Note> |
| 44 | +<Warning> |
| 45 | +When you delete a run and choose to delete associated artifacts, the artifacts are permanently removed and can't be recovered, even if the run is restored later. This includes artifacts linked to the Registry. |
| 46 | +</Warning> |
21 | 47 |
|
22 | | -### Run deletion flowchart |
| 48 | +## Run deletion flowchart |
23 | 49 |
|
24 | 50 | The following diagram illustrates the complete run deletion process, including the handling of associated artifacts and Registry links: |
25 | 51 |
|
@@ -55,6 +81,14 @@ graph TB |
55 | 81 | style FullEnd fill:#ffcdd2,stroke:#333,stroke-width:2px,color:#000 |
56 | 82 | ``` |
57 | 83 |
|
58 | | -<Warning> |
59 | | -When you delete a run and choose to delete associated artifacts, the artifacts are permanently removed and can't be recovered, even if the run is restored later. This includes artifacts linked to the Registry. |
60 | | -</Warning> |
| 84 | +## When deleted run data is removed from storage |
| 85 | + |
| 86 | +On [W&B Dedicated Cloud](/platform/hosting/hosting-options/dedicated-cloud) and [W&B Self-Managed](/platform/hosting/hosting-options/self-managed), the `GORILLA_DATA_RETENTION_PERIOD` environment variable controls how long **deleted run data** is retained before it can be permanently removed from object storage. **Artifacts are not removed by this setting**; they follow the artifact deletion and garbage collection flow described in [Delete an artifact](/models/artifacts/delete-artifacts). |
| 87 | + |
| 88 | +Setting or changing `GORILLA_DATA_RETENTION_PERIOD` is irreversible for data past the retention window. Back up your database and bucket before enabling or tightening retention. See [Configure environment variables](/platform/hosting/env-vars) for the reference table and warnings. |
| 89 | + |
| 90 | +Even after run or file deletion and retention processing, **bucket usage can lag** while background jobs catch up. W&B does not guarantee immediate reclamation of object storage. For a full overview of artifacts versus run data, timing expectations, and optional operator actions, see [Manage bucket storage and costs](/platform/hosting/managing-bucket-storage). |
| 91 | + |
| 92 | +<Note> |
| 93 | +If deletions do not appear as expected in the W&B App when using the Public API, upgrade the W&B Python SDK to a current release and retry. |
| 94 | +</Note> |
0 commit comments