Connect to an existing Ray cluster or start one and connect to it. This method handles two cases; either a Ray cluster already exists and we just attach this driver to it or we start all of the processes associated with a Ray cluster and attach to the newly started cluster. Not
(
address: Optional[str] = None,
*,
num_cpus: Optional[int] = None,
num_gpus: Optional[int] = None,
resources: Optional[Dict[str, float]] = None,
labels: Optional[Dict[str, str]] = None,
object_store_memory: Optional[int] = None,
local_mode: bool = False,
ignore_reinit_error: bool = False,
include_dashboard: Optional[bool] = None,
dashboard_host: str = get_localhost_ip(),
dashboard_port: Optional[int] = None,
job_config: "ray.job_config.JobConfig" = None,
configure_logging: bool = True,
logging_level: int = ray_constants.LOGGER_LEVEL,
logging_format: Optional[str] = None,
logging_config: Optional[LoggingConfig] = None,
log_to_driver: Optional[bool] = None,
namespace: Optional[str] = None,
runtime_env: Optional[Union[Dict[str, Any], "RuntimeEnv"]] = None, # noqa: F821
enable_resource_isolation: bool = False,
cgroup_path: Optional[str] = None,
system_reserved_cpu: Optional[float] = None,
system_reserved_memory: Optional[int] = None,
proxy_server_url: Optional[str] = None,
**kwargs,
)
| 1436 | @PublicAPI |
| 1437 | @client_mode_hook |
| 1438 | def init( |
| 1439 | address: Optional[str] = None, |
| 1440 | *, |
| 1441 | num_cpus: Optional[int] = None, |
| 1442 | num_gpus: Optional[int] = None, |
| 1443 | resources: Optional[Dict[str, float]] = None, |
| 1444 | labels: Optional[Dict[str, str]] = None, |
| 1445 | object_store_memory: Optional[int] = None, |
| 1446 | local_mode: bool = False, |
| 1447 | ignore_reinit_error: bool = False, |
| 1448 | include_dashboard: Optional[bool] = None, |
| 1449 | dashboard_host: str = get_localhost_ip(), |
| 1450 | dashboard_port: Optional[int] = None, |
| 1451 | job_config: "ray.job_config.JobConfig" = None, |
| 1452 | configure_logging: bool = True, |
| 1453 | logging_level: int = ray_constants.LOGGER_LEVEL, |
| 1454 | logging_format: Optional[str] = None, |
| 1455 | logging_config: Optional[LoggingConfig] = None, |
| 1456 | log_to_driver: Optional[bool] = None, |
| 1457 | namespace: Optional[str] = None, |
| 1458 | runtime_env: Optional[Union[Dict[str, Any], "RuntimeEnv"]] = None, # noqa: F821 |
| 1459 | enable_resource_isolation: bool = False, |
| 1460 | cgroup_path: Optional[str] = None, |
| 1461 | system_reserved_cpu: Optional[float] = None, |
| 1462 | system_reserved_memory: Optional[int] = None, |
| 1463 | proxy_server_url: Optional[str] = None, |
| 1464 | **kwargs, |
| 1465 | ) -> BaseContext: |
| 1466 | """ |
| 1467 | Connect to an existing Ray cluster or start one and connect to it. |
| 1468 | |
| 1469 | This method handles two cases; either a Ray cluster already exists and we |
| 1470 | just attach this driver to it or we start all of the processes associated |
| 1471 | with a Ray cluster and attach to the newly started cluster. |
| 1472 | Note: This method overwrite sigterm handler of the driver process. |
| 1473 | |
| 1474 | In most cases, it is enough to just call this method with no arguments. |
| 1475 | This will autodetect an existing Ray cluster or start a new Ray instance if |
| 1476 | no existing cluster is found: |
| 1477 | |
| 1478 | .. testcode:: |
| 1479 | |
| 1480 | ray.init() |
| 1481 | |
| 1482 | To explicitly connect to an existing local cluster, use this as follows. A |
| 1483 | ConnectionError will be thrown if no existing local cluster is found. |
| 1484 | |
| 1485 | .. testcode:: |
| 1486 | :skipif: True |
| 1487 | |
| 1488 | ray.init(address="auto") |
| 1489 | |
| 1490 | To connect to an existing remote cluster, use this as follows (substituting |
| 1491 | in the appropriate address). Note the addition of "ray://" at the beginning |
| 1492 | of the address. This requires `ray[client]`. |
| 1493 | |
| 1494 | .. testcode:: |
| 1495 | :skipif: True |
no test coverage detected
searching dependent graphs…