feat: add get_execution_environment() API#13059
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe changes add environment configuration support to the 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
8f7e986 to
70340d4
Compare
|
Should this be added to the public API and not just in the implementation file? |
Adds api.environment.get() to the public ComfyAPI — returns "local" (default), "cloud", or "remote" based on the COMFY_EXECUTION_ENVIRONMENT env var. Custom nodes use this to adapt behavior for managed deployments (e.g. skip model downloads when models are pre-provisioned).
cb1ca33 to
8165160
Compare
done! |
Summary
Adds
api.environment.get()to the public ComfyAPI, returning"local","cloud", or"remote"based on theCOMFY_EXECUTION_ENVIRONMENTenv var.Motivation
ComfyComplete (the curated node distribution) needs a way for custom nodes to detect whether they are running in a local, cloud, or remote environment. For example:
Usage
Or synchronously:
How deployments set it
Managed deployments set the env var in their container:
When not set, defaults to
"local"— existing installations are unaffected.Design decisions
ComfyAPI_latest.Environment) notcomfy.utils— follows the same pattern asExecution,Caching,NodeReplacementlocal(default),cloud(Comfy Cloud),remote(other managed deployments)"local"Test plan
api.environment.get()returns"local"when env var is not set"cloud"whenCOMFY_EXECUTION_ENVIRONMENT=cloud"remote"whenCOMFY_EXECUTION_ENVIRONMENT=remote"local"for invalid valuesComfyAPISync) works the same