get_worker_info

paddle.distributed.rpc. get_worker_info ( name ) [source]

Get worker information by worker name.

Parameters

name (str) – name of the worker.

Returns

class WorkerInfo with attribute name, rank, ip and port.

Examples

>>> 
>>> import paddle.distributed.rpc as rpc
>>> import os

>>> os.environ["PADDLE_WORKER_ENDPOINT"] = "127.0.0.1:9002"
>>> rpc.init_rpc("worker0", rank=0, world_size=1,
...             master_endpoint="127.0.0.1:8005")

>>> print(rpc.get_worker_info("worker0"))
{name: worker0, rank: 0, ip: 127.0.0.1, port: 9002}

>>> rpc.shutdown()