Source code for lightning.fabric.plugins.environments.kubeflow
# Copyright The Lightning AI team.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.importloggingimportosfromtyping_extensionsimportoverridefromlightning.fabric.plugins.environments.cluster_environmentimportClusterEnvironmentlog=logging.getLogger(__name__)
[docs]classKubeflowEnvironment(ClusterEnvironment):"""Environment for distributed training using the `PyTorchJob`_ operator from `Kubeflow`_. This environment, unlike others, does not get auto-detected and needs to be passed to the Fabric/Trainer constructor manually. .. _PyTorchJob: https://www.kubeflow.org/docs/components/trainer/legacy-v1/user-guides/pytorch/ .. _Kubeflow: https://www.kubeflow.org """@property@overridedefcreates_processes_externally(self)->bool:returnTrue@property@overridedefmain_address(self)->str:returnos.environ["MASTER_ADDR"]@property@overridedefmain_port(self)->int:returnint(os.environ["MASTER_PORT"])
[docs]@staticmethod@overridedefdetect()->bool:raiseNotImplementedError("The Kubeflow environment can't be detected automatically.")
@overridedefset_world_size(self,size:int)->None:log.debug("KubeflowEnvironment.set_world_size was called, but setting world size is not allowed. Ignored.")
@overridedefset_global_rank(self,rank:int)->None:log.debug("KubeflowEnvironment.set_global_rank was called, but setting global rank is not allowed. Ignored.")
To analyze traffic and optimize your experience, we serve cookies on this
site. By clicking or navigating, you agree to allow our usage of cookies.
Read PyTorch Lightning's
Privacy Policy.
You are viewing an outdated version of PyTorch Lightning Docs