From cb438be146b069799a151192cf257a75a328e1de Mon Sep 17 00:00:00 2001 From: Richard Liaw Date: Sat, 29 Aug 2020 16:35:14 -0700 Subject: [PATCH] [core] Move log_to_driver back to public (#10422) --- python/ray/serve/benchmarks/microbenchmark.py | 2 +- python/ray/tests/test_advanced_3.py | 4 ++-- .../tune/examples/pbt_transformers/pbt_transformers.py | 2 +- python/ray/tune/tests/test_commands.py | 2 +- .../ray/util/sgd/torch/examples/cifar_pytorch_example.py | 2 +- python/ray/util/sgd/torch/examples/cifar_pytorch_pbt.py | 2 +- python/ray/worker.py | 8 ++++---- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/python/ray/serve/benchmarks/microbenchmark.py b/python/ray/serve/benchmarks/microbenchmark.py index 718d3cf30..1274c60b9 100644 --- a/python/ray/serve/benchmarks/microbenchmark.py +++ b/python/ray/serve/benchmarks/microbenchmark.py @@ -77,7 +77,7 @@ async def trial(actors, session, data_size): async def main(): - ray.init(_log_to_driver=False) + ray.init(log_to_driver=False) serve.init() serve.create_backend("backend", backend) diff --git a/python/ray/tests/test_advanced_3.py b/python/ray/tests/test_advanced_3.py index 75874542e..ffb6e0cea 100644 --- a/python/ray/tests/test_advanced_3.py +++ b/python/ray/tests/test_advanced_3.py @@ -208,7 +208,7 @@ class CaptureOutputAndError: def test_logging_to_driver(shutdown_only): - ray.init(num_cpus=1, _log_to_driver=True) + ray.init(num_cpus=1, log_to_driver=True) @ray.remote def f(): @@ -233,7 +233,7 @@ def test_logging_to_driver(shutdown_only): def test_not_logging_to_driver(shutdown_only): - ray.init(num_cpus=1, _log_to_driver=False) + ray.init(num_cpus=1, log_to_driver=False) @ray.remote def f(): diff --git a/python/ray/tune/examples/pbt_transformers/pbt_transformers.py b/python/ray/tune/examples/pbt_transformers/pbt_transformers.py index a3d6c36e5..ee144f6e3 100644 --- a/python/ray/tune/examples/pbt_transformers/pbt_transformers.py +++ b/python/ray/tune/examples/pbt_transformers/pbt_transformers.py @@ -106,7 +106,7 @@ def tune_transformer(num_samples=8, gpus_per_trial=0, smoke_test=False, ray_address=None): - ray.init(ray_address, _log_to_driver=False) + ray.init(ray_address, log_to_driver=False) data_dir_name = "./data" if not smoke_test else "./test_data" data_dir = os.path.abspath(os.path.join(os.getcwd(), data_dir_name)) if not os.path.exists(data_dir): diff --git a/python/ray/tune/tests/test_commands.py b/python/ray/tune/tests/test_commands.py index 1ffc98a87..179ec5e74 100644 --- a/python/ray/tune/tests/test_commands.py +++ b/python/ray/tune/tests/test_commands.py @@ -31,7 +31,7 @@ class Capturing: @pytest.fixture def start_ray(): - ray.init(_log_to_driver=False, local_mode=True) + ray.init(log_to_driver=False, local_mode=True) _register_all() yield ray.shutdown() diff --git a/python/ray/util/sgd/torch/examples/cifar_pytorch_example.py b/python/ray/util/sgd/torch/examples/cifar_pytorch_example.py index 2ecd356f4..94d286d45 100644 --- a/python/ray/util/sgd/torch/examples/cifar_pytorch_example.py +++ b/python/ray/util/sgd/torch/examples/cifar_pytorch_example.py @@ -102,7 +102,7 @@ if __name__ == "__main__": args, _ = parser.parse_known_args() num_cpus = 4 if args.smoke_test else None - ray.init(address=args.address, num_cpus=num_cpus, _log_to_driver=True) + ray.init(address=args.address, num_cpus=num_cpus, log_to_driver=True) trainer1 = TorchTrainer( model_creator=ResNet18, diff --git a/python/ray/util/sgd/torch/examples/cifar_pytorch_pbt.py b/python/ray/util/sgd/torch/examples/cifar_pytorch_pbt.py index de066c328..f2b6a75c3 100644 --- a/python/ray/util/sgd/torch/examples/cifar_pytorch_pbt.py +++ b/python/ray/util/sgd/torch/examples/cifar_pytorch_pbt.py @@ -98,7 +98,7 @@ if __name__ == "__main__": "--tune", action="store_true", default=False, help="Tune training") args, _ = parser.parse_known_args() - ray.init(address=args.address, _log_to_driver=True) + ray.init(address=args.address, log_to_driver=True) TorchTrainable = TorchTrainer.as_trainable( model_creator=ResNet18, diff --git a/python/ray/worker.py b/python/ray/worker.py index 9feb9c148..f7d67e008 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -483,12 +483,12 @@ def init( configure_logging=True, logging_level=logging.INFO, logging_format=ray_constants.LOGGER_FORMAT, + log_to_driver=True, enable_object_reconstruction=False, # The following are unstable parameters and their use is discouraged. _redis_max_memory=None, _node_ip_address=ray_constants.NODE_DEFAULT_IP, _driver_object_store_memory=None, - _log_to_driver=True, _memory=None, _redis_password=ray_constants.REDIS_DEFAULT_PASSWORD, _include_java=False, @@ -564,6 +564,8 @@ def init( timestamp, filename, line number, and message. See the source file ray_constants.py for details. Ignored unless "configure_logging" is true. + log_to_driver (bool): If true, the output from all of the worker + processes on all nodes will be directed to the driver. enable_object_reconstruction (bool): If True, when an object stored in the distributed plasma store is lost due to node failure, Ray will attempt to reconstruct the object by re-executing the task that @@ -574,8 +576,6 @@ def init( _node_ip_address (str): The IP address of the node that we are on. _driver_object_store_memory (int): Limit the amount of memory the driver can use in the object store for creating objects. - _log_to_driver (bool): If true, the output from all of the worker - processes on all nodes will be directed to the driver. _memory: Amount of reservable memory resource to create. _redis_password (str): Prevents external clients without the password from connecting to Redis if provided. @@ -739,7 +739,7 @@ def init( connect( _global_node, mode=driver_mode, - log_to_driver=_log_to_driver, + log_to_driver=log_to_driver, worker=global_worker, driver_object_store_memory=_driver_object_store_memory, job_id=None,