Task processing method, device and storage medium

By obtaining and adjusting the number of operator instances in the intelligent solution, the problem of low efficiency caused by the time-consuming difference in intelligent algorithms processing data is solved, and the task throughput rate is improved and the efficient utilization of hardware resources is achieved.

CN118377601BActive Publication Date: 2024-09-06ZHEJIANG DAHUA TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410799368.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-09-06
Estimated Expiration
2044-06-20

AI Technical Summary

Technical Problem

The difference in time consumption of different intelligent algorithms in processing data results in the low data processing efficiency of intelligent solutions.

Method used

By obtaining the operator set of the current task, determine the target operator whose cache parameters meet the preset conditions, adjust the decision-making and operating environment information based on the number of instances, train the decision-making agent, and dynamically adjust the number of operator instances to improve task processing performance.

Benefits of technology

The number of algorithm instances in the operator set is adaptively expanded or reduced, making full use of hardware resources, improving task throughput and reducing hardware usage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118377601B
    Figure CN118377601B
Patent Text Reader

Abstract

The present application discloses a task processing method, device and storage medium, which includes: obtaining an operator set corresponding to the currently executed task, taking an operator whose cache parameter meets a preset condition in the operator set as a target operator; determining the instance number adjustment decision adopted by the target operator, and obtaining the task processing performance change after the target operator executes the instance number adjustment decision, and the operating environment information corresponding to the target operator before the instance number adjustment decision is executed; based on the instance number adjustment decision adopted by the target operator, the task processing performance change and the operating environment information, training the decision agent to be trained to obtain a trained decision agent; using the trained decision agent, determining the instance number adjustment decision adopted by each operator in the operator set during operation. The number of algorithm instances in the operator set can be adaptively expanded or reduced, thereby improving the throughput rate of the currently executed task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a task processing method, device and storage medium. Background Art

[0002] A variety of different types of intelligent algorithms can be flexibly combined according to the application scenario, the problem to be solved, etc. These algorithms generate corresponding intelligent solutions through different permutations and combinations.

[0003] For example, in the field of audio and video processing, different intelligent solutions in different scenarios often require parallel and serial combinations of multiple different types of intelligent algorithms. For example, common intelligent algorithms include target detection, target tracking, target recognition, target segmentation, target optimization, key points, image comparison, area proportion, traffic rules, target association, etc. These algorithms generate corresponding intelligent solutions through different permutations and combinations. When applied to the corresponding scenarios, audio and video data are collected, and then sent to the intelligent solution in time sequence. Each frame of audio and video data will be processed by the algorithm in the intelligent solution.

[0004] However, due to the differences in the time it takes for different algorithms to process data, the data processing efficiency of the entire intelligent solution is low. Summary of the invention

[0005] In order to solve the above problems, the present application at least provides a task processing method, device and storage medium.

[0006] The first aspect of the present application provides a task processing method, which includes: obtaining an operator set corresponding to a currently executed task, and taking an operator in the operator set whose cache parameters meet preset conditions as a target operator; determining an instance quantity adjustment decision adopted by the target operator, and obtaining a task processing performance change after the target operator executes the instance quantity adjustment decision, and operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed; based on the instance quantity adjustment decision adopted by the target operator, the task processing performance change and the operating environment information, training a decision-making agent to be trained to obtain a trained decision-making agent; using the trained decision-making agent, determining the instance quantity adjustment decision adopted by each operator in the operator set during the operation process.

[0007] In one embodiment, the cache parameters include a used cache value and a cache threshold; an operator in an operator set whose cache parameters meet preset conditions is used as a target operator, including: obtaining the used cache value and cache threshold of each operator in the operator set; using operators whose used cache values ​​are greater than the cache threshold as candidate operators to obtain a candidate operator set; and selecting a target operator from the candidate operator set.

[0008] In one embodiment, the cache parameters also include the cache space size; selecting a target operator from a set of candidate operators includes: obtaining the cache space size of each candidate operator in the set of candidate operators; calculating the cache usage rate of each candidate operator based on the cache space size and the used cache value of each candidate operator; and selecting the candidate operator with the largest cache usage rate as the target operator.

[0009] In one embodiment, determining the instance quantity adjustment decision adopted by the target operator includes: obtaining a preset decision set, the decision set containing multiple candidate adjustment decisions; and using each candidate adjustment decision in the decision set as the instance quantity adjustment decision adopted by the target operator.

[0010] In one embodiment, the change in task processing performance includes a change in environmental throughput; based on the instance quantity adjustment decision adopted by the target operator, the task processing performance change and the operating environment information, the decision agent to be trained is trained to obtain a trained decision agent, including: if the environmental throughput increases after the target operator executes the instance quantity adjustment decision, the instance quantity adjustment decision and the operating environment information of the target operator are saved as a sample data pair; if the environmental throughput does not increase after the target operator executes the instance quantity adjustment decision, the instance quantity adjustment decision and the operating environment information of the target operator are filtered out; the saved sample data is used to train the decision agent to be trained to obtain a trained decision agent.

