Skip to content

Add a new field to existing runs#

If you've already logged a set of runs and would like to introduce new fields, you can automate it by fetching runs from your project programmatically.

The below script illustrates how to obtain the run IDs as a list, then resume the runs one by one.

Example script
import neptune

with neptune.init_project(project="ml-team/xnlu") as project: # (1)!
    runs_table_df = project.fetch_runs_table().to_pandas() # (2)!
    run_ids = runs_table_df["sys/id"].to_list()

for run_id in run_ids:
    with neptune.init_run(with_id=run_id) as run: # (3)!
        # some criteria for the new field or value
        run["some_new_field"] = some_value
  1. Initialize your project with neptune.init_project() to get a Project object that you can operate on.
  2. Use fetch_runs_table() on the project object to get a list of run IDs. You can also filter the runs by a custom query. See the NQL reference →
  3. Use the IDs to resume each run and modify its metadata.

Depending on the fields you want to introduce, you can implement some checks or other criteria in order to determine what metadata to assign to the run.

Fetching the runs individually#

You reinitialize any one run as follows:

import neptune

run = neptune.init_run(with_id="RUN-ID")

where RUN-ID is the identifier of some existing run.

How do I find the ID?

You can grab the ID manually from the Runs table. It's displayed in the leftmost column.

Location of ID column in the runs table of the Neptune web app

The ID is stored in the system namespace (sys/id). If the run is active, you can obtain its ID with run["sys/id"].fetch(). For example:

>>> run = neptune.init_run(project="ml-team/classification")
>>> run["sys/id"].fetch()

Once the run is active, you can log to it normally.