Resumable Training APIs
The DLRecoverManager class provides APIs related to process-level recovery and process-level online recovery. The client imports it into the client code as a Python package.
The APIs provided by the DLRecoverManager class may throw exceptions. The caller is responsible for catching and handling these exceptions.
init(self, info: pb.ClientInfo, server_addr: str)
Constructs a DLRecoverManager for subsequent communication.
Table 1 Parameters
| Parameter | Type | Description |
|---|---|---|
| info | pb.ClientInfo | info.jobId: str type, the job ID. info.role: str type, the client role. |
| server_addr | str | Server address |
register(self, request: pb.ClientInfo) -> pb.Status
Registers a client. The server performs pre-recovery initialization operations for the job specified by the request.
Table 2 Parameters
| Parameter | Type | Description |
|---|---|---|
| request | pb.ClientInfo | request.jobId: str type, job ID. request.role: str type, client role. |
Table 3 Return value description
| Return Value Type | Description |
|---|---|
| Status | Status.info: str type, return information description. Status.code: int type. |
def start_subscribe(self, frame: str = "pytorch")
The client and server establish a gRPC persistent connection, through which the server communicates unidirectionally with the client. For example, when a fault occurs, the server sends the client information such as a training stop signal and global faulty process rank.
Table 4 Parameters
| Parameter | Type | Description |
|---|---|---|
| frame | str | Indicates the AI framework used by the job. |
Initializes the ClusterD server status on the client side to ensure normal registration and connection establishment for subsequent jobs.
The client reports to the server that the job process has stopped. Typically, after the client receives a stop training signal from the server, the client stops the training job process and then reports to the server that the job process has stopped.
Table 1 Parameter description
| Parameter | Type | Description |
|---|---|---|
| code | int | Status code |
| msg | str | Return information |
| fault_ranks | dict | Rank fo the faulty process |
Table 2 Return value description
| Return Value Type | Description |
|---|---|
| int | 0 indicates success, and other return values indicate failure. For details about return codes, see Return Codes. |
The client provides the server with the recovery strategies it supports, so that the server can select the optimal recovery strategy. The server then sends it to the client through the persistent connection established by start_subscribe.
Table 1 Parameter Description
| Parameter | Type | Description |
|---|---|---|
| fault_ranks | dict | Rank of the faulty process |
| strategy_list | list | Recovery strategy list |
Table 2 Return value description
| Return Value Type | Description |
|---|---|
| int | 0 indicates success, and other return values indicate failure. For details about return codes, see Return Codes. |
The client reports the job recovery status to the server.
Table 1 Parameter description
| Parameter | Type | Description |
|---|---|---|
| code | int | Status code |
| msg | str | Return information |
| fault_ranks | dict | Rank of the faulty process |
| strategy | str | Recovery strategy |
Table 2 Return value description
| Return Value Type | Description |
|---|---|
| int | 0 indicates success, and other return values indicate failure. For details about return codes, see Return Codes. |
The client reports a service-plane fault in the job process. When the client detects a fault first, it reports the information of the rank where the service-plane fault occurred to the server.
Table 1 Parameter description
| Parameter | Type | Description |
|---|---|---|
| fault_ranks | dict | Rank of the faulty process |
Table 2 Return value description
| Return Value Type | Description |
|---|---|
| int | 0 indicates success, and other return values indicate failure. For details about return codes, see Return Codes. |
The MSRunPlugin class provides MindSpore process management functions. It is called by MindSpore and integrated into the MindSpore package.
Registers a process management function with TaskD for subsequent use in managing the process lifecycle.
Table 1 Parameter description
| Parameter | Type | Description |
|---|---|---|
| operator | string | The type of callback currently being injected.
|
| func | Function | The function callback for the currently registered function |
Calls the MSRunPlugin start method to allow TaskD to take over MindSpore training process management.
Constructs the MSRunPlugin class for subsequent instantiation and invocation by the user.