[0011] In one embodiment, the decision-making agent to be trained is composed of a first-layer agent and a second-layer agent; the decision-making agent to be trained is trained using the stored sample data to obtain a trained decision-making agent, including: taking the operating environment information corresponding to the target operator as the input of the first-layer agent, and taking the instance number adjustment decision adopted by the target operator as the expected output of the first-layer agent, training the first-layer agent to obtain a trained first-layer agent; taking the operating environment information corresponding to the target operator and the output of the first-layer agent as the input of the second-layer agent, and taking the instance number adjustment decision adopted by the target operator as the expected output of the second-layer agent, training the second-layer agent to obtain a trained second-layer agent; combining the trained first-layer agent and the trained second-layer agent to obtain a trained decision-making agent.

[0012] In one embodiment, the second-layer agent is composed of multiple decision neural networks, and the network architecture of each decision neural network is different; using the trained decision intelligent agent, the instance quantity adjustment decision adopted in the operation process of each operator in the operator set is determined, including: obtaining the current operating environment information of the operator to be decided to obtain input data; inputting the input data into the trained decision intelligent agent to obtain the network output of each decision neural network; and obtaining the weight parameter value of each decision neural network; based on the weight parameter value of each decision neural network, each network output is weighted calculated to obtain multiple weighted output results; from the multiple weighted output results, the output result with the largest weight is selected as the current instance quantity adjustment decision of the operator to be decided.

[0013] In one embodiment, it also includes: obtaining the change in environmental throughput after the operator to be decided executes the decision to adjust the number of instances; if the environmental throughput increases after the operator to be decided executes the decision to adjust the number of instances, then increasing the weight parameter value corresponding to the decision neural network that outputs the decision to adjust the number of instances; if the environmental throughput does not increase after the operator to be decided executes the decision to adjust the number of instances, then reducing the weight parameter value corresponding to the decision neural network that outputs the decision to adjust the number of instances.

[0014] The second aspect of the present application provides a task processing device, which includes: an operator determination module, which is used to obtain an operator set corresponding to a currently executed task, and use an operator in the operator set whose cache parameters meet preset conditions as a target operator; a data acquisition module, which is used to determine the instance quantity adjustment decision adopted by the target operator, and obtain the task processing performance change after the target operator executes the instance quantity adjustment decision, and the operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed; an agent training module, which is used to train a decision-making agent to be trained based on the instance quantity adjustment decision adopted by the target operator, the task processing performance change and the operating environment information, to obtain a trained decision-making agent; an agent application module, which is used to use the trained decision-making agent to determine the instance quantity adjustment decision adopted by each operator in the operator set during the operation process.

[0015] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-mentioned task processing method.

[0016] A fourth aspect of the present application provides a computer-readable storage medium on which program instructions are stored, and when the program instructions are executed by a processor, the above-mentioned task processing method is implemented.

[0017] The above scheme obtains the operator set corresponding to the currently executed task, and takes the operator whose cache parameters meet the preset conditions in the operator set as the target operator; determines the instance quantity adjustment decision adopted by the target operator, and obtains the task processing performance change after the target operator executes the instance quantity adjustment decision, and the operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed; based on the instance quantity adjustment decision adopted by the target operator, the task processing performance change and the operating environment information, the decision agent to be trained is trained to obtain a trained decision agent; using the trained decision agent, the instance quantity adjustment decision adopted by each operator in the operator set during operation is determined, and the number of algorithm instances in the operator set can be adaptively expanded or reduced, so as to make full use of hardware resources in dynamic changes and achieve maximum utilization, thereby improving the throughput of the currently executed task and reducing the hardware usage cost.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0020] Figure 1 is a schematic diagram of an implementation environment involved in a task processing method shown in an exemplary embodiment of the present application;

[0021] Figure 2 is a flowchart of a task processing method shown in an exemplary embodiment of the present application;

[0022] Figure 3 is a schematic diagram of determining a target operator shown in an exemplary embodiment of the present application;

[0023] Figure 4 is a schematic diagram of a decision set shown in an exemplary embodiment of the present application;

[0024] Figure 5 is a flowchart of training a decision-making agent to be trained, shown in an exemplary embodiment of the present application;

[0025] Figure 6 is a block diagram of a task processing device shown in an exemplary embodiment of the present application;

[0026] Figure 7 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present application;

[0027] Figure 8It is a schematic diagram of the structure of a computer-readable storage medium shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0028] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0029] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0030] The term "and / or" in this article is only an association information describing the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.

[0031] The task processing method provided in the embodiment of the present application is described below.

