Skip to content

Set custom run ID#

When working with pipelines or multiple scripts, you may need to access the same run in multiple places. You can achieve this by specifying a custom identifier for the run. When you use the same ID for different run instances, you ensure that all metadata is logged to the same run.

To automatically make the ID unique for each new run, you may wish to compose it from components such as hash and time.

Good to know

  • The maximum length of the ID is 36 characters.
  • The custom ID is stored in the system namespace (sys/custom_run_id) field of the run.
  • It's not possible to use a custom run ID in offline mode.

Setting custom ID through environment variable#

When a run is initialized, Neptune automatically picks up the custom ID from the environment variable NEPTUNE_CUSTOM_RUN_ID.

To ensure a unique ID for every run, you can use the following example:

export NEPTUNE_CUSTOM_RUN_ID=`date +"%Y%m%d%H%M%s%N" | md5sum`
export NEPTUNE_CUSTOM_RUN_ID=`date +"%Y%m%d%H%M%s%N" | md5`
set NEPTUNE_CUSTOM_RUN_ID=`date +"%Y%m%d%H%M%s%N"`

Setting custom ID through init_run() argument#

You can set the ID through the custom_run_id argument of the init_run() function when initializing the run.

To ensure a unique ID for every run, you can use the following example:

import hashlib
import time

run = neptune.init_run(

You can also manually set the ID to a string of your choice.

run = neptune.init_run(custom_run_id="Your custom run ID")