A resource processing method and device, electronic equipment and storage medium

By deploying the target container in the Kubernetes cluster and gradually consuming worker node resources, the problem of resource preemption in the logical preemption method is solved, and stable resource acquisition and reliable execution of job tasks are achieved.

CN122220100APending Publication Date: 2026-06-16BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
Filing Date
2026-03-18
Publication Date
2026-06-16

Smart Images

  • Figure CN122220100A_ABST
    Figure CN122220100A_ABST
Patent Text Reader

Abstract

The application relates to a resource processing method and device, electronic equipment and a storage medium. The method comprises the following steps: receiving a job request, wherein the job request carries a job task; determining a target work node from a work node cluster based on the job request, and deploying a target container in the target work node, wherein the target work node is used for representing a work node for providing resources for the job task; gradually occupying the resources released by the target work node through the target container during the running process of the target work node; and based on the resources occupied by the target container, the job task is distributed to the target container, so that the target container executes the job task based on the occupied resources. The application ensures that the job task can stably obtain sufficient resources, and improves the reliability of the job task execution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a resource processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] In Kubernetes cluster resource scheduling scenarios, the execution of various job tasks depends on the resources (such as CPU, memory, etc.) provided by the worker nodes in the cluster. Some job tasks require a large amount of resources due to business characteristics. Whether sufficient resources can be stably obtained directly determines whether such job tasks can be executed normally. Therefore, it is necessary to lock the required resources for job tasks through resource allocation to prevent the resources of worker nodes from being preempted by other tasks in the cluster, thereby preventing the failure of pre-allocation of resources when job tasks are submitted and preventing interruption during job task execution.

[0003] Currently, the logical pre-reservation method is commonly used to lock the resources required for job tasks. This means that there is no need to create actual containers on the worker nodes. The cluster scheduler simply records the preset resource pre-reservation status in memory. When calculating resources later, the resources marked as pre-reserved are deducted from the total available resources of the worker nodes, thereby achieving virtual reservation of the resources required for job tasks.

[0004] However, logical pre-allocation only exists in the scheduler's memory and lacks physical isolation. Once the scheduler restarts, the pre-allocation state will be lost and it cannot prevent the pre-allocated resources from being preempted by other jobs, causing resource contention and conflicts, which seriously affects the reliability of job execution. Summary of the Invention

[0005] In view of this, in order to solve the above-mentioned technical problems or some of the technical problems, embodiments of this application provide a resource processing method, apparatus, electronic device and storage medium.

[0006] Firstly, this application provides a resource processing method, including: Receive a job request, which carries a job task; Based on the job request, a target worker node is determined from the worker node cluster, and a target container is deployed on the target worker node, wherein the target worker node is used to characterize the worker node that provides resources for the job task; During the operation of the target worker node, the resources released by the target worker node are gradually occupied by the target container; Based on the resources occupied by the target container, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0007] In an optional implementation, the job request further carries a first resource threshold, which is used to characterize the resources required to perform the job task; Based on the resources occupied by the target container, the job task is distributed to the target container so that the target container can execute the job task based on the occupied resources, including: When the resources occupied by the target container reach the first resource threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0008] In an optional implementation, determining the target worker node from the worker node cluster based on the job request includes: Obtain the current remaining resources of each worker node in the worker node cluster; Based on the job request and all the current remaining resources obtained, if all the worker nodes in the worker node cluster meet the first preset condition, the current node load rate of each worker node in the worker node cluster is obtained. The first preset condition includes that the current remaining resources of the worker node are less than the first resource threshold. For each worker node in the worker node cluster, a node score is determined based on the current remaining resources and the current node load rate of the worker node. Based on all the obtained node scores, the worker node with the highest node score is determined from the worker node cluster as the target worker node.

[0009] In an optional implementation, before determining the scores of each of the nodes, the method further includes: Determine the historical resource release rate of each worker node in the worker node cluster within a preset historical time period; The process of determining the node score corresponding to the working node based on the current remaining resources and the current node load rate includes: Determine the first weight corresponding to the current remaining resources of the working node, the second weight corresponding to the current node load rate of the working node, and the third weight corresponding to the historical resource release rate of the working node; Using the first weight, the second weight, and the third weight, the current remaining resources, the current node load rate, and the historical resource release rate are weighted and calculated to determine the node score corresponding to the working node.

[0010] In an optional implementation, after obtaining the load rate of each current node, the method further includes: Based on the current remaining resources and current node load rate of each worker node in the worker node cluster, all worker nodes that meet the second preset condition are filtered out from the worker node cluster to complete the update of the worker node cluster. The second preset condition includes the current remaining resources of the worker node being less than a second resource threshold, and / or the current node load rate of the worker node being greater than a preset load rate threshold, wherein the second resource threshold is less than the first resource threshold. For each worker node in the worker node cluster, determining the node score corresponding to the worker node based on the worker node's current remaining resources and current node load rate includes: For each worker node in the updated worker node cluster, a node score is determined based on the worker node's current remaining resources and current node load rate.