[0032] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include a terminal 110 and a server 120, and the terminal 110 and the server 120 are connected to each other in communication.

[0033] The number of the terminal 110 may be one or more. The terminal 110 may be a camera, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, etc., but is not limited thereto.

[0034] Server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0035] In the task processing method provided in the embodiment of the present application, the execution subject of each step can be the terminal 110, such as the client of the target application installed and running in the terminal 110, or the server 120, or the terminal 110 and the server 120 interact and cooperate to execute, that is, part of the steps of the method are executed by the terminal 110 and the other part of the steps are executed by the server 120.

[0036] See also Figure 2 , Figure 2 is a flowchart of a task processing method shown in an exemplary embodiment of the present application. The task processing method can be applied to Figure 1 It should be understood that the method can also be applied to other exemplary implementation environments and be specifically executed by devices in other implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable.

[0037] like Figure 2 As shown, the task processing method at least includes steps S210 to S240, which are described in detail as follows:

[0038] Step S210: Acquire the operator set corresponding to the currently executed task, and use the operator in the operator set whose cache parameters meet preset conditions as the target operator.

[0039] The currently executed task can be an audio analysis task, image analysis task, audio and video analysis task, text analysis task, etc. in various scenarios, and this application does not limit this.

[0040] Different tasks correspond to different operator sets. An operator set consists of multiple operators, which together form an intelligent solution.

[0041] For example, if the current execution task is an image analysis task, its corresponding operator set includes target detection operators, target tracking operators, target association operators, and traffic rule judgment operators, etc.; if the current execution task is an audio analysis task, its corresponding operator set includes speech recognition operators, emotion recognition operators, scene judgment operators, etc.

[0042] Exemplarily, the operator set can be represented as:

[0043]

[0044] Among them, solu represents a set of operators, which corresponds to an intelligent solution; algn represents the nth operator.

[0045] After obtaining the operator set corresponding to the currently executed task, the cache parameters of each operator in the operator set are obtained. For example, the cache parameters include one parameter or a combination of multiple parameters including the cache value used by the operator, the cache space size, and the cache threshold.

[0046] It should be noted that different preset conditions will result in different corresponding cache parameters.

[0047] Exemplarily, the task characteristic parameters of the currently executed task are extracted, preset conditions matching the task characteristic parameters are determined, the cache parameter type to be obtained is determined according to the preset conditions, and the cache parameter is obtained according to the cache parameter type. The task characteristic parameters include, but are not limited to, one or more combinations of task type, urgency, and the number of tasks in the task waiting queue.

[0048] For example, according to the task type of the currently executed task, the matching preset conditions are queried, the cache parameter type to be obtained is determined according to the preset conditions, and the cache parameters are obtained according to the cache parameter type. For example, if the currently executed task is an audio and video analysis task, the matching preset condition is condition 1. This condition 1 not only needs to judge the size of the operator's cached data, but also needs to judge the usage of the cache space. The cache parameter type to be obtained contains the used cache value, cache space size, and cache threshold; if the currently executed task is an audio analysis task, the matching preset condition is condition 2. This condition 2 only needs to judge the size of the operator's cached data. The cache parameter type to be obtained contains the used cache value and cache threshold; if the currently executed task is an image analysis task, the matching preset condition is condition 3. This condition 3 only needs to judge the growth of the operator's cached data. The cache parameter type to be obtained only contains the used cache value.

[0049] In addition to determining the preset conditions according to the task type of the currently executed task as mentioned above, cache parameters can also be obtained based on the urgency of the currently executed task, the number of tasks in the task waiting queue, etc., and this application does not limit this.

[0050] For example, the used cache value, cache space size, and cache threshold of each operator are obtained to obtain the cache parameters of each operator. For example, the cache parameters of the nth operator can be expressed as:

[0051]

[0052] Among them, cache_T represents the cache threshold; cache_Max represents the cache space size; cache_rt represents the used cache value.

[0053] The operator whose cache parameters meet the preset conditions in the operator set is taken as the target operator.

[0054] For example, an operator whose cached data value is greater than a cache threshold can be used as a target operator; an operator whose cache space usage rate is greater than a usage threshold can also be used as a target operator; an operator whose cached data growth rate is greater than a growth rate threshold can also be used as a target operator, and this application does not limit this.

[0055] The above-mentioned thresholds can be pre-set; the above-mentioned thresholds can also be flexibly determined according to actual application situations. For example, the number of tasks in the task waiting queue corresponding to the currently executed task can be obtained, and the above-mentioned thresholds can be determined according to the number of tasks. For example, the more tasks there are, the larger the cache threshold and / or the utilization threshold, and the fewer tasks there are, the smaller the cache threshold and / or the utilization threshold. The above-mentioned thresholds can also be flexibly determined by obtaining the cache status of other operators, the urgency of the currently executed task, etc., and this application does not limit this.

