I want my code to behave differently while I'm developing it in Jupyterlab than it does when live as a model, but I don't want to manually edit a true/false variable every time. Is there a smart way to do this programmatically?
Yes, here's a sample python snippet you can use to determine if you're in a model:
import os os.environ['HOSTNAME'].startswith('model')
Domino injects a handful of useful environment variables into your runs - you can use the `HOSTNAME` environment variable to tell if you're inside a model.
In a Domino model, it will look like model-<hash>, for example:
In a Domino run, it will look like domino-run-<hash>, for example:
When running locally, it won't exist unless you've created it on your machine.