Skip to main content
App version: 3.4.10

Working with runs

Python package: neptune-fetcher

Experiments consist of runs. By default, the Fetcher API returns metadata only from experiment head runs, not all individual runs.

To target runs instead of experiments, you have two options:

A) Import methods from runs module

Import one or more fetching methods from the runs module:

from neptune_fetcher.alpha.runs import (
fetch_metrics,
fetch_runs_table,
list_attributes,
list_runs,
)


fetch_metrics(
runs=...,
...
)

B) Specify runs in each call

Import the runs module and prepend .runs to each fetching method call:

import neptune_fetcher.alpha as npt
from neptune_fetcher.alpha import runs


runs.fetch_metrics(
runs=...,
...
)

In both cases, instead of the experiments parameter, use runs.

Note the difference in identifying runs versus experiments:

  • Experiments are characterized by name (sys/name). This is the string passed to the name argument at creation.
  • Runs are characterized by ID (sys/custom_run_id). This is the string passed to the run_id argument at creation.

Example:

import neptune_fetcher.alpha as npt
from neptune_fetcher.alpha import runs


runs.fetch_metrics(
runs=r"^speedy-seagull.*_02", # run ID
attributes=r"losses/.*",
)
What's the connection between a run and experiment?

In the code, experiments are represented as runs. An experiment run has the experiment name stored in its sys/name attribute.

In the below example, a run is created as the head of the experiment gull-flying-skills:

from neptune_scale import Run

run = Run(
experiment_name="gull-flying-skills",
run_id="vigilant-kittiwake-1",
)

If a new run is created with the same experiment name, it becomes the new experiment head:

run = Run(
experiment_name="gull-flying-skills",
run_id="vigilant-kittiwake-2",
)

The vigilant-kittiwake-1 run is still accessible as part of the experiment history, but it's no longer considered an experiment.