From fe720d9001e7a7cad8f1443eafbcfc8b9d744f12 Mon Sep 17 00:00:00 2001 From: Travis Addair Date: Mon, 11 Oct 2021 10:40:02 -0700 Subject: [PATCH] Ray: fix RayExecutor to fail when num_workers=0 and num_hosts=None (#3210) Signed-off-by: Travis Addair Signed-off-by: weihanmines --- horovod/ray/runner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/horovod/ray/runner.py b/horovod/ray/runner.py index 02017fb426..595e0361de 100644 --- a/horovod/ray/runner.py +++ b/horovod/ray/runner.py @@ -218,12 +218,12 @@ def __init__( cpus_per_worker = cpus_per_slot gpus_per_worker = gpus_per_slot - if num_workers is None and num_hosts is None: - raise ValueError("Either `num_workers` or `num_hosts` must be " + if not (num_workers or num_hosts): + raise ValueError("One of `num_workers` or `num_hosts` must be " "set.") if num_workers and num_hosts: - raise ValueError("Both `num_workers` and `num_hosts` cannot be " + raise ValueError("Only one of `num_workers` and `num_hosts` must be " "set.") if gpus_per_worker and not use_gpu: