API for Specifying an Instance Role v2

Function

Specifies an instance role.

Format

Operation type: POST

URL: https://{ip}:{port}/v2/role/{role}

  • The {ip} field prioritizes reading the environment variable MIES_CONTAINER_MANAGEMENT_IP. If the environment variable does not exist, managementIpAddress in the configuration file is used. If managementIpAddress does not exist in the configuration file, ipAddress in the configuration file is used.
  • The {port} field prioritizes reading the managementPort parameter in the configuration file. If the configuration file does not contain the managementPort parameter, the port parameter in the configuration file is used.

Request Parameters

Table 1 URL field description

Field

Mandatory/Optional

Type

Description

role

Mandatory

String

Instance role. Possible values:

  • prefill

  • decode

Table 2 Body field description

Field

Mandatory/Optional

Type

Description

local

Mandatory

Structure

Instance information.

local[].dp_inst_list

Mandatory

Structure array

List of DP group information in the current prefill/decode instance.

local[].dp_inst_list[].device

Mandatory

Structure array

NPU information in the current DP group. Multiple NPUs may exist.

local[].dp_inst_list[].device[].device_id

Mandatory

Integer string

Physical ID of an NPU.

local[].dp_inst_list[].device[].device_ip

Mandatory

String

IP address of an NPU.

local[].dp_inst_list[].device[].rank_id

Mandatory

Integer string

Rank ID of an NPU.

local[].dp_inst_list[].device[].device_logical_id

Mandatory

Integer string

Logical ID of an NPU.

local[].dp_inst_list[].dp_inst_id

Mandatory

Integer string

ID of the DP group of the prefill/decode instance.

local[].host_ip

Mandatory

String

Host IP address of the current node.

local[].server_ip

Mandatory

String

Server IP address of the current node.

peers

Mandatory

Structure array

List of objects to be connected. Each instance sees only the instances related to itself.

  • For a decode instance, it corresponds to a prefill instance that needs to be connected.
  • For a prefill instance, it corresponds to a decode instance that needs to be connected.

peers[].dp_inst_list

Mandatory

Structure array

List of DP group information in the prefill/decode instance on the peer node.

peers[].dp_inst_list[].device

Mandatory

Structure array

NPU information in the DP group on the peer node. Multiple NPUs may exist.

peers[].dp_inst_list[].device[].device_id

Mandatory

Integer string

Physical ID of the NPU in the DP group on the peer node.

peers[].dp_inst_list[].device[].device_ip

Mandatory

String

IP address of the NPU in the DP group on the peer node.

peers[].dp_inst_list[].device[].rank_id

Mandatory

Integer string

Rank ID of the NPU in the prefill-decode group on the peer node.

peers[].dp_inst_list[].device[].device_logical_id

Mandatory

Integer string

Logical ID of the NPU in the DP group on the peer node.

peers[].dp_inst_list[].dp_inst_id

Mandatory

Integer string

ID of the DP group of the prefill/decode instance on the peer node.

peers[].host_ip

Mandatory

String

Host IP address of the peer node.

peers[].server_ip

Mandatory

String

Server IP address of the peer node.

Usage Example

Request example:

POST https://{ip}:{port}/v2/role/prefill

Request body:

{
    "local": [
        {
            "dp_inst_list": [
                {
                    "device": [
                        {
                            "device_id": "0",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "0",
                            "device_logical_id": "0"
                        },
                        {
                            "device_id": "1",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "1"
                        },
                        {
                            "device_id": "2",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "2",
                            "device_logical_id": "2"
                        },
                        {
                            "device_id": "3",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "3",
                            "device_logical_id": "3"
                        }
                    ],
                    "dp_inst_id": 1111110000
                },
                {
                    "device": [
                        {
                            "device_id": "4",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "4",
                            "device_logical_id": "4"
                        },
                        {
                            "device_id": "5",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "5",
                            "device_logical_id": "5"
                        },
                        {
                            "device_id": "6",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "6",
                            "device_logical_id": "6"
                        },
                        {
                            "device_id": "7",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "7",
                            "device_logical_id": "7"
                        }
                    ],
                    "dp_inst_id": 1111110001
                }
            ],
            "host_ip": "xxx.xxx.xxx.xxx",
            "server_ip": "xxx.xxx.xxx.xxx"
        },
        {
            "dp_inst_list": [
                {
                    "device": [
                        {
                            "device_id": "0",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "0"
                        },
                        {
                            "device_id": "1",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "1"
                        },
                        {
                            "device_id": "2",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "2"
                        },
                        {
                            "device_id": "3",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "3"
                        }
                    ],
                    "dp_inst_id": 1111110002
                },
                {
                    "device": [
                        {
                            "device_id": "4",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "4"
                        },
                        {
                            "device_id": "5",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "5"
                        },
                        {
                            "device_id": "6",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "6"
                        },
                        {
                            "device_id": "7",
                            "device_ip": "xxx.xxx.xxx.xxx",
                            "rank_id": "1",
                            "device_logical_id": "7"
                        }
                    ],
                    "dp_inst_id": 1111110003
                }
            ],
            "host_ip": "141.61.33.76",
            "server_ip": "192.168.165.113"
        }
    ],
    "peers": [
        [
            {
                "dp_inst_list": [
                    {
                        "device": [
                            {
                                "device_id": "0",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "0"
                            },
                            {
                                "device_id": "1",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "1"
                            },
                            {
                                "device_id": "2",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "2"
                            },
                            {
                                "device_id": "3",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "3"
                            }
                        ],
                        "dp_inst_id": 2222220000
                    },
                    {
                        "device": [
                            {
                                "device_id": "4",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "4"
                            },
                            {
                                "device_id": "5",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "5"
                            },
                            {
                                "device_id": "6",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "6"
                            },
                            {
                                "device_id": "7",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "7"
                            }
                        ],
                        "dp_inst_id": 2222220001
                    }
                ],
                "host_ip": "141.61.33.78",
                "server_ip": "192.168.195.39"
            },
            {
                "dp_inst_list": [
                    {
                        "device": [
                            {
                                "device_id": "0",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "0",
                                "device_logical_id": "0"
                            },
                            {
                                "device_id": "1",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "1",
                                "device_logical_id": "1"
                            },
                            {
                                "device_id": "2",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "2",
                                "device_logical_id": "2"
                            },
                            {
                                "device_id": "3",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "3",
                                "device_logical_id": "3"
                            }
                        ],
                        "dp_inst_id": 2222220002
                    },
                    {
                        "device": [
                            {
                                "device_id": "4",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "4",
                                "device_logical_id": "4"
                            },
                            {
                                "device_id": "5",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "5",
                                "device_logical_id": "5"
                            },
                            {
                                "device_id": "6",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "6",
                                "device_logical_id": "6"
                            },
                            {
                                "device_id": "7",
                                "device_ip": "xxx.xxx.xxx.xxx",
                                "rank_id": "7",
                                "device_logical_id": "7"
                            }
                        ],
                        "dp_inst_id": 2222220003
                    }
                ],
                "host_ip": "xxx.xxx.xxx.xxx",
                "server_ip": "xxx.xxx.xxx.xxx"
            }
        ]
    ]
}

Response example:

  • Success
    {
        "result": "OK"
    }
  • Failure
    {
    "error": "xxx",
    "error_type": "xxxxx"
    }

Response status code:

  • 200: success
  • 400: request error
  • 422: The request body does not meet the specifications.

Output Description

Field

Type

Description

result

String

Success.

error

String

Error message.

error_type

String

Error type.