[0056] Step S220: determine the instance quantity adjustment decision adopted by the target operator, and obtain the task processing performance change after the target operator executes the instance quantity adjustment decision and the operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed.

[0057] The instance quantity adjustment decision is used to adjust the number of instances processed by the target operator.

[0058] For example, instance quantity adjustment decisions include expanding the number of operator instances, reducing the number of operator instances, and not changing the number of operator instances.

[0059] Before using the instance quantity adjustment decision to adjust the instance quantity of the target operator, it is necessary to first record the operating environment information corresponding to the target operator. The operating environment information refers to the relevant environmental parameters of the device or platform running the target operator.

[0060] For example, the operating environment information can be expressed as;

[0061]

[0062] Among them, di represents the operating environment information, solu represents the corresponding operator set, scene represents the scene enumeration of the scene corresponding to the operator set, business represents the current execution task enumeration, platform represents the type of device or platform running the operator, action represents the instance quantity adjustment decision adopted by the operator, and dev represents the resource usage of the current device.

[0063] Action can include three situations , where 1 means expanding the number of current operator instances; 0 means not changing the number of instances; -1 means judging whether the number of previous and next operator instances corresponding to the current operator is greater than 1. If the number of previous and next operator instances is greater than 1, the number of previous and next operator instances is reduced; if the number of previous and next operator instances is equal to 1, the number of instances is not changed.

[0064] dev can include memory utilization, central processing unit (CPU) utilization, graphics processing unit (GPU) utilization, and neural processing unit (NPU) utilization, etc.

[0065] According to the operating environment information record corresponding to the target operator, the operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed is obtained.

[0066] In addition, the change in task processing performance after the decision to adjust the number of target operator execution instances is obtained.

[0067] For example, before adopting the instance quantity adjustment decision to adjust the instance quantity of the target operator, it is necessary to first record the task processing performance of the device or platform corresponding to the target operator. After adopting the instance quantity adjustment decision to adjust the instance quantity of the target operator, the task processing performance of the device or platform corresponding to the target operator is recorded again. Based on the task processing performance recorded twice, the task processing performance change after the target operator executes the instance quantity adjustment decision is obtained.

[0068] The task processing performance may be evaluated from multiple dimensions, such as environment throughput, waiting time of tasks in a task waiting queue, or a combination of environment throughput and waiting time of tasks to evaluate the task processing performance.

[0069] Taking the waiting time of tasks in the task waiting queue as an example, if the waiting time of each task in the task waiting queue is longer, the task processing performance is lower; if the waiting time of each task in the task waiting queue is shorter, the task processing performance is higher; taking the environmental throughput as an example, if the environmental throughput is lower, the task processing performance is lower; if the environmental throughput is higher, the task processing performance is higher.

[0070] Step S230: Based on the instance quantity adjustment decision adopted by the target operator, the task processing performance change and the operating environment information, the decision agent to be trained is trained to obtain a trained decision agent.

[0071] The data of the above target operator is used as a training sample to train the decision-making agent to be trained, and a trained decision-making agent is obtained.

[0072] Among them, the specific implementation method of the decision-making agent can be flexibly set according to the actual application situation, and this application does not limit this.

[0073] Exemplarily, the operating environment information and task processing performance changes before and after the operator execution instance number adjustment decision can be collected and saved in real time to gradually expand the training sample data. Then, the decision agent can be periodically trained according to the preset cycle, such as after each actual T detection, the decision agent is trained using the pre-saved training sample data. It is also possible to detect whether there is a training trigger event. For example, when it is detected that the current decision agent optimizes the current execution task, the optimization efficiency is low, such as the task processing performance is reduced or the task processing performance improvement speed is less than the preset speed, it is judged that there is a training trigger event, and the pre-saved training sample data is immediately used to train the decision agent; and if it is detected that there is no training trigger event, the decision agent is periodically trained according to the preset cycle.

[0074] Step S240: using the trained decision-making agent, determine the instance quantity adjustment decision used in the operation of each operator in the operator set.

[0075] The trained decision-making agent can determine the instance quantity adjustment decision for each operator in the operator set, so as to adjust the instance quantity of the corresponding operator according to the determined instance quantity adjustment decision.

[0076] Specifically, the operator in the operator set that needs to adjust the number of instances is used as the operator to be decided. The method for determining the operator to be decided can refer to the method for determining the target operator in step S210, which will not be described in detail here. The operating environment information of the operator to be decided is used as input data and input into the trained decision agent to obtain the instance quantity adjustment decision output by the decision agent.

[0077] Therefore, by observing the changes in the cache parameters of a single operator, we can obtain the algorithm bottleneck of the current execution task and determine whether it is necessary to expand the operator instance.

[0078] Through the above method, in the process of concurrent scheduling and processing of multiple tasks, the number of algorithm instances in the operator set can be adaptively expanded or reduced according to the hardware capabilities of the device platform, and the hardware resources can be fully utilized in dynamic changes to achieve maximum utilization, thereby improving the throughput of the current execution task and reducing the hardware usage cost.

[0079] Next, some embodiments of the present application are described in detail.

[0080] In some implementations, in step S210, taking an operator in the operator set whose cache parameters meet a preset condition as a target operator includes:

[0081] Step S211: Obtain the used cache value and cache threshold of each operator in the operator set.

[0082] The used cache value is used to represent the size of the operator's cached data; the cache threshold is used to determine whether the operator's cached data is too much.

[0083] Step S212: operators whose used cache values ​​are greater than the cache threshold are taken as candidate operators to obtain a candidate operator set.

[0084] The used cache value of each operator is compared with the cache threshold, and the operators whose used cache values ​​are greater than the cache threshold are taken as candidate operators to obtain a candidate operator set.

[0085] Step S213: Select a target operator from the candidate operator set.

[0086] Exemplarily, selecting a target operator from a set of candidate operators includes: obtaining the cache space size of each candidate operator in the set of candidate operators; calculating the cache usage rate of each candidate operator based on the cache space size and used cache value of each candidate operator; and selecting the candidate operator with the largest cache usage rate as the target operator.

[0087] For example, the ratio of the used cache value cache_rt to the cache space size cache_Max is calculated to obtain the cache usage rate, and the target operator is selected from the candidate operator set according to the cache usage rate of each candidate operator.

[0088] The candidate operator with the largest cache usage rate may be selected as the target operator; or the candidate operator with a cache usage rate greater than a usage rate threshold may be selected as the target operator, which is not limited in this application.

[0089] Specifically, see Figure 3 , Figure 3 This is a schematic diagram of determining a target operator shown in an exemplary embodiment of the present application, such as Figure 3 As shown, for each operator in the operator set solu, the operator whose used cache value cache_rt is greater than the cache threshold cache_T is taken as a candidate operator to obtain a candidate operator set S, and then the cache usage rate of the operators in the candidate operator set S is calculated to select the candidate operator with the largest cache usage rate as the target operator.

[0090] In addition to selecting the target operator from the candidate operator set based on the cache usage rate as described above, it is also possible to count the used cache value of each candidate operator at each time point to obtain the cache usage growth rate of each candidate operator, and use the candidate operator with the largest cache usage growth rate as the target operator; or use the candidate operator with a cache usage growth rate greater than a growth rate threshold as the target operator. This application does not limit the method for selecting the target operator.

[0091] In some implementations, determining the instance quantity adjustment decision adopted by the target operator in step S220 includes:

[0092] Step S221: obtaining a preset decision set, which contains multiple candidate adjustment decisions.

[0093] The decision set contains a plurality of preset candidate adjustment decisions, such as the three cases of action exemplified in the above step S220 , each case corresponding to a candidate adjustment decision.

[0094] Specifically, see Figure 4 , Figure 4 A schematic diagram of a decision set shown in an exemplary embodiment of the present application is shown in FIG. Figure 4 As shown, the decision set contains three decision rules, namely, decision rule 1: expand the number of current operator instances; decision rule 2: do not change the number of instances; decision rule 3: reduce the number of previous and next operator instances. Each decision rule is taken as a candidate adjustment decision.

[0095] Step S222: each candidate adjustment decision in the decision set is used as an instance quantity adjustment decision adopted by the target operator.

[0096] That is, each candidate adjustment decision is executed for the target operator respectively to observe the impact of the target operator executing different candidate adjustment decisions on the task processing performance.

[0097] In some embodiments, task processing performance changes include environmental throughput changes; see Figure 5 , Figure 5 A flowchart of training a decision-making agent to be trained is shown in an exemplary embodiment of the present application, as shown in FIG. Figure 5 As shown, including:

[0098] Step S231: record the environment throughput before the target operator executes the instance quantity adjustment decision as throughput_before, and then record the environment throughput after the target operator executes the instance quantity adjustment decision as throughout_after;

[0099] Step S232: Determine whether throughout_after is greater than throughout_before to determine whether the environmental throughput increases. If throughout_after is greater than throughout_before after the target operator executes the instance quantity adjustment decision, the environmental throughput increases, and step S233 is executed; if throughout_after is not greater than throughout_before after the target operator executes the instance quantity adjustment decision, the environmental throughput does not increase, and step S234 is executed.

[0100] Step S233: Save the instance quantity adjustment decision and the operating environment information of the target operator as a sample data pair.

[0101] Step S234: Filter out the instance quantity adjustment decision and operating environment information of the target operator.

[0102] Step S235: Use the saved sample data to train the decision-making agent to be trained to obtain a trained decision-making agent.

