Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Warn when doing local torch elastic training with nnodes > 1 #1697

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions plugins/flytekit-kf-pytorch/flytekitplugins/kfpytorch/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from flytekit.configuration import SerializationSettings
from flytekit.core.resources import convert_resources_to_resource_model
from flytekit.extend import IgnoreOutputs, TaskPlugins
from flytekit.loggers import logger

TORCH_IMPORT_ERROR_MESSAGE = "PyTorch is not installed. Please install `flytekitplugins-kfpytorch['elastic']`."

Expand Down Expand Up @@ -274,6 +275,15 @@ def _execute(self, **kwargs) -> Any:
else:
nproc = self.task_config.nproc_per_node

dist_env_vars_set = os.environ.get("PET_NNODES") is not None
if not dist_env_vars_set and self.min_nodes > 1:
logger.warning(
(
f"`nnodes` is set to {self.task_config.nnodes} in elastic task but execution appears "
"to not run in a `PyTorchJob`. Rendezvous might timeout."
)
)

config = LaunchConfig(
run_id=flytekit.current_context().execution_id.name,
min_nodes=self.min_nodes,
Expand Down