Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Saturn99X_Etherion /src /services /execution_mode.py
| import os | |
| from enum import Enum | |
| class ExecutionMode(str, Enum): | |
| LOCAL = "local" | |
| DOCKER = "docker" | |
| BARE_METAL = "bare_metal" | |
| CLOUD_RUN = "cloud_run" | |
| def detect() -> ExecutionMode: | |
| explicit = os.getenv("EXECUTION_MODE", "").lower() | |
| if explicit: | |
| try: | |
| return ExecutionMode(explicit) | |
| except ValueError: | |
| pass | |
| # Heuristics | |
| if os.path.exists("/.dockerenv"): | |
| return ExecutionMode.DOCKER | |
| if os.path.exists("/run/systemd/system") and not os.path.exists("/.dockerenv"): | |
| if os.getenv("GOOGLE_CLOUD_PROJECT"): | |
| return ExecutionMode.CLOUD_RUN | |
| return ExecutionMode.BARE_METAL | |
| return ExecutionMode.LOCAL | |
Xet Storage Details
- Size:
- 707 Bytes
- Xet hash:
- 187f09a2fa55aadfafbb2898f0e3275a2de564a20b53cd9ef97cf53c5bce4e0a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.