[0103] The above steps only save the instance quantity adjustment decision and operating environment information corresponding to the increase in environment throughput, and filter out the data whose environment throughput has not increased.

[0104] The decision-making agent to be trained is trained based on the saved sample data pairs.

[0105] In some implementations, in addition to filtering out data according to the task processing performance change described above, the data may also be divided into positive sample data pairs and negative sample data pairs according to the task processing performance change.

[0106] Specifically, if the environment throughput does not increase after the target operator executes the instance quantity adjustment decision, the instance quantity adjustment decision of the target operator and the operating environment information are used as a negative sample data pair; if the environment throughput increases after the target operator executes the instance quantity adjustment decision, the instance quantity adjustment decision of the target operator and the operating environment information are used as a positive sample data pair.

[0107] Combine the negative sample data pairs and the positive sample data pairs to train the decision-making agent to be trained.

[0108] By executing the instance quantity adjustment decision on the target operator, the relevant data before and after the instance quantity adjustment decision is collected and recorded to obtain sample data. In addition to the example of performing random decision execution on the target operator according to the decision set to obtain sample data as exemplified in steps S221 to S222, the relevant data before and after the instance quantity adjustment decision is determined by the decision agent completed by periodic training during the execution of the current execution task to obtain sample data can also be collected and recorded, thereby obtaining diverse sample data and improving the training effect of subsequent decision agents.

[0109] Next, we will give an example to illustrate the training process of the decision-making agent.

[0110] In some embodiments, the decision-making agent to be trained is composed of a first-layer agent and a second-layer agent; the decision-making agent to be trained is trained using the stored sample data to obtain a trained decision-making agent, including: taking the operating environment information corresponding to the target operator as the input of the first-layer agent, and taking the instance number adjustment decision adopted by the target operator as the expected output of the first-layer agent, training the first-layer agent to obtain a trained first-layer agent; taking the operating environment information corresponding to the target operator and the output of the first-layer agent as the input of the second-layer agent, and taking the instance number adjustment decision adopted by the target operator as the expected output of the second-layer agent, training the second-layer agent to obtain a trained second-layer agent; combining the trained first-layer agent and the trained second-layer agent to obtain a trained decision-making agent.

[0111] Specifically, a sample data pair is obtained, the sample data pair consisting of mutually related operating environment information and instance quantity adjustment decisions, the operating environment information is used as the input of the first-layer intelligent agent, and the instance quantity adjustment decisions corresponding to the operating environment information are used as the expected output of the first-layer intelligent agent, so as to train the first-layer intelligent agent and obtain a trained second-layer intelligent agent.

[0112] Then, the operating environment information and the output of the first-layer intelligent agent are used as the input of the second-layer intelligent agent, and the instance quantity adjustment decision corresponding to the operating environment information is used as the expected output of the second-layer intelligent agent. The second-layer intelligent agent is trained to obtain a trained second-layer intelligent agent.

[0113] For example, the loss function used in the above training can be expressed as:

[0114]

[0115] Among them, k represents the value of the instance quantity adjustment decision, which can be -1, 0, or 1; yi represents 1 if the output category is i, otherwise 0; pi represents the probability of the output category being i.

[0116] The trained first-layer agent and the trained second-layer agent are then combined to obtain a trained decision-making agent.

[0117] Optionally, in order to improve the stability of the first-layer intelligent agent, when building the first-layer intelligent agent, multiple types of recognition algorithms can be selected, such as decision trees, random forests, multi-layer perceptrons, support vector machines, etc., so as to use each recognition algorithm to obtain multiple output results, and each output result can be used as the input of the second-layer intelligent agent.

[0118] In addition, in order to improve the accuracy of the second-layer intelligent agent, when building the second-layer intelligent agent, multiple decision neural networks can be selected, and the network architectures of each decision neural network are different, such as the number of network layers and / or the number of neurons. Then, the output results of each decision neural network can be combined to obtain more accurate output results.

[0119] Specifically, the current operating environment information of the operator to be decided is obtained to obtain input data; the input data is input into the trained decision-making agent to obtain the network output of each decision neural network; and the weight parameter value of each decision neural network is obtained; based on the weight parameter value of each decision neural network, each network output is weightedly calculated to obtain multiple weighted output results; the output result with the largest weight is selected from the multiple weighted output results as the current instance quantity adjustment decision of the operator to be decided.

[0120] According to the weight parameter value corresponding to each decision neural network, the corresponding output result is weightedly calculated to obtain multiple weighted output results, and the output result with the largest weight is selected from these weighted output results as the current instance quantity adjustment decision of the operator to be decided.

[0121] In some embodiments, a change in the environmental throughput after the operator to be decided executes a decision to adjust the number of instances is obtained; if the environmental throughput increases after the operator to be decided executes the decision to adjust the number of instances, the weight parameter value corresponding to the decision neural network that outputs the decision to adjust the number of instances is increased; if the environmental throughput does not increase after the operator to be decided executes the decision to adjust the number of instances, the weight parameter value corresponding to the decision neural network that outputs the decision to adjust the number of instances is reduced.

[0122] A third-layer intelligent agent is further constructed, and the third-layer intelligent agent is used to dynamically adjust the weight parameter value corresponding to each decision neural network.

[0123] Specifically, the weight parameter values ​​of each decision neural network are initialized to obtain the weight parameter value of each decision neural network:

[0124]

[0125] Among them, q is the initialized weight parameter value, and n is the number of decision neural networks.

[0126] Then, the instance quantity adjustment decision corresponding to the operator to be decided is determined according to the above-mentioned first-layer intelligent agents and second-layer intelligent agents, and the change in the environmental throughput after the operator to be decided executes the instance quantity adjustment decision is obtained. If the environmental throughput increases after the operator to be decided executes the instance quantity adjustment decision, the weight parameter value corresponding to the decision neural network that outputs the instance quantity adjustment decision is increased; if the environmental throughput does not increase after the operator to be decided executes the instance quantity adjustment decision, the weight parameter value corresponding to the decision neural network that outputs the instance quantity adjustment decision is reduced, thereby increasing the weight of the decision neural network that predicts correctly and reducing the weight of the decision neural network that predicts incorrectly.

[0127] Through the above method, the decision-making agent can continuously learn during the processing, improve the adaptability of the model, and improve the model's anti-interference ability.

[0128] In some implementations, for operators with expanded instance numbers, data stream synchronization processing is required. Specifically, the order of data is marked at the input, and the data is sorted in the output queue according to the marked order.

[0129] The task processing method provided by the present application obtains the operator set corresponding to the currently executed task, and takes the operator whose cache parameters meet the preset conditions in the operator set as the target operator; determines the instance quantity adjustment decision adopted by the target operator, and obtains the task processing performance change after the target operator executes the instance quantity adjustment decision, and the operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed; based on the instance quantity adjustment decision adopted by the target operator, the task processing performance change and the operating environment information, the decision agent to be trained is trained to obtain a trained decision agent; using the trained decision agent, the instance quantity adjustment decision adopted by each operator in the operator set during the operation process is determined, and the number of algorithm instances in the operator set can be adaptively expanded or reduced, so as to make full use of hardware resources in dynamic changes and achieve maximum utilization, thereby improving the throughput of the currently executed task and reducing the hardware usage cost.

[0130] Figure 6 FIG. 1 is a block diagram of a task processing device shown in an exemplary embodiment of the present application. Figure 6As shown, the exemplary task processing device 600 includes: an operator determination module 610, a data acquisition module 620, an agent training module 630 and an agent application module 640. Specifically:

[0131] The operator determination module 610 is used to obtain the operator set corresponding to the currently executed task, and take the operator whose cache parameters meet the preset conditions in the operator set as the target operator;

[0132] The data acquisition module 620 is used to determine the instance quantity adjustment decision adopted by the target operator, and to obtain the task processing performance change after the target operator executes the instance quantity adjustment decision, and the operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed;

[0133] An agent training module 630 is used to adjust the decision based on the number of instances adopted by the target operator, the change in task processing performance and the operating environment information, and train the decision agent to be trained to obtain a trained decision agent;

[0134] The agent application module 640 is used to use the trained decision-making agent to determine the number of instances used in the operation of each operator in the operator set to adjust the decision.

[0135] It should be noted that the task processing device provided in the above embodiment and the task processing method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the task processing device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0136] See also Figure 7 , Figure 7 7 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 700 includes a memory 701 and a processor 702, and the processor 702 is used to execute program instructions stored in the memory 701 to implement the steps in any of the above-mentioned task processing method embodiments. In a specific implementation scenario, the electronic device 700 may include but is not limited to: a microcomputer, a server, and in addition, the electronic device 700 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0137] Specifically, the processor 702 is used to control itself and the memory 701 to implement the steps in any of the above-mentioned task processing method embodiments. The processor 702 can also be called a central processing unit (CPU). The processor 702 may be an integrated circuit chip with signal processing capabilities. The processor 702 can also 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 gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 702 can be implemented by an integrated circuit chip.

[0138] See also Figure 8 , Figure 8 The computer-readable storage medium 800 stores program instructions 810 that can be executed by a processor, and the program instructions 810 are used to implement the steps in any of the above-mentioned task processing method embodiments.

[0139] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0140] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0141] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0142] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

Claims

