A parallel task scheduling method, system, storage medium and terminal
By sorting and configuring the test environment by test queue in the automated testing framework, the problems of wasted computing resources and time-consuming task execution are solved, and resource utilization and execution efficiency are improved.
Patent Information
- Application Number
- CN202210681507.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-16
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-06-16
AI Technical Summary
Existing automated testing frameworks lack scheduling strategies to optimize concurrent execution efficiency, resulting in wasted computing resources and increased task execution time.
By obtaining the number of test environments for tasks to be executed and using each test environment as a test queue, the longest-running tasks are obtained in order of initial sorting. Tasks are executed using the test queue, the test environment is configured to adapt to the test context, tasks with task dependencies are merged, and the total execution time of tasks is balanced.
It has achieved improved resource utilization and task execution efficiency, reduced task execution time, and ensured balanced use of resources.
Smart Images

Figure CN114995981B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of network security, in particular to a parallel task scheduling method and system, a storage medium and a terminal. BACKGROUND
[0002] The mainstream automated test framework today lacks support for scheduling strategies related to optimizing concurrent execution efficiency. Concurrent case execution usually reduces case execution time by increasing more test environments, but case execution without scheduling strategy planning can easily cause the following problems: if the cases executed by the case execution process are pushed by the outside at one time, the case escort effect on a single test environment will cause global computing resource waste, that is, some test environments face the state of no task to be executed because they have completed the assigned tasks in advance, but in fact, from the global perspective, there are still cases that have not been executed.
[0003] Therefore, how to improve the resource utilization rate during task scheduling is a technical problem that technicians in the field need to solve. SUMMARY
[0004] The purpose of the present application is to provide a parallel task scheduling method, a parallel task scheduling system, a computer readable storage medium and a terminal, which can reduce the waste of computing resources and reduce the time consumption of concurrent execution.
[0005] To solve the above technical problems, the present application provides a parallel task scheduling method, and the specific technical solutions are as follows:
[0006] Obtain tasks to be executed, and determine the number of test environments of the tasks to be executed; wherein the task execution time of each task to be executed is known;
[0007] Each test environment is used as a test queue, and the initial order between each test queue is determined;
[0008] Each test queue obtains a task to be executed with the longest current time consumption in turn according to the initial order, determines the current order according to the order of the task execution time of each test queue from short to long, and obtains a task to be executed with the longest current time consumption in turn according to the current order;
[0009] Each test queue executes each task to be executed.
[0010] Optionally, executing each task to be executed by the test queue comprises:
[0011] Determine the test background corresponding to each test queue;
[0012] Configure the test environment according to the test background, and execute the task to be executed contained in the corresponding test queue in the test environment.
[0013] Optionally, determining the test context corresponding to each of the test queues includes:
[0014] When the number of the tasks to be executed meets a threshold, general configuration information of the tasks to be executed is extracted to obtain the test background.
[0015] Optionally, also include:
[0016] If there is a task dependency relationship between the first test task and the second test task, and the first test task corresponds to the first execution time and the second test task corresponds to the second execution time, the first test task and the second test task are merged as the target task to be executed; the task execution time of the target task to be executed is the sum of the first execution time and the second execution time.
[0017] Optionally, if an unknown pending task with an unknown execution time is received, the following is also included:
[0018] If the number of the unknown tasks to be executed is greater than the number threshold, the unknown tasks to be executed are evenly distributed to each of the test queues according to the number of tasks;
[0019] If the number of the unknown tasks to be executed is less than the number threshold, the unknown tasks to be executed are added to the end of the test queue with the shortest total execution time of the current task.
[0020] Optionally, if the task to be executed includes several different test scenarios, it also includes:
[0021] In each of the test scenarios, tasks to be executed that are adapted to the test scenario are selected to execute the parallel task scheduling method according to claim 1, thereby obtaining a plurality of test queues in each of the test scenarios; wherein the number of test queues in each of the test scenarios is the same;
[0022] The test queues in each test scenario are sorted according to the task execution time, and each test queue is sorted from longest to shortest according to the time consumption, and a test queue in the next test scenario with the shortest total task execution time after being combined with the test queue is obtained to obtain a combined queue;
[0023] The combined queue is used as the test queue, and the step of sorting the test queues from longest to shortest in terms of the time consumption is repeated to obtain a test queue with the shortest total task execution time after being combined with the test queue in the next test scenario, until the test queues of all the test scenarios are combined to obtain a scheduling queue;
[0024] The tasks to be executed are executed in sequence according to the scheduling queue.
[0025] The present application also provides a parallel task scheduling system, comprising:
[0026] A task acquisition module is used to acquire tasks to be executed and determine the number of test environments for the tasks to be executed; wherein the execution time of each task to be executed is known;
[0027] A test queue generation module, configured to use each test environment as a test queue and determine an initial order among the test queues;
[0028] A task scheduling module is used for each of the test queues to sequentially obtain a task that currently takes the longest time to execute according to the initial sorting, determine the current sorting according to the order of the execution time of the tasks corresponding to each of the test queues from shortest to longest, and sequentially obtain a task that currently takes the longest time to execute according to the current sorting;
[0029] The task processing module is used to execute each of the tasks to be executed using the test queue.
[0030] Optionally, the task processing module includes:
[0031] A background determination unit, configured to determine the test background corresponding to each of the test queues;
[0032] An environment configuration unit is used to configure a test environment according to the test background, and execute the tasks to be executed included in the corresponding test queue in the test environment.
[0033] The present application also provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-described method when executed by a processor.
[0034] The present application also provides a terminal, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned method when calling the computer program in the memory.
[0035] The present application provides a parallel task scheduling method, comprising: obtaining tasks to be executed and determining the number of test environments for the tasks to be executed; wherein the task execution time of each of the tasks to be executed is known; using each test environment as a test queue, and determining an initial sorting between the test queues; each of the test queues sequentially obtains a task to be executed that currently takes the longest time according to the initial sorting, determines the current sorting according to the order of the execution time of the tasks corresponding to each of the test queues from short to long, and sequentially obtains a task to be executed that currently takes the longest time according to the current sorting; and executes each of the tasks to be executed using the test queues.
[0036] This application configures the test queue so that the test queue obtains the tasks to be executed in sequence according to the total execution time of its own existing tasks each time it obtains the tasks to be executed, ensuring that the total time of the tasks to be executed by each test queue is relatively balanced, ensuring resource utilization during the test process, reducing task execution time, and improving task execution efficiency.
[0037] The present application also provides a parallel task scheduling system, a computer-readable storage medium, and a terminal, which have the above-mentioned beneficial effects and are not described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0039] Figure 1 A flowchart of a parallel task scheduling method provided in an embodiment of the present application;
[0040] Figure 2 A schematic diagram of a parallel task scheduling result provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of the delay results of parallel task scheduling provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of the structure of the dual test scenario and three test environments provided in the embodiment of this application:
[0043] Figure 5 The embodiment of this application provides Figure 4 Schematic diagram of the scheduling queue generated by combining the corresponding test queues;
[0044] Figure 6 A schematic diagram of the structure of a parallel task scheduling system provided in an embodiment of the present application;
[0045] Figure 7 A schematic diagram of the structure of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0047] See also Figure 1 , Figure 1 A flowchart of a parallel task scheduling method provided in an embodiment of the present application, the method comprising:
[0048] S101: Obtaining a task to be executed and determining the number of test environments for the task to be executed;
[0049] This step aims to obtain tasks to be executed, and the execution time of each task to be executed is known. Generally speaking, for a task executed once, its execution time is considered to be known the next time it is executed. The task execution time is a relative reference time and is not necessarily the exact time when the task to be executed is actually executed. Considering the differences in the execution environment during task execution, the execution time of the same task to be executed may vary to a certain extent in different task execution environments.
[0050] Furthermore, this step requires determining the number of test environments for the pending tasks. This number is typically determined by the performance of the test equipment itself, and can be determined by those skilled in the art based on the test equipment's parameters. Because automated testing involves case escalation, whereby resource-intensive cases are forced to wait in a single test environment while a more resource-intensive case is executing, and automated testing is non-preemptive, multiple test cases should not be executed simultaneously in a single test environment, a case escalation effect can occur when statically allocating a series of cases for execution in a single test environment. Therefore, for resource-intensive pending tasks, the corresponding test environments should be prioritized.
[0051] As a preferred implementation, there are usually two or more tasks with task dependency relationship when actually executing tasks. If the tasks are pushed from outside when executing the tasks, the tasks with task dependency relationship are easily pushed to different processes or environments for execution, resulting in a large error in test results. Therefore, if the first test task and the second test task have task dependency relationship and the task execution time of both is known, for example, the first test task corresponds to a first execution time and the second test task corresponds to a second execution time, the first test task and the second test task can be combined as a target to-be-executed task, and the task execution time of the target to-be-executed task is the sum of the first execution time and the second execution time. In other words, for tasks with task dependency relationship, as long as the task execution time of each task is known, all tasks with task dependency relationship can be regarded as a to-be-executed task for execution. It should be noted that if the task execution time of any test task is unknown, although it can still be combined or regarded as a to-be-executed task, the to-be-executed task should be treated as a to-be-executed task with unknown task execution time.
[0052] S102: Each test environment is regarded as a test queue, and an initial order between the test queues is determined;
[0053] In this step, each test environment is regarded as a test queue, and each to-be-executed task in the test queue is executed in turn. In order to facilitate the execution of the subsequent steps, the order between the test queues needs to be determined for the subsequent steps to obtain to-be-executed tasks.
[0054] S103: Each test queue obtains a to-be-executed task with the longest current time in turn according to the initial order, determines a current order according to the order of the task execution time of the current test queue from short to long, and obtains a to-be-executed task with the longest current time in turn according to the current order;
[0055] In this step, each test queue needs to obtain to-be-executed tasks in turn. Specifically, a to-be-executed task with the longest current time is obtained in turn according to the order determined in the previous step. After each test queue obtains a to-be-executed task, a current order is determined according to the order of the task execution time of the current test queue from short to long, and a to-be-executed task with the longest current time is obtained in turn according to the current order. This can be continued until all to-be-executed tasks are obtained. As can be seen, the longer the total task execution time of the to-be-executed task currently obtained by the test queue, the shorter the task execution time of the to-be-executed task obtained next time. In this way, the total task execution time between the test queues can be relatively averaged, avoiding resource waste caused by the completion of some test queues first.
[0056] S104: Each to-be-executed task is executed by using the test queue.
[0057] After the tasks to be executed in the test queue are determined, each task to be executed can be executed. It should be noted that step S103 is a description of the task acquisition method. In the actual task execution process, the task acquisition can be performed while the task is executed, or each time a task is completed, the next task to be executed can be acquired according to the above method.
[0058] It should also be noted that due to various unexpected situations during the execution of pending tasks, the execution time of the task may exceed the known execution time of the task. At this time, if each pending task is completed and then the pending task with the longest execution time is obtained, the problem of decreased resource utilization caused by abnormal task execution can be effectively reduced.
[0059] As a preferred execution method of this step, when executing the tasks to be executed, the test background corresponding to each test queue can be determined first, so as to configure the test environment according to the test background, and execute the tasks to be executed contained in the corresponding test queue in the test environment. There may be differences in test environments between different test queues. In order to reduce the impact of the task execution environment on the time consumption of task execution during task execution, the corresponding test environment can be configured for the test queue when executing this step. There is no limitation on how to determine the test background of the test queue. When the number of tasks to be executed meets the threshold, the general configuration information of the tasks to be executed can be extracted as the test background. There is no limitation on the threshold, and it can be three, five or even more. The specific setting can be made by those skilled in the art.
[0060] See also Figure 2 , Figure 2 A schematic diagram of the parallel task scheduling results provided in an embodiment of the present application shows that there are 12 tasks to be executed with different execution times. According to the method described in this embodiment, they can be divided into four test queues, which are numbered in sequence as test queue 1, test queue 2, test queue 3 and test queue 4. The tasks to be executed with the longest execution time of the current task are obtained in turn, and 37 (indicating task execution time, synonymous below), 31, 25 and 21 are obtained respectively. At this time, test queue 4, which has the shortest total execution time of the current test queue task, takes precedence in obtaining the task to be executed with the longest execution time of the current task, that is, the task to be executed corresponding to 17. After the second round of task acquisition is completed, test queue 4 is still the test queue with the shortest total execution time of the current test queue task. Therefore, the task to be executed with the longest execution time of the current task, that is, the task to be executed corresponding to 7, is obtained. It can be seen that the execution time of test queue 1, test queue 2, test queue 3 and test queue 4 are 46, 44, 41 and 45 respectively, which achieves relative balance of execution time between the test queues and also makes resource utilization relatively balanced.
[0061] During the task execution process, if each pending task is completed, the pending task with the longest execution time is obtained, even if a task execution exception occurs and the actual task execution time is extended, the task scheduling balance can still be achieved. Figure 3 , Figure 3 This is a schematic diagram of the parallel task scheduling delay results provided in an embodiment of the present application. If the actual task execution time of the second task to be executed in test queue 3 becomes 16, and it is sorted from short to long, the total task execution time of test queue 3 will change from the second to the third when it obtains the task to be executed next time. When it obtains the task for the third time, it can only obtain the task to be executed with a task execution time of 4. At this time, the execution time of test queue 1, test queue 2, test queue 3 and test queue 4 are 46, 45, 45 and 45 respectively, which does not affect the realization of balanced task scheduling.
[0062] The embodiment of the present application configures the test queue so that the test queue obtains the tasks to be executed in sequence according to the total execution time of its own existing tasks each time it obtains the tasks to be executed, ensuring that the total time of the tasks to be executed by each test queue is relatively balanced, ensuring resource utilization during the test process, reducing task execution time, and improving task execution efficiency.
[0063] Based on the above embodiment, as a preferred embodiment, this embodiment handles unknown pending tasks whose execution time is unknown. The specific solution may include the following steps:
[0064] If the number of unknown tasks to be executed is greater than the threshold, the unknown tasks to be executed are evenly distributed to each test queue according to the number of tasks;
[0065] If the number of unknown tasks to be executed is less than the quantity threshold, the unknown tasks to be executed are added to the end of the test queue with the shortest total execution time of the current task.
[0066] This embodiment requires appropriate handling due to the number of unknown pending tasks. If the number is less than the quantity threshold, the tasks can be directly added to the end of the test queue with the shortest total execution time for the current task. If the number is greater than the quantity threshold, the tasks are relatively evenly distributed to the end of each test queue according to the number of test queues. The quantity threshold is not limited here and can be specifically set by those skilled in the art based on the total number of pending tasks to be tested and the number of unknown pending tasks.
[0067] In the above embodiment, each task to be executed is considered to be based on the same or similar test scenario, that is, the test scenario requirements for the task to be executed are similar or the same. As a preferred embodiment, if the task to be executed includes at least two different test scenarios, it also includes:
[0068] S201: In each of the test scenarios, select a to-be-executed task that is suitable for the test scenario and execute the parallel task scheduling method according to claim 1 to obtain a plurality of test queues in each of the test scenarios; wherein the number of test queues in each of the test scenarios is the same;
[0069] S202: sorting the test queues in each test scenario according to the task execution time, and sequentially obtaining a test queue in the next test scenario that has the shortest total task execution time after being combined with the test queue in order from the longest to the shortest time, to obtain a combined queue;
[0070] S203: Using the combined queue as the test queue, re-performing the step of sorting the test queues from longest to shortest in terms of the time consumption to sequentially obtain a test queue with the shortest total task execution time after combining with the combined queue in the next test scenario, until the test queues of all the test scenarios are combined to obtain a scheduling queue;
[0071] S204: Execute the tasks to be executed in sequence according to the scheduling queue.
[0072] Although there are different test scenarios for the tasks to be executed, the test equipment used is the same, that is, the same equipment is used to process the tasks to be executed. Therefore, in each test scenario, the number of test queues is the same.
[0073] According to the process of the above embodiment, a test queue is generated for each test scenario, so that several test queues under different test scenarios can be obtained, and then the test queues under different test scenarios are combined or connected. The specific combination method depends on the order of the total task execution time of the test queues in the first test scenario. If the test queues in the first test scenario are combined in order of execution time from long to short, then when combining the test queues in the next test scenario, the test queue with the shortest total task execution time after combination is selected. Conversely, if the test queues in the first test scenario are combined in order of execution time from short to long, then when combining the test queues in the next test scenario, the test queue with the longest total task execution time after combination is selected. After all test scenarios are combined, a scheduling queue is obtained.
[0074] It should be noted that the test scenario in this embodiment is not equivalent to the test environment in the above embodiment. The test environment in the above embodiment can be regarded as different processes under the same test scenario, and the automated execution of tasks to be executed can be realized in parallel.
[0075] The embodiment can realize global resource usage balance when the to-be-executed tasks are scheduled by different test scenarios. A preferred execution manner can configure a dedicated test service in each test queue, and the test service obtains a to-be-executed task with the longest current task duration from the service for managing test tasks. At this time, the execution of the test task is a single-queue multi-processor model, and the longest task priority strategy described above can ensure load balance on each test environment, thereby maximizing resource utilization.
[0076] Reference Figure 4 and Figure 5 , Figure 4 A structure diagram of a double-test-scenario three-test-environment provided by the embodiment of the application, Figure 5 To apply the embodiment of the application to Figure 4 A generation diagram of a scheduling queue obtained by combining the corresponding test queues, Figure 4 In the embodiment, two test scenarios, i.e., test scenario 1 and test scenario 2, are included, and six to-be-executed tasks are included. Three test queues can be obtained according to the steps of the above embodiment. Similarly, three test queues can also be obtained for test scenario 2. Test queue 1-1, 1-2, and 1-3 are in the order of task execution duration from short to long. Test queue 1-1 should combine the test queue with the longest task execution duration in test scenario 2, i.e., test queue 2-1, to satisfy the longest total task execution duration after combination. Finally, three scheduling queues shown in FIG. 6 can be obtained, and the duration of each scheduling queue is 29, which realizes the maximum utilization of global resources. Figure 5 The duration of each scheduling queue is 29, which realizes the maximum utilization of global resources.
[0077] Reference Figure 6 , Figure 6 A structure diagram of a parallel task scheduling system provided by the embodiment of the application. The parallel task scheduling system disclosed by the embodiment can be cross-referenced with the parallel task scheduling method described above. The application also provides a parallel task scheduling system, which comprises:
[0078] A task acquisition module configured to acquire to-be-executed tasks and determine the number of test environments of the to-be-executed tasks. The task execution duration of each to-be-executed task is known.
[0079] A test queue generation module configured to take each test environment as a test queue and determine the initial order between each test queue.
[0080] A task scheduling module configured to acquire a to-be-executed task with the longest current duration from each test queue in turn according to the initial order, determine a current order according to the order of task execution duration of each test queue from short to long, and acquire a to-be-executed task with the longest current duration in turn according to the current order.
[0081] The task processing module is used to execute each of the tasks to be executed using the test queue.
[0082] Based on the above embodiment, as a preferred embodiment, the task processing module includes:
[0083] A background determination unit, configured to determine the test background corresponding to each of the test queues;
[0084] An environment configuration unit is used to configure a test environment according to the test background, and execute the tasks to be executed included in the corresponding test queue in the test environment.
[0085] Based on the above embodiment, as a preferred embodiment, the background determination unit is a unit configured to extract the general configuration information of the tasks to be executed and obtain the test background when the number of the tasks to be executed meets a threshold.
[0086] Based on the above embodiment, as a preferred embodiment, it also includes:
[0087] A task merging module is used to merge the first test task and the second test task as the target task to be executed if there is a task dependency relationship between the first test task and the second test task, and the first test task corresponds to a first execution time and the second test task corresponds to a second execution time; the task execution time of the target task to be executed is the sum of the first execution time and the second execution time.
[0088] Based on the above embodiment, as a preferred embodiment, it also includes:
[0089] An unknown task scheduling module is configured to, upon receiving unknown tasks to be executed whose execution time is unknown, evenly distribute the unknown tasks to be executed to each of the test queues according to the number of tasks if the number of the unknown tasks to be executed is greater than a quantity threshold;
[0090] If the number of the unknown tasks to be executed is less than the number threshold, the unknown tasks to be executed are added to the end of the test queue with the shortest total execution time of the current task.
[0091] Based on the above embodiment, as a preferred embodiment, it also includes:
[0092] The global scheduling module is used to perform the following steps:
[0093] If the tasks to be executed include several different test scenarios, in each of the test scenarios, the tasks to be executed that are suitable for the test scenario are selected to execute the above-mentioned parallel task scheduling method to obtain several test queues in each of the test scenarios; wherein the number of test queues in each of the test scenarios is the same;
[0094] The test queues in each test scenario are sorted according to the task execution time, and each test queue is sorted from longest to shortest according to the time consumption, and a test queue in the next test scenario with the shortest total task execution time after being combined with the test queue is obtained to obtain a combined queue;
[0095] The combined queue is used as the test queue, and the step of sorting the test queues from longest to shortest in terms of the time consumption is repeated to obtain a test queue with the shortest total task execution time after being combined with the test queue in the next test scenario, until the test queues of all the test scenarios are combined to obtain a scheduling queue;
[0096] The tasks to be executed are executed in sequence according to the scheduling queue.
[0097] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, can implement the steps of the method provided in the above embodiment. The storage medium may include: a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which can store program code.
[0098] The present application also provides a terminal, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, the steps of the method provided in the above embodiment can be implemented. Of course, the terminal may also include various network interfaces, power supplies and other components. Figure 7 , Figure 7 This is a structural diagram of a terminal provided in an embodiment of the present application. The terminal in this embodiment may include: a processor 2101 and a memory 2102.
[0099] Optionally, the terminal may further include a communication interface 2103 , an input unit 2104 , a display 2105 , and a communication bus 2106 .
[0100] The processor 2101 , the memory 2102 , the communication interface 2103 , the input unit 2104 , and the display 2105 all communicate with each other via the communication bus 2106 .
[0101] In the embodiment of the present application, the processor 2101 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a readily available programmable gate array, or other programmable logic devices.
[0102] The processor may call a program stored in the memory 2102. Specifically, the processor may execute the operations executed by the terminal in the above embodiment.
[0103] The memory 2102 is used to store one or more programs. The programs may include program codes, and the program codes include computer operating instructions. In the embodiment of the present application, the memory stores at least a program for implementing the following functions:
[0104] Obtaining tasks to be executed and determining the number of test environments for the tasks to be executed; wherein the execution time of each task to be executed is known;
[0105] Taking each test environment as a test queue and determining an initial order between the test queues;
[0106] Each of the test queues sequentially obtains a task to be executed that currently takes the longest time according to the initial sorting, determines a current sorting according to the order of the execution time of the tasks corresponding to each of the test queues from shortest to longest, and sequentially obtains a task to be executed that currently takes the longest time according to the current sorting;
[0107] The test queue is used to execute each of the tasks to be executed.
[0108] In one possible implementation, the memory 2102 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function, etc.; the data storage area may store data created during the use of the computer.
[0109] In addition, the memory 2102 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0110] The communication interface 2103 may be an interface of a communication module, such as an interface of a GSM module.
[0111] The present application may further include a display 2105 and an input unit 2104 and the like.
[0112] Figure 7 The structure of the terminal shown does not constitute a limitation on the terminal in the embodiment of the present application. In actual applications, the terminal may include Figure 7 More or fewer components than shown, or combinations of certain components.
[0113] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems provided in the embodiments, since they correspond to the methods provided in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0114] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core ideas of this application. It should be noted that for those skilled in the art, without departing from the principles of this application, various improvements and modifications can be made to this application, and such improvements and modifications also fall within the scope of protection of the claims of this application.
[0115] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
Claims
1. A parallel task scheduling method, characterized in that: include: Obtaining tasks to be executed and determining the number of test environments for the tasks to be executed; wherein the execution time of each task to be executed is known; Taking each test environment as a test queue and determining an initial order between the test queues; Each of the test queues sequentially obtains a task to be executed that currently takes the longest time according to the initial sorting, determines a current sorting according to the order of the execution time of the tasks corresponding to each of the test queues from shortest to longest, and sequentially obtains a task to be executed that currently takes the longest time according to the current sorting; Utilizing the test queue to execute each of the tasks to be executed; If the task to be performed includes several different test scenarios, it also includes: In each of the test scenarios, tasks to be executed that are suitable for the test scenario are selected to obtain a plurality of test queues in each of the test scenarios; wherein the number of test queues in each of the test scenarios is the same; The test queues in each test scenario are sorted according to the task execution time, and each test queue is sorted from longest to shortest according to the time consumption, and a test queue in the next test scenario with the shortest total task execution time after being combined with the test queue is obtained to obtain a combined queue; The combined queue is used as the test queue, and the step of sorting the test queues from longest to shortest in terms of the time consumption is repeated to obtain a test queue with the shortest total task execution time after being combined with the test queue in the next test scenario, until the test queues of all the test scenarios are combined to obtain a scheduling queue; The tasks to be executed are executed in sequence according to the scheduling queue.
2. The parallel task scheduling method according to claim 1, characterized in that: Utilizing the test queue to execute each of the tasks to be executed includes: Determining the test context corresponding to each of the test queues; The test environment is configured according to the test background, and the tasks to be executed included in the corresponding test queue are executed in the test environment.
3. The parallel task scheduling method according to claim 2, characterized in that: Determining the test context corresponding to each of the test queues includes: When the number of the tasks to be executed meets a threshold, general configuration information of the tasks to be executed is extracted to obtain the test background.
4. The parallel task scheduling method according to claim 1, characterized in that: Also includes: If there is a task dependency relationship between the first test task and the second test task, and the first test task corresponds to the first execution time and the second test task corresponds to the second execution time, the first test task and the second test task are merged as the target task to be executed; the task execution time of the target task to be executed is the sum of the first execution time and the second execution time.
5. The parallel task scheduling method according to claim 1, characterized in that: If an unknown pending task is received and the execution time is unknown, it also includes: If the number of the unknown tasks to be executed is greater than the number threshold, the unknown tasks to be executed are evenly distributed to each of the test queues according to the number of tasks; If the number of the unknown tasks to be executed is less than the number threshold, the unknown tasks to be executed are added to the end of the test queue with the shortest total execution time of the current task.
6. A parallel task scheduling system, characterized in that: include: A task acquisition module is used to acquire tasks to be executed and determine the number of test environments for the tasks to be executed; wherein the execution time of each task to be executed is known; A test queue generation module, configured to use each test environment as a test queue and determine an initial order among the test queues; A task scheduling module is used for each of the test queues to sequentially obtain a task that currently takes the longest time to execute according to the initial sorting, determine the current sorting according to the order of the execution time of the tasks corresponding to each of the test queues from shortest to longest, and sequentially obtain a task that currently takes the longest time to execute according to the current sorting; A task processing module, configured to execute each of the tasks to be executed using the test queue; A global scheduling module is used for selecting tasks to be executed that are suitable for the test scenario in each test scenario if the tasks to be executed include several different test scenarios, and obtaining several test queues in each test scenario; wherein the number of test queues in each test scenario is the same; sorting the test queues in each test scenario according to the task execution time, and sorting each test queue from long to short according to the time consumption in turn to obtain a test queue with the shortest total task execution time after combining with it in the next test scenario, to obtain a combined queue; using the combined queue as the test queue, re-executing the step of sorting each test queue from long to short according to the time consumption in turn to obtain a test queue with the shortest total task execution time after combining with it in the next test scenario, until the test queues of all the test scenarios are combined to obtain a scheduling queue; and executing the tasks to be executed in turn according to the scheduling queue.
7. The parallel task scheduling system according to claim 6, characterized in that: The task processing module includes: A background determination unit, configured to determine the test background corresponding to each of the test queues; An environment configuration unit is used to configure a test environment according to the test background, and execute the tasks to be executed included in the corresponding test queue in the test environment.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the parallel task scheduling method according to any one of claims 1 to 5 are implemented.
9. A terminal, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of the parallel task scheduling method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Distribution method and device for scan task
CN102722417A