Skip to content

Environment variables

Detecting the system environment

The userenv module sets an environment variable, ISAMBARD_HOST, by default. This allows you to programmatically detect which system your code is running on.

ISAMBARD_HOST is set to one of the following values:

System ISAMBARD_HOST value
Isambard-AI Phase 1 I-AI_P1
Isambard-AI Phase 2 I-AI_P2
Isambard 3 (Grace) I3
Isambard 3 MACS I3MACS

For example, from the command line:

$ env | grep ISAMBARD
ISAMBARD_HOST=I-AI_P2

Or, in Python:

import os

host = os.getenv("ISAMBARD_HOST", "Unknown System")
print(f"Running on: {host}")