CN110287008B - Test task scheduling method and device and electronic equipment - Google Patents
Test task scheduling method and device and electronic equipment Download PDFInfo
- Publication number
- CN110287008B CN110287008B CN201910428021.6A CN201910428021A CN110287008B CN 110287008 B CN110287008 B CN 110287008B CN 201910428021 A CN201910428021 A CN 201910428021A CN 110287008 B CN110287008 B CN 110287008B
- Authority
- CN
- China
- Prior art keywords
- test
- machine
- subtask
- scheduled
- individual
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 749
- 238000000034 method Methods 0.000 title claims abstract description 73
- 230000035772 mutation Effects 0.000 claims description 41
- 230000004083 survival effect Effects 0.000 claims description 31
- 238000004364 calculation method Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012216 screening Methods 0.000 claims description 3
- 238000004422 calculation algorithm Methods 0.000 description 13
- 230000002068 genetic effect Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000002776 aggregation Effects 0.000 description 2
- 238000004220 aggregation Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 1
- 238000010845 search algorithm Methods 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/004—Artificial life, i.e. computing arrangements simulating life
- G06N3/006—Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/484—Precedence
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Debugging And Monitoring (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The invention relates to the technical field of computers, and provides a test task scheduling method, a test task scheduling device and electronic equipment, so as to solve the problem of low execution efficiency of test tasks. The method comprises the following steps: determining a target test task from a test task set to be scheduled; determining a first machine for executing a first test subtask in the target test task based on the corresponding relation between the machine corresponding to the target test task and the test subtask; a first test sub-task is performed by a first machine. Because the test data of the first test subtask is stored in the first machine in advance, after the first machine is determined, the first machine does not need to download the test data of the first test subtask, and the first test subtask is executed based on the test data of the first test subtask stored in advance by the first machine, so that the test data downloading time is saved, and the task execution efficiency is improved.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a test task scheduling method, a test task scheduling device, an electronic device, and a computer readable storage medium.
Background
With the rapid development of intelligent technology, more and more applications and systems emerge. The user may perform corresponding operations through various applications to implement the relevant functions. After the application development is completed and before the formal online use, testing is needed to ensure that the application can normally run. Since applications can involve various modules, each module needs to be tested, a system-level test task of an application can be understood as being composed of test subtasks of each module in the application, and execution of the test subtasks of each module in the application is completed, and then the system-level test task of the application is considered to be completed.
Currently, a system-level test task scheduling platform may schedule a test task, where the test task may include test subtasks for multiple test modules (i.e., modules to be tested), and all modules in the test task are required to aggregate test data and execution resources (e.g., CPU and memory) required for testing, so that the task can be scheduled. However, in the current process of executing the test subtask corresponding to the test module, the test subtask of the machine for executing the test module is randomly selected from the machine to be selected (the equipment capable of executing the test subtask), and for the test module requiring larger test data, the randomly selected machine needs more time to download the test data in the process of executing the test, so that the execution efficiency of the test subtask is affected, and thus the execution efficiency of the test task is easy to be low.
Disclosure of Invention
The embodiment of the invention provides a test task scheduling method, a test task scheduling device, electronic equipment and a computer readable storage medium, which are used for solving the problem of low execution efficiency of test tasks in the prior art.
In a first aspect, an embodiment of the present invention provides a test task scheduling method, where the method includes:
determining a target test task from a test task set to be scheduled;
determining a first machine for executing a first test subtask in the target test task based on the corresponding relation between the machine corresponding to the target test task and the test subtask, wherein test data of the first test subtask is stored in the first machine in advance;
the first test subtask is performed by the first machine.
Optionally, after the target test task is determined from the set of test tasks to be scheduled, the method further includes:
determining a second machine that performs a second test subtask of the target test tasks;
and downloading test data of the second test subtask through the second machine and executing the second test subtask.
Optionally, the priority of the target test task is higher than the priority of the to-be-scheduled test task, and the to-be-scheduled test task is a test task in the to-be-scheduled test task set except the target test task.
Optionally, before determining the target test task from the set of test tasks to be scheduled, the method further includes:
and determining the priority of each test task to be scheduled in the test task set to be scheduled based on the characteristic parameters of the test task to be scheduled, wherein the characteristic parameters comprise resource characteristic parameters and time length characteristic parameters.
Optionally, before determining the first machine for executing the first test subtask in the target test task based on the correspondence between the machine corresponding to the target test task and the test subtask, the method further includes:
initializing a plurality of individuals to obtain a first population based on a first preset concurrency number of the first test subtask;
calculating the fitness of each individual in the first population;
based on the fitness of each individual in the first population, individual selection is carried out on the first population, and a survival individual group is obtained;
obtaining individuals to be mutated in the survival individual group;
performing mutation treatment on the individuals to be mutated in the survival individual group to determine a mutated population;
and under the condition that the preset termination condition is not met, returning the variant population as the first population to the step of calculating the fitness of each individual in the first population until the preset termination condition is met, and taking the content corresponding to the individual with the largest fitness in the variant population as the corresponding relation between the machine and the test subtask.
Optionally, the calculating the fitness of each individual in the first population includes:
calculating the execution resource conflict degree of each individual according to the first resource and the second resource of each individual; the first resource is the sum of execution resources required by at least one test subtask corresponding to each machine in the individual, and the second resource is the execution resource corresponding to each machine in the individual;
and calculating the fitness of each individual in the first population according to the execution resource conflict degree and the variation cost of each individual.
Optionally, the subjecting the individuals to be mutated in the surviving individual group to mutation treatment to determine a mutated population includes:
determining machines to be mutated in the individuals to be mutated according to the execution resource conflict degree of each machine in the individuals to be mutated;
determining a subtask to be mutated corresponding to the machine to be mutated in the individual to be mutated according to the resource occupation amount of at least one test subtask corresponding to the machine to be mutated in the individual to be mutated;
determining a variation target machine from M machine to be selected according to the execution resource conflict degree of the M machine to be selected; m is an integer greater than or equal to 1;
Changing a machine to be mutated corresponding to the subtask to be mutated in the individual to be mutated into the mutation target machine to obtain a mutated individual;
determining the variant population based on the population of surviving individuals and the variant individuals.
In a second aspect, an embodiment of the present invention further provides a test task scheduling device, including:
the task determining module is used for determining a target test task from the to-be-scheduled test task set;
the first machine determining module is used for determining a first machine for executing a first test subtask in the target test task based on the corresponding relation between the machine corresponding to the target test task and the test subtask, wherein test data of the first test subtask are stored in the first machine in advance;
and the scheduling module is used for executing the first test subtask through the first machine.
Optionally, the apparatus further comprises a second machine determination module;
the second machine determining module is used for determining a second machine for executing a second test subtask in the target test task;
the scheduling module is further configured to download, by the second machine, test data of the second test subtask and execute the second test subtask.
Optionally, the priority of the target test task is higher than the priority of the to-be-scheduled test task, and the to-be-scheduled test task is a test task in the to-be-scheduled test task set except the target test task.
Optionally, the apparatus further includes:
and the task priority determining module is used for determining the priority of each test task to be scheduled in the test task set to be scheduled based on the characteristic parameters of the test tasks to be scheduled, wherein the characteristic parameters comprise resource characteristic parameters and time length characteristic parameters.
Optionally, the apparatus further includes:
the population initializing module is used for initializing a plurality of individuals to obtain a first population based on a first preset concurrency number of the first test subtask;
the fitness calculation module is used for calculating fitness of each individual in the first population;
the screening module is used for selecting the individuals in the first population based on the fitness of each individual in the first population to obtain a survival individual group;
the individual to be mutated is obtained by the individual to be mutated obtaining module, which is used for obtaining the individual to be mutated in the survival individual group;
the mutation module is used for carrying out mutation treatment on the individuals to be mutated in the survival individual group to determine a mutation population;
And the corresponding relation determining module is used for taking the variant population as the first population, returning to the fitness calculating module to execute the calculation of the fitness of each individual in the first population until the preset termination condition is met, and taking the content corresponding to the individual with the largest fitness in the variant population as the corresponding relation between the machine and the test subtask.
Optionally, the fitness calculating module includes:
the individual resource conflict degree calculation module is used for calculating the execution resource conflict degree of each individual according to the first resource and the second resource of each individual; the first resource is the sum of execution resources required by at least one test subtask corresponding to each machine in the individual, and the second resource is the execution resource corresponding to each machine in the individual;
and the individual fitness obtaining module is used for calculating the fitness of each individual in the first population according to the execution resource conflict degree and the variation cost of each individual.
Optionally, the mutation module includes:
the to-be-mutated machine determining module is used for determining to-be-mutated machines in the to-be-mutated individuals according to the execution resource conflict degree of each machine in the to-be-mutated individuals;
The subtask to be mutated determining module is used for determining subtasks to be mutated corresponding to the machine to be mutated in the individual to be mutated according to the resource occupation amount of at least one test subtask corresponding to the machine to be mutated in the individual to be mutated;
the variable target machine determining module is used for determining variable target machines from M to-be-selected machines according to the execution resource conflict degrees of the M to-be-selected machines; m is an integer greater than or equal to 1;
the replacing module is used for replacing the machine to be mutated corresponding to the subtask to be mutated in the individual to be mutated with the mutation target machine to obtain a mutated individual;
and the variant population determining module is used for determining the variant population according to the survival individual group and the variant individuals.
In a third aspect, an embodiment of the present invention further provides an electronic device, including: a memory storing a computer program and a processor implementing the steps in the test task scheduling method as described above when the processor executes the computer program.
In a fourth aspect, embodiments of the present invention also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the test task scheduling method as described above.
In the test task scheduling method, the first machine for executing the first test subtask in the target test task can be determined based on the corresponding relation between the machine corresponding to the target test task and the test subtask. Because the test data of the first test subtask is stored in the first machine in advance, after the first machine is determined, the first test subtask can be executed through the first machine, the first machine does not need to download the test data of the first test subtask, the first test subtask is executed based on the test data of the first test subtask which is stored in advance locally, the download time of the test data of the first test subtask is saved, the execution time of the first test subtask is shortened, and therefore the execution efficiency of the target test task is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
FIG. 1 is one of the flowcharts of a test task scheduling method provided by an embodiment of the present invention;
FIG. 2 is a second flowchart of a test task scheduling method according to an embodiment of the present invention;
FIG. 3 is one of the schematic diagrams of the test task scheduling method provided by the embodiment of the invention;
FIG. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, in one embodiment, a test task scheduling method is provided, applicable to a task scheduling platform (the task scheduling platform may include an electronic device), including:
s101: and determining a target test task from the test task set to be scheduled.
And scheduling the test tasks, and executing the test tasks through a machine, wherein the test tasks to be scheduled can be understood as the test tasks to be executed. The to-be-scheduled test task set comprises at least one to-be-scheduled test task, and the to-be-scheduled test tasks in the to-be-scheduled test task set can be scheduled through the task scheduling platform so as to execute the to-be-scheduled test tasks. In the task scheduling process, a target test task is first determined from a to-be-scheduled test task set, namely, a test task to be executed is determined, and after a machine for executing test subtasks in the target test task is subsequently determined, the corresponding test subtasks can be executed through the determined machine, so that the execution of the target test task is completed.
S102: and determining a first machine for executing a first test subtask in the target test task based on the corresponding relation between the machine corresponding to the target test task and the test subtask.
The test data of the first test subtask are stored in the first machine in advance. The corresponding relation between the machine corresponding to the target test task and the test subtask is determined in advance, and the test data of the test subtask in the corresponding relation between the machine and the test subtask is stored in the corresponding machine in advance. After the target test task is determined from the set of test tasks to be scheduled, a first machine for executing a first test subtask in the target test task can be determined based on the corresponding relation between the machine and the test subtask. The target test task comprises a plurality of test subtasks, for example, a first test subtask and a second test subtask, wherein the first test subtask has a corresponding machine in the corresponding relation between the machine and the test subtask, the required test data is stored in the corresponding machine in advance, and the first machine for executing the first test subtask can be determined from the corresponding relation between the machine and the first test subtask. Wherein, the execution resource (usable resource) of the first machine is greater than or equal to the execution resource required by the first test subtask. If a first machine correspondingly executes at least one first test subtask, the execution resources of the first machine are larger than or equal to the sum of the execution resources required by the at least one first test subtask correspondingly executed.
For example, the target test task includes a test subtask a, a test subtask b, and a test subtask c, in which, in the correspondence between the machine and the test subtask, the machine 1 corresponds to the test subtask a, the machine 2 corresponds to the test subtask b, and the machine 3 corresponds to the test subtask c. Test data for test subtask a is stored in machine 1 and machine 2, respectively, test data for test subtask b is stored in machine 2, and test data for test subtask c is stored in machine 3. The first test subtask of the target test task is a test subtask a, and in the correspondence between the machine and the test subtask, a first machine for executing the test subtask a may be determined in the machine 1 and the machine 2 corresponding to the test subtask a, for example, if the execution resource of the machine 1 is greater than or equal to the execution resource required for executing the test subtask a, the machine 1 may be used as the first machine for executing the test subtask a. For another example, if the execution resources of both the machine 1 and the machine 2 are greater than or equal to the execution resources required to execute the test subtask a, either one of the machine 1 and the machine 2 may be selected as the first machine to execute the test subtask a.
If the first test subtask of the target test task includes a test subtask a and a test subtask b, the first machine for executing the test subtask a can be determined from the machines 1 and 2 corresponding to the test subtask a, and if the machine corresponding to the test subtask b is the machine 2 in the corresponding relation between the machines and the test subtask a, the machine 2 can be determined as the first machine for executing the test subtask b, the execution resource of the machine 2 is greater than or equal to the execution resource required for executing the test subtask b, and if the machine 2 is determined as the first machine for executing the test subtask a, the execution resource of the machine 2 is greater than or equal to the sum of the execution resources required for the test subtask a and the test subtask b. In this way, it is ensured that machine 2 has sufficient execution resources to perform test subtask b. At this point, it will be appreciated that the first machine of the first test subtask includes a first machine that performs test subtask a and a first machine that performs test subtask b.
S103: a first test sub-task is performed by a first machine.
After the first machine is determined, the first test subtask can be distributed to the first machine, and the first test subtask is executed through the first machine. Because the test data of the first test subtask is stored in the first machine in advance, the download of the test data of the first test subtask is not needed in the execution process of the first test subtask in the target test task, the execution time is shortened, and the test efficiency is improved.
In the test task scheduling method, the first machine for executing the first test subtask in the target test task can be determined based on the corresponding relation between the machine corresponding to the target test task and the test subtask. Because the test data of the first test subtask is stored in the first machine in advance, after the first machine is determined, the first test subtask can be executed through the first machine, the first machine does not need to download the test data of the first test subtask, the first test subtask is executed based on the test data of the first test subtask which is stored in advance locally, the download time of the test data of the first test subtask is saved, the execution time of the first test subtask is shortened, and therefore the execution efficiency of the target test task is improved. Meanwhile, the corresponding relation between the machine and the test subtask can be predetermined without determining the corresponding relation between the machine and the test subtask on line, when the test task is scheduled on line, the first machine for executing the first test subtask in the target test task is determined through the corresponding relation between the machine corresponding to the target test task and the test subtask, the first machine can be used for executing the first test subtask, the problem that the corresponding relation between the machine and the test subtask is determined on line and the time is long is avoided, and the real-time requirement of the test task scheduling can be met.
In one embodiment, after the determining the target test task from the set of test tasks to be scheduled, the method further includes: determining a second machine that performs a second test subtask of the target test tasks; and downloading test data of the second test subtask through the second machine and executing the second test subtask.
Since the target test subtask may include a second test subtask in addition to the first test subtask, a second machine that executes the second test subtask in the target test task may also be determined. The execution resources of the second machines are greater than or equal to the execution resources required by the second test subtasks, and if at least one second test subtask is executed on one second machine, the execution resources of the second machines are greater than or equal to the sum of the execution resources required by at least one second test subtask correspondingly executed. For example, machines 4 and 5 may have sufficient execution resources that machines 4 and 5 do not belong to a machine in the correspondence of a machine corresponding to a target test task and a test sub-task, and after determining the target test task, a second machine executing a second test sub-task may be determined in machines 4 and 5. For example, if the second test subtask is the test subtask d, one machine may be arbitrarily selected from the machines 4 and 5 as the second machine for executing the second test subtask, and the execution resources of the selected machine are greater than or equal to the execution resources required by the test subtask d, for example, the machine 4 may be selected as the second machine for executing the test subtask d.
For another example, the second test subtask includes a test subtask d and a test subtask e, and then one machine may be arbitrarily selected from the machines 4 and 5 as the second machine for executing the test subtask d and one machine may be arbitrarily selected as the second machine for executing the test subtask e, and the second machine for executing the test subtask d and the second machine for executing the test subtask e may be the same, for example, the machine 4, but the execution resources of the machine 4 are greater than or equal to the sum of the execution resources required by the test subtask d and the test subtask e. The second machine performing the test subtask d and the second machine performing the test subtask e may be different, for example, machine 4 is the second machine performing the test subtask d, machine 5 is the second machine performing the test subtask e, the execution resources of machine 4 are greater than or equal to the execution resources required by the test subtask d, and the execution resources of machine 5 are greater than or equal to the execution resources required by the test subtask e.
After the second machine is determined, the second test task can be distributed to the second machine, and the second test subtask is executed through the second machine, wherein the second machine downloads the test data of the second test subtask and then executes the task, for example, a download address of the test data of the second test subtask can be provided for the second machine, and the second machine downloads the test data according to the download address. The test data of the second test subtask can be prevented from being stored in the second machine to occupy the resources of the second machine, and the second machine is stressed to influence the task execution of the second machine.
In this embodiment, after determining the first machine and the second machine, the first test subtask may be allocated to the first machine for executing, and the second test task may be allocated to the second machine for executing, where the second machine downloads the test data of the second test subtask and then executes the task, the test data of the first test subtask is stored in the first machine in advance, and in the task execution process, no download of the test data is required, thereby reducing execution time and improving test efficiency.
In one example, the first test subtask is a test subtask that the amount of corresponding test data in a plurality of test subtasks included in the target test task is larger than the preset data amount, which can be understood as a large test data subtask, larger test data is needed, and in order to avoid the influence on the execution efficiency caused by the downloading of the larger test data, the corresponding test data can be prestored in a corresponding machine in the corresponding relation between the machine and the test subtask. The second test subtask is a test subtask of which the corresponding test data amount is smaller than or equal to the preset data amount in a plurality of test subtasks included in the target test task, and can be understood as a small test data subtask, and the second machine only needs to spend less time to download the test data and execute the task.
In one embodiment, the intersection of the first machine and the second machine is empty, i.e., if the number of the first machine and the second machine is one, it indicates that the first machine is different from the second machine, and if the number of the first machine or the second machine is at least two, it indicates that the first machine and the second machine are not identical. Therefore, the first machine for executing the first test subtask can be ensured not to execute the second test subtask, and it can be understood that the first machine belongs to a machine in the corresponding relation between the machine corresponding to the target test task and the test subtask, and the second machine does not belong to a machine in the corresponding relation between the machine corresponding to the target test task and the test subtask, namely, the second test subtask is not allowed to be distributed to the first machine, so that the resource competition of the second test subtask to the first machine for executing the first test subtask is avoided, the resource preemption of the first machine is avoided, the execution efficiency of the first test subtask is ensured, the overall throughput is improved, the task queuing time is shortened, the execution efficiency of the overall task is improved, and the corresponding product delivery cycle is shortened.
In one embodiment, determining a first machine to execute a first test sub-task of the target test tasks includes: if N first target machines meeting the first preset requirement exist, determining the first machines from the N first target machines; wherein N is a positive integer greater than or equal to 1. The first preset requirement comprises a machine corresponding to the first test subtask in the corresponding relation between the machine and the test subtask, and the execution resource is greater than or equal to the resource required by the first test subtask.
The first target machine is a machine corresponding to the first test subtask in the corresponding relation between the machine and the test subtask, and the execution resource of the first target machine is greater than or equal to the execution resource required by the first test subtask. In the corresponding relation between the machine and the test subtask, if the first test subtask corresponds to at least one machine and all meet the first preset requirement, one of N first target machines meeting the first preset requirement can be arbitrarily selected as the first machine of the first test subtask. For the case that there are a plurality of first test subtasks, the corresponding first machine can be determined for each first test subtask through the above process.
In one embodiment, the priority of the target test task is higher than the priority of the pending test task, which is a test task in the set of test tasks to be scheduled other than the target test task.
The test tasks with higher priority in the set of test tasks to be scheduled are used as target test tasks, and then test subtasks in the target test tasks can be executed to complete execution of the target test tasks. The tasks are not scheduled according to the sequence from beginning to end, but are scheduled according to the priority of the test tasks, so that the problem that the overall scheduling efficiency is influenced due to long time spent for collecting the required execution resources under the condition that the test subtasks with larger execution resources exist in the prior test tasks is avoided, and the overall task scheduling efficiency is improved.
In one embodiment, before determining the target test task from the set of test tasks to be scheduled, the method further comprises:
and determining the priority of each test task to be scheduled in the test task set to be scheduled based on the characteristic parameters of the test tasks to be scheduled, wherein the characteristic parameters comprise resource characteristic parameters and time length characteristic parameters.
Certain execution resources are required for executing the test tasks, and the required execution resources are different for different test tasks (for example, the size of required test data is different or the test process is different), for example, the larger the test data is, the larger the required execution resources are. Different test tasks, the resources that can be collected at present are also different (different test tasks, the corresponding relation between the machine and the test subtasks is different, the corresponding selectable machine is different, and thus the resources that can be collected by the test subtasks are different). In addition, the corresponding waiting time period is different for different test tasks. Therefore, in this embodiment, the priority of the test task to be scheduled is determined according to the resource characteristic parameter and the time length characteristic parameter of the test task to be scheduled, and the target test task is determined according to the priority, so that reasonable scheduling of the task can be ensured, and overall scheduling efficiency and overall execution efficiency are improved.
In one example, the resource characteristic parameters may include a resource bundling rate and a required execution resource duty cycle, and the duration characteristic parameters may include a wait duration duty cycle. The priority of the test task to be scheduled is proportional to the occupation of waiting time length and the resource alignment rate, and is inversely proportional to the required execution resources. When the test tasks to be scheduled need less execution resources, the resource aggregation rate is high, and the tasks can be scheduled preferentially, so that the average queuing time of the tasks is shortened, and the overall execution efficiency is improved. When the number of execution resources required by the test tasks to be scheduled is large, the resource aggregation rate is low, and the longest queuing time can be controlled by increasing the waiting time. In the process of determining the priority, the requirement of executing resources, waiting time of tasks and resource alignment are comprehensively considered, so that the situation that small test data test subtasks meet the seam and insert pins, large test data test subtasks cannot align resources for a long time, and the queuing time is severely differentiated.
In one example, the formula for determining the priority of a test task to be scheduled is:
wherein i is more than or equal to 1 and less than or equal to n, n is the total number of the test tasks to be scheduled in the set of the test tasks to be scheduled, U i For the i-th priority of test task to be scheduled, J i Resource alignment rate X for ith test task to be scheduled i For the required execution resource duty ratio, T, of the ith test task to be scheduled i The waiting time duty ratio of the ith test task to be scheduled is aThe first preset coefficient, b is the second preset coefficient, and c is the third preset coefficient.
Wherein, the resource alignment rate J of the ith test task to be scheduled i The calculation formula of (2) is as follows:
wherein lambda is a fourth preset coefficient S1 i For the CPU resource that the ith test task to be scheduled can apply to (i.e. the sum of the CPU resources required by m1 test subtasks in the ith test task to be scheduled, where m1 test subtasks represent the test subtasks that can apply to the CPU resources and that the applied CPU resources are equal to the CPU resources required by the test subtasks themselves, m1 is an integer greater than or equal to zero, and when zero is 0, it means that no test subtask in the ith test task to be scheduled can apply to the CPU resources equal to the required CPU resources at present), Z1 i For the CPU resource required by the ith test task to be scheduled (i.e. the sum of the CPU resources required by a plurality of test subtasks in the ith test task to be scheduled), S2 i For the memory resource that the ith test task to be scheduled can apply to (i.e. the sum of the memory resources required by m2 test subtasks in the ith test task to be scheduled, where m2 test subtasks represent test subtasks that can apply to memory resources and that apply to memory resources equal to the memory resources required by the test subtasks themselves, m2 is an integer greater than or equal to zero, and zero indicates that no test subtask in the ith test task to be scheduled can apply to memory resources equal to the required memory resources at present), Z2 i And (3) the memory resource required by the ith test task to be scheduled.
The required execution resource duty ratio X of the ith test task to be scheduled i The calculation formula of (2) is as follows:
wherein, beta is a fifth preset coefficient, L1 is the CPU resource required by the test task to be scheduled with the largest CPU resource required in the test task set to be scheduled, and L2 is the CPU resource required by the test task to be scheduled with the largest memory resource required in the test task set to be scheduled.
The waiting time length of the ith test task to be scheduled is duty ratio T i The calculation formula of (2) is as follows:
wherein t is i For the waiting time length (in minutes) of the ith test task to be scheduled, t h For a preset duration, for example, 30 minutes may be used.
In an embodiment, in the test task scheduling method, after determining the target test task from the set of test tasks to be scheduled, the method further includes: if the target test task is not scheduled within the preset time length, the priority of each test task to be scheduled in the set of test tasks to be scheduled is determined again. And determining a target test task according to the priority of each test task to be scheduled in the updated test task set to be scheduled, and updating the target test task. The problem that the overall task execution efficiency is low due to the fact that the waiting time of the target test task is too long to influence the subsequent task scheduling can be avoided, priority determination is conducted again, the target test task is determined again according to the updated priority, and the task execution efficiency is improved.
Referring to fig. 2, in one embodiment, before determining the first machine that executes the first test subtask in the target test task based on the correspondence between the machine corresponding to the target test task and the test subtask, the method further includes:
s201: and initializing a plurality of individuals to obtain a first population based on a first preset concurrency number of the first test subtask.
In this embodiment, the corresponding relationship between the machine corresponding to the target test task and the test subtask is determined by a genetic algorithm. The genetic algorithm is a heuristic search algorithm, the problem to be solved is to simulate a biological evolution process, individuals with lower fitness are gradually eliminated through copying, crossing, mutation and other operations, individuals with high fitness are increased, the chance that individuals with high fitness are heritable to the next generation is high, and thus individuals with high fitness may be evolved. In this embodiment, one individual in the genetic algorithm represents a correspondence between a machine and a test subtask, that is, one individual represents a deployment scheme of the machine and the test subtask, which may also be understood as that the content corresponding to one individual is a correspondence between the machine and the test subtask.
Specifically, a plurality of individuals are initialized to obtain a first population, wherein the first population comprises the plurality of individuals, and the first preset concurrence number is determined based on historical task data. As can be seen from the historical task data (executed task data), the plurality of tasks may include the same first test subtask, and if the plurality of tasks are executed simultaneously, the same number of test data of the same first test subtask as the number of the plurality of tasks is required, that is, the same test data of the same first test subtask is to be stored in a plurality of machines in advance, so that under the condition that the plurality of tasks are executed simultaneously, the test data of the same first test subtask of each task is ensured to be valid and sufficient. The preset concurrency number is the number of pre-stored copies, and the first preset concurrency number is the number of pre-stored copies of the test data of the first test subtask. The corresponding relation between the machine and the test subtask in the individual comprises a plurality of machine and test subtask pairs, and the number of the machine and test subtask pairs is a first preset concurrency number. If the number of the first test subtasks is a plurality, namely at least two, each first test subtask has a corresponding first preset concurrency number, and the number of the machine and test subtasks in the individual is the sum of the first preset concurrency numbers. That is, in the process of determining the correspondence between the machine and the test subtask, the embodiment considers the pre-distribution number (the pre-distribution number of test data) actually required by the corresponding history of the first test subtask, avoids the resource competition of the second test subtask on the first machine which stores the test data of the first test subtask in advance, and improves the efficiency of executing resources required by collecting the first test resource.
For example, the first test subtask is a test subtask a, which can be depended on by 3 test tasks at most, when 3 test tasks are executed simultaneously, the test data of the test subtask a is stored in 3 different machines in advance, and the first preset concurrency number is 3. When initializing individuals, the number of machine and test subtask pairs in the corresponding relation between the machine and the test subtask in each individual is 3, namely the test task a is respectively paired with 3 different machines. For another example, the first test subtask includes a test subtask a and a test subtask b, the test subtask a can be relied on by 3 test tasks at most, when the 3 test tasks are executed simultaneously, the test subtask a needs to be executed, the test data of the test subtask a are stored in 3 different machines in advance, and the first preset concurrency number corresponding to the test subtask a is 3. The test subtask b can be depended on 2 test tasks at maximum, when 2 test tasks are executed simultaneously, the test subtask b needs to be executed, the test data of the test subtask b are stored in 2 different machines in advance, and the first preset concurrency number corresponding to the test subtask b is 2. When initializing individuals, the number of machine and test subtask pairs in the corresponding relation between the machine and the test subtask in each individual is 5, namely the test task a is respectively paired with 3 different machines and the test task is respectively paired with 2 different machines.
S202: the fitness of each individual in the first population is calculated.
After initializing individuals to obtain the population, the fitness of each individual can be calculated, and the fitness of each individual is evaluated according to the fitness of the individuals in a genetic algorithm, so that the genetic opportunity of each individual is determined.
S203: and selecting the individuals in the first population based on the fitness of each individual in the first population to obtain a survival individual group.
And selecting the first population according to the fitness of the individuals (the selection of the individuals is carried out through a roulette algorithm, which is also called a proportion selection algorithm), wherein the probability of each individual being selected is proportional to the fitness of each individual, so as to obtain a survival individual group, and the survival individual group comprises the individuals selected from the first population. The greater the fitness of the individuals in the first population, the greater the probability of being selected, i.e., the probability of being selected is proportional to the fitness.
S204: obtaining individuals to be mutated in a survival individual group;
s205: carrying out mutation treatment on individuals to be mutated in the survival individual group to determine a mutation population;
and then carrying out individual mutation treatment, namely randomly selecting individuals needing mutation from the survival individual group, namely, the number of the individuals to be mutated can be one or at least two, carrying out mutation treatment on the individuals to be mutated to obtain variant individuals, namely, the number of the obtained variant individuals can be one or at least two, and combining the variant individuals and the survival individual group to obtain a variant population, wherein the number of the variant individuals is the same as that of the individuals to be mutated.
S206: and under the condition that the preset termination condition is not met, taking the variant population as a first population, returning to the step of calculating the fitness of each individual in the first population until the preset termination condition is met, and taking the content corresponding to the individual with the largest fitness in the variant population as the corresponding relation between the machine and the test subtask.
After obtaining the variant population, whether a preset termination condition is met or not, namely, a condition of stopping the genetic algorithm is needed to be judged, if the condition is not met, the variant population is taken as a first population, namely, the first population is updated, the step of calculating the fitness of each individual in the first population is returned, the previous processes of individual selection, variant processing and the like are continued until the preset termination condition is met, the content of the individual with the largest fitness in the finally obtained variant population is taken as the corresponding relation between the machine and the test subtask, the corresponding relation between the machine corresponding to the target test task and the test subtask is determined, then the test data of the test subtask in the corresponding relation between the machine and the test subtask can be stored in the corresponding machine in advance, and the corresponding prestored test data can be called in the process of executing the first test subtask by the machine in the corresponding relation between the subsequent machine and the test subtask. The corresponding relation between the machine and the test subtask determined by the genetic algorithm is the content of the individual with the maximum adaptability, so that the rationality of the corresponding relation between the machine and the test subtask corresponding to the obtained target test task can be ensured, and the waste of resources is avoided.
In one embodiment, the preset termination condition may include the number of iterations exceeding a preset maximum number of iterations. The method comprises the steps that before a plurality of individuals are initialized to obtain a first population, the initialized iteration number is zero, after a variant population is determined, the iteration number is increased by one, if the iteration number does not exceed the preset maximum iteration number, the variant population is used as the first population, the calculation of fitness is carried out again, and the cycle is carried out until the iteration number exceeds the preset maximum iteration number, and the content of the individual with the largest fitness in the variant population is used as the corresponding relation between a machine corresponding to a target test task and a test subtask.
In one embodiment, calculating the fitness of each individual in the first population comprises:
calculating the execution resource conflict degree of each individual according to the first resource and the second resource of each individual; the first resource is the sum of execution resources required by at least one test subtask corresponding to each machine in the individual, and the second resource is the execution resource corresponding to each machine in the individual; and calculating the fitness of each individual in the first population according to the execution resource conflict degree and the variation cost of each individual.
In one individual, one machine may correspond to different test subtasks, for example, machine 1 may be selected to perform corresponding test subtask a and test subtask b, and the task execution needs the resources of machine 1, so that the resource conflict degree of machine 1 is determined according to the execution resources of machine 1, the sum (corresponding to the first resource) of the execution resources required by test subtask a and test subtask b, and the execution resources (corresponding to the second resource) of machine 1. In the correspondence between an individual machine and a test subtask, there may be at least one machine, for example, machine 1 and machine 2, where the foregoing is calculation of the resource conflict degree of machine 1, and according to the same principle, the resource conflict degree of machine 2 may be calculated, where the individual execution resource conflict degree is the sum of the resource conflict degrees of at least one machine in the individual.
The mutation cost is understood as the relocation cost, and one mutation corresponds to one relocation, i.e. the machine corresponding to the subtask to be mutated is replaced. Then the cost of the variation is required once per variation. The adaptability of each individual in the first population can be calculated according to the execution resource conflict degree and the variation cost of each individual, so that the corresponding relationship obtained by considering the execution resource conflict degree and the variation cost in the process of the corresponding relationship between the machine and the test subtask obtained by the genetic algorithm is more reasonable.
In one example, the individual execution resource conflict degree is calculated as:
wherein K is the number of machines (the number of different machines) in the jth individual, D j For the execution resource conflict degree of the jth individual, delta is a sixth preset coefficient, y jk For the CPU resource of machine k in the jth individual, Δy jk Subtracting the difference, f (deltay), of the CPU resources of machine k in the jth individual from the sum of the CPU resources required for the corresponding test subtasks of machine k in the jth individual jk ) As a discriminant function, if deltay jk Less than 0, f (deltay) jk ) Equal to 0, if deltay jk Greater than or equal to 0, f (Δy) jk ) Equal to deltay jk 。h jk For the memory resource of machine k in the jth individual, Δh jk Subtracting the difference of the memory resources of machine k in the jth individual from the sum of the memory resources required for the corresponding test subtasks of machine k in the jth individual, f (Δh) jk ) As a discriminant function, if Δh jk Less than 0, f (Δh) jk ) Equal to 0, if Δh jk Greater than or equal to 0, f (Δh) jk ) Equal to Deltah jk 。
In one example, the individual variation cost is calculated as:
B j =R j /R rj 。
B j for variation cost of jth individual, R j Is the j thNumber of subtasks to be mutated in individual, R rj The total number of the test subtasks (repeated test subtasks, the number being repeatedly calculated) in the corresponding relation between the machine and the test subtasks in the j-th individual.
In one example, the fitness calculation formula for an individual is: b (B) j =ω*D j +(1-ω)*B j Wherein ω is a seventh preset coefficient.
In one embodiment, the ratio of the number of individuals in the population of surviving individuals to the number of individuals in the first population is equal to a preset survival rate. That is, each time an individual selection is made, the proportion of the selected individuals in the first population is a predetermined survival rate, thus ensuring a survival rate. For example, the preset survival rate is 5%, if there are 1000 individuals in the first population, individual selection is performed, and the number of individuals in the obtained survival individual group is 50.
In one embodiment, the mutation processing is performed on individuals to be mutated in the survival individual group, and the mutation population is determined, which includes: determining machines to be mutated in the individuals to be mutated according to the execution resource conflict degree of each machine in the individuals to be mutated; determining subtasks to be mutated corresponding to the machines to be mutated in the individuals to be mutated according to the resource occupation amount of at least one test subtask corresponding to the machines to be mutated in the individuals to be mutated; determining a variation target machine from the M machines to be selected according to the execution resource conflict degrees of the M machines to be selected; m is an integer greater than or equal to 1; changing a machine to be mutated corresponding to a subtask to be mutated in the individual to be mutated into a mutation target machine to obtain a mutated individual; a variant population is determined based on the population of surviving individuals and variant individuals.
In the mutation process, a machine to be mutated, a subtask to be mutated corresponding to the machine to be mutated and a mutation target machine are required to be determined, so that the machine to be mutated of the subtask to be mutated can be replaced by the mutation target machine to realize mutation, and the obtained mutation population comprises a survival individual group and mutation individuals. The number of machines to be mutated may be at least one, and the subtask to be mutated may be at least one. It will be appreciated that the process of mutation is a process of changing the correspondence between the machine and the test subtasks. The machine involved in the correspondence between the machine corresponding to the target test task and the test subtask is determined from the M machines to be selected, that is, the machine providing the alternative for executing the first test subtask is determined from the M machines to be selected in advance, and the genetic algorithm process is performed. The first machine belongs to M candidate machines.
In the process of determining the machines to be mutated in the individuals to be mutated according to the execution resource conflict degree of each machine in the individuals to be mutated, the larger the execution resource conflict degree is, the greater the possibility of being determined as the machines to be mutated is, namely the greater the possibility of being replaced by other machines is, so that the resource conflict can be reduced. In the process of determining the subtask to be mutated corresponding to the machine to be mutated in the individual to be mutated according to the resource occupation amount of the at least one test subtask corresponding to the machine to be mutated in the individual to be mutated, the larger the resource occupation amount of the test subtask is, the greater the possibility of being determined as the subtask to be mutated is, the greater the possibility of being replaced by the corresponding machine to be mutated is, so that enough resources are ensured to execute the test subtask, wherein the resource occupation amount of the test subtask corresponding to the machine to be mutated is the proportion of the execution resources required by the test subtask to the sum of the execution resources required by the at least one test subtask corresponding to the machine to be mutated. In the process of determining a mutation target machine from M to-be-selected machines according to the execution resource conflict degrees of the M to-be-selected machines, the smaller the execution resource conflict degrees are, the larger the possibility of being determined as the mutation target machine is, the smaller the execution resource conflict degrees are, the lower the possibility of resource conflict of the machine is, the more sufficient execution resources are indicated for the machine, the execution resources required by the corresponding test subtasks of the machine are not up to the execution resources of the machine, and the to-be-mutated machine corresponding to the subtasks to be mutated in an individual to be mutated is replaced with the mutation target machine, so that the resource conflict in the process of executing the subtasks to be mutated can be reduced.
The test task scheduling method described above is described in detail below with reference to one embodiment.
As shown in fig. 3, first, feature extraction is performed according to historical task data, a resource alignment rate, a required execution resource duty ratio and a waiting time period duty ratio of a test task to be scheduled are obtained, a priority of the test task to be scheduled can be calculated according to the resource alignment rate, the required execution resource duty ratio and the waiting time period duty ratio, and then a target test task can be determined, namely, online task sequencing scheduling is adopted. In addition, the feature extraction is performed according to the historical task data, so that a first preset concurrency number (i.e., a preset maximum concurrency number) of each first test subtask in the target test task, a CPU resource (i.e., a CPU demand) required by each test subtask in the target test task, and a required memory resource (i.e., a memory demand) can be obtained. The corresponding relation between the machine corresponding to the test subtask to be scheduled and the test subtask can be determined through a genetic algorithm in advance according to the first preset concurrency number of the first test subtask, the CPU resources required by each test subtask in the target test task and the required memory resources, and the test data of the test subtask is distributed to the corresponding machine in advance, namely, the offline big data is pre-distributed and scheduled, so that queuing caused by resource competition is reduced. In the task scheduling process, after the target test task is determined, the corresponding relation between the machine corresponding to the target test task and the test subtask can be used for determining the first machine of the first test subtask.
An individual in the genetic algorithm represents a corresponding relation between a machine and a test subtask, namely a deployment scheme, wherein the machine corresponds to the test subtask, namely the test subtask can be deployed on a corresponding machine, as shown in the following table 1, the corresponding relation table of the machine and the test subtask is a deployment scheme, the test subtask a corresponds to the machine 1 and the machine 2, the machine 1 and the machine 2 respectively store test data of the test subtask a in advance, the test subtask b corresponds to the machine 3, and the machine 3 stores test data of the test subtask b in advance. Initializing a population, wherein the population comprises a plurality of individuals, evaluating the fitness of the individuals, selecting the individuals according to the fitness, then performing individual variation until the preset stopping condition of an algorithm is met, and taking the corresponding relation between a machine and a test subtask in the individuals with the highest fitness in the variant population as the corresponding relation between a machine and the test subtask corresponding to a target test task.
TABLE 1
Machine 1 | Machine 2 | Machine 3 |
Test subtask a | Test subtask a | Test subtask b |
Then, based on the corresponding relation between the machine corresponding to the target test task and the test subtask, determining a first machine for executing a first test subtask in the target test task, determining a second machine for executing a second test subtask in the target test task, executing the first test subtask by the first machine according to the test data stored in advance locally, and downloading the test data of the second test subtask by the second machine and executing the second test subtask.
As shown in fig. 4, the present invention further provides a test task scheduling device 400 according to an embodiment, including:
a task determining module 401, configured to determine a target test task from a set of test tasks to be scheduled;
a first machine determining module 402, configured to determine, based on a correspondence between a machine corresponding to a target test task and a test subtask, a first machine that executes a first test subtask in the target test task, where test data of the first test subtask is stored in the first machine in advance;
a scheduling module 403 for executing the first test subtask by the first machine.
In one embodiment, the apparatus further comprises a second machine determination module.
A second machine determining module for determining a second machine that performs a second test subtask of the target test tasks;
and the scheduling module is also used for downloading the test data of the second test subtask through the second machine and executing the second test subtask.
In one embodiment, the priority of the target test task is higher than the priority of the pending test task, which is a test task in the set of test tasks to be scheduled other than the target test task.
In one embodiment, the apparatus further comprises:
The task priority determining module is used for determining the priority of each test task to be scheduled in the test task set to be scheduled based on the characteristic parameters of the test tasks to be scheduled, wherein the characteristic parameters comprise resource characteristic parameters and time length characteristic parameters.
In one embodiment, the apparatus further comprises:
the population initializing module is used for initializing a plurality of individuals to obtain a first population based on a first preset concurrence number of a first test subtask;
the fitness calculation module is used for calculating the fitness of each individual in the first population;
the screening module is used for selecting the individuals in the first population based on the fitness of each individual in the first population to obtain a survival individual group;
the individual to be mutated acquires an individual to be mutated in the surviving individual group;
the mutation module is used for carrying out mutation treatment on individuals to be mutated in the survival individual group and determining a mutation population;
and the corresponding relation determining module is used for taking the variant population as the first population under the condition that the preset termination condition is not met, returning to the fitness calculating module to execute the calculation of the fitness of each individual in the first population until the preset termination condition is met, and taking the content corresponding to the individual with the largest fitness in the variant population as the corresponding relation between the machine and the test subtask.
In one embodiment, the fitness calculation module comprises:
the individual resource conflict degree calculation module is used for calculating the execution resource conflict degree of each individual according to the first resource and the second resource of each individual; the first resource is the sum of execution resources required by at least one test subtask corresponding to each machine in the individual, and the second resource is the execution resource corresponding to each machine in the individual;
and the individual fitness obtaining module is used for calculating the fitness of each individual in the first population according to the execution resource conflict degree and the variation cost of each individual.
In one embodiment, the mutation module comprises:
the to-be-mutated machine determining module is used for determining to-be-mutated machines in the to-be-mutated individuals according to the execution resource conflict degree of each machine in the to-be-mutated individuals;
the subtask to be mutated determining module is used for determining subtasks to be mutated corresponding to the machine to be mutated in the individual to be mutated according to the resource occupation amount of at least one test subtask corresponding to the machine to be mutated in the individual to be mutated;
the variable target machine determining module is used for determining variable target machines from the M to-be-selected machines according to the execution resource conflict degrees of the M to-be-selected machines; m is an integer greater than or equal to 1;
The replacing module is used for replacing the machine to be mutated corresponding to the subtask to be mutated in the individual to be mutated with the mutation target machine to obtain the mutated individual;
and the variant population determining module is used for determining a variant population according to the survival individual group and the variant individuals.
In one embodiment, the apparatus further comprises: and the updating module is used for determining the priority of the plurality of test tasks to be scheduled in the test task set to be scheduled again if the target test task is not called within the preset time.
The technical features in the test task scheduling device provided by the embodiment of the invention correspond to the technical features in the test task scheduling method, and each process of the test task scheduling method is realized by the test task scheduling device, so that the same effect can be obtained, and the repetition is avoided, and the description is omitted here.
Referring to fig. 5, an embodiment of the present invention further provides an electronic device 500, including a processor 501 and a memory 502, where the memory 502 stores a computer program capable of running on the processor 501, and the computer program realizes each process in the above embodiment of the test task scheduling method when executed by the processor 501, and can achieve the same technical effect, so that repetition is avoided and redundant description is omitted.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements each process of the test task scheduling method embodiment described above, and can achieve the same technical effects, and in order to avoid repetition, the description is omitted here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or electronic device that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or electronic device. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or electronic device that comprises the element.
In embodiments of the invention, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment should not be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing an electronic device (which may be a computer) to perform the method of the various embodiments of the present invention.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.
Claims (12)
1. A test task scheduling method, the method comprising:
determining a target test task from a test task set to be scheduled;
determining a first machine for executing a first test subtask in the target test tasks based on the corresponding relation between the machine corresponding to the target test tasks and the test subtasks, wherein test data of the first test subtask is stored in the first machine in advance, and the first test subtask is a test subtask of which the quantity of corresponding test data is larger than the preset data quantity in a plurality of test subtasks included in the target test tasks;
executing, by the first machine, the first test subtask;
after the target test task is determined from the to-be-scheduled test task set, the method further comprises:
determining a second machine for executing a second test subtask in the target test task, wherein the second test subtask is a test subtask of which the amount of corresponding test data in a plurality of test subtasks included in the target test task is smaller than or equal to the preset data amount;
downloading test data of the second test subtask through the second machine and executing the second test subtask;
Before determining the target test task from the to-be-scheduled test task set, the method further comprises:
determining the priority of each test task to be scheduled in the test task set to be scheduled based on the characteristic parameters of the test task to be scheduled, wherein the characteristic parameters comprise resource characteristic parameters and time length characteristic parameters; the resource characteristic parameters comprise a resource alignment rate and a required execution resource proportion, the duration characteristic parameters comprise a waiting duration proportion, and the priority of the test task to be scheduled is in direct proportion to the waiting duration proportion and the resource alignment rate and in inverse proportion to the required execution resource proportion;
the determining the target test task from the test task set to be scheduled comprises the following steps: determining a target test task based on the priority of the test task to be scheduled in the test task set to be scheduled;
the formula for determining the priority of the test task to be scheduled is:
wherein i is more than or equal to 1 and less than or equal to n, n is the total number of the test tasks to be scheduled in the set of the test tasks to be scheduled, U i For the i-th priority of test task to be scheduled, J i Resource alignment rate X for ith test task to be scheduled i For the ith test task to be scheduledThe required execution resource ratio, T i The waiting time duty ratio of the ith test task to be scheduled is a first preset coefficient, b is a second preset coefficient and c is a third preset coefficient;
resource alignment rate J of ith test task to be scheduled i The calculation formula of (2) is as follows:
wherein lambda is a fourth preset coefficient S1 i CPU resource applicable to ith test task to be scheduled, Z1 i CPU resource required for ith test task to be scheduled S2 i Z2 for the memory resource which can be applied for the ith test task to be scheduled i And (3) the memory resource required by the ith test task to be scheduled.
2. The method of claim 1, wherein the target test task has a higher priority than a pending test task, the pending test task being a test task in the set of test tasks to be scheduled other than the target test task.
3. The method of claim 1, wherein determining a first machine that executes a first test subtask of the target test tasks based on a correspondence of machines corresponding to the target test tasks and test subtasks, further comprises:
initializing a plurality of individuals to obtain a first population based on a first preset concurrency number of the first test subtask;
Calculating the fitness of each individual in the first population;
based on the fitness of each individual in the first population, individual selection is carried out on the first population, and a survival individual group is obtained;
obtaining individuals to be mutated in the survival individual group;
performing mutation treatment on the individuals to be mutated in the survival individual group to determine a mutated population;
and under the condition that the preset termination condition is not met, returning the variant population as the first population to the step of calculating the fitness of each individual in the first population until the preset termination condition is met, and taking the content corresponding to the individual with the largest fitness in the variant population as the corresponding relation between the machine and the test subtask.
4. A method according to claim 3, wherein said calculating fitness of each of said individuals in said first population comprises:
calculating the execution resource conflict degree of each individual according to the first resource and the second resource of each individual; the first resource is the sum of execution resources required by at least one test subtask corresponding to each machine in the individual, and the second resource is the execution resource corresponding to each machine in the individual;
And calculating the fitness of each individual in the first population according to the execution resource conflict degree and the variation cost of each individual.
5. The method of claim 3, wherein said subjecting said individual to be mutated in said population of surviving individuals to determine a mutated population comprises:
determining machines to be mutated in the individuals to be mutated according to the execution resource conflict degree of each machine in the individuals to be mutated;
determining a subtask to be mutated corresponding to the machine to be mutated in the individual to be mutated according to the resource occupation amount of at least one test subtask corresponding to the machine to be mutated in the individual to be mutated;
determining a variation target machine from M machine to be selected according to the execution resource conflict degree of the M machine to be selected; m is an integer greater than or equal to 1;
changing a machine to be mutated corresponding to the subtask to be mutated in the individual to be mutated into the mutation target machine to obtain a mutated individual;
determining the variant population based on the population of surviving individuals and the variant individuals.
6. A test task scheduler, the apparatus comprising:
The task determining module is used for determining a target test task from the to-be-scheduled test task set;
the first machine determining module is used for determining a first machine for executing a first test subtask in the target test tasks based on the corresponding relation between the machine corresponding to the target test tasks and the test subtasks, wherein test data of the first test subtask are stored in the first machine in advance, and the first test subtask is a test subtask with the quantity of corresponding test data being larger than the preset data quantity in a plurality of test subtasks included in the target test tasks;
a scheduling module for executing the first test subtask by the first machine;
the apparatus further includes a second machine determination module;
the second machine determining module is configured to determine a second machine that executes a second test subtask in the target test task, where the second test subtask is a test subtask that includes a plurality of test subtasks corresponding to the test data in the target test task, and the amount of the test data is less than or equal to the preset data amount;
the scheduling module is further configured to download test data of the second test subtask through the second machine and execute the second test subtask;
The apparatus further comprises:
the task priority determining module is used for determining the priority of each to-be-scheduled test task in the to-be-scheduled test task set based on the characteristic parameters of the to-be-scheduled test tasks, wherein the characteristic parameters comprise resource characteristic parameters and time length characteristic parameters; the resource characteristic parameters comprise a resource alignment rate and a required execution resource proportion, the duration characteristic parameters comprise a waiting duration proportion, and the priority of the test task to be scheduled is in direct proportion to the waiting duration proportion and the resource alignment rate and in inverse proportion to the required execution resource proportion;
the determining the target test task from the test task set to be scheduled comprises the following steps: determining a target test task based on the priority of the test task to be scheduled in the test task set to be scheduled;
the formula for determining the priority of the test task to be scheduled is:
wherein i is more than or equal to 1 and less than or equal to n, n is the total number of the test tasks to be scheduled in the set of the test tasks to be scheduled, U i For the i-th priority of test task to be scheduled, J i Resource alignment rate X for ith test task to be scheduled i For the required execution resource duty ratio, T, of the ith test task to be scheduled i The waiting time duty ratio of the ith test task to be scheduled is a first preset coefficient, b is a second preset coefficient and c is a third preset coefficient;
resource alignment rate J of ith test task to be scheduled i The calculation formula of (2) is as follows:
wherein lambda is a fourth preset coefficient S1 i CPU resource applicable to ith test task to be scheduled, Z1 i CPU resource required for ith test task to be scheduled S2 i Z2 for the memory resource which can be applied for the ith test task to be scheduled i And (3) the memory resource required by the ith test task to be scheduled.
7. The apparatus of claim 6, wherein the target test tasks have a higher priority than pending test tasks, the pending test tasks being test tasks in the set of to-be-scheduled test tasks other than the target test tasks.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the population initializing module is used for initializing a plurality of individuals to obtain a first population based on a first preset concurrency number of the first test subtask;
the fitness calculation module is used for calculating fitness of each individual in the first population;
The screening module is used for selecting the individuals in the first population based on the fitness of each individual in the first population to obtain a survival individual group;
the individual to be mutated is obtained by the individual to be mutated obtaining module, which is used for obtaining the individual to be mutated in the survival individual group;
the mutation module is used for carrying out mutation treatment on the individuals to be mutated in the survival individual group to determine a mutation population;
and the corresponding relation determining module is used for taking the variant population as the first population, returning to the fitness calculating module to execute the calculation of the fitness of each individual in the first population until the preset termination condition is met, and taking the content corresponding to the individual with the largest fitness in the variant population as the corresponding relation between the machine and the test subtask.
9. The apparatus of claim 8, wherein the fitness calculation module comprises:
the individual resource conflict degree calculation module is used for calculating the execution resource conflict degree of each individual according to the first resource and the second resource of each individual; the first resource is the sum of execution resources required by at least one test subtask corresponding to each machine in the individual, and the second resource is the execution resource corresponding to each machine in the individual;
And the individual fitness obtaining module is used for calculating the fitness of each individual in the first population according to the execution resource conflict degree and the variation cost of each individual.
10. The apparatus of claim 8, wherein the mutation module comprises:
the to-be-mutated machine determining module is used for determining to-be-mutated machines in the to-be-mutated individuals according to the execution resource conflict degree of each machine in the to-be-mutated individuals;
the subtask to be mutated determining module is used for determining subtasks to be mutated corresponding to the machine to be mutated in the individual to be mutated according to the resource occupation amount of at least one test subtask corresponding to the machine to be mutated in the individual to be mutated;
the variable target machine determining module is used for determining variable target machines from M to-be-selected machines according to the execution resource conflict degrees of the M to-be-selected machines; m is an integer greater than or equal to 1;
the replacing module is used for replacing the machine to be mutated corresponding to the subtask to be mutated in the individual to be mutated with the mutation target machine to obtain a mutated individual;
and the variant population determining module is used for determining the variant population according to the survival individual group and the variant individuals.
11. An electronic device, comprising: a memory storing a computer program, and a processor implementing the steps of the test task scheduling method according to any one of claims 1 to 5 when the processor executes the computer program.
12. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the test task scheduling method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910428021.6A CN110287008B (en) | 2019-05-22 | 2019-05-22 | Test task scheduling method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910428021.6A CN110287008B (en) | 2019-05-22 | 2019-05-22 | Test task scheduling method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110287008A CN110287008A (en) | 2019-09-27 |
CN110287008B true CN110287008B (en) | 2023-12-19 |
Family
ID=68002218
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910428021.6A Active CN110287008B (en) | 2019-05-22 | 2019-05-22 | Test task scheduling method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110287008B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111737118B (en) * | 2020-06-11 | 2024-02-20 | 百度在线网络技术(北京)有限公司 | Pipeline testing method and device, electronic equipment and storage medium |
CN113487201B (en) * | 2021-07-14 | 2022-11-11 | 海南马良师傅网络科技有限公司 | Instrument relocation task distribution system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101324854A (en) * | 2008-07-21 | 2008-12-17 | 武汉理工大学 | Method for allocating graticule resource based on paralleling genetic algorithm |
WO2012159500A1 (en) * | 2011-05-26 | 2012-11-29 | 中国移动通信集团公司 | Method, system and device for acquiring drive test data |
CN107234616A (en) * | 2017-07-07 | 2017-10-10 | 上海木爷机器人技术有限公司 | Multirobot control method and device |
CN108733464A (en) * | 2017-04-18 | 2018-11-02 | 华为软件技术有限公司 | A kind of method and device of the scheduling scheme of determining calculating task |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107291548B (en) * | 2016-03-31 | 2021-04-13 | 阿里巴巴集团控股有限公司 | Task resource scheduling method and device |
-
2019
- 2019-05-22 CN CN201910428021.6A patent/CN110287008B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101324854A (en) * | 2008-07-21 | 2008-12-17 | 武汉理工大学 | Method for allocating graticule resource based on paralleling genetic algorithm |
WO2012159500A1 (en) * | 2011-05-26 | 2012-11-29 | 中国移动通信集团公司 | Method, system and device for acquiring drive test data |
CN108733464A (en) * | 2017-04-18 | 2018-11-02 | 华为软件技术有限公司 | A kind of method and device of the scheduling scheme of determining calculating task |
CN107234616A (en) * | 2017-07-07 | 2017-10-10 | 上海木爷机器人技术有限公司 | Multirobot control method and device |
Also Published As
Publication number | Publication date |
---|---|
CN110287008A (en) | 2019-09-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Maghsoudlou et al. | Multi-skilled project scheduling with level-dependent rework risk; three multi-objective mechanisms based on cuckoo search | |
Geiger | A multi-threaded local search algorithm and computer implementation for the multi-mode, resource-constrained multi-project scheduling problem | |
Blythe et al. | Task scheduling strategies for workflow-based applications in grids | |
EP2176751B1 (en) | Scheduling by growing and shrinking resource allocation | |
CN112416585B (en) | Deep learning-oriented GPU resource management and intelligent scheduling method | |
Özcan | Balancing stochastic parallel assembly lines | |
WO2012151054A1 (en) | Scheduling in mapreduce-like systems for fast completion time | |
CN112053002B (en) | Cloud manufacturing multi-task scheduling method based on utility perception | |
CN110287008B (en) | Test task scheduling method and device and electronic equipment | |
CN105929690A (en) | Flexible workshop robustness scheduling method based on decomposition multi-target evolution algorithm | |
CN113886034A (en) | Task scheduling method, system, electronic device and storage medium | |
CN108427602B (en) | Distributed computing task cooperative scheduling method and device | |
CN111913785A (en) | Multi-satellite task scheduling method and system | |
Liu et al. | A reinforcement learning based resource management approach for time-critical workloads in distributed computing environment | |
Fan et al. | An effective approximation algorithm for the malleable parallel task scheduling problem | |
CN106934537A (en) | The sub- time limit based on the scheduling of reverse operation stream obtains optimization method | |
Rawson et al. | Old or heavy? Decaying gracefully with age/weight shapes | |
Ferreira da Silva et al. | Controlling fairness and task granularity in distributed, online, non‐clairvoyant workflow executions | |
CN106897199A (en) | A kind of batch job running time prediction method that framework common characteristic is processed based on big data | |
CN112150035B (en) | Data processing method and device | |
Gong et al. | Chic: experience-driven scheduling in machine learning clusters | |
Adamu et al. | Metaheuristics for scheduling on parallel machine to minimize weighted number of early and tardy jobs | |
CN113641448A (en) | Edge computing container allocation and layer download ordering architecture and method thereof | |
Rokou et al. | Multi-project flexible resource profiles project scheduling with Ant Colony Optimization | |
CN116069473A (en) | Deep reinforcement learning-based Yarn cluster workflow scheduling method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |