switch_role
Applicability
Product |
Supported (√/x) |
|---|---|
Atlas 350 Accelerator Card |
x |
√ |
|
√ |
|
x |
|
x |
|
x |
Note: For
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 |
Target role to be switched. |
|
switch_options |
options: Dict[str, str] |
Switch the role 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. When this configuration item specifies the hixl backend, the listening port cannot be changed using switch_role. |
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, the TypeError or ValueError exception is reported.
- If there are residual link resources during switch_role, an LLMException is thrown, and status_code is LLM_EXIST_LINK.
Restrictions
None