Reasoning resource recovery method and device of reasoning platform, equipment and storage medium
Patent Information
- Application Number
- CN202311862025.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2043-12-29
AI Technical Summary
一方面用户真正使用的推理服务资源会在所有资源被创建完成后才会开始恢复,不利于服务快速上线;另一方面推理服务资源的恢复无法区分对用户的重要性,只能按照记录顺序,通常是资源创建时间顺序进行恢复,无法实现重要服务优先恢复
[0054]本申请所提供的推理平台的推理资源恢复方法,当接收到推理资源访问请求时,分别获取推理平台中各实际推理资源分别对应的实际资源参数;将各实际资源参数与数据库中记录的各原始资源参数进行对比,得到各实际推理资源中包含的各待恢复推理资源;获取各待恢复推理资源之间的资源依赖关系和各待恢复推理资源分别对应的预设权重参数;根据资源依赖关系和各预设权重参数计算各待恢复推理资源分别对应的累计权重;根据各累计权重对各待恢复推理资源进行恢复。
Smart Images

Figure CN117811900B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer application technology, and in particular to a method, apparatus, device, and computer-readable storage medium for restoring inference resources of an inference platform. Background Technology
[0002] Inference platforms (such as AIStation) support the creation of various inference resources, including namespaces, storage classes, persistent volume declarations (PVCs), Istio services (ISVCs), Helm services, and inference tasks. These resources are interdependent; for example, namespaces and persistent volume declarations may be needed during the creation and operation of inference services. When a fundamental component of the inference platform fails, it typically requires redeployment for repair. Redeploying components, such as Kubernetes, can erase all types of resources, leading to inconsistencies with the records in the inference platform's database. Furthermore, accidental operations by inference platform personnel in the server backend can modify, delete, or occupy cluster resources, further causing discrepancies between the actual inference resources on the platform and the records in the inference platform's database.
[0003] When the one-to-one correspondence between inference resource records and actual inference resources is broken due to basic component failures or server backend misoperations, a sequential cluster recovery strategy can be used for reconstruction. This involves sequentially calling the namespace management module to restore namespace resources, the storage management module to restore storage class resources and persistent volume declaration resources, and the service management module to restore inference service resources. The recovery order for each resource must follow the order in which it is recorded in the database. However, this approach has two drawbacks. First, the inference service resources actually used by users will only begin to be restored after all resources have been created, hindering rapid service deployment. Second, the recovery of inference service resources cannot differentiate between the importance of users, as it can only be performed according to the record order, usually the resource creation time, failing to prioritize the recovery of critical services.
[0004] In conclusion, effectively addressing issues such as slow service deployment speeds and the inability to prioritize the restoration of critical services is a pressing problem that those skilled in the art urgently need to solve. Summary of the Invention
[0005] The purpose of this application is to provide a method for restoring inference resources on an inference platform. This method can restore inference resources according to their importance, thereby achieving the goal of restoring important user services more quickly. Another purpose of this application is to provide an inference resource restoration device, equipment, and computer-readable storage medium for an inference platform.
[0006] To solve the above-mentioned technical problems, this application provides the following technical solution:
[0007] A method for restoring inference resources on an inference platform, comprising:
[0008] When a request to access inference resources is received, the actual resource parameters corresponding to each actual inference resource in the inference platform are obtained respectively.
[0009] The actual resource parameters are compared with the original resource parameters recorded in the database to obtain the inference resources to be recovered contained in the actual inference resources.
[0010] Obtain the resource dependencies between the various inference resources to be recovered and the preset weight parameters corresponding to each of the inference resources to be recovered;
[0011] Calculate the cumulative weight corresponding to each of the inference resources to be recovered based on the resource dependencies and the preset weight parameters;
[0012] The inference resources to be recovered are restored according to the cumulative weights described above.
[0013] In one specific embodiment of this application, the actual resource parameters corresponding to each actual inference resource in the inference platform are obtained respectively, including:
[0014] Obtain the actual namespace identifier information corresponding to each actual namespace by accessing the application programming interface of the namespace management module;
[0015] The application programming interface of the storage management module is used to obtain the actual storage class identification information corresponding to each actual storage class and the actual persistent volume declaration identification information, actual capacity and actual access mode corresponding to each actual persistent volume declaration.
[0016] The application programming interface of the service management module is used to obtain the actual inference service identification information corresponding to each actual inference service.
[0017] Accordingly, the actual resource parameters are compared with the original resource parameters recorded in the database to obtain the inference resources to be recovered contained in each actual inference resource, including:
[0018] Obtain the original namespace identifier information, original storage class identifier information, original persistent volume declaration identifier information, original capacity, original access mode, and original inference service identifier information recorded in the database;
[0019] The actual namespace identifier information is compared with the original namespace identifier information to obtain the namespace comparison result;
[0020] The actual storage class identifier information is compared with the original storage class identifier information to obtain the storage class comparison result;
[0021] The actual persistent volume declaration identifier information, actual capacity and actual access mode corresponding to each actual persistent volume declaration are compared with the original persistent volume declaration identifier information, original capacity and original access mode to obtain the persistent volume declaration comparison results.
[0022] The actual inference service identifier information is compared with the original inference service identifier information to obtain the inference service comparison result;
[0023] The comparison results of the namespace, storage class, persistent volume declaration, and inference service are summarized to obtain each of the inference resources to be recovered.
[0024] In one specific embodiment of this application, the namespace comparison results, storage class comparison results, persistent volume declaration comparison results, and inference service comparison results are summarized to obtain each of the inference resources to be recovered, including:
[0025] Generate a namespace task list based on the namespace comparison results;
[0026] A storage task list is generated based on the storage class comparison results and the persistent volume declaration comparison results.
[0027] A list of reasoning service tasks is generated based on the comparison results of the reasoning services.
[0028] The namespace task list, the storage task list, and the inference service task list each store corresponding categories of inference resources to be recovered.
[0029] Accordingly, the resource dependencies between the various inference resources to be recovered and the preset weight parameters corresponding to each of the inference resources to be recovered are obtained, including:
[0030] For the namespace task list, the storage task list, and the inference service task list, the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered are obtained asynchronously.
[0031] In one specific embodiment of this application, it further includes:
[0032] For each inference resource to be recovered, when the recovery of the resource is detected to be complete, the task status of the inference resource to be recovered in the corresponding task list is updated.
[0033] In one specific embodiment of this application, the recovery of each of the inference resources to be recovered according to the cumulative weights includes:
[0034] The inference resources to be restored are restored in descending order of their weights.
[0035] In one specific embodiment of this application, the recovery of each of the inference resources to be recovered is performed in descending order of weight, including:
[0036] Obtain the sorting results of the cumulative weights;
[0037] For each inference resource to be recovered, based on the larger end of the sorting results, determine whether the current inference resource to be recovered has dependent resources;
[0038] If not, then restore the current inference resources that are yet to be restored;
[0039] If so, determine whether the dependent resources of the inference resource to be restored are in an available state;
[0040] If not, then jump to the next inference resource to be restored and repeat the step of determining whether the current inference resource to be restored has dependent resources;
[0041] If so, then perform the step of restoring the current inference resources to be restored.
[0042] In one specific embodiment of this application, the actual resource parameters corresponding to each actual inference resource in the inference platform are obtained respectively, including:
[0043] Asynchronously obtain the actual resource parameters corresponding to each actual inference resource in the inference platform.
[0044] A reasoning resource recovery device for a reasoning platform, comprising:
[0045] The actual resource parameter acquisition unit is used to acquire the actual resource parameters corresponding to each actual inference resource in the inference platform when an inference resource access request is received.
[0046] The resource to be recovered determination unit is used to compare each of the actual resource parameters with each of the original resource parameters recorded in the database to obtain each of the actual inference resources to be recovered.
[0047] The dependency relationship and preset weight acquisition unit is used to acquire the resource dependency relationship between each of the inference resources to be recovered and the preset weight parameters corresponding to each of the inference resources to be recovered.
[0048] The cumulative weight calculation unit is used to calculate the cumulative weight corresponding to each of the inference resources to be recovered based on the resource dependency relationship and each of the preset weight parameters.
[0049] The resource recovery unit is used to recover each of the inference resources to be recovered according to the cumulative weights.
[0050] A device for restoring inference resources for an inference platform, comprising:
[0051] Memory, used to store computer programs;
[0052] A processor, used to implement the steps of the inference resource recovery method of the inference platform as described above when executing the computer program.
[0053] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the inference resource recovery method of the inference platform as described above.
[0054] The inference resource recovery method for the inference platform provided in this application, when receiving an inference resource access request, obtains the actual resource parameters corresponding to each actual inference resource in the inference platform; compares each actual resource parameter with each original resource parameter recorded in the database to obtain each inference resource to be recovered contained in each actual inference resource; obtains the resource dependency relationship between each inference resource to be recovered and the preset weight parameter corresponding to each inference resource to be recovered; calculates the cumulative weight corresponding to each inference resource to be recovered based on the resource dependency relationship and each preset weight parameter; and recovers each inference resource to be recovered based on each cumulative weight.
[0055] As described in the above technical solution, by specifying resource weights or using default weights when users create inference resources on the inference platform, the importance of each inference resource is determined. After resource recovery is triggered, the actual resource parameters of each actual inference resource are compared with the original resource parameters recorded in the database to obtain the inference resources to be recovered contained in each actual inference resource. The cumulative weight corresponding to each inference resource to be recovered is calculated, and the importance of each inference resource to be recovered can be determined based on the cumulative weight. The system automatically determines the inference resources that the user needs to recover first and can recover inference resources according to their importance. Inference service resources, storage resources, and namespace resources in the inference platform can be recovered in parallel without waiting for all namespace resources and all storage resources to be recovered before restoring service resources, thereby achieving the goal of faster recovery of important user services.
[0056] Accordingly, this application also provides a reasoning resource recovery device, equipment, and computer-readable storage medium for a reasoning platform that corresponds to the reasoning resource recovery method of the aforementioned reasoning platform, which has the aforementioned technical effects, and will not be elaborated further here. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is a flowchart illustrating one implementation of the inference resource recovery method for the inference platform in this application.
[0059] Figure 2 This is a flowchart illustrating another implementation of the inference resource recovery method for the inference platform in this application.
[0060] Figure 3 This is an architecture diagram of an inference resource recovery system for an inference platform according to an embodiment of this application;
[0061] Figure 4 This is a timing diagram of inference resource recovery for an inference platform according to an embodiment of this application;
[0062] Figure 5 This is a flowchart illustrating another implementation of the inference resource recovery method for the inference platform in this application.
[0063] Figure 6 This is a structural block diagram of a reasoning resource recovery device for a reasoning platform according to an embodiment of this application;
[0064] Figure 7 This is a structural block diagram of a reasoning resource recovery device for a reasoning platform according to an embodiment of this application;
[0065] Figure 8 This is a schematic diagram of the specific structure of a reasoning resource recovery device for a reasoning platform provided in this embodiment. Detailed Implementation
[0066] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0067] See Figure 1 , Figure 1 This is a flowchart illustrating an implementation of a method for restoring inference resources on an inference platform, as described in this application. The method may include the following steps:
[0068] S101: When a request to access inference resources is received, the actual resource parameters corresponding to each actual inference resource in the inference platform are obtained respectively.
[0069] When a user needs to access inference resources in the inference platform, they send an inference resource access request to the inference management center of the inference platform. When the inference management center receives the inference resource access request, it retrieves the actual resource parameters corresponding to each actual inference resource in the inference platform.
[0070] Inference resources can include various types of resources such as namespaces, storage classes, persistent volume declarations (PVCs), Istio services (ISVCs), Helm services, and inference tasks.
[0071] In one specific embodiment of this application, obtaining the actual resource parameters corresponding to each actual inference resource in the inference platform may include the following steps:
[0072] Asynchronously obtain the actual resource parameters corresponding to each actual inference resource in the inference platform.
[0073] When an inference resource access request is received, the actual resource parameters corresponding to each actual inference resource in the inference platform are retrieved asynchronously. By asynchronously retrieving the actual resource parameters corresponding to each actual inference resource, the efficiency of parameter retrieval is improved.
[0074] S102: Compare each actual resource parameter with each original resource parameter recorded in the database to obtain each inference resource to be recovered contained in each actual inference resource.
[0075] The database pre-records each original resource parameter. After obtaining each actual resource parameter, the actual resource parameter is compared with each original resource parameter recorded in the database to obtain each inference resource to be recovered contained in each actual inference resource.
[0076] In this embodiment, cluster recovery involves three actions: creation (database record exists but corresponding actual inference resource does not exist), deletion (database record does not exist but corresponding actual inference resource exists), and modification (database record and actual inference resource exist, but parameters are inconsistent). In this embodiment, a parameter validation list is used to verify whether modification is needed. The parameter validation list can contain multiple fields or be empty. When empty, it indicates that only the existence of the namespace inference resource is checked, i.e., only deletion or creation is performed without modification. In this implementation, the parameter validation lists for namespace inference resources, inference service resources, and storage resources are empty. The fields of the elements in the persistent volume declaration resource validation list are the storage class name, the namespace name, the capacity, and the access mode (accessModes).
[0077] S103: Obtain the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered.
[0078] Pre-set weight parameters for each inference resource, such as setting weight parameters based on the inference resource category. There may be resource dependencies between the inference resources to be recovered. After comparing and identifying the inference resources to be recovered, obtain the resource dependencies between them and the pre-set weight parameters for each resource.
[0079] S104: Calculate the cumulative weight of each inference resource to be recovered based on resource dependencies and preset weight parameters.
[0080] After obtaining the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered, the cumulative weight corresponding to each inference resource to be recovered is calculated based on the resource dependencies and the preset weight parameters.
[0081] S105: Restore each inference resource to be restored according to its cumulative weight.
[0082] After calculating the cumulative weight of each inference resource to be recovered, the resources are recovered according to their cumulative weights. The importance of each resource is determined based on its cumulative weight, automatically identifying the resources that users need to prioritize for recovery. Recovery of inference resources based on their importance ensures rapid restoration of critical services. By prioritizing resource recovery, the efficiency of inference resource management is improved, and the consistency between the database's aggregated inference resource records and the actual inference resources is better guaranteed.
[0083] As described in the above technical solution, by specifying resource weights or using default weights when users create inference resources on the inference platform, the importance of each inference resource is determined. After resource recovery is triggered, the actual resource parameters of each actual inference resource are compared with the original resource parameters recorded in the database to obtain the inference resources to be recovered contained in each actual inference resource. The cumulative weight corresponding to each inference resource to be recovered is calculated, and the importance of each inference resource to be recovered can be determined based on the cumulative weight. The system automatically determines the inference resources that the user needs to recover first and can recover inference resources according to their importance. Inference service resources, storage resources, and namespace resources in the inference platform can be recovered in parallel without waiting for all namespace resources and all storage resources to be recovered before restoring service resources, thereby achieving the goal of faster recovery of important user services.
[0084] It should be noted that, based on the above embodiments, this application also provides corresponding improvement solutions. In subsequent embodiments, steps that are the same as or corresponding to those in the above embodiments can be referred to each other, and the corresponding beneficial effects can also be referred to each other. These improvements will not be elaborated upon in the following improved embodiments.
[0085] See Figure 2 , Figure 2 This is another implementation flowchart of the inference resource recovery method of the inference platform in this application embodiment. The method may include the following steps:
[0086] S201: When a request to access inference resources is received, the actual namespace identifier information corresponding to each actual namespace is obtained by accessing the application programming interface of the namespace management module.
[0087] See Figure 3 , Figure 3 This is an architecture diagram of an inference resource recovery system for an inference platform according to an embodiment of this application. An application programming interface (API) for the namespace management module is pre-configured. When an inference resource access request is received, the API of the namespace management module is used to obtain the actual namespace identifier information corresponding to each actual namespace.
[0088] S202: Obtain the actual storage class identifier information corresponding to each actual storage class and the actual persistent volume declaration identifier information, actual capacity and actual access mode corresponding to each actual persistent volume declaration through the application programming interface of the storage management module.
[0089] like Figure 3As shown, the application programming interface of the storage management module is pre-configured. When an inference resource access request is received, the application programming interface of the storage management module is used to obtain the actual storage class identification information corresponding to each actual storage class and the actual persistent volume declaration identification information, actual capacity and actual access mode corresponding to each actual persistent volume declaration.
[0090] S203: Obtain the actual inference service identifier information corresponding to each actual inference service through the application programming interface of the service management module.
[0091] like Figure 3 As shown, the application programming interface of the service management module is pre-configured. When a request to access inference resources is received, the application programming interface of the service management module is used to obtain the actual inference service identifier information corresponding to each actual inference service.
[0092] See Figure 4 , Figure 4This is a sequence diagram of inference resource recovery for an inference platform according to an embodiment of this application. The cluster recovery module sends recovery list requests (recovery_list) to the namespace management module, storage management module, and service management module, respectively. Each recovery list request can be executed asynchronously. The namespace management module returns a list of namespaces recorded in the database (DB). The fields of each element in the namespace list are (namespace name, namespace ID, weight, status), where the status can be incomplete or completed. The storage management module returns a list of storage classes (storage class name, storage class ID, status) and a list of persistent volume declarations (persistent volume declaration name, persistent volume declaration ID, storage class ID, namespace ID, weight, status) recorded in the database. The format of the persistent volume declaration ID can be set to the letter 'p' followed by an index, such as p1, p10, p11, and the status can be incomplete or completed. The service management module returns the Istio services recorded in the database. The cluster recovery module generates a list of Istio services (Istio service name, namespace ID, dependent persistent volume declaration ID, weight, and status), a Helm service list (Helm service name, namespace ID, dependent persistent volume declaration ID, weight, and status), and an inference task list (Job name, namespace ID, dependent persistent volume declaration ID, weight, and status). The IDs for these three services can be formatted as the letters i, h, and j followed by an index, such as i2, h15, and j9. The status can be either incomplete or completed, which is equivalent to not ready or ready, essentially indicating whether the actual inference resources match the database records. Based on the returned information, a task list is created. After receiving each task list, the cluster recovery module recovers namespace inference resources, storage resources, and inference service resources. Since there may be multiple inference resources of each type to be recovered, the cluster recovery module can call the application programming interfaces of the namespace management module, storage management module, and service management module multiple times to recover resources. Figure 4 The resource recovery process only illustrates two recovery steps for each type of inference resource. The recovery process for other inference resources to be recovered can be deduced in the same way.
[0093] S204: Retrieve the original namespace identifier information, original storage class identifier information, original persistent volume declaration identifier information, original capacity, original access mode, and original inference service identifier information recorded in the database.
[0094] When a request to access inference resources is received, the database is retrieved for each original namespace identifier, each original storage class identifier, each original persistent volume declaration identifier, each original capacity, each original access mode, and each original inference service identifier.
[0095] S205: Compare the actual namespace identifier information with the original namespace identifier information to obtain the namespace comparison results.
[0096] After obtaining the actual namespace identifier information and the original namespace identifier information, the actual namespace identifier information is compared with the original namespace identifier information to obtain the namespace comparison results.
[0097] S206: Compare the actual storage class identifier information with the original storage class identifier information to obtain the storage class comparison results.
[0098] After obtaining the actual storage class identifier information and the original storage class identifier information, the actual storage class identifier information and the original storage class identifier information are compared to obtain the storage class comparison results.
[0099] S207: Compare the actual persistent volume declaration identifier information, actual capacity, and actual access mode corresponding to each actual persistent volume declaration with the original persistent volume declaration identifier information, original capacity, and original access mode to obtain the persistent volume declaration comparison results.
[0100] After obtaining the identification information, actual capacity, and actual access mode of each actual persistent volume declaration, and the identification information, original capacity, and original access mode of each original persistent volume declaration, the identification information, actual capacity, and actual access mode of each actual persistent volume declaration are compared with the identification information, original capacity, and original access mode of each original persistent volume declaration to obtain the persistent volume declaration comparison results.
[0101] S208: Compare the actual inference service identifier information with the original inference service identifier information to obtain the inference service comparison results.
[0102] After obtaining the actual inference service identifier information and the original inference service identifier information, the actual inference service identifier information and the original inference service identifier information are compared to obtain the inference service comparison results.
[0103] S209: Summarize the comparison results of namespaces, storage classes, persistent volume declarations, and inference services to obtain the inference resources to be recovered.
[0104] After obtaining the comparison results for namespaces, storage classes, persistent volume declarations, and inference services, these results are summarized to obtain the inference resources to be recovered. By classifying and comparing each actual inference resource with the original inference resources recorded in the database, the comparison efficiency is improved, thus enhancing the subsequent resource recovery efficiency.
[0105] S210: Obtain the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered.
[0106] Various inference resources are interdependent. For example, namespaces and persistent volume declarations may be needed during the creation and operation of the inference service. Weight parameters are pre-set for each inference resource, with weights specified by the user during resource creation. The weight range is 1-9, with a default of 1. Namespaces and storage resources have their weights multiplied by 1, persistent volume declarations (PVCs) have their weights multiplied by 10, and the three inference service resources—Istio service (ISVC), Helm service, and inference task (Job)—have their weights multiplied by 100. The system retrieves the resource dependencies between the inference resources to be recovered and the pre-set weight parameters for each resource.
[0107] If the weights of all inference resources are all set to the default value of 1, the inference resource recovery method of this cluster degenerates into a sequential cluster recovery method. However, compared with the existing technical solution of sequentially calling the three module application programming interfaces, the asynchronous call of the three module application programming interfaces in this application embodiment will achieve higher concurrency and less recovery time.
[0108] In one specific embodiment of this application, step S209 may include the following steps:
[0109] Step 1: Generate a namespace task list based on the namespace comparison results;
[0110] Step 2: Generate a list of storage tasks based on the comparison results of storage classes and persistent volume declarations;
[0111] Step 3: Generate a list of reasoning service tasks based on the comparison results of the reasoning services;
[0112] Among them, the namespace task list, storage task list, and inference service task list store the corresponding categories of inference resources to be recovered;
[0113] Accordingly, step S210 may include the following steps:
[0114] For the namespace task list, storage task list, and inference service task list, asynchronously obtain the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered.
[0115] For the namespace task list, storage task list, and inference service task list, the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered are obtained asynchronously. By asynchronously obtaining the preset weight parameters and resource dependencies according to the task lists of different resource categories, the efficiency of obtaining weight parameters and resource dependencies is greatly improved, thereby improving the efficiency of subsequent resource recovery.
[0116] The task list element is a structure containing the following fields: type (pvc, ns, isvc, helm, job); ID (unique identifier of the current inference resource); weight (cumulative weight of the current inference resource); status (completion status of the current inference resource); and dependencies (IDs of the inference resources that the current inference resource depends on).
[0117] See Figure 5 , Figure 5 This is another implementation flowchart of the inference resource recovery method of the inference platform in this application. The task list is split into three types of resource lists, corresponding to the namespace management module, storage management module, and service management module, respectively. The following operations are performed asynchronously on the three types of resource lists:
[0118] The task's dependency list is traversed. If a resource in the dependency list is not ready, the resource cannot be created; otherwise, it can be created.
[0119] The corresponding management module's application programming interface (API) is invoked for recovery. If there are incomplete tasks in the list and all prerequisites for the task have been met, the API is invoked for recovery; otherwise, the next incomplete task is traversed until all tasks are completed.
[0120] In one specific embodiment of this application, the method may further include the following steps:
[0121] For each inference resource to be recovered, when the recovery of the resource is detected to be complete, update the task status of the inference resource to be recovered in the corresponding task list.
[0122] Each task list records the task status of each inference resource to be recovered. For each inference resource to be recovered, when resource recovery is detected as complete, the task status of the corresponding inference resource to be recovered in the task list is updated. This achieves effective recording of the task status of each inference resource to be recovered.
[0123] S211: Calculate the cumulative weight of each inference resource to be recovered based on resource dependencies and preset weight parameters.
[0124] The cumulative weight of a namespace is calculated based on resource dependencies. The formula is: Cumulative weight of namespace = Weight of current namespace + Sum of weights of persistent volume declarations in the current namespace + Sum of weights of inference services in the current namespace.
[0125] The cumulative weight of the storage class is calculated based on resource dependencies. The formula is: Cumulative weight of storage class = Current storage class weight + Sum of weights of persistent volume declarations that depend on the current storage class + Sum of weights of inference services that depend on the aforementioned persistent volume declarations.
[0126] The cumulative weight of a persistent volume declaration is calculated based on resource dependencies. The formula is: Cumulative weight = Current persistent volume declaration weight + Sum of the weights of inference services that depend on the current persistent volume declaration.
[0127] S212: Restore each inference resource to be restored in descending order of weight.
[0128] After calculating the cumulative weights of each inference resource to be restored, the resources are restored in descending order of weight. This fully considers the importance of each resource and restores them according to their priority, thus ensuring that important inference resources are restored first and improving the user experience.
[0129] In one specific embodiment of this application, step S212 may include the following steps:
[0130] Step 1: Obtain the sorting results of each cumulative weight;
[0131] Step 2: Starting from the larger end of the sorted results, for each resource to be recovered, determine whether the current resource to be recovered has dependent resources. If not, proceed to Step 3; if yes, proceed to Step 4.
[0132] Step 3: Restore the currently pending inference resources;
[0133] Step 4: Determine whether the dependent resources of the inference resource to be restored are available. If not, proceed to Step 5; if yes, return to Step 3.
[0134] Step 5: Jump to the next inference resource to be restored and return to the step of determining whether the current inference resource to be restored has dependent resources.
[0135] Obtain the sorting results of the cumulative weights. Starting from the larger end of the sorting results, for each inference resource to be recovered, determine whether the current inference resource to be recovered has dependent resources. If not, recover the current inference resource to be recovered. If yes, determine whether the dependent resources of the current inference resource to be recovered are available. If not, jump to the next inference resource to be recovered and return to execute the step of determining whether the current inference resource to be recovered has dependent resources. If yes, recover the current inference resource to be recovered.
[0136] The pseudocode for the task list is as follows:
[0137]
[0138]
[0139] To determine if a resource can be created, iterate through the task's dependency list. If any resource in the dependency list is not ready, the resource cannot be created; otherwise, it can be created. The pseudocode is as follows:
[0140]
[0141] The corresponding management module's application programming interface (API) is invoked for recovery. Taking a namespace as an example, the namespace recovery task list is retrieved and sorted. If there is an incomplete task in the list and all its prerequisites have been met, the API is invoked to perform the recovery; otherwise, the next incomplete task is traversed until all tasks are completed. The pseudocode is as follows:
[0142]
[0143] Corresponding to the above method embodiments, this application also provides a reasoning resource recovery device for a reasoning platform. The reasoning resource recovery device for a reasoning platform described below and the reasoning resource recovery method for a reasoning platform described above can be referred to in correspondence with each other.
[0144] See Figure 6 , Figure 6 This is a structural block diagram of a reasoning resource recovery device for a reasoning platform according to an embodiment of this application. The device may include:
[0145] The actual resource parameter acquisition unit 61 is used to acquire the actual resource parameters corresponding to each actual inference resource in the inference platform when an inference resource access request is received.
[0146] The resource to be recovered determination unit 62 is used to compare each actual resource parameter with each original resource parameter recorded in the database to obtain each inference resource to be recovered contained in each actual inference resource;
[0147] The dependency relationship and preset weight acquisition unit 63 is used to acquire the resource dependency relationship between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered.
[0148] The cumulative weight calculation unit 64 is used to calculate the cumulative weight corresponding to each inference resource to be recovered based on the resource dependency relationship and each preset weight parameter.
[0149] Resource recovery unit 65 is used to recover each inference resource to be recovered according to each cumulative weight.
[0150] As described in the above technical solution, by specifying resource weights or using default weights when users create inference resources on the inference platform, the importance of each inference resource is determined. After resource recovery is triggered, the actual resource parameters of each actual inference resource are compared with the original resource parameters recorded in the database to obtain the inference resources to be recovered contained in each actual inference resource. The cumulative weight corresponding to each inference resource to be recovered is calculated, and the importance of each inference resource to be recovered can be determined based on the cumulative weight. The system automatically determines the inference resources that the user needs to recover first and can recover inference resources according to their importance. Inference service resources, storage resources, and namespace resources in the inference platform can be recovered in parallel without waiting for all namespace resources and all storage resources to be recovered before restoring service resources, thereby achieving the goal of faster recovery of important user services.
[0151] In one specific embodiment of this application, the actual resource parameter acquisition unit 61 includes:
[0152] The namespace parameter acquisition subunit is used to obtain the actual namespace identifier information corresponding to each actual namespace by accessing the application programming interface of the namespace management module.
[0153] The storage class and persistent volume declaration parameter acquisition subunit is used to obtain the actual storage class identification information, actual capacity and actual access mode corresponding to each actual storage class and the actual persistent volume declaration identification information, actual capacity and actual access mode corresponding to each actual persistent volume declaration through the application programming interface of the storage management module.
[0154] The inference service parameter acquisition subunit is used to obtain the actual inference service identifier information corresponding to each actual inference service through the application programming interface of the service management module.
[0155] Accordingly, the resource to be restored determination unit 62 includes:
[0156] The original parameter acquisition subunit is used to acquire the original namespace identifier information, original storage class identifier information, original persistent volume declaration identifier information, original capacity, original access mode and original inference service identifier information recorded in the database;
[0157] The namespace comparison result acquisition sub-unit is used to compare each actual namespace identifier with each original namespace identifier to obtain the namespace comparison result;
[0158] The storage class comparison result acquisition sub-unit is used to compare each actual storage class identification information with each original storage class identification information to obtain the storage class comparison result;
[0159] The persistent volume declaration comparison result acquisition sub-unit is used to compare the actual persistent volume declaration identification information, actual capacity and actual access mode corresponding to each actual persistent volume declaration with the original persistent volume declaration identification information, original capacity and original access mode to obtain the persistent volume declaration comparison result.
[0160] The reasoning service comparison result acquisition sub-unit is used to compare each actual reasoning service identification information with each original reasoning service identification information to obtain the reasoning service comparison result;
[0161] The sub-unit for obtaining inference resources to be recovered is used to summarize the comparison results of namespaces, storage classes, persistent volume declarations, and inference services to obtain each inference resource to be recovered.
[0162] In one specific embodiment of this application, the sub-unit for obtaining inference resources to be recovered is specifically used to generate a namespace task list based on the namespace comparison results; generate a storage task list based on the storage class comparison results and the persistent volume declaration comparison results; and generate an inference service task list based on the inference service comparison results; wherein the namespace task list, the storage task list, and the inference service task list store inference resources to be recovered of their respective corresponding categories.
[0163] Correspondingly, the dependency relationship and preset weight acquisition unit 63 is specifically a unit that asynchronously acquires the resource dependency relationships between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered for the namespace task list, storage task list, and inference service task list.
[0164] In one specific embodiment of this application, the device may further include:
[0165] The task status update unit is used to update the task status of each inference resource to be recovered in the corresponding task list when the recovery of the resource is detected to be complete.
[0166] In one specific embodiment of this application, the resource recovery unit 65 is specifically a unit that recovers each inference resource to be recovered in descending order of weight.
[0167] In one specific embodiment of this application, the resource recovery unit 65 includes:
[0168] The size sorting result retrieval sub-unit is used to retrieve the size sorting results of each cumulative weight;
[0169] The first judgment subunit is used to determine whether the current inference resource to be recovered has dependent resources for each resource from the larger end of the size sorting result;
[0170] The resource recovery subunit is used to recover the current inference resource when it is determined that the current inference resource to be recovered does not have any dependent resources.
[0171] The second judgment subunit is used to determine whether the dependent resources of the current inference resource to be restored are available when it is determined that the current inference resource to be restored has dependent resources.
[0172] The resource jumper unit is used to jump to the next inference resource to be recovered and trigger the first judgment subunit when it is determined that the dependent resources of the current inference resource to be recovered are in an unavailable state.
[0173] The resource recovery subunit is also used to recover the current inference resource when it is determined that the dependent resources of the current inference resource to be recovered are in an available state.
[0174] In one specific embodiment of this application, the actual resource parameter acquisition unit 61 is specifically a unit that asynchronously acquires the actual resource parameters corresponding to each actual inference resource in the inference platform.
[0175] For the method embodiments described above, see [link to relevant documentation]. Figure 7 , Figure 7 This is a schematic diagram of the inference resource recovery device for the inference platform provided in this application. The device may include:
[0176] Memory 332 is used to store computer programs;
[0177] The processor 322 is used to implement the steps of the inference resource recovery method of the inference platform in the above method embodiment when executing a computer program.
[0178] For details, please refer to Figure 8 , Figure 8This is a schematic diagram illustrating the specific structure of an inference resource recovery device for an inference platform provided in this embodiment. The device can vary significantly depending on its configuration or performance. It may include a processor (central processing unit, CPU) 322 (e.g., one or more processors) and a memory 332. The memory 332 stores one or more computer programs 342 or data 344. The memory 332 can be temporary or persistent storage. The program stored in the memory 332 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the data processing device. Furthermore, the processor 322 may be configured to communicate with the memory 332 and execute the series of instruction operations stored in the memory 332 on the device 301.
[0179] The penetration testing equipment 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341.
[0180] The steps in the inference resource recovery method of the inference platform described above can be implemented by the structure of the inference resource recovery device of the inference platform.
[0181] Corresponding to the above method embodiments, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the following steps:
[0182] When a request to access inference resources is received, the actual resource parameters corresponding to each actual inference resource in the inference platform are obtained respectively; each actual resource parameter is compared with each original resource parameter recorded in the database to obtain each inference resource to be recovered contained in each actual inference resource; the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered are obtained; the cumulative weight corresponding to each inference resource to be recovered is calculated according to the resource dependencies and the preset weight parameters; and each inference resource to be recovered is recovered according to the cumulative weight.
[0183] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0184] For a description of the computer-readable storage medium provided in this application, please refer to the above method embodiments; further details will not be repeated here.
[0185] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses, devices, and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0186] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the technical solutions and core ideas of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for restoring inference resources on an inference platform, characterized in that, include: When a request to access inference resources is received, the actual resource parameters corresponding to each actual inference resource in the inference platform are obtained respectively. The actual resource parameters are compared with the original resource parameters recorded in the database to obtain the inference resources to be recovered contained in the actual inference resources. Obtain the resource dependencies between the various inference resources to be recovered and the preset weight parameters corresponding to each of the inference resources to be recovered; Calculate the cumulative weight corresponding to each of the inference resources to be recovered based on the resource dependencies and the preset weight parameters; The inference resources to be recovered are restored according to the cumulative weights described above. The recovery of each of the aforementioned inference resources to be recovered is performed based on the cumulative weights, including: Obtain the sorting results of the cumulative weights; For each inference resource to be recovered, based on the larger end of the sorting results, determine whether the current inference resource to be recovered has dependent resources; If there are no dependent resources, then restore the current inference resources that are yet to be restored; If there are dependent resources, determine whether the dependent resources of the current inference resource to be restored are available; If the dependent resources are available, then restore the inference resources that are currently pending recovery. If the dependent resource is in an unavailable state, skip the current inference resource to be recovered and continue processing the next inference resource to be recovered; The cumulative weights for each inference resource to be recovered are calculated based on resource dependencies and preset weight parameters, including: The cumulative weight of a namespace is calculated based on resource dependencies using the following formula: Namespace cumulative weight = current namespace weight + sum of persistent volume declaration weights within the current namespace + sum of inference service weights within the current namespace; The cumulative weight of the storage class is calculated based on resource dependencies using the following formula: Cumulative weight of storage class = current storage class weight + sum of weights of persistent volume declarations that depend on the current storage class + sum of weights of inference services that depend on the aforementioned persistent volume declarations; The cumulative weight of the persistent volume declaration is calculated based on resource dependencies using the following formula: The cumulative weight of a persistent volume declaration = the weight of the current persistent volume declaration + the sum of the weights of inference services that depend on the current persistent volume declaration.
2. The inference resource recovery method for an inference platform according to claim 1, characterized in that, Obtain the actual resource parameters corresponding to each actual inference resource in the inference platform, including: Obtain the actual namespace identifier information corresponding to each actual namespace by accessing the application programming interface of the namespace management module; The application programming interface of the storage management module is used to obtain the actual storage class identification information corresponding to each actual storage class and the actual persistent volume declaration identification information, actual capacity and actual access mode corresponding to each actual persistent volume declaration. The application programming interface of the service management module is used to obtain the actual inference service identification information corresponding to each actual inference service. Accordingly, the actual resource parameters are compared with the original resource parameters recorded in the database to obtain the inference resources to be recovered contained in each actual inference resource, including: Obtain the original namespace identifier information, original storage class identifier information, original persistent volume declaration identifier information, original capacity, original access mode and original inference service identifier information recorded in the database; The actual namespace identifier information is compared with the original namespace identifier information to obtain the namespace comparison result; The actual storage class identifier information is compared with the original storage class identifier information to obtain the storage class comparison result; The actual persistent volume declaration identifier information, actual capacity and actual access mode corresponding to each actual persistent volume declaration are compared with the original persistent volume declaration identifier information, original capacity and original access mode to obtain the persistent volume declaration comparison results. The actual inference service identifier information is compared with the original inference service identifier information to obtain the inference service comparison result; The comparison results of the namespace, storage class, persistent volume declaration, and inference service are summarized to obtain each of the inference resources to be recovered.
3. The inference resource recovery method for an inference platform according to claim 2, characterized in that, The comparison results of the namespace, storage class, persistent volume declaration, and inference service are summarized to obtain each of the inference resources to be recovered, including: Generate a namespace task list based on the namespace comparison results; A storage task list is generated based on the storage class comparison results and the persistent volume declaration comparison results. A list of reasoning service tasks is generated based on the comparison results of the reasoning services. The namespace task list, the storage task list, and the inference service task list each store corresponding categories of inference resources to be recovered. Accordingly, the resource dependencies between the various inference resources to be recovered and the preset weight parameters corresponding to each of the inference resources to be recovered are obtained, including: For the namespace task list, the storage task list, and the inference service task list, the resource dependencies between each inference resource to be recovered and the preset weight parameters corresponding to each inference resource to be recovered are obtained asynchronously.
4. The inference resource recovery method for an inference platform according to claim 3, characterized in that, Also includes: For each inference resource to be recovered, when the recovery of the resource is detected to be complete, the task status of the inference resource to be recovered in the corresponding task list is updated.
5. The inference resource recovery method for an inference platform according to claim 1, characterized in that, Obtain the actual resource parameters corresponding to each actual inference resource in the inference platform, including: Asynchronously obtain the actual resource parameters corresponding to each actual inference resource in the inference platform.
6. A device for restoring reasoning resources for a reasoning platform, characterized in that, include: The actual resource parameter acquisition unit is used to acquire the actual resource parameters corresponding to each actual inference resource in the inference platform when an inference resource access request is received. The resource to be recovered determination unit is used to compare each of the actual resource parameters with each of the original resource parameters recorded in the database to obtain each of the actual inference resources to be recovered. The dependency relationship and preset weight acquisition unit is used to acquire the resource dependency relationship between each of the inference resources to be recovered and the preset weight parameters corresponding to each of the inference resources to be recovered. The cumulative weight calculation unit is used to calculate the cumulative weight corresponding to each of the inference resources to be recovered based on the resource dependency relationship and each of the preset weight parameters. The resource recovery unit is used to recover each of the inference resources to be recovered according to the cumulative weights. The resource recovery unit includes: The size sorting result retrieval sub-unit is used to retrieve the size sorting results of each cumulative weight; The first judgment subunit is used to determine whether the current inference resource to be recovered has dependent resources for each resource from the larger end of the size sorting result; The resource recovery subunit is used to recover the current inference resource when it is determined that the current inference resource to be recovered does not have any dependent resources. The second judgment subunit is used to determine whether the dependent resources of the current inference resource to be restored are available when it is determined that the current inference resource to be restored has dependent resources. The resource skip unit is used to skip the current inference resource to be recovered and continue processing the next inference resource to be recovered when it is determined that the dependent resources of the current inference resource to be recovered are in an unavailable state. The resource recovery subunit is also used to recover the current inference resource when it is determined that the dependent resources of the current inference resource to be recovered are in an available state; The cumulative weight calculation unit is specifically used for: The cumulative weight of a namespace is calculated based on resource dependencies using the following formula: Namespace cumulative weight = current namespace weight + sum of persistent volume declaration weights within the current namespace + sum of inference service weights within the current namespace; The cumulative weight of the storage class is calculated based on resource dependencies using the following formula: Cumulative weight of storage class = current storage class weight + sum of weights of persistent volume declarations that depend on the current storage class + sum of weights of inference services that depend on the aforementioned persistent volume declarations; The cumulative weight of the persistent volume declaration is calculated based on resource dependencies using the following formula: The cumulative weight of a persistent volume declaration = the weight of the current persistent volume declaration + the sum of the weights of inference services that depend on the current persistent volume declaration.
7. A device for restoring inference resources for an inference platform, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the method as claimed in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the inference resource recovery method of the inference platform as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and apparatus for multi-source restore
CN103582875A
Method, device and system for reasoning service management of reasoning platform and medium
CN113112023A
