Task management methods and related devices
Patent Information
- Application Number
- CN202111293353.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-03
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2041-11-03
AI Technical Summary
[0003]然而,研究发现,现有的一些调度方法在分配任务时,未感知任务的处理状况,从而存在调度结果不合理的问题
Smart Images

Figure CN113986511B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a task management method and related apparatus. Background Technology
[0002] In scenarios involving high traffic and big data, it is necessary to ensure the stability of business operations while scheduling and allocating processing tasks to achieve rational utilization of computing resources, thereby improving task processing efficiency.
[0003] However, research has found that some existing scheduling methods are unaware of the processing status of tasks when assigning tasks, resulting in unreasonable scheduling results. Summary of the Invention
[0004] To overcome at least one deficiency in the prior art, this application provides a task management method and related apparatus, including:
[0005] In a first aspect, this application provides a task management method applied to a server, the server providing multiple task queues, the method comprising:
[0006] For the current period, obtain the idle status of each of the multiple task queues;
[0007] The weights of the multiple task queues are determined based on their respective idle status.
[0008] Based on the weights of the multiple task queues, a task allocation plan among the multiple task queues is determined by weighted round-robin.
[0009] According to the task allocation plan, the tasks to be allocated are assigned to the target queues among the multiple task queues, so as to be processed in the target queues.
[0010] Secondly, this application provides a task management device applied to a server, the server providing multiple task queues, the task management device comprising:
[0011] The status module is used to obtain the idle status of each of the multiple task queues for the current period;
[0012] The weighting module is used to determine the weight of each of the multiple task queues based on their respective idle status.
[0013] The planning module is used to determine the task allocation plan among the multiple task queues by weighted round-robin based on their respective weights.
[0014] The allocation module is used to allocate the tasks to be allocated to the target queues among the multiple task queues according to the task allocation plan, so as to serve as the tasks to be processed in the target queues.
[0015] Thirdly, this application provides a server, which includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the task management method.
[0016] Fourthly, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the task management method described above.
[0017] Compared with the prior art, this application has the following beneficial effects:
[0018] In the task management method and related apparatus provided in this application, the server obtains the idle status of each task queue in each task allocation cycle and determines the weight of each task queue based on the idle status; then, it generates a task allocation plan based on the weight of each task queue; finally, it allocates the tasks to be allocated to the target queues according to the task allocation plan. Because this method dynamically adjusts the task allocation plan based on the idle status of each task queue, it can make the cached tasks in each task queue more evenly distributed. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 The server hardware structure provided in the embodiments of this application;
[0021] Figure 2 A flowchart of a task management method provided in an embodiment of this application;
[0022] Figure 3 This application provides a minimal plan representation for its embodiments.
[0023] Figure 4 This application provides a schematic representation of the global plan for embodiments.
[0024] Figure 5 This is a schematic diagram of the structure of the task management device provided in the embodiments of this application.
[0025] Icons: 120-Memory; 130-Processor; 140-Communication Unit; 201-Status Module; 202-Weight Module; 203-Planning Module; 204-Assignment Module. Detailed Implementation
[0026] 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, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0027] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0028] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0029] To fully utilize server computing resources, task allocation needs to be balanced as much as possible. Therefore, numerous scheduling and allocation methods have been proposed. Research has found that these methods primarily allocate tasks based on the task consumption capacity of task consumers, without appropriately adjusting the scheduling and allocation methods according to the actual processing progress, thus leading to task backlog. In this embodiment, the task consumer can be a service instance running as a process or thread on the server, or a service sub-node managed by the server.
[0030] Taking the weighted round-robin algorithm as an example, in this algorithm, the user will configure a corresponding weight for each task consumer based on the task consumption capacity of each task consumer. The weight of each task consumer is positively correlated with the task consumption capacity of that task consumer. Then, after receiving the tasks to be assigned, they are assigned according to the weight of each task consumer.
[0031] For example, suppose there are three task consumers, namely consumer A, consumer B, and consumer C; and the fixed weights among these three task consumers are (5, 1, 2), that is, the sum of the weights is 8. Each time the server assigns a task, it selects the consumer with the highest weight from the list based on the updated reference weights; and after the assignment, it adjusts the reference weights of each task consumer to obtain new reference weights. The specific process is as follows:
[0032] The first task to be assigned:
[0033] The fixed weights (5, 1, 2) are used as the current reference weights. At this point, the consumer with the largest reference weight is consumer A. The task to be assigned is then assigned to consumer A, and consumer A's reference weight is subtracted from 8 to obtain the temporary weights (-3, 1, 2). Since the sum of the weights among the three needs to be maintained at 8, each temporary weight is added to its corresponding fixed weight to obtain the new reference weights (2, 2, 4).
[0034] The second person to be assigned believes:
[0035] Since consumer C has the highest reference weight, the task to be assigned is given to consumer C, and consumer C's reference weight is subtracted from 8 to obtain temporary weights (2, 2, -4) among the three. Since the sum of the weights among the three needs to be maintained at 8, each temporary weight is added to its corresponding fixed weight to obtain new reference weights (7, 3, -2).
[0036] Following this pattern, we can obtain the task allocation plan table shown in Table 1:
[0037] Table 1
[0038]
[0039]
[0040] However, while the spending power of task consumers can reflect the speed at which they process tasks to some extent, research has found that the processing speed of tasks is also related to the task data itself. Therefore, there will be certain differences in the processing time between tasks, which will lead to fluctuations in the amount of tasks backlogged. Thus, it is necessary to perceive the processing status of tasks and adjust the weight of each task consumer.
[0041] For example, suppose the task to be assigned is an image recognition task. The time consumed by image recognition is related to information such as the size and resolution of the image to be recognized. Therefore, even two image recognition tasks of the same type may require different times due to differences in image quality.
[0042] Therefore, this embodiment provides a task management method applied to a server. In this method, the server provides multiple task queues, each task queue is used to cache tasks to be processed; then, in each task allocation cycle, the server obtains the idle status of each task queue, and dynamically adjusts the task allocation plan according to the idle status of each queue. This task allocation plan enables the idler task queues to be allocated more tasks.
[0043] In this embodiment, the task to be assigned is obtained from a task processing request sent by a user terminal. This user terminal can be, but is not limited to, a mobile terminal, tablet computer, laptop computer, or a built-in device in a motor vehicle, or any combination thereof. In some embodiments, the mobile terminal can include smart home devices, wearable devices, smart mobile devices, virtual reality devices, or augmented reality devices, or any combination thereof. In some embodiments, smart home devices can include smart lighting devices, control devices for smart appliances, smart monitoring devices, smart TVs, smart cameras, or walkie-talkies, or any combination thereof. In some embodiments, wearable devices can include smart bracelets, smart shoelaces, smart glass, smart helmets, smartwatches, smart clothing, smart backpacks, smart accessories, or any combination thereof. In some embodiments, smart mobile devices can include smartphones, personal digital assistants (PDAs), gaming devices, navigation devices, or point-of-sale (POS) devices, or any combination thereof.
[0044] The server in this embodiment can be, but is not limited to, a web server, an FTP (File Transfer Protocol) server, a data processing server, etc. Furthermore, the server can be a single server or a group of servers. The server group can be centralized or distributed (e.g., the servers can be a distributed system). In some embodiments, the server can be local or remote relative to the user terminal. In some embodiments, the server can be implemented on a cloud platform; by way of example only, the cloud platform can include private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, inter-cloud, multi-cloud, etc., or any combination thereof. In some embodiments, the server can be implemented on an electronic device having one or more components.
[0045] This embodiment also provides a structural diagram of the server, such as... Figure 1As shown, the server includes a memory 120, a processor 130, and a communication unit 140.
[0046] The memory 120, processor 130, and communication unit 140 are electrically connected to each other directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0047] The memory 120 may be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory 120 stores programs, which the processor 130 executes upon receiving an execution instruction.
[0048] The communication unit 140 is used to send and receive data via a network. The network may include a wired network, a wireless network, a fiber optic network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network, or a near field communication (NFC) network, or any combination thereof. In some embodiments, the network may include one or more network access points. For example, the network may include wired or wireless network access points, such as base stations and / or network switching nodes, through which one or more components of the service request processing system can connect to the network to exchange data and / or information.
[0049] The processor 130 may be an integrated circuit chip with signal processing capabilities, and the processor may include one or more processing cores (e.g., a single-core processor or a multi-core processor). By way of example only, the processor described above may include a Central Processing Unit (CPU), an Application-Specific Integrated Circuit (ASIC), an Application-Specific Instruction-set Processor (ASIP), a Graphics Processing Unit (GPU), a Physics Processing Unit (PPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), a Programmable Logic Device (PLD), a controller, a microcontroller unit, a Reduced Instruction Set Computing (RISC) computer, or a microprocessor, or any combination thereof.
[0050] Based on the above introduction, the following will combine... Figure 2 This embodiment provides a detailed description of the task management method. It should be understood that the operations in the flowchart may not be implemented in sequence, and steps without logical contextual relationships may be reversed in order or implemented simultaneously. Furthermore, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowchart, or remove one or more operations from the flowchart. For example... Figure 2 As shown, the method includes:
[0051] S101: For the current period, obtain the idle status of each of the multiple task queues.
[0052] Because the task backlog in each task queue changes dynamically, this implementation periodically retrieves the idle status of each task queue and adjusts the weight of each task queue in each cycle. For example, the server can wait one minute after each task assignment to retrieve the idle status of each task queue.
[0053] Of course, the above-described method of dividing the task cycle is merely an example provided in this embodiment, and those skilled in the art can make appropriate adjustments as needed.
[0054] For example, the server can provide a registration and subscription service to record the status of each task queue in the current server, including task idle status and the number of remaining tasks to be processed. If the task consumer in this embodiment is a service instance, the registration and subscription service is also used to record the function of each service instance and the correspondence between each service instance and the task queue.
[0055] Therefore, the server can obtain the idle status of each task queue through this registration and subscription service.
[0056] S102, determine the weight of each task queue based on its idle status.
[0057] The weight of each task queue is positively correlated with its idle status. In an optional implementation, if multiple task queues have the same queue length, the server can directly use the idle capacity of each task queue as its idle status.
[0058] In alternative implementations, if the queue lengths of multiple task queues are not the same, the server can obtain the remaining number of tasks to be processed in each task queue, and then calculate the inverse ratio of the remaining number of tasks for each task queue as the weight of the task queue.
[0059] For example, assuming there are 3 task queues, the server divides the remaining number of tasks in each queue by their greatest common divisor, and the resulting ratio can be expressed as (2:10:5); then, the reciprocal of each queue is used as the weight. Therefore, the weight ratio of these 5 task queues is (1 / 2:1 / 10:1 / 5). Since the weights in this embodiment need to be integers, the converted weight ratio is (5:1:2).
[0060] Of course, the server can also sum the (2:10:5) ratios, and then divide the sum 17 by each ratio, taking the integer part of the ratio as the weight. Therefore, the weight ratio of these three task queues is (6:1:3).
[0061] S103, based on the weights of each of the multiple task queues, determines the task allocation plan among the multiple task queues through a weighted round-robin method.
[0062] S104. According to the task allocation plan, the tasks to be allocated are assigned to the target queues in multiple task queues, so as to be processed in the target task queues.
[0063] As described above regarding the weighted round-robin method, this algorithm can obtain a more even task allocation plan based on the weights of each task queue; thus, when the server receives a task to be allocated, it allocates it according to the task allocation plan.
[0064] Therefore, through the above implementation method, the server obtains the idle status of each task queue in each task allocation cycle and determines the weight of each task queue based on the idle status; then, it generates a task allocation plan based on the weight of each task queue; finally, it allocates the tasks to be allocated to the target queues according to the task allocation plan. Because this method dynamically adjusts the task allocation plan based on the idle status of each task queue, it can make the cached tasks in each task queue more evenly distributed.
[0065] Research has found that before allocating tasks according to the task allocation plan, it is necessary to query the task plan to determine the current target queue. However, when the number of tasks to be allocated reaches a certain scale, it will seriously affect the allocation efficiency.
[0066] Therefore, the server obtains the planned number of tasks to be assigned in the current week; generates a minimum task table that matches the weights of the multiple task queues through weighted round-robin; then, based on the minimum task table, generates a global task table for the planned number of tasks to be assigned, wherein the global task table records the allocation order when the planned number of tasks to be assigned are distributed to the multiple task queues.
[0067] Finally, the global task table is used as a task allocation plan among multiple task queues.
[0068] For example, continuing with the three task queues mentioned above, namely queue A, queue B, and queue C, and with a weight ratio of (5:1:2), then based on weighted round-robin, the task queues can be determined as follows: Figure 3 The minimum task table shown represents the task allocation order, where the order of queue identifiers in the minimum task table indicates the task allocation order.
[0069] If the planned number of tasks to be assigned this week is 80, the server can generate 10 minimum task tables. Finally, by concatenating these 10 minimum task tables together, the following can be obtained: Figure 4 The global task table shown.
[0070] When the server allocates tasks based on the global task table, it determines the target queue according to the allocation order in the global task table. After allocation is complete, the identifier of the target queue is removed from the global task table. Therefore, through this global task table, the server can quickly determine the target queue of tasks to be allocated and allocate them.
[0071] The study also found that tasks awaiting assignment often carry task data, and some tasks carry a lot of data. Therefore, if the task data of tasks awaiting assignment is directly assigned to the task queue, it will not only take a lot of time to transfer the task data, but also place high demands on the storage capacity of the task queue.
[0072] For example, with the rapid development of artificial intelligence, the optimization and iteration of models and algorithms such as deep learning and neural networks have made these models and algorithms increasingly powerful. This has led to a large number of business scenarios adopting artificial intelligence technology, while some business scenarios utilize artificial intelligence services provided by cloud computing platforms. In this scenario, the user terminal sends task data to the cloud computing platform's server, and the cloud computing platform's server feeds back the calculation results to the user terminal.
[0073] Furthermore, a business sometimes requires the cooperation of multiple neural network-based service instances, and cloud computing platform servers will process a large number of businesses at the same time. This means that tasks need to be scheduled and allocated. However, directly using the business data to be processed as the object of scheduling and allocation will seriously reduce the efficiency of data flow.
[0074] Therefore, the server receives a task processing request sent by the user terminal, which includes task data of the task to be assigned; then, it caches the task data of the task to be assigned and obtains the cache location.
[0075] Furthermore, the server generates task information for tasks to be assigned, including cache locations; this task information is then used as the allocation object when assigning tasks.
[0076] In this embodiment, the business data of the business to be assigned is cached in a specific location, and task information recording the cache location is generated. The task information is used as the assignment object, so that the data stored in the task queue is the task information, and the amount of task information is much smaller than the amount of task data. Therefore, the task assignment efficiency is improved.
[0077] In addition, the task information also includes preprocessing information of the tasks to be processed. Therefore, in an optional implementation, before generating the task information of the tasks to be assigned, the server first preprocesses the task data of the tasks to be assigned to obtain the preprocessing information of the tasks to be processed.
[0078] Then, the server generates task information, including the cache address of the task to be assigned and preprocessing information.
[0079] For example, when the task data is an image, the preprocessing operation can be to compress, scale, or convert the image format. In this case, the obtained preprocessing information may include information such as the image format and resolution.
[0080] When the task data is text, the preprocessing operation can be to segment and trim the text. In this case, the preprocessing information obtained can include the number of text segments after trimming and the size of each text segment.
[0081] When the task data is video, preprocessing operations can include adjusting the video bitrate and resolution, or taking screenshots of the video. In this case, the preprocessing information obtained can include the video resolution, format, and the number of video screenshots.
[0082] When the task data is audio, the processing operations can include converting the audio to an archive format or a data format. In this case, the preprocessed information obtained can include information such as the audio format.
[0083] Based on the above task information, for each task queue, the server retrieves the task information of a target task from the task queue; obtains the task data of the target task based on the task information of the target task; and then feeds back the processing result of the task data of the target task to the user terminal that initiated the target task.
[0084] In an optional implementation, the server provides service instances for multiple task queues. The server inputs the task data of the target task into the service instance corresponding to the task queue, obtains the processing result, and feeds back the processing result to the user terminal that initiated the target task.
[0085] For example, assuming the target task is an image recognition task, and the service instance of the target task is an image recognition model, the server obtains the cache address of the image to be recognized based on the task information of the target task, and then retrieves the image to be recognized through the cache address; then, the image to be recognized is input into the image recognition model to obtain the recognition result output by the image recognition model.
[0086] In addition, the task information of the target task also includes the constraints of the target task. The server inputs the task data of the target task into the service instance corresponding to the task queue to obtain the results to be analyzed; the results to be analyzed are compared with the constraints to obtain the processing results.
[0087] For example, this constraint could be a recognition threshold of an image recognition model. If the image recognition model is used for face detection, the user terminal can set a recognition threshold for face confidence as needed, and the server can determine objects with a face confidence score greater than the recognition threshold as faces based on the face confidence score output by the face recognition model.
[0088] In this embodiment, the service instances of the multiple task queues are server instances of the same type, and the task information also carries the task type. Therefore, before the server assigns the task to be assigned to the target queue among the multiple task queues, it needs to determine whether the task type of the task to be assigned matches the type of the service instance of the multiple task queues. If they match, the task to be assigned is assigned to the target queue among the multiple task queues.
[0089] For example, the server provides multiple functions: face recognition, object detection, and anomaly detection. The face recognition function corresponds to multiple instances of face recognition models; the object detection function corresponds to multiple instances of object detection models; and the anomaly detection function also corresponds to multiple instances of anomaly detection. Furthermore, each instance corresponds to a task queue; that is, if the face recognition function corresponds to three instances of face recognition models, the server provides three corresponding task queues for these three instances.
[0090] Therefore, the server can assign task information to service instances that match the task type based on the task information.
[0091] It is worth noting that the server can adjust the number of each type of service instance appropriately based on the backlog of the task queue. Taking the multiple task queues in this embodiment as an example, if the number of remaining tasks in all task queues shows an increasing trend after a preset number of task allocation cycles, a preset number of service instances will be added to alleviate the pressure on the current task queues.
[0092] The study also found that during the process of receiving and assigning tasks, the tasks in the task queue are also being consumed. If the number of planned tasks to be assigned is too large, it means that more time needs to be spent on task assignment. If the number of planned tasks to be assigned is too small, it means that the weights of each task queue need to be adjusted frequently.
[0093] Therefore, in order to more reasonably determine the planned number of tasks to be assigned, in this embodiment, the server obtains the remaining number of tasks to be processed in each of the multiple task queues, and then determines the planned number of tasks to be assigned in the current week based on the remaining number of tasks in each of the multiple task queues.
[0094] For example, assuming the remaining quantities in each task queue are (6:30:15) and the greatest common divisor among the remaining quantities in each task queue is 3, then the planned number of tasks to be assigned is (6+30+15) / 3 = 17.
[0095] Of course, this embodiment also provides a reference range for the planned quantity. When the ratio of the sum of the planned quantity and the remaining quantity to the common divisor of the remaining quantity is not within the reference range, the reference value is used as the planned quantity of the task to be assigned.
[0096] For example, assuming the reference range is [30, 100], when the calculated planned quantity is less than 30, 30 is used as the planned quantity; when the calculated planned quantity is greater than 100, 100 is used as the planned quantity, so that the planned quantity is within a reasonable range.
[0097] The study also found that the time required for task allocation in the initial cycle is related not only to the number of planned tasks but also to the number of tasks received for allocation. That is, if no tasks are received for an extended period, it will also take a long time to allocate the planned number of tasks. During the waiting period, the idle status of the task queues changes significantly. Therefore, in this embodiment, if the planned number of tasks has not been received after a preset time, the server will re-obtain the remaining number of tasks in each of the multiple task queues and recalculate the planned number of tasks to be allocated.
[0098] The study also found that when there are many backlogged tasks in the task queue, continuing to assign tasks to that queue will result in a long waiting time before the tasks can be processed. Therefore, in this embodiment, candidate queues are first screened to identify multiple task queues.
[0099] In an alternative implementation, the server obtains the remaining number of tasks to be processed in each candidate queue, and then determines the candidate queues with a remaining number less than a threshold as task queues.
[0100] In other optional implementations, the server obtains the sum of the remaining number of tasks to be processed in each candidate queue, and then obtains the ratio between the remaining number of tasks to be processed in each candidate queue and the sum of the remaining numbers, and determines the candidate queues with a ratio less than a ratio threshold as task queues.
[0101] Based on the same inventive concept as the task management method in this embodiment, this embodiment also provides an apparatus related to the task management method, including:
[0102] This embodiment also provides a task management device applied to a server, wherein the server provides multiple task queues. It should be understood that the task management device includes at least one functional module that can be stored in memory in software form. For example... Figure 5 As shown, functionally, the task management device may include:
[0103] Status module 201 is used to obtain the idle status of multiple task queues for the current period.
[0104] In this embodiment, the state module 201 is used to implement Figure 2 For a detailed description of the state module 201 in step S101, please refer to the detailed description of step S101.
[0105] The weight module 202 is used to determine the weight of each of the multiple task queues based on their respective idle status.
[0106] In this embodiment, the weighting module 202 is used to implement Figure 2 For a detailed description of the weight module 202, see step S102.
[0107] The planning module 203 is used to determine the task allocation plan among multiple task queues by weighted round-robin based on the weights of each task queue.
[0108] In this embodiment, the planning module 203 is used to implement... Figure 2 For a detailed description of step S103 of the program module 203, please refer to the detailed description of step S103.
[0109] The allocation module 204 is used to allocate the tasks to be allocated to the target queues in multiple task queues according to the task allocation plan, so as to serve as the tasks to be processed in the target queues.
[0110] In this embodiment, the allocation module 204 is used to implement Figure 2 For a detailed description of step S104, which is the allocation module 204, please refer to the detailed description of step S104.
[0111] This embodiment also provides a server, which includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the task management method provided in this embodiment.
[0112] This embodiment also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the task management method provided in this embodiment.
[0113] It should be noted that in the description of this application, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance. 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. Without further limitations, 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 said element.
[0114] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0115] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0116] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0117] The above descriptions are merely various embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A task management method, characterized in that, Applied to a server that provides multiple task queues, the method includes: For the current period, obtain the idle status of each of the multiple task queues; Based on the idle status of each of the multiple task queues, the weight of each of the multiple task queues is determined, wherein the weight of each task queue is positively correlated with the idle status of that task queue; Obtain the remaining number of tasks to be processed in each of the multiple task queues, and then determine the planned number of tasks to be assigned in the current week based on the ratio of the sum of the remaining numbers of the multiple task queues to the common divisor of the remaining numbers. A minimum task table matching the weights of the multiple task queues is generated by weighted round-robin. The minimum task tables are concatenated together to generate a global task table for the planned number of tasks to be assigned. The global task table records the allocation order when the planned number of tasks to be assigned are allocated to the multiple task queues. The global task table is used as a task allocation plan among the multiple task queues; According to the task allocation plan, the tasks to be allocated are assigned to the target queues among the multiple task queues, so as to be processed in the target queues.
2. The task management method according to claim 1, characterized in that, Before assigning the tasks to be assigned to the target queues among the plurality of task queues according to the task allocation plan, the method further includes: Receive a task processing request sent by a user terminal, wherein the task processing request includes task data of the task to be assigned; Cache the task data of the tasks to be assigned and obtain the cache location; Generate task information for the task to be assigned, wherein the task information for the task to be assigned includes the cache location; The task information of the task to be assigned is used as the allocation object when assigning the task.
3. The task management method according to claim 2, characterized in that, The method further includes: For each of the task queues, retrieve the task information of a target task from the task queue; Based on the task information of the target task, obtain the task data of the target task; The processing results of the target task's data are fed back to the user terminal that initiated the target task.
4. The task management method according to claim 3, characterized in that, The task information also includes preprocessing information of the task to be processed. Before generating the task information of the task to be assigned, the method further includes: The task data of the task to be assigned is preprocessed to obtain the preprocessing information of the task to be processed.
5. The task management method according to claim 3, characterized in that, The server provides service instances for each of the multiple task queues, and feeds back the processing results of the target task's task data to the user terminal that initiated the target task, including: The task data of the target task is input into the service instance corresponding to the task queue to obtain the processing result; The processing result is then fed back to the user terminal that initiated the target task.
6. The task management method according to claim 5, characterized in that, The task information of the target task also includes the constraints of the target task. The task data of the target task is input into the service instance corresponding to the task queue to obtain the processing result, including: Input the task data of the target task into the service instance corresponding to the task queue to obtain the analysis results; The result to be analyzed is compared with the constraints to obtain the processing result.
7. A task management device, characterized in that, Applied to a server, the server provides multiple task queues, and the task management device includes: The status module is used to obtain the idle status of each of the multiple task queues for the current period; The weighting module is used to determine the weight of each of the multiple task queues based on their respective idle status, wherein the weight of each task queue is positively correlated with the idle status of that task queue. The planning module is used to obtain the remaining number of tasks to be processed in each of the multiple task queues, and then determine the planned number of tasks to be allocated in the current week by the ratio of the sum of the remaining tasks in each of the multiple task queues to the common divisor of the remaining tasks. A minimum task table matching the weights of each of the multiple task queues is generated through weighted round-robin polling. The minimum task tables are concatenated together to generate a global task table for the planned number of tasks to be allocated, wherein the global task table records the allocation order when the planned number of tasks to be allocated to the multiple task queues; the global task table serves as the task allocation plan among the multiple task queues. The allocation module is used to allocate the tasks to be allocated to the target queues among the multiple task queues according to the task allocation plan, so as to serve as the tasks to be processed in the target queues.
8. A server, characterized in that, The server includes a processor and a memory, the memory storing a computer program, which, when executed by the processor, implements the task management method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the task management method according to any one of claims 1-6.
Citation Information
Patent Citations
Task scheduling method and device based on DSP
CN111324427A
Message processing method, device and equipment
CN111404838A
Task scheduling method and device
CN113157424A
Task list allocation method and device, electronic equipment, medium and program product
CN113449994A