get_current_worker_info

paddle.distributed.rpc. get_current_worker_info ( ) [source]

Get current worker information.

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:9004"
>>> rpc.init_rpc("worker0", rank=0, world_size=1,
...             master_endpoint="127.0.0.1:8007")

>>> print(rpc.get_current_worker_info())
{name: worker0, rank: 0, ip: 127.0.0.1, port: 9004}

>>> rpc.shutdown()