1. A task processing method, characterized in that: include: Obtain an operator set corresponding to the currently executed task, and use an operator in the operator set whose cache parameters meet preset conditions as a target operator; Determine the instance quantity adjustment decision adopted by the target operator, and obtain the task processing performance change after the target operator executes the instance quantity adjustment decision and the operating environment information corresponding to the target operator before the instance quantity adjustment decision is executed; Determine the target operator of the training decision agent by using the change in task processing performance, take the operating environment information corresponding to the target operator of the training decision agent as input, take the instance quantity adjustment decision corresponding to the target operator of the training decision agent as the expected output, train the training decision agent, and obtain a trained decision agent; The trained decision-making agent is used to determine the instance quantity adjustment decision adopted during the operation of each operator in the operator set.

2. The method according to claim 1, characterized in that The cache parameter includes a used cache value and a cache threshold; the operator whose cache parameter in the operator set meets a preset condition is used as a target operator, including: Obtaining the used cache value and cache threshold of each operator in the operator set; Operators whose used cache values ​​are greater than the cache threshold are taken as candidate operators to obtain a set of candidate operators; A target operator is selected from the candidate operator set.

3. The method according to claim 2, characterized in that The cache parameter also includes a cache space size; the selecting a target operator from the candidate operator set includes: Obtaining the cache space size of each candidate operator in the candidate operator set; Based on the cache space size and used cache value of each candidate operator, respectively calculate the cache usage rate of each candidate operator; The candidate operator with the highest cache usage is selected as the target operator.

4. The method according to claim 1, characterized in that: The determining of the instance quantity adjustment decision adopted by the target operator includes: Obtaining a preset decision set, wherein the decision set contains multiple candidate adjustment decisions; Each candidate adjustment decision in the decision set is used as an instance quantity adjustment decision adopted by the target operator.

5. The method according to claim 1, characterized in that The task processing performance change includes an environment throughput change; the task processing performance change is used to determine the target operator of the training decision agent, the operating environment information corresponding to the target operator of the training decision agent is used as input, the instance quantity adjustment decision corresponding to the target operator of the training decision agent is used as the expected output, and the training decision agent is trained to obtain the trained decision agent, including: If the environment throughput increases after the target operator executes the instance quantity adjustment decision, the instance quantity adjustment decision of the target operator and the operating environment information are saved as a sample data pair; If the environment throughput does not increase after the target operator executes the instance quantity adjustment decision, filtering the instance quantity adjustment decision and operating environment information of the target operator; The stored sample data pairs are used to train the decision-making agent to be trained to obtain a trained decision-making agent.

6. The method according to claim 5, characterized in that The decision agent to be trained is composed of a first layer agent and a second layer agent; the method of using the stored sample data pairs to train the decision agent to be trained to obtain a trained decision agent includes: Using the operating environment information corresponding to the target operator as the input of the first-layer agent, and using the instance quantity adjustment decision adopted by the target operator as the expected output of the first-layer agent, training the first-layer agent to obtain a trained first-layer agent; The operating environment information corresponding to the target operator and the output of the first-layer agent are used as the input of the second-layer agent, and the instance quantity adjustment decision adopted by the target operator is used as the expected output of the second-layer agent, and the second-layer agent is trained to obtain a trained second-layer agent; The trained first-layer agent and the trained second-layer agent are combined to obtain a trained decision-making agent.

7. The method according to claim 6, characterized in that The second-layer intelligent agent is composed of multiple decision neural networks, and the network architecture of each decision neural network is different; The using the trained decision agent to determine the instance quantity adjustment decision used in the operation process of each operator in the operator set includes: Obtain the current operating environment information of the operator to be decided and obtain input data; Inputting the input data into the trained decision agent to obtain the network output of each decision neural network; and obtaining the weight parameter value of each decision neural network; Based on the weight parameter value of each decision neural network, each network output is weightedly calculated to obtain multiple weighted output results; An output result with the largest weight is selected from the multiple weighted output results as the current instance quantity adjustment decision of the operator to be decided.

8. The method according to claim 7, characterized in that Also includes: Obtaining a change in the environment throughput after the operator to be decided executes the instance quantity adjustment decision; If the environment throughput increases after the operator to be decided executes the instance quantity adjustment decision, then the weight parameter value corresponding to the decision neural network that outputs the instance quantity adjustment decision is increased; If the environment throughput does not increase after the operator to be decided executes the instance quantity adjustment decision, the weight parameter value corresponding to the decision neural network that outputs the instance quantity adjustment decision is reduced.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory to implement the steps in the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and the program instructions can be executed by a processor to implement the steps in the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Dynamic resource allocation task unloading method based on deep reinforcement learning

    CN116467009A

  • Resource adjustment method and device, computing device cluster and readable storage medium

    CN117290083A

  • Multi-task resource scheduling and task unloading strategy updating method and related device

    CN117573233A

  • Distributed cloud container resource scheduling method and system

    CN117909083A

  • Computing resource configuration methods and apparatuses

    US20240054020A1