Is there a way to detect whether a flow is running...
# ask-metaflow
d
Is there a way to detect whether a flow is running locally, on aws batch with my computer as orchestrator, or using step functions? For context, I want certain operations to run only when a flow is running using step functions (namely calling other step functions / flows)
1
c
METAFLOW_RUNTIME_ENVIRONMENT
will tell whether it is local
Copy code
if os.environ.get("METAFLOW_RUNTIME_ENVIRONMENT", "local") == "local" --> local
elif os.environ.get("METAFLOW_RUNTIME_ENVIRONMENT") == "aws-batch" --> batch
can use the run id to determine if a run is on step functions
Copy code
if current.run_id.startswith('sfn-') --> step functions
d
Awesome. Thank you very much
👀 1