[0011] In an optional implementation, determining the worker node with the highest node score from the worker node cluster as the target worker node based on all the obtained node scores includes: Based on all the obtained node scores, the worker node corresponding to the highest node score is determined from the worker node cluster; Determine the target number of the target containers that have been deployed in the working node corresponding to the highest node score; When the number of targets is less than a preset threshold, the working node corresponding to the highest node score is determined as the target working node.

[0012] In an optional implementation, the step of issuing the job task to the target container when the resources occupied by the target container reach the first resource threshold, so that the target container can execute the job task based on the occupied resources, includes: Obtain the preset duration threshold corresponding to the target container; When the resources occupied by the target container reach the first resource threshold within the preset time threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0013] Secondly, this application provides a resource processing apparatus, comprising: A receiving module is used to receive job requests, wherein the job requests carry job tasks. The deployment module is used to determine a target worker node from the worker node cluster based on the job request, and to deploy a target container on the target worker node, wherein the target worker node is used to characterize the worker node that provides resources for the job task; The occupancy module is used to gradually occupy the resources released by the target worker node through the target container during the operation of the target worker node; The processing module is used to distribute the job task to the target container based on the resources occupied by the target container, so that the target container can execute the job task based on the occupied resources.

[0014] Thirdly, this application provides an electronic device, including: a processor and a memory, wherein the processor is configured to execute a resource processing program stored in the memory to implement the resource processing method described above.

[0015] Fourthly, this application also provides a storage medium storing one or more programs that can be executed by one or more processors to implement the resource processing method described above.

[0016] Compared with the prior art, the technical solution provided in this application has the following advantages. The method provided in this application includes: receiving a job request, the job request carrying a job task; determining a target worker node from the worker node cluster based on the job request, and deploying a target container in the target worker node, the target worker node being used to represent a worker node that provides resources for the job task; gradually occupying the resources released by the target worker node through the target container during the operation of the target worker node; and distributing the job task to the target container based on the resources occupied by the target container, so that the target container can execute the job task based on the occupied resources.

[0017] In this embodiment, by receiving a job request carrying a job task, determining the target worker node that provides resources for the job task from the worker node cluster based on the job request, and deploying a target container on the target worker node, the target container gradually occupies the resources released by the target worker node during its operation. Thus, the job task is distributed to the target container based on the resources occupied by the target worker node, and the target container executes the job task based on the occupied resources. This achieves physical-level locking of the resources required by the job task, avoiding the problem of pre-occupied resources being preempted by other job tasks due to the existing logical pre-occupancy method, which only records the pre-occupancy status in the scheduler memory. This ensures that the job task can stably obtain sufficient resources and improves the reliability of job task execution. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0021] Figure 1 A flowchart illustrating a resource processing method provided in an embodiment of this application; Figure 2 A flowchart illustrating another resource processing method provided in an embodiment of this application; Figure 3 A flowchart illustrating yet another resource processing method provided in an embodiment of this application; Figure 4 A flowchart illustrating another resource processing method provided in an embodiment of this application; Figure 5 An example diagram of a resource processing method provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a resource processing device provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0024] This application provides a resource processing method, which is referenced in its embodiments. Figure 1 Specifically, it includes the following steps: S101: Receive job request.

[0025] In this embodiment, the method is applied to the scheduler in a Kubernetes cluster (i.e., a worker node cluster). The job request carries a job task and a first resource threshold, and is used to instruct the execution of the job task. The job request is a request sent by a user or business system to the scheduler. The job task includes application information such as the job's program code, startup parameters, and environment variables. For example, a user submits a job request to execute an image recognition model training job task, which includes program code for training a neural network model, startup parameters, and environment variables. The first resource threshold is the resource required to execute the job task, and is preset before the job request is initiated.

[0026] S102: Based on the job request, determine the target worker node from the worker node cluster and deploy the target container on the target worker node.

[0027] In this embodiment, the target worker node is used to represent the worker node that provides resources for the job task. The target worker node is the deployment carrier of the target container and also the hardware carrier for the execution of the job task.

[0028] After receiving a job request, the scheduler can obtain the current remaining resources of all worker nodes in the worker node cluster based on the first resource threshold carried in the job request. If there is a worker node in the worker node cluster with current remaining resources greater than or equal to the first resource threshold, a container is deployed in the aforementioned worker node. Since the resources are already sufficient at this time, there is no need for the container to pre-allocate resources. The scheduler directly sends the job task to the target container so that the container can execute the job task based on the current remaining resources of the worker node.

[0029] When the remaining resources of all worker nodes in the worker node cluster are less than the first resource threshold, it is necessary to identify a target worker node from the worker node cluster to provide resources for the job task, and deploy a target container on the target worker node. The target container will then reserve resources for the job task on the target worker node to ensure the normal execution of the subsequent job task.

[0030] S103: During the operation of the target worker node, the target container gradually occupies the resources released by the target worker node.

