Multi-task processing method and device, electronic equipment and storage medium
By generating task encoding sequences and using genetic algorithms for iterative arrangement, the problem of unreasonable task scheduling was solved, achieving uniform distribution of tasks within the time interval and efficient utilization of server resources.
Patent Information
- Application Number
- CN202411144445.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-11-15
AI Technical Summary
Existing technologies cannot perform reasonable task scheduling and orchestration, resulting in low system utilization.
By obtaining the initial time information of the task set, an encoded sequence is generated, and a genetic algorithm is used for iterative arrangement to generate the target task arrangement set. The target server is then scheduled according to the task attributes.
This ensures that tasks are distributed more evenly over time, avoiding concentrated outbreaks of problems and improving server resource utilization and task execution efficiency.
Smart Images

Figure CN118963964A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of task scheduling, and in particular to a multi-task processing method, device, electronic device and storage medium. Background Art
[0002] In computer systems, task scheduling refers to assigning various tasks to computing resources according to certain strategies and algorithms to achieve the goal of optimal resource utilization and improve system throughput. Task orchestration refers to arranging and organizing tasks in a certain order according to the dependencies and constraints between tasks to ensure that tasks can be executed in the expected order and conditions.
[0003] In actual computer systems, there are usually multiple tasks that need to be executed simultaneously, and system resources are limited. Therefore, the goal of task scheduling is to allocate resources reasonably to maximize system utilization and throughput. Summary of the invention
[0004] The present invention provides a multi-task processing method, device, electronic device and storage medium, which are used to solve the problem of low system utilization caused by the inability to perform reasonable task scheduling and task arrangement.
[0005] To this end, an object of the present disclosure is to provide a multi-task processing method.
[0006] A second objective of the present disclosure is to provide a multi-tasking processing device.
[0007] A third objective of the present disclosure is to provide an electronic device.
[0008] A fourth object of the present disclosure is to provide a non-transitory computer-readable storage medium.
[0009] A fifth object of the present disclosure is to provide a computer program product.
[0010] To achieve the above-mentioned purpose, the first aspect of the present disclosure proposes a multi-task processing method, including: obtaining a batch task set and determining the initial time information of each task in the task set, wherein the initial time information includes an initial start time and a duration; for each task in the task set, encoding the task according to the initial time information of the task to obtain an initial coding sequence of the task; according to the initial coding sequence of the task, obtaining an initial task scheduling set of the task set; using the initial task scheduling set as the initial population, scheduling the task set iteratively based on a genetic algorithm until an iteration end condition is met, and obtaining a target task scheduling set of the task set, wherein the target task scheduling set includes the target time information of each task in the task set; scheduling a target server for the task set, and sending the task set and the target task scheduling set to the target server.
[0011] According to one embodiment of the present disclosure, encoding the task according to the initial time information of the task to obtain the initial coding sequence of the task includes: determining the initial start time and duration of the task according to the initial time information; determining the time units occupied by the task within the task processing cycle according to the initial start time and duration; encoding the time units occupied by the task and the time units not occupied by the task to obtain the initial coding sequence of the task.
[0012] According to one embodiment of the present disclosure, determining the time units occupied by the task within the task processing cycle based on the initial start time and duration includes: starting from the initial start time, determining the time units occupied by the task according to the duration of the task; determining a first coding position corresponding to the time units occupied by the task and a second coding position corresponding to the remaining time units; encoding the first coding position and the remaining second coding positions to obtain an initial coding sequence for the task.
[0013] According to one embodiment of the present disclosure, starting from the initial start time, determining the time units occupied by the task according to the duration of the task includes: in response to the execution process of the task occupying adjacent task processing cycles, starting from the initial start time, determining the time units occupied by the tasks in adjacent task processing cycles according to the duration; determining the time units occupied by the tasks in adjacent task processing cycles as the time units occupied by the task.
[0014] According to one embodiment of the present disclosure, the orchestration iteration of the task set based on a genetic algorithm also includes: obtaining dependencies between tasks in the task set and task types of the tasks; generating orchestration constraints based on the task types and the dependencies; and performing genetic operations on the population of the previous orchestration iteration based on the orchestration constraints to obtain the population of the current orchestration iteration.
[0015] According to one embodiment of the present disclosure, the method further includes: obtaining a candidate task orchestration set of the task set obtained in the i-th orchestration iteration, where i is a natural number greater than or equal to 1; determining the fitness of the candidate task orchestration set; in response to the fitness of the candidate task orchestration set satisfying an iteration end condition, ending the orchestration iteration; in response to the fitness of the candidate task orchestration set not satisfying the iteration end condition and the cumulative number of iterations has not reached a set number, continuing the i+1-th orchestration iteration.
[0016] According to an embodiment of the present disclosure, the method further includes: in response to the fitness of the candidate task scheduling set not satisfying an iteration termination condition, but the accumulated number of iterations reaches a set number, terminating the scheduling iteration.
[0017] According to one embodiment of the present disclosure, determining the fitness of the candidate task arrangement set includes: determining a candidate coding sequence for each task in the task set based on the candidate task arrangement set; performing an accumulation operation at the same coding position on the candidate coding sequence of each task in the task set to obtain an accumulated coding sequence; and obtaining the variance of the accumulated coding sequence as the fitness of the candidate task arrangement set.
[0018] According to one embodiment of the present disclosure, the accumulation operation at the same coding position is performed on the candidate coding sequence of each task in the task set to obtain the accumulated coding sequence, including: determining the coding value at coding position j according to the candidate coding sequence of the task, wherein j is a natural number greater than or equal to 1; accumulating the coding value at the coding position j of each task in the task set to obtain the accumulated coding value at the coding position j; and obtaining the accumulated coding sequence according to the accumulated coding value at each coding position.
[0019] According to one embodiment of the present disclosure, the method further includes: obtaining the score of the candidate task orchestration set obtained in each orchestration iteration; selecting the candidate task orchestration set whose fitness is greater than or equal to a set fitness threshold from the candidate task orchestration set obtained in each orchestration iteration; and selecting the candidate task orchestration set with the highest score as the target task orchestration set from the candidate task orchestration set whose fitness is greater than or equal to the set fitness threshold.
[0020] According to one embodiment of the present disclosure, scheduling the target server for the task set includes: obtaining task execution data of a historical task set; determining the amount of resources occupied by the historical task set when executing based on the task execution data; and scheduling the target server for the task set from a server cluster based on the amount of resources occupied by the historical task set when executing.
[0021] According to one embodiment of the present disclosure, scheduling the target server for the task set includes: obtaining the data volume of each task in the task set, and determining the total data volume of the task set based on the data volume of the task; predicting the required resources of the task set based on the total data volume of the task set; and scheduling the target server for the task set from a server cluster based on the required resources of the task set.
[0022] According to one embodiment of the present disclosure, the method also includes: obtaining task attributes of the task set, and determining whether the task set is associated with a dedicated server based on the task attributes; in response to the task set not being associated with a dedicated server, scheduling the target server for the task set from a server cluster; in response to the task set being associated with a dedicated server, determining that the dedicated server associated with the task set is the target server.
[0023] To achieve the above-mentioned purpose, the second aspect of the present disclosure proposes a multi-task processing device, including: a determination module, used to obtain a batch task set and determine the initial time information of each task in the task set, wherein the initial time information includes an initial start time and a duration; an encoding module, used to encode each task in the task set according to the initial time information of the task, and obtain an initial encoding sequence of the task; an acquisition module, used to obtain an initial task scheduling set of the task set according to the initial encoding sequence of the task; an iteration module, used to use the initial task scheduling set as the initial population, and iterate the task set based on a genetic algorithm until an iteration end condition is met, so as to obtain a target task scheduling set of the task set, wherein the target task scheduling set includes the target time information of each task in the task set; a scheduling module, used to schedule a target server for the task set, and send the task set and the target task scheduling set to the target server.
[0024] According to one embodiment of the present disclosure, the encoding module is also used to: determine the initial start time and duration of the task based on the initial time information; determine the time units occupied by the task within the task processing cycle based on the initial start time and duration; encode the time units occupied by the task and the time units not occupied by the task to obtain the initial encoding sequence of the task.
[0025] According to one embodiment of the present disclosure, it is characterized in that the encoding module is also used to: starting from the initial start time, determine the time unit occupied by the task according to the duration of the task; determine the first encoding position corresponding to the time unit occupied by the task and the second encoding position corresponding to the remaining time unit; encode the first encoding position and the remaining second encoding position to obtain the initial encoding sequence of the task.
[0026] According to one embodiment of the present disclosure, the encoding module is also used to: in response to the execution process of the task occupying adjacent task processing cycles, starting from the initial start time, determine the time units occupied by the tasks in the adjacent task processing cycles according to the duration; determine the time units occupied by the tasks in the adjacent task processing cycles as the time units occupied by the tasks.
[0027] According to one embodiment of the present disclosure, the iterative module is also used to: obtain the dependencies between tasks in the task set and the task types of the tasks; generate orchestration constraints based on the task types and the dependencies; and perform genetic operations on the population of the previous orchestration iteration based on the orchestration constraints to obtain the population of the current orchestration iteration.
[0028] According to one embodiment of the present disclosure, the iteration module is further used to: obtain a candidate task orchestration set of the task set obtained in the i-th orchestration iteration, where i is a natural number greater than or equal to 1; determine the fitness of the candidate task orchestration set; in response to the fitness of the candidate task orchestration set satisfying an iteration end condition, end the orchestration iteration; in response to the fitness of the candidate task orchestration set not satisfying the iteration end condition and the cumulative number of iterations has not reached a set number, continue the i+1-th orchestration iteration.
[0029] According to an embodiment of the present disclosure, the iteration module is further configured to: in response to the fitness of the candidate task orchestration set not satisfying an iteration termination condition, but the accumulated number of iterations reaches a set number, terminate the orchestration iteration.
[0030] According to one embodiment of the present disclosure, the iteration module is also used to: determine the candidate coding sequence of each task in the task set according to the candidate task arrangement set; perform an accumulation operation at the same coding position on the candidate coding sequence of each task in the task set to obtain an accumulated coding sequence; and obtain the variance of the accumulated coding sequence as the fitness of the candidate task arrangement set.
[0031] According to one embodiment of the present disclosure, the iteration module is also used to: determine the coding value at the coding position j according to the candidate coding sequence of the task, wherein j is a natural number greater than or equal to 1; accumulate the coding value of each task in the task set at the coding position j to obtain the accumulated coding value at the coding position j; and obtain the accumulated coding sequence according to the accumulated coding value at each coding position.
[0032] According to one embodiment of the present disclosure, the iteration module is further used to: obtain the score of the candidate task orchestration set obtained in each orchestration iteration; select the candidate task orchestration set whose fitness is greater than or equal to the set fitness threshold from the candidate task orchestration set obtained in each orchestration iteration; select the candidate task orchestration set with the highest score from the candidate task orchestration set whose fitness is greater than or equal to the set fitness threshold as the target task orchestration set.
[0033] According to one embodiment of the present disclosure, the scheduling module is also used to: obtain task execution data of a historical task set; determine the amount of resources occupied by the historical task set when it is executed based on the task execution data; and schedule the target server for the task set from a server cluster based on the amount of resources occupied by the historical task set when it is executed.
[0034] According to one embodiment of the present disclosure, the scheduling module is also used to: obtain the data volume of each task in the task set, and determine the total data volume of the task set based on the data volume of the task; predict the required resources of the task set based on the total data volume of the task set; and schedule the target server for the task set from the server cluster based on the required resources of the task set.
[0035] According to one embodiment of the present disclosure, the scheduling module is also used to: obtain the task attributes of the task set, and determine whether the task set is associated with a dedicated server based on the task attributes; in response to the task set not being associated with a dedicated server, schedule the target server for the task set from a server cluster; in response to the task set being associated with a dedicated server, determine that the dedicated server associated with the task set is the target server. To achieve the above purpose, the third aspect of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to implement the multi-task processing method as described in the first aspect of the present disclosure.
[0036] To achieve the above-mentioned purpose, the fourth aspect of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to implement the multi-tasking processing method as described in the first aspect of the present disclosure.
[0037] To achieve the above-mentioned purpose, the fifth aspect of the present disclosure proposes a computer program product, including a computer program, which, when executed by a processor, is used to implement the multi-tasking processing method as described in the first aspect of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0039] Figure 1 An example flowchart of a multi-task processing method provided by an embodiment of the present disclosure;
[0040] Figure 2 A flowchart of another multi-task processing method provided by an embodiment of the present disclosure;
[0041] Figure 3 An example diagram of a process of arranging and iterating a task set in a multi-task processing method provided by an embodiment of the present disclosure;
[0042] Figure 4 An example diagram of the process of arranging and iterating a task set provided in an embodiment of the present disclosure;
[0043] Figure 5 An example diagram of a process for determining the fitness of a candidate task scheduling set in a multi-task processing method provided in an embodiment of the present disclosure;
[0044] Figure 6A flowchart of another multi-task processing method provided by an embodiment of the present disclosure;
[0045] Figure 7 An example diagram of a multi-tasking process provided by an embodiment of the present disclosure;
[0046] Figure 8 A structural example diagram of a multi-task processing device provided by an embodiment of the present disclosure;
[0047] Fig. 9 This is a diagram showing an example structure of an electronic device provided in an embodiment of the present disclosure.
[0048] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0049] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0051] It should be noted that the acquisition, storage, use, and processing of data in the technical solution disclosed in this disclosure are in compliance with the provisions of relevant laws and regulations.
[0052] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards.
[0053] It should be noted that in the embodiments of the present disclosure, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present disclosure, but it does not mean that the applicant has or will necessarily use the relevant content of the solution.
[0054] Figure 1 The following is an example flow chart of a multi-task processing method provided by an embodiment of the present disclosure. Figure 1 As shown, the multi-task processing method includes:
[0055] S101, obtaining a batch task set and determining initial time information of each task in the task set, where the initial time information includes an initial start time and duration.
[0056] It should be noted that the execution subject of the multi-task processing method provided in the embodiment of the present disclosure is an electronic device, and the electronic device may be a terminal device. Optionally, the terminal device may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device may be a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc. The embodiment of the present disclosure does not make specific limitations.
[0057] It can be understood that batch processing refers to batch processing of a certain object, which implements a specific operation by automatically executing a series of commands or programs in batches. In other words, batch processing can perform non-interactive batch execution of multiple tasks. These tasks may be data conversion, data processing, file operations, system maintenance, etc.
[0058] In some implementations, the tasks to be processed may be traversed to determine a task set to be batch processed from the tasks to be processed, and the initial time information of each task may be determined based on the attribute information of each task in the task set. Optionally, the attribute information of the task may include: initial start time, duration, resource size of the task, associated server, etc. Optionally, the initial start time and duration of the task may be used as the initial time information of the task.
[0059] S102, for each task in the task set, encode the task according to the initial time information of the task to obtain an initial encoding sequence of the task.
[0060] In some implementations, the task processing cycle can be set, and the proportion of each task in a task processing cycle can be determined. Then, the tasks can be encoded according to the proportion of the tasks in a task processing cycle, and the initial encoding sequence of the tasks can be obtained.
[0061] Optionally, the initial start time and duration of the task may be determined according to the initial time information of the task, so as to determine the proportion information of the task in a task processing cycle according to the initial start time and duration.
[0062] For example, assume that the task processing cycle is 24 hours, and determine that the minimum unit in the task processing cycle is 10 minutes, that is, there are 144 units in the task processing cycle. If the initial start time of task A is 0:10 and the duration is 30 minutes, then the proportion of task A in a task processing cycle is that task A occupies 3 units.
[0063] Furthermore, the position information of the task occupying the task processing cycle can be determined based on the proportion information of the task in a task processing cycle, and the task can be encoded based on the position information to obtain the initial coding sequence of the task. For example, the unit occupied by the task can be encoded as 1, and the unoccupied unit can be encoded as 0, thereby obtaining an initial coding sequence composed of 0 and 1.
[0064] S103, obtaining an initial task arrangement set of the task set according to the initial coding sequence of the task.
[0065] Optionally, by acquiring the initial coding sequence of each task in the task set, and based on the initial coding sequence of each task, an initial task arrangement set of the task set can be constructed.
[0066] S104, taking the initial task scheduling set as the first generation population, scheduling the task set iteratively based on the genetic algorithm until the iteration end condition is met, and obtaining the target task scheduling set of the task set, wherein the target task scheduling set includes the target time information of each task in the task set.
[0067] In some implementations, the initial task orchestration set can be iterated according to a genetic algorithm-based orchestration model. The initial task orchestration set is used as a first-generation population and the initial population is input into the genetic algorithm-based orchestration model. The orchestration model iterates the first-generation population until the iteration end condition is met, thereby obtaining a target task orchestration set of the task set.
[0068] Optionally, for each orchestration iteration, the orchestration model may obtain a new population for the iteration based on genetic operations, such as selection, mutation, crossover, and the like, that is, a set of candidate task orchestrations obtained for the iteration.
[0069] It is understandable that in the orchestration iteration process, each orchestration iteration will obtain a candidate task orchestration set, and the fitness of each candidate task orchestration set can be calculated and the candidate task orchestration set with the largest fitness can be selected as the target task orchestration set.
[0070] Optionally, the iteration end condition can be determined based on the fitness of the candidate task arrangement set, for example, the fitness being greater than a fitness threshold can be used as the iteration end condition. Optionally, the iteration end condition can also be determined based on the number of iterations, for example, the number of iterations reaching a number threshold can be used as the iteration end condition.
[0071] S105, scheduling a target server for the task set, and sending the task set and the target task scheduling set to the target server.
[0072] In some implementations, it can be determined whether there is a dedicated server for the task set. If there is a dedicated server for the task set, the dedicated server is used as the target server for the task set, and the task set and the target task orchestration set are sent to the target server so that the task set is executed on the target server according to the target task orchestration set.
[0073] Alternatively, if there is no dedicated server for the task set, the computing resources required for the task set can be determined, and the target server can be determined from the server cluster based on the computing resources. Alternatively, the computing resources required for the task set can be estimated based on the historical execution data of the task set by obtaining the historical execution data.
[0074] In some implementations, after a task set is executed on a target server, the duration of the task set execution, the central processing unit (CPU), and memory usage may be recorded so that resource evaluation and scheduling of the corresponding server can be performed at the next execution based on the recorded data.
[0075] In the multi-task processing method provided by the embodiment of the present disclosure, a batch task set is obtained, and the task is encoded according to the initial time information of each task in the task set to obtain the initial coding sequence of the task, so as to obtain the initial task scheduling set of the task set. Further, based on the initial task scheduling set, the task set is scheduled based on a genetic algorithm until the iteration ends, and the target task scheduling set of the task set is obtained, and then the task set is scheduled, and the task is executed on the target server based on the target task scheduling set. Scheduling based on the time information of batch tasks can make the tasks more evenly distributed in the time interval, disperse the risk of executing tasks, avoid concentrated outbreaks of problems, so as to achieve staggered scheduling of different task running times, effectively solve the resource bottleneck of the server, and improve the utilization rate of server resources.
[0076] Figure 2 The following is an example flow chart of a multi-task processing method provided by an embodiment of the present disclosure. Figure 2 As shown, the multi-task processing method includes:
[0077] S201, obtaining a batch task set and determining initial time information of each task in the task set.
[0078] The relevant contents of step S201 can be found in the above embodiment and will not be described again here.
[0079] S202: Determine the initial start time and duration of the task according to the initial time information.
[0080] S203: Determine the time unit occupied by the task in the task processing cycle according to the initial start time and the duration.
[0081] In some implementations, the initial time information of the task includes the initial start time and duration of the task, and the unit information for encoding can be preset, and then the unit information occupied by the task in the task processing cycle can be determined according to the initial start time and duration of the task. Among them, the unit information can be a time unit. By determining the time unit occupied by the task, the processing time of each task can be clarified to avoid resource conflicts in the process of executing the task.
[0082] Optionally, the time units occupied by the task can be determined according to the duration of the task starting from the initial start time. For example, assuming that one time unit is 10 minutes and the task processing cycle is 24 hours, if the initial start time of task A is 0:10 and the duration is 30 minutes, then the time units occupied by task A are 3 time units.
[0083] In some implementations, there may be a situation where a task occupies two adjacent task processing cycles during execution. Whether a task occupies adjacent task processing cycles can be determined based on the initial start time and duration of the task. For example, assuming that the task processing cycle is 24 hours, if the initial start time of task B is 23:50 and the duration is 50 minutes, which exceeds one task processing cycle, then task B occupies adjacent task processing cycles.
[0084] Optionally, in response to the execution process of the task occupying adjacent task processing cycles, starting from the initial start time, the time units occupied by each task in the adjacent task processing cycles are determined according to the duration, and then the time units occupied by each task in the adjacent task processing cycles are determined as the time units occupied by the tasks, so as to clarify the processing time of each task and avoid resource conflicts during the execution of tasks.
[0085] S204, encoding the time units occupied by the task and the time units not occupied by the task to obtain an initial encoding sequence of the task.
[0086] In some implementations, the initial coding sequence of the task is obtained by determining the position information of the time units occupied by the task and the time units not occupied by the task, and encoding based on the position information. Among them, the time units not occupied by the task are the remaining time units in the task processing cycle. By encoding according to the position information of the time unit, it is possible to accurately locate when the task starts and ends, as well as the state changes in different time periods, so that the sequence of each task is clearer.
[0087] Optionally, the initial coding sequence of the task is obtained by determining a first coding position corresponding to the time unit occupied by the task and a second coding position corresponding to the remaining time unit, and encoding the first coding position and the remaining second coding position.
[0088] For example, taking the above-mentioned tasks A and B as an example, the first coding position of the time unit occupied by task A is position 2, position 3 and position 4 of the first hour, then the initial coding sequence of task A is as follows:
[0089] [0 1 1 1 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,0 0 0 0 0 0,
[0090] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0091] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0092] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0093] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0094] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0]
[0095] The first encoding position of the time unit occupied by task B is position 1, position 2, position 3 and position 4 of the first hour, and position 6 of the 24th hour. Then the initial encoding sequence of task B is as follows:
[0096] [1 1 1 1 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,0 0 0 0 0 0,
[0097] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0098] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0099] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0100] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0,
[0101] 0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 0 0,0 0 0 0 0 1]
[0102] Among them, 1 means that the task has occupied the time unit, and 0 means that the task has not occupied the time unit.
[0103] S205: Obtain an initial task arrangement set of the task set according to the initial coding sequence of the task.
[0104] The relevant contents of step S205 can be found in the above embodiment and will not be described again here.
[0105] S206, taking the initial task scheduling set as the first generation population, scheduling the task set iteratively based on the genetic algorithm until the iteration end condition is met, and obtaining the target task scheduling set of the task set, wherein the target task scheduling set includes the target time information of each task in the task set.
[0106] The relevant contents of step S206 can be found in the above embodiment and will not be described again here.
[0107] In some implementations, when performing orchestration iterations on a task set, an orchestration constraint condition may be generated based on the type of task, and then the next iteration operation may be performed on the population of the previous iteration based on the orchestration constraint condition until a target task orchestration set is obtained, so as to improve resource utilization in the process of executing tasks in the target task orchestration set.
[0108] Optionally, by obtaining the dependencies between tasks in the task set and the task types of the tasks, and based on the task types and dependencies, the orchestration constraints are generated. The task types include: fixed time execution tasks, flexible time execution tasks, and upstream-dependent execution tasks. The upstream-dependent execution tasks are divided into external upstream-dependent execution tasks and internal upstream-dependent execution tasks.
[0109] For example, based on the execution of tasks at fixed time, the generated scheduling constraints can be tasks executed at fixed time, and the time cannot be changed; the scheduling constraints for externally dependent upstream execution tasks can be externally dependent upstream execution tasks, which will be in accordance with the corresponding time interval according to historical execution records and flexible time execution task types; internally dependent upstream execution tasks must have a strict sequence in time.
[0110] Furthermore, a genetic operation is performed on the population of the previous orchestration iteration based on the orchestration constraints to obtain the population of the current orchestration iteration, and then the next orchestration iteration is performed on the population of the current orchestration iteration based on the orchestration constraints until a target task orchestration set is obtained.
[0111] S207, scheduling a target server for the task set, and sending the task set and the target task scheduling set to the target server.
[0112] In some implementations, when scheduling servers for a task set, the target server corresponding to the task set can be determined based on the total data volume of the task set, historical task execution data, or any one of the parameters of the dedicated server, so as to improve the flexibility of task scheduling and the utilization of server resources and achieve efficient execution of the task set.
[0113] Optionally, when scheduling a target server based on historical task execution data, the task execution data of the historical task set is obtained, and the amount of resources occupied by the historical task set when it is executed is determined according to the task execution data, so as to schedule the target server for the task set from the server cluster according to the amount of resources occupied by the historical task set when it is executed. In other words, a target server with a resource amount greater than the historical resource amount can be scheduled according to the historical task execution data.
[0114] Optionally, when scheduling a target server based on the total data volume of a task set, the data volume of each task in the task set is obtained, and the total data volume of the task set is determined based on the data volume of the task, and then the required resources of the task set can be predicted based on the total data volume of the task set, so as to schedule a target server for the task set from a server cluster based on the required resources of the task set. In other words, the resources required to execute the task set can be predicted based on the total data volume of the task set, and a target server with a resource volume greater than the required resource volume can be scheduled.
[0115] Optionally, when scheduling a target server based on a dedicated server, the task attributes of the task set are obtained, and it is determined whether the task set is associated with a dedicated server based on the task attributes. Optionally, in response to the task set not being associated with a dedicated server, the target server is scheduled for the task set from the server cluster; in response to the task set being associated with a dedicated server, the dedicated server associated with the task set is determined to be the target server. In other words, when the task set is associated with a dedicated server, the dedicated server is used as the target server; if the task set is not associated with a dedicated server, the target server can be scheduled based on the total data volume of the task set, or historical task execution data.
[0116] In the multi-task processing method provided by the embodiment of the present disclosure, by obtaining a batch task set, and according to the initial time information of each task in the task set, the time unit occupied by each task is determined, and then the task is encoded based on the time unit to obtain the initial coding sequence of the task, so as to obtain the initial task scheduling set of the task set. Further, based on the initial task scheduling set, the task set is iterated based on the genetic algorithm until the iteration ends, and the target task scheduling set of the task set is obtained, and then the task set is scheduled, and the task is executed on the target server based on the target task scheduling set. Scheduling based on the time information of the batch task can make the tasks more evenly distributed in the time interval, disperse the risk of executing the tasks, avoid the concentrated outbreak of problems, so as to realize the staggered arrangement of different task running times, effectively solve the resource bottleneck of the server, and improve the utilization rate of the server resources. Further, according to the resource amount of the task set and whether it is associated with a dedicated server, the target server is scheduled for the task set, and the task set can be assigned to a server with sufficient resources, avoiding bottlenecks when the tasks are running on the server.
[0117] Based on the above embodiments, the embodiments of the present disclosure can explain the iterative process of arranging a task set, such as Figure 3 As shown in the figure, the iterative process of arranging a task set includes:
[0118] S301, obtaining a candidate task scheduling set of a task set obtained by an i-th scheduling iteration, where i is a natural number greater than or equal to 1.
[0119] In some implementations, for the i-th iteration, the candidate task orchestration set obtained in the i-1-th iteration is obtained as the candidate task orchestration set used in the i-th orchestration iteration, and the candidate task orchestration set is used as the iteration population. Genetic operations such as selection, crossover, mutation, etc. are performed on the iteration population to obtain the candidate task orchestration set of the task set obtained in the i-th orchestration iteration.
[0120] Optionally, during the genetic operation, the iterative population may be genetically operated according to the scheduling constraints. For example, the task type may be determined from the scheduling constraints to be a task executed at a fixed time, and no crossover or mutation operations may be performed.
[0121] S302: Determine the fitness of the candidate task scheduling set.
[0122] Optionally, each coding sequence in the candidate task arrangement set is accumulated, and the variance of the accumulation result is calculated, and the variance is used as the fitness of the candidate task arrangement set.
[0123] S303: In response to the fitness of the candidate task scheduling set satisfying the iteration termination condition, the scheduling iteration is terminated.
[0124] In some implementations, after the orchestration iteration is completed, the target task orchestration set can be determined from the candidate task orchestration set according to the fitness of the candidate task orchestration set. It is understandable that a candidate task orchestration set with high fitness can more effectively achieve load balancing, ensure balanced utilization of resources, and thus improve the execution efficiency of tasks.
[0125] In some implementations, the scores of the candidate task orchestration sets obtained in each orchestration iteration may also be obtained, and the target task orchestration set may be determined based on the scores and fitness of the candidate task orchestration sets. That is, the candidate task orchestration sets whose fitness is greater than or equal to the set fitness threshold are selected from the candidate task orchestration sets obtained in each orchestration iteration, and the candidate task orchestration sets with the highest scores are selected from the candidate task orchestration sets whose fitness is greater than or equal to the set fitness threshold as the target task orchestration set.
[0126] S304: In response to the fitness of the candidate task scheduling set not satisfying the iteration end condition and the accumulated number of iterations not reaching the set number, continue to perform the (i+1)th scheduling iteration.
[0127] In some implementations, the iteration end condition may be determined based on the fitness of the candidate task arrangement set. Optionally, the iteration end condition may be that the fitness of the candidate task arrangement set is greater than a set threshold. Optionally, the iteration end condition may also be determined based on the number of iterations. For example, the iteration end condition may be that the number of iterations reaches a set number.
[0128] In some implementations, when the fitness of the candidate task scheduling set meets the iteration end condition, the iteration ends; when the fitness of the candidate task scheduling set does not meet the iteration end condition and the cumulative number of iterations has not reached the set number, the i+1th scheduling iteration is continued until the iteration end condition is met and the iteration ends.
[0129] Optionally, in response to the fitness of the candidate task scheduling set not satisfying the iteration termination condition, but the cumulative number of iterations reaches a set number, the scheduling iteration is terminated, thereby avoiding infinite scheduling iterations due to failure to satisfy the fitness and saving computing resources.
[0130] In the multi-task processing method provided by the embodiment of the present disclosure, a candidate task scheduling set obtained by the i-1th scheduling iteration is genetically operated to obtain a candidate task scheduling set obtained by the i-1th scheduling iteration, and the fitness of the candidate task scheduling set is calculated, and whether to end the iteration is determined based on the fitness. After the iteration is ended, the target task scheduling set is determined based on the fitness. Judging whether to end the iteration based on the high fitness can make the scheduling of tasks more effectively balance the load and ensure that resources are used evenly, thereby improving the execution efficiency of tasks.
[0131] like Figure 4 The flowchart shown is a flow chart of the orchestration iteration of the task set. The initial task orchestration set is used as the first generation population, and the orchestration iteration is performed based on the first generation population. During the iteration process, the candidate task orchestration set of the task set is obtained by obtaining the i-th orchestration iteration, where i is a natural number greater than or equal to 1, and the fitness of the candidate task orchestration set is calculated, and whether the iteration end condition is met is determined based on the fitness. If the iteration end condition is met, the orchestration iteration is ended and the candidate task orchestration set is output. If the iteration end condition is not met, and the cumulative number of iterations has not reached the set number, the i+1th orchestration iteration is continued, and the candidate task orchestration set of the i+1th orchestration iteration is obtained by performing genetic operations such as selection, crossover, mutation, etc. on the candidate task orchestration set obtained by the i-th orchestration iteration; if the iteration end condition is not met, but the cumulative number of iterations reaches the set number, the orchestration iteration is ended.
[0132] Based on the above embodiments, the present disclosure can explain the process of determining the fitness of the candidate task scheduling set. Figure 5 As shown in FIG, the process of determining the fitness of the candidate task arrangement set includes:
[0133] S501, determining a candidate encoding sequence for each task in the task set according to the candidate task arrangement set.
[0134] S502, performing an accumulation operation at the same coding position on the candidate coding sequence of each task in the task set to obtain an accumulated coding sequence.
[0135] In some implementations, the task orchestration set consists of coding sequences of tasks in the task orchestration set, that is, by reading the candidate task orchestration set, a candidate coding sequence of each task in the task orchestration set can be determined from the candidate task orchestration set.
[0136] Furthermore, by obtaining the upper coding value of each position of each candidate coding sequence and accumulating the coding values at the same position to obtain the accumulated coding sequence of the task set, the coding information in multiple candidate coding sequences can be summarized to achieve unified management of task time information and help calculate the fitness of the candidate task scheduling set.
[0137] Optionally, the code value at the code position j is determined according to the candidate code sequence of the task, where j is a natural number greater than or equal to 1, and the code value at the code position j of each task in the task set is accumulated to obtain the accumulated code value at the code position j. Then, according to the above accumulation method, the accumulated code value at each code position can be obtained, and the accumulated code sequence can be obtained according to the accumulated code value at each code position.
[0138] For example, suppose the task set includes candidate coding sequences of three tasks, namely [01 0 1 00,…], [0 0 1 1 0 1,…], and [1 1 1 1 1 0,…], and suppose coding position j is coding position 1, then the coding values at coding position 1 are 0, 0, and 1 are accumulated, and the accumulated coding value at coding position 1 is 1, and then the accumulated coding value of each coding position can be calculated, and then the accumulated coding sequence is [1, 2, 2, 3, 1, 1,…] according to the accumulated coding values.
[0139] S503, obtaining the variance of the accumulated coding sequence as the fitness of the candidate task arrangement set.
[0140] Optionally, the accumulated value in the accumulated coding sequence is obtained, and the variance of the accumulated coding sequence is calculated based on the accumulated value, and the calculation result is used as the fitness of the candidate task arrangement set.
[0141] In the multi-task processing method provided by the embodiment of the present disclosure, the candidate coding sequence of each task is cumulatively added at the same coding position to obtain a cumulative coding sequence, and the variance of the cumulative value in the cumulative coding sequence is calculated to obtain the fitness of the candidate task scheduling set. By calculating the variance as the fitness of the candidate task scheduling set, the load balancing of the candidate task scheduling set can be intuitively displayed to ensure that resources are used in a balanced manner, thereby improving the execution efficiency of the task.
[0142] Figure 6 The following is an example flow chart of a multi-task processing method provided by an embodiment of the present disclosure. Figure 6 As shown, the multi-task processing method includes:
[0143] S601, obtaining a batch task set and determining initial time information of each task in the task set.
[0144] S602: Determine the initial start time and duration of the task according to the initial time information.
[0145] S603: Determine the time unit occupied by the task in the task processing cycle according to the initial start time and the duration.
[0146] S604, encoding the time units occupied by the task and the time units not occupied by the task to obtain an initial encoding sequence of the task.
[0147] S605: Obtain an initial task arrangement set of the task set according to the initial coding sequence of the task.
[0148] S606, using the initial task scheduling set as the first generation population, performing genetic operations on the population of the previous scheduling iteration based on the scheduling constraints to obtain the population of the current scheduling iteration, until the iteration end condition is met, and obtaining the target task scheduling set of the task set.
[0149] S607, scheduling a target server for the task set, and sending the task set and the target task scheduling set to the target server.
[0150] The relevant contents of step S601 to step S607 can be found in the above embodiment and will not be repeated here.
[0151] In the multi-task processing method provided by the embodiment of the present disclosure, a batch task set is obtained, and the task is encoded according to the initial time information of each task in the task set to obtain the initial coding sequence of the task, so as to obtain the initial task scheduling set of the task set. Further, based on the initial task scheduling set, the task set is scheduled based on a genetic algorithm until the iteration ends, and the target task scheduling set of the task set is obtained, and then the task set is scheduled, and the task is executed on the target server based on the target task scheduling set. Scheduling based on the time information of batch tasks can make the tasks more evenly distributed in the time interval, disperse the risk of executing tasks, avoid concentrated outbreaks of problems, so as to achieve staggered scheduling of different task running times, effectively solve the resource bottleneck of the server, and improve the utilization rate of server resources.
[0152] like Figure 7The flowchart of multi-tasking shown in FIG. By obtaining a batch task set and encoding the task according to the initial time information of the task, the initial coding sequence of the task is obtained, and the initial task scheduling set is obtained based on the initial coding sequence. Further, the initial task scheduling set is input into the scheduling model based on the genetic algorithm, and the initial task scheduling set is scheduled iteratively until the iteration ends to obtain the target task scheduling set. Further, the target server is scheduled for the task set, and the target server sends the task set and the target task scheduling set. Optionally, by judging whether the task set is associated with a dedicated server, and in the case of an associated dedicated server, the dedicated server associated with the task set is determined as the target server. If the task set is not associated with a dedicated server, the server cluster can be polled, and the amount of resources required for the task set can be evaluated based on the task execution data of the historical task set, and the target server can be determined from the server cluster. After the task set is executed on the target server, the task execution time, memory usage, etc. can be recorded for the next resource evaluation.
[0153] Corresponding to the multi-task processing methods provided in the above-mentioned embodiments, an embodiment of the present disclosure further provides a multi-task processing device. Since the multi-task processing device provided in the embodiment of the present disclosure corresponds to the multi-task processing methods provided in the above-mentioned embodiments, the implementation methods of the above-mentioned multi-task processing methods are also applicable to the multi-task processing device provided in the embodiment of the present disclosure, and will not be described in detail in the following embodiments.
[0154] Figure 8 This is a diagram showing an example of the structure of a multi-task processing device provided by an embodiment of the present disclosure. Figure 8 As shown, the multi-task processing device includes: a determination module 801, an encoding module 802, an acquisition module 803, an iteration module 804 and a scheduling module 805.
[0155] A determination module 801 is used to obtain a batch task set and determine initial time information of each task in the task set, wherein the initial time information includes an initial start time and a duration;
[0156] The encoding module 802 is used to encode each task in the task set according to the initial time information of the task to obtain an initial encoding sequence of the task;
[0157] An acquisition module 803 is used to acquire an initial task arrangement set of the task set according to the initial coding sequence of the task;
[0158] Iteration module 804 is used to use the initial task scheduling set as the initial population, schedule the task set iteratively based on the genetic algorithm, until the iteration end condition is met, and obtain the target task scheduling set of the task set, wherein the target task scheduling set includes the target time information of each task in the task set;
[0159] The scheduling module 805 is used to schedule a target server for the task set, and send the task set and the target task arrangement set to the target server.
[0160] According to one embodiment of the present disclosure, the encoding module 802 is also used to: determine the initial start time and duration of the task based on the initial time information; determine the time units occupied by the task within the task processing cycle based on the initial start time and duration; encode the time units occupied by the task and the time units not occupied by the task to obtain the initial encoding sequence of the task.
[0161] According to one embodiment of the present disclosure, it is characterized in that the encoding module 802 is also used to: starting from the initial start time, determine the time unit occupied by the task according to the duration of the task; determine the first encoding position corresponding to the time unit occupied by the task and the second encoding position corresponding to the remaining time unit; encode the first encoding position and the remaining second encoding position to obtain the initial encoding sequence of the task.
[0162] According to one embodiment of the present disclosure, the encoding module 802 is also used to: in response to the execution process of the task occupying adjacent task processing cycles, starting from the initial start time, determine the time units occupied by the tasks in the adjacent task processing cycles according to the duration; determine the time units occupied by the tasks in the adjacent task processing cycles as the time units occupied by the tasks.
[0163] According to one embodiment of the present disclosure, the iterative module 804 is further used to: obtain the dependencies between tasks in the task set and the task types of the tasks; generate orchestration constraints based on the task types and the dependencies; and perform genetic operations on the population of the previous orchestration iteration based on the orchestration constraints to obtain the population of the current orchestration iteration.
[0164] According to one embodiment of the present disclosure, the iteration module 804 is further used to: obtain a candidate task orchestration set of the task set obtained in the i-th orchestration iteration, where i is a natural number greater than or equal to 1; determine the fitness of the candidate task orchestration set; in response to the fitness of the candidate task orchestration set satisfying an iteration end condition, end the orchestration iteration; in response to the fitness of the candidate task orchestration set not satisfying the iteration end condition and the cumulative number of iterations has not reached a set number, continue the i+1-th orchestration iteration.
[0165] According to an embodiment of the present disclosure, the iteration module 804 is further configured to: in response to the fitness of the candidate task scheduling set not satisfying the iteration termination condition, but the accumulated number of iterations reaches a set number, terminate the scheduling iteration.
[0166] According to one embodiment of the present disclosure, the iteration module 804 is further used to: determine the candidate coding sequence of each task in the task set according to the candidate task arrangement set; perform an accumulation operation at the same coding position on the candidate coding sequence of each task in the task set to obtain an accumulated coding sequence; and obtain the variance of the accumulated coding sequence as the fitness of the candidate task arrangement set.
[0167] According to one embodiment of the present disclosure, the iteration module 804 is further used to: determine the coding value at the coding position j according to the candidate coding sequence of the task, wherein j is a natural number greater than or equal to 1; accumulate the coding value of each task in the task set at the coding position j to obtain the accumulated coding value at the coding position j; and obtain the accumulated coding sequence according to the accumulated coding value at each coding position.
[0168] According to an embodiment of the present disclosure, the iteration module 804 is further used to: obtain the score of the candidate task orchestration set obtained in each orchestration iteration; select the candidate task orchestration set whose fitness is greater than or equal to the set fitness threshold from the candidate task orchestration set obtained in each orchestration iteration; select the candidate task orchestration set with the highest score from the candidate task orchestration set whose fitness is greater than or equal to the set fitness threshold as the target task orchestration set.
[0169] According to one embodiment of the present disclosure, the scheduling module 805 is also used to: obtain task execution data of a historical task set; determine the amount of resources occupied by the historical task set when it is executed based on the task execution data; and schedule the target server for the task set from a server cluster based on the amount of resources occupied by the historical task set when it is executed.
[0170] According to one embodiment of the present disclosure, the scheduling module 805 is also used to: obtain the data volume of each task in the task set, and determine the total data volume of the task set based on the data volume of the task; predict the required resources of the task set based on the total data volume of the task set; and schedule the target server for the task set from the server cluster based on the required resources of the task set.
[0171] According to one embodiment of the present disclosure, the scheduling module 805 is also used to: obtain task attributes of the task set, and determine whether the task set is associated with a dedicated server based on the task attributes; in response to the task set not being associated with a dedicated server, schedule the target server for the task set from a server cluster; in response to the task set being associated with a dedicated server, determine that the dedicated server associated with the task set is the target server.
[0172] In the multi-task processing device provided by the embodiment of the present disclosure, by obtaining a batch task set, and encoding the task according to the initial time information of each task in the task set, the initial coding sequence of the task is obtained, so as to obtain the initial task scheduling set of the task set. Further, based on the initial task scheduling set, the task set is scheduled based on the genetic algorithm until the iteration ends, and the target task scheduling set of the task set is obtained, and then the task set is scheduled, and the task is executed on the target server based on the target task scheduling set. Scheduling based on the time information of the batch task can make the tasks more evenly distributed in the time interval, disperse the risk of executing the task, avoid the concentrated outbreak of problems, so as to realize the staggered arrangement of the running time of different tasks, effectively solve the resource bottleneck of the server, and improve the utilization rate of server resources.
[0173] Fig. 9 This is a diagram showing an example of the structure of an electronic device provided in an embodiment of the present disclosure. Fig. 9 As shown, the electronic device 900 may include: a transceiver 901 , a processor 902 , and a memory 903 .
[0174] The processor 902 executes the computer execution instructions stored in the memory, so that the processor 902 executes the scheme in the above embodiment. The processor 902 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be 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.
[0175] The memory 903 is connected to the processor 902 via a system bus and completes communication between them. The memory 903 is used to store computer program instructions.
[0176] The transceiver 901 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.
[0177] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.
[0178] The electronic device provided in the embodiments of the present disclosure may be the terminal device of the above embodiments.
[0179] The disclosed embodiment also provides a chip for executing instructions, which is used to execute the technical solution of the multi-task processing method in the above embodiment.
[0180] The embodiment of the present disclosure further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the multi-task processing method of the above embodiment.
[0181] The embodiments of the present disclosure also provide a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When the at least one processor executes the computer program, the technical solution of the multi-task processing method in the above embodiments can be implemented.
[0182] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0183] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A multi-task processing method, characterized in that: The method comprises: Acquire a batch task set, and determine initial time information of each task in the task set, wherein the initial time information includes an initial start time and a duration; For each task in the task set, encoding the task according to initial time information of the task to obtain an initial encoding sequence of the task; According to the initial coding sequence of the task, obtaining an initial task arrangement set of the task set; Taking the initial task scheduling set as the first generation population, scheduling the task set iteratively based on the genetic algorithm until an iteration end condition is met, and obtaining a target task scheduling set of the task set, wherein the target task scheduling set includes target time information of each task in the task set; A target server is scheduled for the task set, and the task set and the target task schedule set are sent to the target server.
2. The method according to claim 1, characterized in that The step of encoding the task according to the initial time information of the task to obtain an initial coding sequence of the task includes: Determine the initial start time and duration of the task according to the initial time information; Determine the time unit occupied by the task in the task processing cycle according to the initial start time and the duration; The time units occupied by the task and the time units not occupied by the task are encoded to obtain an initial encoding sequence of the task.
3. The method according to claim 2, characterized in that Determining the time unit occupied by the task in the task processing cycle according to the initial start time and the duration includes: Starting from the initial start time, determining the time unit occupied by the task according to the duration of the task; Determine a first coding position corresponding to the time unit occupied by the task and a second coding position corresponding to the remaining time unit; The first coding position and the remaining second coding positions are encoded to obtain an initial coding sequence of the task.
4. The method according to claim 3, characterized in that The step of determining the time unit occupied by the task according to the duration of the task starting from the initial start time includes: In response to the execution process of the task occupying adjacent task processing cycles, starting from the initial start time, determining the time units occupied by the tasks in the adjacent task processing cycles according to the duration; The time units respectively occupied in the adjacent task processing cycles are determined as the time units occupied by the tasks.
5. The method according to any one of claims 1 to 4, characterized in that The iterative arrangement of the task set based on the genetic algorithm also includes: Obtaining dependencies between tasks in the task set and task types of the tasks; Generate an orchestration constraint condition based on the task type and the dependency relationship; Based on the arrangement constraint condition, a genetic operation is performed on the population of the previous arrangement iteration to obtain the population of the current arrangement iteration.
6. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Obtaining a candidate task scheduling set of the task set obtained by the i-th scheduling iteration, where i is a natural number greater than or equal to 1; Determining the fitness of the candidate task arrangement set; In response to the fitness of the candidate task scheduling set satisfying an iteration termination condition, terminating the scheduling iteration; In response to the fitness of the candidate task scheduling set not satisfying the iteration end condition and the accumulated number of iterations not reaching the set number, continuing the (i+1)th scheduling iteration.
7. The method according to claim 6, characterized in that The method further comprises: In response to the fitness of the candidate task scheduling set not satisfying the iteration termination condition, but the accumulated number of iterations reaches a set number, the scheduling iteration is terminated.
8. The method according to claim 6, characterized in that The determining the fitness of the candidate task arrangement set includes: Determine, according to the candidate task arrangement set, a candidate encoding sequence for each task in the task set; Performing an accumulation operation at the same encoding position on the candidate encoding sequence of each task in the task set to obtain an accumulated encoding sequence; The variance of the accumulated coding sequence is obtained as the fitness of the candidate task arrangement set.
9. The method according to claim 8, characterized in that The step of performing an accumulation operation at the same encoding position on the candidate encoding sequence of each task in the task set to obtain an accumulated encoding sequence includes: Determine a code value at a code position j according to a candidate code sequence of the task, where j is a natural number greater than or equal to 1; Accumulating the code value of each task in the task set at the code position j to obtain the accumulated code value at the code position j; The accumulated coding sequence is obtained according to the accumulated coding value at each coding position.
10. The method according to claim 6, characterized in that The method further comprises: Obtaining scores of the candidate task orchestration set obtained in each orchestration iteration; From the candidate task scheduling set obtained in each scheduling iteration, select a candidate task scheduling set whose fitness is greater than or equal to a set fitness threshold; From the candidate task scheduling sets whose fitness is greater than or equal to the set fitness threshold, select the candidate task scheduling set with the highest score as the target task scheduling set.
11. The method according to claim 1, characterized in that: The step of scheduling a target server for the task set includes: Get the task execution data of the historical task collection; Determining the amount of resources occupied by the historical task set when it is executed according to the task execution data; The target server is scheduled for the task set from a server cluster according to the amount of resources occupied when the historical task set is executed.
12. The method according to claim 1, characterized in that The step of scheduling a target server for the task set includes: Acquire the data volume of each task in the task set, and determine the total data volume of the task set according to the data volume of the task; Predicting required resources for the task set according to the total data volume of the task set; The target server is scheduled for the task set from a server cluster according to the required resources of the task set.
13. The method according to claim 10 or 11, characterized in that: The method further comprises: Acquire task attributes of the task set, and determine whether the task set is associated with a dedicated server according to the task attributes; In response to the task set not being associated with a dedicated server, scheduling the target server for the task set from a server cluster; In response to the task set being associated with a dedicated server, the dedicated server associated with the task set is determined to be the target server.
14. A multi-task processing device, characterized in that: The device comprises: A determination module, used to obtain a batch task set and determine initial time information of each task in the task set, wherein the initial time information includes an initial start time and a duration; An encoding module, used for encoding each task in the task set according to the initial time information of the task to obtain an initial encoding sequence of the task; An acquisition module, used for acquiring an initial task arrangement set of the task set according to an initial coding sequence of the task; An iteration module is used to use the initial task scheduling set as a primary population, perform scheduling iterations on the task set based on a genetic algorithm, until an iteration end condition is met, and obtain a target task scheduling set of the task set, wherein the target task scheduling set includes target time information of each task in the task set; The scheduling module is used to schedule the target server for the task set and send the task set and the target task arrangement set to the target server.
15. The device according to claim 14, characterized in that The encoding module is further used for: Determine the initial start time and duration of the task according to the initial time information; Determine the time unit occupied by the task in the task processing cycle according to the initial start time and the duration; The time units occupied by the task and the time units not occupied by the task are encoded to obtain an initial encoding sequence of the task.
16. The device according to claim 15, characterized in that The encoding module is further used for: Starting from the initial start time, determining the time unit occupied by the task according to the duration of the task; Determine a first coding position corresponding to the time unit occupied by the task and a second coding position corresponding to the remaining time unit; The first coding position and the remaining second coding positions are encoded to obtain an initial coding sequence of the task.
17. The device according to claim 16, characterized in that The encoding module is further used for: In response to the execution process of the task occupying adjacent task processing cycles, starting from the initial start time, determining the time units occupied by the tasks in the adjacent task processing cycles according to the duration; The time units respectively occupied in the adjacent task processing cycles are determined as the time units occupied by the tasks.
18. The device according to any one of claims 14 to 17, characterized in that The iterated module is also used for: Obtaining dependencies between tasks in the task set and task types of the tasks; Generate an orchestration constraint condition based on the task type and the dependency relationship; Based on the arrangement constraint condition, a genetic operation is performed on the population of the previous arrangement iteration to obtain the population of the current arrangement iteration.
19. The device according to any one of claims 14 to 17, characterized in that The iteration module is also used for: Obtaining a candidate task scheduling set of the task set obtained by the i-th scheduling iteration, where i is a natural number greater than or equal to 1; Determining the fitness of the candidate task arrangement set; In response to the fitness of the candidate task scheduling set satisfying an iteration termination condition, terminating the scheduling iteration; In response to the fitness of the candidate task scheduling set not satisfying the iteration end condition and the accumulated number of iterations not reaching the set number, continuing the (i+1)th scheduling iteration.
20. The device according to claim 19, characterized in that The iteration module is also used for: In response to the fitness of the candidate task scheduling set not satisfying the iteration termination condition, but the accumulated number of iterations reaches a set number, the scheduling iteration is terminated.
21. The device according to claim 19, characterized in that The iteration module is also used for: Determine, according to the candidate task arrangement set, a candidate encoding sequence for each task in the task set; Performing an accumulation operation at the same encoding position on the candidate encoding sequence of each task in the task set to obtain an accumulated encoding sequence; The variance of the accumulated coding sequence is obtained as the fitness of the candidate task arrangement set.
22. The device according to claim 21, characterized in that The iteration module is also used for: Determine a code value at a code position j according to a candidate code sequence of the task, where j is a natural number greater than or equal to 1; Accumulating the code value of each task in the task set at the code position j to obtain the accumulated code value at the code position j; The accumulated coding sequence is obtained according to the accumulated coding value at each coding position.
23. The device according to claim 19, characterized in that The iteration module is also used for: Obtaining scores of the candidate task orchestration set obtained in each orchestration iteration; From the candidate task scheduling set obtained in each scheduling iteration, select a candidate task scheduling set whose fitness is greater than or equal to a set fitness threshold; From the candidate task scheduling sets whose fitness is greater than or equal to the set fitness threshold, select the candidate task scheduling set with the highest score as the target task scheduling set.
24. The device according to claim 14, characterized in that The scheduling module is also used for: Get the task execution data of the historical task collection; Determining the amount of resources occupied by the historical task set when it is executed according to the task execution data; The target server is scheduled for the task set from a server cluster according to the amount of resources occupied when the historical task set is executed.
25. The device according to claim 14, characterized in that The scheduling module is also used for: Acquire the data volume of each task in the task set, and determine the total data volume of the task set according to the data volume of the task; Predicting required resources for the task set according to the total data volume of the task set; The target server is scheduled for the task set from a server cluster according to the required resources of the task set.
26. The device according to claim 23 or 24, characterized in that The scheduling module is also used for: Acquire task attributes of the task set, and determine whether the task set is associated with a dedicated server according to the task attributes; In response to the task set not being associated with a dedicated server, scheduling the target server for the task set from a server cluster; In response to the task set being associated with a dedicated server, the dedicated server associated with the task set is determined to be the target server.
27. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 13.
28. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 13 when executed by a processor.
29. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 13 when being executed by a processor.
