Returns a string representing the execution environment of the pipeline. Returns: str: the execution environment
()
| 63 | |
| 64 | |
| 65 | def get_environment() -> str: |
| 66 | """Returns a string representing the execution environment of the pipeline. |
| 67 | |
| 68 | Returns: |
| 69 | str: the execution environment |
| 70 | """ |
| 71 | # Order is important here |
| 72 | if Environment.in_kubernetes(): |
| 73 | return EnvironmentType.KUBERNETES |
| 74 | elif Environment.in_github_actions(): |
| 75 | return EnvironmentType.GITHUB_ACTION |
| 76 | elif Environment.in_gitlab_ci(): |
| 77 | return EnvironmentType.GITLAB_CI |
| 78 | elif Environment.in_circle_ci(): |
| 79 | return EnvironmentType.CIRCLE_CI |
| 80 | elif Environment.in_bitbucket_ci(): |
| 81 | return EnvironmentType.BITBUCKET_CI |
| 82 | elif Environment.in_ci(): |
| 83 | return EnvironmentType.GENERIC_CI |
| 84 | elif Environment.in_github_codespaces(): |
| 85 | return EnvironmentType.GITHUB_CODESPACES |
| 86 | elif Environment.in_zenml_codespace(): |
| 87 | return EnvironmentType.ZENML_CODESPACE |
| 88 | elif Environment.in_vscode_remote_container(): |
| 89 | return EnvironmentType.VSCODE_REMOTE_CONTAINER |
| 90 | elif Environment.in_lightning_ai_studio(): |
| 91 | return EnvironmentType.LIGHTNING_AI_STUDIO |
| 92 | elif Environment.in_docker(): |
| 93 | return EnvironmentType.DOCKER |
| 94 | elif Environment.in_container(): |
| 95 | return EnvironmentType.CONTAINER |
| 96 | elif Environment.in_google_colab(): |
| 97 | return EnvironmentType.COLAB |
| 98 | elif Environment.in_paperspace_gradient(): |
| 99 | return EnvironmentType.PAPERSPACE |
| 100 | elif Environment.in_notebook(): |
| 101 | return EnvironmentType.NOTEBOOK |
| 102 | elif Environment.in_wsl(): |
| 103 | return EnvironmentType.WSL |
| 104 | else: |
| 105 | return EnvironmentType.NATIVE |
| 106 | |
| 107 | |
| 108 | class Environment(metaclass=SingletonMetaClass): |