[0031] In this embodiment, after the target container is deployed, it monitors the resource release status of the target worker nodes during their operation. When a running task on the target worker node completes and releases resources, the target container immediately occupies and uses those released resources. Once occupied by the target container, these resources are in placeholder mode and will not be preempted by other jobs in the worker node cluster. This process is a continuous, gradual occupancy; the target container occupies the same amount of resources released by the target worker node. This occupancy action is executed cyclically, and the resources occupied by the target container continuously accumulate until they reach a first resource threshold, thus reserving sufficient and stable hardware resources for the execution of job tasks.

[0032] It should be noted that the resources occupied by the target container also include the current remaining resources of the target worker node occupied by the target container when the target container deployment ends. Therefore, the fact that the resources occupied by the target container reach the first resource threshold can be understood as the sum of the resources occupied by the target container and the current remaining resources of the target worker node.

[0033] S104: Based on the resources occupied by the target container, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0034] In this embodiment, the target container verifies its occupied resources in real time. When it determines that the occupied resources have reached a first resource threshold, the target container switches the occupied resources to execution mode in their original position and sends a resource ready signal to the scheduler. After receiving the resource ready signal, the scheduler distributes the job task (including program code, startup parameters, and environment variables, etc.) to the target container. Upon receiving the job task, the target container does not need to destroy itself or release the occupied resources. Instead, it directly loads the job task's program code, configures environment variables, and initializes the running conditions according to the startup parameters in its isolated runtime environment. It then calls upon the occupied resources to execute the job task until all job tasks are completed. Throughout the entire execution process, the target container continuously occupies the locked resources, with no risk of resource preemption or interruption.

[0035] This embodiment provides a resource processing method that receives a job request carrying a job task, determines a target worker node from the worker node cluster based on the job request to provide resources for the job task, deploys a target container on the target worker node, and gradually uses the resources released by the target worker node during its operation. Based on the resources used by the target worker node, the job task is then distributed to the target container, which executes the job task based on the used resources. This achieves physical-level locking of the resources required by the job task, avoiding the problem of pre-allocated resources being preempted by other job tasks due to existing logical pre-allocation methods that only record the pre-allocation state in the scheduler's memory. This ensures that the job task can stably obtain sufficient resources and improves the reliability of job task execution.

[0036] refer to Figure 2 , Figure 2 This is a flowchart illustrating another resource processing method provided in an embodiment of this application. The resource processing method provided in this embodiment includes the following steps: S201: Receive job request.

[0037] In this embodiment, step S201 is the same as step S101 described above. For details, please refer to step S101 described above. This embodiment will not repeat the details here.

[0038] S202: Obtain the current remaining resources of each worker node in the worker node cluster.

[0039] S203: Based on the job request and all currently remaining resources, if all worker nodes in the worker node cluster meet the first preset condition, obtain the current node load rate of each worker node in the server cluster.

[0040] S204: For each worker node in the worker node cluster, determine the node score corresponding to the worker node based on the current remaining resources and the current node load rate.

[0041] S205: Based on all the obtained node scores, determine the worker node with the highest node score from the worker node cluster as the target worker node.

[0042] Regarding steps S202 to S205 above, the current remaining resources refer to the resources of a work node that are not currently occupied and can be immediately allocated to job tasks. The current remaining resources are used to determine whether they are sufficient for job execution. The current remaining resources are equal to the difference between the total resources of the work node and the resources already used. A first preset condition includes that the current remaining resources of the work node are less than a first resource threshold, which can be referred to above. The current node load rate is used to characterize the ratio between the currently used resources of the work node and the total resources of the work node, reflecting the current operating pressure of the work node. For example, the current node load rate can be expressed as the ratio of the sum of the number of CPU cores used and the amount of memory used by the work node to the sum of the total number of CPU cores and the total amount of memory of the work node. The node score is a unique value calculated using a preset quantitative formula based on the current remaining resources and the current node load rate of the work node. It is a comprehensive evaluation result of the resource potential and operating pressure of the work node. A higher node score indicates that the work node is more suitable as a target work node to provide resources for the execution of job tasks carried by job requests.

[0043] After receiving a job request, the scheduler collects the current remaining resources of each worker node in the worker node cluster in real time. It compares the current remaining resources of each worker node with the first resource threshold carried in the job request to determine if a first preset condition is met. If the scheduler determines that there is a worker node in the worker node cluster that does not meet the first preset condition, it means that the current remaining resources of that worker node are sufficient to provide resources for the execution of the job task. Therefore, a container is deployed directly on that worker node to occupy the resources corresponding to the first resource threshold from the worker node's current remaining resources. The scheduler then distributes the job task to the aforementioned worker node, enabling the deployed container to execute the job task distributed by the scheduler based on the occupied resources.

[0044] If all worker nodes in the worker node cluster meet the first preset condition, it means that there are no worker nodes in the worker node cluster with sufficient remaining resources to provide resources for the execution of the job task. At this time, the current node load rate of each worker node in the worker node cluster is obtained. For each worker node in the worker node cluster, a weighted calculation is performed based on the current remaining resources and the current node load rate to determine the node score corresponding to the worker node. The current remaining resources are positively correlated with the node score (i.e., the more remaining resources, the higher the score), and the current node load rate is negatively correlated with the node score (i.e., the higher the current node load rate, the more points are deducted).

[0045] After obtaining the node scores for each worker node in the worker node cluster, all worker nodes in the cluster are sorted in descending order according to their node scores to select the worker node with the highest node score as the target worker node. It should be noted that if there are multiple worker nodes with the highest node score, the worker node with the smallest difference between the current remaining resources and the first resource threshold is determined from among the multiple worker nodes, and this determined worker node is used as the final target worker node.

[0046] In this embodiment, for scenarios where all worker nodes in a worker node cluster are unable to directly provide resources for job tasks, the target worker node is determined from the worker node cluster through a multi-dimensional quantitative score of the worker node's current remaining resources and current node load rate. This avoids subjective selection bias and ensures that the selected target worker node has both sufficient resource potential and low operating pressure, enabling rapid resource accumulation and further improving the reliability of the resource processing flow and the efficiency of cluster resource utilization, thus providing a stable resource foundation for the subsequent in-situ switching of the target container.

[0047] In this embodiment, step S205 specifically includes: Based on all the obtained node scores, determine the worker node corresponding to the highest node score from the worker node cluster; Determine the number of target containers that have been deployed in the worker node corresponding to the highest node score; When the number of targets is less than the preset threshold, the working node corresponding to the highest node score is determined as the target working node.

[0048] The preset number threshold is used to characterize the maximum number of target containers that can be deployed in energy saving. The preset number threshold can be set according to actual needs. In this embodiment, the specific value of the preset number threshold is not limited.

[0049] After obtaining the node scores for each worker node in the worker node cluster, the scheduler sorts all node scores in descending order. It then extracts the worker node corresponding to the highest node score from the sorting results. The scheduler queries this worker node to determine the number of target containers currently deployed on it. The scheduler compares this number of targets with a preset threshold. If the number of targets is less than the preset threshold, it means the worker node with the highest node score still has the capacity to handle new target containers, and it is designated as the final target worker node. If the number of targets is greater than or equal to the preset threshold, it means the worker node with the highest node score has approached or reached its container capacity limit. This worker node must be abandoned, and the scheduler selects the worker node with the second highest node score according to the sorting results, returning to the step of determining the number of targets, until a worker node with a target number less than the preset threshold is found as the target worker node.

[0050] By adding a target container count check, this embodiment avoids high-scoring worker nodes from clustering together to deploy target containers. Combined with a preset count threshold, it ensures the carrying capacity of the final target worker nodes, guarantees the balance of worker node cluster resources, and ensures the stable accumulation of resources of the deployed target containers.

[0051] S206: During the operation of the target worker node, the target container gradually consumes the resources released by the target worker node.

[0052] In this embodiment, step S206 is the same as step S103 described above. For details, please refer to step S103 described above. This embodiment will not repeat the details here.

[0053] S207: When the resources occupied by the target container reach the first resource threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0054] In this embodiment, the target container verifies its occupied resources in real time. When it determines that the occupied resources have reached a first resource threshold, the target container switches the occupied resources to execution mode in their original position and sends a resource ready signal to the scheduler. Upon receiving the resource ready signal, the scheduler distributes the job task to the target container. After receiving the job task, the target container does not need to destroy itself or release the occupied resources. Instead, it directly loads the job task's program code, configures environment variables, and initializes the running conditions according to the startup parameters in its isolated running environment. It then calls upon the occupied resources to execute the job task until it is fully completed. Throughout the entire execution process, the target container continuously occupies the locked resources, without any risk of resource preemption or interruption. By adding a first resource threshold as the trigger condition for job task distribution, this embodiment avoids job task execution failure due to insufficient resources or waste caused by resource excess, ensuring the stability of job task execution and improving the utilization efficiency of worker node cluster resources.

[0055] Specifically, step S207 includes: Obtain the preset duration threshold corresponding to the target container; When the resources occupied by the target container reach the first resource threshold within the preset time threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0056] In the above, the preset duration threshold is used to characterize the upper limit of the allowed duration for the target container to occupy resources, so as to avoid the deployed target container waiting indefinitely for the target worker node to release resources. The preset duration threshold can be set according to actual needs, and the specific value of the preset duration threshold is not limited in this embodiment.

[0057] Before deploying the target container on the target worker node, the scheduler determines the task priority corresponding to the job task carried in the job request. Based on the task priority, it matches the corresponding preset duration threshold and sets this preset duration threshold as the preset duration threshold for the target container. As the target container gradually occupies the resources of the target worker node, the preset duration threshold for the target container is obtained, and the duration of resource occupation by the target container is statistically analyzed. If the resources occupied by the target container reach a first resource threshold within the preset duration threshold, it means that the job task carried in the job request can be executed through the target container. If the resources occupied by the target container do not reach the first resource threshold within the preset duration threshold, the target container sends an exception signal to the scheduler. The scheduler then terminates the operation of the target container on the target worker node, releases the occupied resources, marks the job task as a processing exception, and triggers an alarm.

[0058] By adding a preset duration threshold, this embodiment avoids the target container from occupying resources indefinitely, thereby improving the timeliness of resource processing and the resource utilization efficiency of the worker node cluster.

[0059] This embodiment provides a resource processing method that receives a job request carrying a job task, determines a target worker node from the worker node cluster based on the job request to provide resources for the job task, deploys a target container on the target worker node, and gradually uses the resources released by the target worker node during its operation. Based on the resources used by the target worker node, the job task is then distributed to the target container, which executes the job task based on the used resources. This achieves physical-level locking of the resources required by the job task, avoiding the problem of pre-allocated resources being preempted by other job tasks due to existing logical pre-allocation methods that only record the pre-allocation state in the scheduler's memory. This ensures that the job task can stably obtain sufficient resources and improves the reliability of job task execution.

[0060] Figure 3 This is a flowchart illustrating another resource processing method provided in this application embodiment. The resource processing method provided in this embodiment includes the following steps: S301: Receive job request.

[0061] S302: Get the current remaining resources of each worker node in the worker node cluster.

[0062] S303: Based on the job request and all currently remaining resources, if all worker nodes in the worker node cluster meet the first preset condition, obtain the current node load rate of each worker node in the server cluster.

[0063] The steps S301 to S303 described above correspond one-to-one with the steps S201 to S203 described above. For details, please refer to the steps S201 to S203 described above. This embodiment will not repeat them here.

[0064] S304: Determine the historical resource release rate of each worker node in the worker node cluster within a preset historical time period.

[0065] S305: For each worker node in the worker node cluster, determine the first weight corresponding to the current remaining resources of the worker node, the second weight corresponding to the current node load rate of the worker node, and the third weight corresponding to the historical resource release rate of the worker node.

[0066] S306: Using the first weight, the second weight, and the third weight, a weighted calculation is performed on the current remaining resources, the current node load rate, and the historical resource release rate to determine the node score corresponding to the working node.

[0067] For steps S304 to S306 above, the preset historical time period can be set according to actual needs. For example, the preset historical time period can be 1 hour or 2 hours prior to the current time. The historical resource release rate is the average rate at which resources are released due to the completion of historical tasks within the preset historical time period. For example, if the preset historical time period is 1 hour, the resources released by the work node within one hour are obtained, and the ratio between the resources released by the work node within one hour and 60 minutes (1 hour) is determined as the historical resource release rate of the work node within the preset historical time period.

[0068] The first weight is a pre-set weight for the current remaining resources, used to quantify the importance of the current remaining resources in the node score. The second weight is a pre-set weight for the current node load rate, used to quantify the negative impact of the current node load rate in the node score. The third weight is a pre-set weight for the historical resource release rate, used to quantify the importance of the working node's future resource release potential in the node score. The first, second, and third weights can be set according to actual needs, and this embodiment does not impose specific limitations.

[0069] The scheduler retrieves resource release logs from each worker node in the worker node cluster within a preset historical time period to calculate the historical resource release rate for each worker node. The scheduler then retrieves the first weight corresponding to the current remaining resources, the second weight corresponding to the current node load rate, and the third weight corresponding to the historical resource release rate. Using these weights, the scheduler performs a weighted calculation on the current remaining resources, the current node load rate, and the historical resource release rate to determine the node score for each worker node. The node score is positively correlated with the current remaining resources and the historical resource release rate, and negatively correlated with the current node load rate. The node score can be expressed by the following formula:

[0070] In the above formula, Indicates node score, Indicates the current remaining resources. Indicates the first weight. This indicates the current node load rate. Indicates the second weight. Indicates the historical resource release rate. This indicates the third weight.

[0071] By adding a historical resource release rate index and introducing a three-dimensional weighted calculation method to evaluate the node score of the working node, this embodiment upgrades the selection of working nodes to a comprehensive assessment of current resource potential and future release capability. This can quickly achieve resource accumulation, further improve the reliability of the resource processing flow and the efficiency of cluster resource utilization, and provide a stable resource foundation for the in-situ switching of subsequent target containers.

[0072] It should be noted that after obtaining the first, second, and third weights, the priority of the task is determined. If the task has a high priority, the third weight is increased to update it. This prioritizes low-load and high-remaining-resource work nodes that can quickly accumulate resources. The first, second, and updated third weights are used to weight the current remaining resources, the current node load rate, and the historical resource release rate to determine the node score for each work node. The task priority can be found in the pre-defined task-priority relationship.

[0073] S307: Based on all the obtained node scores, determine the worker node with the highest node score from the worker node cluster as the target worker node.

[0074] S308: During the operation of the target worker node, the target container gradually consumes the resources released by the target worker node.

[0075] S309: When the resources occupied by the target container reach the first resource threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0076] Regarding steps S307 to S309, steps S307 to S309 correspond one-to-one with steps S205 to S207. For details, please refer to steps S205 to S207. This embodiment will not repeat them here.

[0077] This embodiment provides a resource processing method that receives a job request carrying a job task, determines a target worker node from the worker node cluster based on the job request to provide resources for the job task, deploys a target container on the target worker node, and gradually uses the resources released by the target worker node during its operation. Based on the resources used by the target worker node, the job task is then distributed to the target container, which executes the job task based on the used resources. This achieves physical-level locking of the resources required by the job task, avoiding the problem of pre-allocated resources being preempted by other job tasks due to existing logical pre-allocation methods that only record the pre-allocation state in the scheduler's memory. This ensures that the job task can stably obtain sufficient resources and improves the reliability of job task execution.

[0078] Figure 4 This is a flowchart illustrating another resource processing method provided in an embodiment of this application. The resource processing method provided in this embodiment includes the following steps: S401: Receive job request.

[0079] S402: Get the current remaining resources of each worker node in the worker node cluster.

[0080] S403: Based on the job request and all currently remaining resources, if all worker nodes in the worker node cluster meet the first preset condition, obtain the current node load rate of each worker node in the server cluster.

[0081] The steps S401 to S403 described above correspond one-to-one with the steps S201 to S203 described above. For details, please refer to the steps S201 to S203 described above. This embodiment will not repeat them here.

[0082] S404: Based on the current remaining resources and current node load rate of each worker node in the worker node cluster, filter out all worker nodes that meet the second preset condition from the worker node cluster to complete the update of the worker node cluster.

[0083] S405: For each worker node in the updated worker node cluster, determine the node score corresponding to the worker node based on the worker node's current remaining resources and current node load rate.

[0084] Regarding steps S404 and S405 above, the second preset condition includes the worker node's current remaining resources being less than a second resource threshold, and / or the worker node's current node load rate being greater than a preset load rate threshold, where the second resource threshold is less than the first resource threshold. The second resource threshold characterizes the lower limit of the current remaining resources corresponding to the worker node's ability to gradually occupy resources for the target container, and the preset load rate threshold characterizes the upper limit of the current node load rate corresponding to the worker node's ability to stably release resources to support the target container's resource occupation. The specific values ​​of the second resource threshold and the preset load rate threshold can be set according to actual needs; this embodiment does not impose specific limitations on them.

[0085] After obtaining the current remaining resources and current node load rate of each worker node in the worker node cluster, the scheduler performs a second preset condition judgment on each worker node in the worker node cluster. If there is a worker node in the worker node cluster that meets the second preset condition, it is characterized as an invalid worker node with no resource potential or too high a load to support resource accumulation. Therefore, in order to quickly determine the node score of the worker node in the subsequent process, the worker nodes that meet the second preset condition are filtered out from the worker node cluster to obtain an updated worker node cluster.

[0086] After obtaining the updated worker node cluster, the node score corresponding to each worker node in the worker node cluster is determined based on the node score determination method described above, so as to obtain the node score corresponding to each worker node in the updated worker node cluster.

[0087] By using the above methods, this embodiment reduces the computational load of node scoring by filtering out invalid working nodes with insufficient remaining resources or excessive load in the pre-processing stage.

[0088] S406: Based on all the obtained node scores, determine the worker node with the highest node score from the worker node cluster as the target worker node.

[0089] S407: During the operation of the target worker node, the target container gradually consumes the resources released by the target worker node.

[0090] S408: When the resources occupied by the target container reach the first resource threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0091] Regarding steps S406 to S408, they correspond one-to-one with steps S205 to S207. For details, please refer to steps S205 to S207. This embodiment will not repeat them here.

[0092] This embodiment provides a resource processing method that receives a job request carrying a job task, determines a target worker node from the worker node cluster based on the job request to provide resources for the job task, deploys a target container on the target worker node, and gradually uses the resources released by the target worker node during its operation. Based on the resources used by the target worker node, the job task is then distributed to the target container, which executes the job task based on the used resources. This achieves physical-level locking of the resources required by the job task, avoiding the problem of pre-allocated resources being preempted by other job tasks due to existing logical pre-allocation methods that only record the pre-allocation state in the scheduler's memory. This ensures that the job task can stably obtain sufficient resources and improves the reliability of job task execution.

[0093] The following is an example for reference. Figure 5 Here is a detailed description of the entire resource processing process, as follows.

[0094] When the scheduler receives a job request, it determines the target worker node (i.e., the Kubernetes node) from the worker node cluster if all worker nodes in the worker node cluster meet the first preset condition based on the job request.

[0095] Deploy a placeholder target container (i.e., a generic container) in the target worker node to monitor the resources released by the target worker node.

[0096] When a task on the target worker node completes execution and releases resources, the target container detects the released resources and then occupies them.

[0097] The target container updates its own resource quota, and sends a Ready signal to the scheduler when the resources it currently occupies reach the first resource threshold.

[0098] After receiving the Ready signal, the scheduler retrieves the job task (i.e., job application information) from the user job configuration (i.e., job request).

[0099] The scheduler will distribute the newly acquired job task to the target container.

[0100] The target container state switches from placeholder mode to execution mode.

[0101] The target container executes job tasks based on the resources it has already used.

[0102] Figure 6This is a schematic diagram of a resource processing device provided in an embodiment of this application. The resource processing device provided in this embodiment includes a receiving module 601, a deployment module 602, an occupancy module 603, and a processing module 604. The receiving module 601 is used to receive a job request, which carries a job task. The deployment module 602 is used to determine a target worker node from a worker node cluster based on the job request, and to deploy a target container on the target worker node, whereby the target worker node represents a worker node that provides resources for the job task. The occupancy module 603 is used to gradually occupy the resources released by the target worker node during its operation through the target container. The processing module 604 is used to distribute the job task to the target container based on the resources occupied by the target container, so that the target container can execute the job task based on the occupied resources.

[0103] In this embodiment, the job request also carries a first resource threshold, which is used to characterize the resources required to execute the job task. The processing module 604 is further used to: When the resources occupied by the target container reach the first resource threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0104] In this embodiment, the deployment module 602 is further configured to: Obtain the current remaining resources of each worker node in the worker node cluster; Based on the job request and all the current remaining resources obtained, if all the worker nodes in the worker node cluster meet the first preset condition, the current node load rate of each worker node in the worker node cluster is obtained. The first preset condition includes that the current remaining resources of the worker node are less than the first resource threshold. For each worker node in the worker node cluster, a node score is determined based on the current remaining resources and the current node load rate of the worker node. Based on all the obtained node scores, the worker node with the highest node score is determined from the worker node cluster as the target worker node.

[0105] In this embodiment, the deployment module 602 is further configured to: Before determining the score of each node, the historical resource release rate of each worker node in the worker node cluster within a preset historical time period is determined.

[0106] In this embodiment, the deployment module 602 is further configured to: Determine the first weight corresponding to the current remaining resources of the working node, the second weight corresponding to the current node load rate of the working node, and the third weight corresponding to the historical resource release rate of the working node; Using the first weight, the second weight, and the third weight, the current remaining resources, the current node load rate, and the historical resource release rate are weighted and calculated to determine the node score corresponding to the working node.

[0107] In this embodiment, the deployment module 602 is further configured to: After obtaining the load rate of each current node, based on the current remaining resources and the current node load rate of each worker node in the worker node cluster, all worker nodes that meet the second preset condition are filtered out from the worker node cluster to complete the update of the worker node cluster. The second preset condition includes that the current remaining resources of the worker node are less than a second resource threshold, and / or the current node load rate of the worker node is greater than a preset load rate threshold, wherein the second resource threshold is less than the first resource threshold.

[0108] In this embodiment, the deployment module 602 is further configured to: For each worker node in the updated worker node cluster, a node score is determined based on the worker node's current remaining resources and current node load rate.

[0109] In this embodiment, the deployment module 602 is further configured to: Based on all the obtained node scores, the worker node corresponding to the highest node score is determined from the worker node cluster; Determine the target number of the target containers that have been deployed in the working node corresponding to the highest node score; When the number of targets is less than a preset threshold, the working node corresponding to the highest node score is determined as the target working node.

[0110] In this embodiment, the processing module 604 is further configured to: Obtain the preset duration threshold corresponding to the target container; When the resources occupied by the target container reach the first resource threshold within the preset time threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

[0111] This embodiment provides a resource processing device that receives a job request carrying a job task, determines a target worker node from a worker node cluster based on the job request to provide resources for the job task, deploys a target container on the target worker node, and gradually uses the resources released by the target worker node during its operation. Based on the resources used by the target worker node, the job task is then distributed to the target container, which executes the job task based on the used resources. This achieves physical-level locking of the resources required by the job task, avoiding the problem of pre-allocated resources being preempted by other job tasks due to existing logical pre-allocation methods that only record the pre-allocation state in the scheduler's memory. This ensures that the job task can stably obtain sufficient resources and improves the reliability of job task execution.

[0112] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 The illustrated electronic device 700 includes at least one processor 701, a memory 702, at least one network interface 704, and other user interfaces 703. The various components in the electronic device 700 are coupled together via a bus system 705. It is understood that the bus system 705 is used to implement communication between these components. In addition to a data bus, the bus system 705 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 7 The general labeled all buses as Bus System 705.

[0113] The user interface 703 may include a display, keyboard, or clicking device (e.g., mouse, trackball, touchpad, or touchscreen).

[0114] It is understood that the memory 702 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 702 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0115] In some implementations, memory 702 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 7021 and application program 7022.

[0116] The operating system 7021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 7022 includes various applications, such as a media player and a browser, used to implement various application functions. The program implementing the method of the embodiments of this application can be included in the application program 7022.

[0117] In the embodiments of this application, the processor 701 executes the method steps provided in each method embodiment by calling the program or instructions stored in the memory 702, specifically the program or instructions stored in the application program 7022.

[0118] The methods disclosed in the embodiments of this application can be applied to or implemented by processor 701. Processor 701 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 701 or by instructions in the form of software. The processor 701 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software units may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 702. Processor 701 reads the information in memory 702 and, in conjunction with its hardware, completes the steps of the above method.

[0119] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions of this application, or combinations thereof.

[0120] For software implementation, the techniques described herein can be implemented through units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented within the processor or external to the processor.

[0121] The electronic device provided in this embodiment may be as follows: Figure 7 The electronic device shown can perform the following: Figures 1-5 All steps of the resource processing method in the middle, thereby achieving Figures 1-5 For details on the technical effects of the resource processing method shown, please refer to [link / reference]. Figures 1-5 The relevant descriptions are presented concisely and will not be elaborated upon here.

[0122] This application also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; it may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; and it may also include combinations of the above types of memory.

[0123] When one or more programs in the storage medium can be executed by one or more processors to implement the resource processing method described above that is executed on the resource processing device side.

[0124] The processor executes a resource processing program stored in memory to implement the steps of the resource processing method executed on the request processing device side.

[0125] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0126] It should be noted that the embodiments referred to in the specification, such as "one implementation," "example," "exemplary embodiment," and "some embodiments," may include specific features, structures, or characteristics, but not every embodiment necessarily includes that specific feature, structure, or characteristic. Furthermore, such phrases do not necessarily refer to the same embodiment. Moreover, when describing a specific feature, structure, or characteristic in conjunction with embodiments, implementing such a feature, structure, or characteristic in conjunction with other embodiments, whether explicitly described or not, is within the knowledge scope of those skilled in the art.

[0127] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A resource processing method, characterized in that, include: Receive a job request, which carries a job task; Based on the job request, a target worker node is determined from the worker node cluster, and a target container is deployed on the target worker node, wherein the target worker node is used to characterize the worker node that provides resources for the job task; During the operation of the target worker node, the resources released by the target worker node are gradually occupied by the target container; Based on the resources occupied by the target container, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

2. The method according to claim 1, characterized in that, The job request also carries a first resource threshold, which is used to characterize the resources required to execute the job task; Based on the resources occupied by the target container, the job task is distributed to the target container so that the target container can execute the job task based on the occupied resources, including: When the resources occupied by the target container reach the first resource threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

3. The method according to claim 2, characterized in that, The step of determining the target worker node from the worker node cluster based on the job request includes: Obtain the current remaining resources of each worker node in the worker node cluster; Based on the job request and all the current remaining resources obtained, if all the worker nodes in the worker node cluster meet the first preset condition, the current node load rate of each worker node in the worker node cluster is obtained. The first preset condition includes that the current remaining resources of the worker node are less than the first resource threshold. For each worker node in the worker node cluster, a node score is determined based on the current remaining resources and the current node load rate of the worker node. Based on all the obtained node scores, the worker node with the highest node score is determined from the worker node cluster as the target worker node.

4. The method according to claim 3, characterized in that, Before determining the scores for each of the nodes, the method further includes: Determine the historical resource release rate of each worker node in the worker node cluster within a preset historical time period; The process of determining the node score corresponding to the working node based on the current remaining resources and the current node load rate includes: Determine the first weight corresponding to the current remaining resources of the working node, the second weight corresponding to the current node load rate of the working node, and the third weight corresponding to the historical resource release rate of the working node; Using the first weight, the second weight, and the third weight, the current remaining resources, the current node load rate, and the historical resource release rate are weighted and calculated to determine the node score corresponding to the working node.

5. The method according to claim 3, characterized in that, After obtaining the load rate of each current node, the method further includes: Based on the current remaining resources and current node load rate of each worker node in the worker node cluster, all worker nodes that meet the second preset condition are filtered out from the worker node cluster to complete the update of the worker node cluster. The second preset condition includes the current remaining resources of the worker node being less than a second resource threshold, and / or the current node load rate of the worker node being greater than a preset load rate threshold, wherein the second resource threshold is less than the first resource threshold. For each worker node in the worker node cluster, determining the node score corresponding to the worker node based on the worker node's current remaining resources and current node load rate includes: For each worker node in the updated worker node cluster, a node score is determined based on the worker node's current remaining resources and current node load rate.

6. The method according to claim 3, characterized in that, The step of determining the worker node with the highest node score from the worker node cluster as the target worker node based on all the obtained node scores includes: Based on all the obtained node scores, the worker node corresponding to the highest node score is determined from the worker node cluster; Determine the target number of the target containers that have been deployed in the working node corresponding to the highest node score; When the number of targets is less than a preset threshold, the working node corresponding to the highest node score is determined as the target working node.

7. The method according to claim 2, characterized in that, When the resources occupied by the target container reach the first resource threshold, the task is sent to the target container so that the target container can execute the task based on the occupied resources, including: Obtain the preset duration threshold corresponding to the target container; When the resources occupied by the target container reach the first resource threshold within the preset time threshold, the job task is sent to the target container so that the target container can execute the job task based on the occupied resources.

8. A resource processing device, characterized in that, include: A receiving module is used to receive job requests, wherein the job requests carry job tasks. The deployment module is used to determine a target worker node from the worker node cluster based on the job request, and to deploy a target container on the target worker node, wherein the target worker node is used to characterize the worker node that provides resources for the job task; The occupancy module is used to gradually occupy the resources released by the target worker node through the target container during the operation of the target worker node; The processing module is used to distribute the job task to the target container based on the resources occupied by the target container, so that the target container can execute the job task based on the occupied resources.

9. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute a resource processing program stored in the memory to implement the resource processing method according to any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the resource processing method according to any one of claims 1 to 7.