class Run
Description
A single run associated with an entity and project.Args
service_api: Interface to the wandb-core service that performs W&B API calls for this run.entity: the name of the entity associated with the runproject: the project associated with the runrun_id: The unique identifier for the run.attrs: The attributes of the run.include_sweeps: Whether to include sweeps in the run.lazy:api_key:
Properties
property state
The state of the run. The following table describes the possible states a run can be in:| State | Description |
|---|---|
| Crashed | Run stopped sending heartbeats in the internal process, which can happen if the machine crashes. |
| Failed | Run ended with a non-zero exit status. |
| Finished | Run ended and fully synced data, or called wandb.Run.finish(). |
| Killed | Run was forcibly stopped before it could finish. |
| Running | Run is still running and has recently sent a heartbeat. |
| Pending | Run is scheduled but not yet started (common in sweeps and Launch jobs). |
property entity
The entity associated with the run.property username
This API is deprecated. Useentity instead.
property storage_id
The unique storage identifier for the run.property id
The unique identifier for the run.property name
The name of the run.property config
Get run config. Auto-loads full data if in lazy mode.property summary
Get run summary metrics. Auto-loads full data if in lazy mode.property system_metrics
Get run system metrics. Auto-loads full data if in lazy mode.property summary_metrics
Get run summary metrics. Auto-loads full data if in lazy mode.property rawconfig
Get raw run config including internal keys. Auto-loads full data if in lazy mode.property sweep_name
Get sweep name. Always available since sweepName is in lightweight fragment.property sweep
The sweep associated with this run. Loads sweep data if include_sweeps is False.property path
The path of the run. The path is a list containing the entity, project, and run_id.property url
The URL of the run. The run URL is generated from the entity, project, and run_id. For SaaS users, it takes the form ofhttps://wandb.ai/entity/project/run_id.
property metadata
Metadata about the run from wandb-metadata.json. Metadata includes the run’s description, tags, start time, memory usage and more.property lastHistoryStep
Returns the last step logged in the run’s history.Methods
method beta_scan_history
Arguments
keys:page_size:min_step:max_step:use_cache:
method create
wandb.init(). wandb.init() provides more robust
logic for creating and updating runs. wandb.apis.public.Run.create
is intended for specific scenarios such as creating runs in
a “pending” state for jobs that may be unschedulable
(for example, in a Kubernetes cluster with insufficient GPUs or high
contention). These pending runs can later be resumed and tracked by W&B.
Runs created with this method have limited functionality. Calling
update() on a run created this way may not work as expected.
Arguments
api: The W&B API instance.run_id: Optional run ID. If not provided, a random ID will be generated.project: Optional project name. Defaults to the project in API settings or “uncategorized”.entity: Optional entity (user or team) name.state: Initial state of the run. Use “pending” for runs that will be resumed later, or “running” for immediate execution.
Examples
Creating a pending run for later executionmethod delete
Arguments
delete_artifacts: Whether to delete the artifacts associated with the run.
method download_history_exports
Arguments
download_dir: The directory to download the history files to.require_complete_history: Whether to require the complete history to be downloaded. If true, and the run contains data that has not been exported to parquet files yet, an IncompleteRunHistoryError will be raised.
Raises
IncompleteRunHistoryError: If require_complete_history is True and the run contains data not yet exported to parquet files.WandbApiFailedError: If the API request fails for reasons other than incomplete history.
method file
Arguments
name: name of requested file.
method files
Files object for all files in the run which match the given criteria.
You can specify a list of exact file names to match, or a pattern to match against.
If both are provided, the pattern will be ignored.
Arguments
names: names of the requested files, if empty returns all filespattern: Pattern to match when returning files from W&B. This pattern uses mySQL’s LIKE syntax, so matching all files that end with .json would be “%.json”. If both names and pattern are provided, a ValueError will be raised.per_page: number of results per page.
method history
Arguments
samples: (int, optional) The number of samples to returnkeys: (list, optional) Only return metrics for specific keysx_axis: (str, optional) Use this metric as the xAxis defaults to _steppandas: (bool, optional) Return a pandas dataframestream: (str, optional) “default” for metrics, “system” for machine metrics
method load
Arguments
force:
method load_full_data
Arguments
force: Force reload even if data is already loaded
method log_artifact
Arguments
artifact: An artifact returned fromwandb.Api().artifact(name).aliases: Aliases to apply to this artifact.tags: (list, optional) Tags to apply to this artifact, if any.
method logged_artifacts
Arguments
per_page: Number of artifacts to fetch per API request.
Examples
method save
method scan_history
Arguments
keys: list of metrics to read from the run’s history. if no keys are provided then all metrics will be returned.page_size: the number of history records to read at a time.min_step: The minimum step to start reading history from (inclusive).max_step: The maximum step to read history up to (exclusive).use_cache: When set to True, checks the WANDB_CACHE_DIR for a run history. If the run history is not found in the cache, it will be downloaded from the server. If set to False, the run history will be downloaded every time.
method to_html
Arguments
height:hidden:
method update
method update_state
- to
pendingfromrunning,failed,crashed, orpreempted(e.g. to requeue a terminated or in-progress run) - to
failedfrompendingorrunning(e.g. to mark a preempted or lost run as failed)
Run.state for the list of possible run states.
Arguments
state: The target run state. One of"pending"or"failed".
Raises
wandb.Error: If the requested state transition is not allowed, or the server does not support this operation.
method upload_file
Arguments
path: Path to the file to upload. Can be absolute or relative.root: The root path to save the file relative to. For example, 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 ”../”. Defaults to current directory (”.“).
method use_artifact
Arguments
artifact: An artifact returned fromwandb.Api().artifact(name)use_as: A string identifying how the artifact is used in the script. Used to easily differentiate artifacts used in a run, when using the beta wandb launch feature’s artifact swapping functionality.
method used_artifacts
run.use_artifact(). Returns a paginated
result that can be iterated over or collected into a single list.
Arguments
per_page: Number of artifacts to fetch per API request.