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

Make elastic timeout configurable for HorovovJob. #2631

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions plugins/flytekit-kf-mpi/flytekitplugins/kfmpi/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class HorovodJob(object):
verbose: Optional flag indicating whether to enable verbose logging (default: False).
log_level: Optional string specifying the log level (default: "INFO").
discovery_script_path: Path to the discovery script used for host discovery (default: "/etc/mpi/discover_hosts.sh").
elastic_timeout: horovod elastic timeout in second (default: 1200).
num_launcher_replicas: [DEPRECATED] The number of launcher server replicas to use. This argument is deprecated. Please use launcher.replicas instead.
num_workers: [DEPRECATED] The number of worker replicas to spawn in the cluster for this job. Please use worker.replicas instead.
"""
Expand All @@ -244,6 +245,7 @@ class HorovodJob(object):
verbose: Optional[bool] = False
log_level: Optional[str] = "INFO"
discovery_script_path: Optional[str] = "/etc/mpi/discover_hosts.sh"
elastic_timeout: Optional[int] = 1200
# Support v0 config for backwards compatibility
num_launcher_replicas: Optional[int] = None
num_workers: Optional[int] = None
Expand Down Expand Up @@ -287,6 +289,8 @@ def _get_horovod_prefix(self) -> List[str]:
f"{self.task_config.slots}",
"--host-discovery-script",
self.task_config.discovery_script_path,
"--elastic-timeout",
f"{self.task_config.elastic_timeout}",
]
if self.task_config.verbose:
base_cmd.append("--verbose")
Expand Down
3 changes: 3 additions & 0 deletions plugins/flytekit-kf-mpi/tests/test_mpi_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def test_horovod_task(serialization_settings):
slots=2,
verbose=False,
log_level="INFO",
elastic_timeout=200,
run_policy=RunPolicy(
clean_pod_policy=CleanPodPolicy.NONE,
backoff_limit=5,
Expand All @@ -182,6 +183,8 @@ def my_horovod_task(): ...
assert "--verbose" not in cmd
assert "--log-level" in cmd
assert "INFO" in cmd
assert "--elastic-timeout" in cmd
assert "200" in cmd
# CleanPodPolicy.NONE is the default, so it should not be in the output dictionary
expected_dict = {
"launcherReplicas": {
Expand Down
Loading