switch_role

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Note: For the Atlas A2 training products/Atlas A2 inference products, only the Atlas 800I A2 inference server, Atlas 300I A2 inference card, and A200I A2 Box heterogeneous components are supported.

Function Description

Switches the role of the current LLM-DataDist instance. You can also configure switch_options to switch the role to client or server.

Prototype

1
switch_role(self, role: LLMRole, switch_options: Optional[Dict[str, str]] = None)

Parameters

Parameter

Data Type

Description

role

LLMRole

Target role to be switched.

switch_options

options: Dict[str, str]

Role switching configuration item.

This parameter is optional. The default value is None.

For a server, you need to use listen_ip_info to configure the host IP address and port for listening, for example, "192.168.1.1:26000". If the host IP address and port number are not configured, the node functions as the client.

If the role is switched from server to client, the previously configured listening port is disabled. If only the listening port of the server needs to be changed, you can use options to switch to another listening port and disable the previous one.

Example

Click Gitcode, select the matching version, and obtain the sample from the examples/python directory.

Returns

  • In normal cases, no value is returned.
  • If the input data type is incorrect, a TypeError or ValueError is thrown.
  • If there are residual link resources during switch_role, an LLMException is thrown, and status_code is LLM_EXIST_LINK.

Restrictions

None