Class wandb.apis.public.Run
A single run associated with an entity and project.Args
ServiceApi
Interface to the wandb-core service that performs W&B API calls for this run.
str
The entity associated with the run.
str
The project associated with the run.
str
The unique identifier for the run.
Mapping | None
The attributes of the run.
bool
Whether to include sweeps in the run.
bool
No description provided.
str | None
No description provided.
Attributes
tags([str]): a list of tags associated with the runurl(str): the url of this runid(str): unique identifier for the run (defaults to eight characters)name(str): the name of the runstate(str): one of: running, finished, crashed, killed, preempting, preemptedconfig(dict): a dict of hyperparameters associated with the runcreated_at(str): ISO timestamp when the run was startedsystem_metrics(dict): the latest system metrics recorded for the runsummary(dict): A mutable dict-like property that holds the current summary. Calling update will persist any changes.project(str): the project associated with the runentity(str): the name of the entity associated with the runproject_internal_id(int): the internal id of the projectuser(str): the name of the user who created the runpath(str): Unique identifier [entity]/[project]/[run_id]notes(str): Notes about the runread_only(boolean): Whether the run is editablehistory_keys(str): History metric keys logged withwandb.Run.log({"key": "value"})metadata(str): Metadata about the run from wandb-metadata.json
Properties
dict[str, Any]
Get run config. Auto-loads full data if in lazy mode.
str
The entity associated with the run.
str
The unique identifier for the run.
int
Returns the last step logged in the run’s history.
dict[str, Any] | None
Metadata about the run from wandb-metadata.json.Metadata includes the run’s description, tags, start time, memory
usage and more.
str | None
The name of the run.
list[str]
The path of the run. The path is a list containing the entity, project, and run_id.
dict[str, Any]
Get raw run config including internal keys. Auto-loads full data if in lazy mode.
str
The state of the run.The following table describes the possible states a run can be in:
str
The unique storage identifier for the run.
HTTPSummary
Get run summary metrics. Auto-loads full data if in lazy mode.
dict[str, Any]
Get run summary metrics. Auto-loads full data if in lazy mode.
public.Sweep | None
The sweep associated with this run. Loads sweep data if include_sweeps is False.
str | None
Get sweep name. Always available since sweepName is in lightweight fragment.
dict[str, Any]
Get run system metrics. Auto-loads full data if in lazy mode.
str
The URL of the run.The run URL is generated from the entity, project, and run_id. For
SaaS users, it takes the form of
https://wandb.ai/entity/project/run_id.str
This API is deprecated. Use
entity instead.Methods
method Run.beta_scan_history()
Arguments
list[str] | None
No description provided.
int
No description provided.
int
No description provided.
int | None
No description provided.
bool
No description provided.
method Run.console_logs()
Arguments
int
Number of lines to fetch per request when reading the log from the beginning. Ignored when
last is given.int | None
If set, fetch only the last N lines of the log in a single request — useful for checking on a live run or diagnosing a crash. The backend caps how many lines one request returns, so a larger tail comes back truncated to the newest lines.
Raises
CommError: When iterating, if a request fails. Reading the log from the beginning requires W&B server 0.77 or newer; on older servers, read the last N lines instead.
Examples
method Run.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
public.Api
The W&B API instance.
str | None
Optional run ID. If not provided, a random ID will be generated.
str | None
Optional project name. Defaults to the project in API settings or “uncategorized”.
str | None
Optional entity (user or team) name.
Literal['running', 'pending']
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 Run.delete()
Arguments
bool
Whether to delete the artifacts associated with the run.
method Run.download_history_exports()
Arguments
pathlib.Path | str
The directory to download the history files to.
bool
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 Run.file()
Arguments
str
name of requested file.
method Run.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
list[str] | None
names of the requested files, if empty returns all files
str | None
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.
int
number of results per page.
method Run.history()
Arguments
int
(int, optional) The number of samples to return
list[str] | None
(list, optional) Only return metrics for specific keys
str
(str, optional) Use this metric as the xAxis defaults to _step
bool
(bool, optional) Return a pandas dataframe
Literal['default', 'system']
(str, optional) “default” for metrics, “system” for machine metrics
method Run.load()
Arguments
bool
If True, re-fetch the run data from the server, even if it is already loaded.
Raises
RunNotFoundError: If the run is not found, or the run data can not be loaded.
method Run.load_full_data()
Arguments
bool
Force reload even if data is already loaded
method Run.log_artifact()
Arguments
wandb.Artifact
An artifact returned from
wandb.Api().artifact(name).Collection[str] | None
Aliases to apply to this artifact.
Collection[str] | None
(list, optional) Tags to apply to this artifact, if any.
method Run.logged_artifacts()
Arguments
int
Number of artifacts to fetch per API request.
Examples
method Run.save()
method Run.scan_history()
Arguments
list[str] | None
List of metrics to read from the run’s history. The scan only returns rows that contain all of the requested keys. If the keys were logged at different steps, use separate calls for each key or omit this argument. If no keys are provided, all metrics are returned.
int
the number of history records to read at a time.
int
The minimum step to start reading history from (inclusive).
int | None
The maximum step to read history up to (exclusive).
bool
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 Run.stop()
Raises
wandb.Error: If the request fails.
Examples
method Run.to_html()
Arguments
int
No description provided.
No description provided.
method Run.update()
method Run.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
str
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 Run.upload_file()
Arguments
str
Path to the file to upload. Can be absolute or relative.
str
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 Run.use_artifact()
Arguments
wandb.Artifact
An artifact returned from
wandb.Api().artifact(name)str | None
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 Run.used_artifacts()
run.use_artifact(). Returns a paginated
result that can be iterated over or collected into a single list.
Arguments
int
Number of artifacts to fetch per API request.