switch_role
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
Note: For the
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] |
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