WO2017063374A1 - 一种动态分配编译机的系统及其方法 - Google Patents
一种动态分配编译机的系统及其方法 Download PDFInfo
- Publication number
- WO2017063374A1 WO2017063374A1 PCT/CN2016/085248 CN2016085248W WO2017063374A1 WO 2017063374 A1 WO2017063374 A1 WO 2017063374A1 CN 2016085248 W CN2016085248 W CN 2016085248W WO 2017063374 A1 WO2017063374 A1 WO 2017063374A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- compiled
- task
- compiler
- compile
- result
- 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.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/47—Retargetable compilers
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5033—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering data affinity
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5013—Request control
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Definitions
- the present invention relates to the field of compiler technologies, and in particular, to a system and a method for dynamically allocating a compiler.
- the static configuration of the compiler is specifically as follows: the existing compiler is deployed in an integrated system (such as Jenkins and other software integration systems), without database maintenance, each time you release the software you need to manually select a compiler. This method has the following drawbacks: the compiler is inefficient to use and requires manual intervention, resulting in high cost and high error rate.
- the technical problem to be solved by the present invention is to provide a system and method for dynamically allocating a compiler, which can automatically allocate compilation tasks, realize efficient use of the compiler, and reduce the error rate.
- a technical solution adopted by the present invention is to provide a method for dynamically allocating a compiler, wherein the method includes: initiating a task to be compiled, and storing the task to be compiled, and then The compiling task is marked as a waiting state to wait for the compiler to compile, wherein when the task to be compiled is stored, three data tables are further established for respectively recording project information, compiler information, and compiling task information. ;
- the task to be compiled when set to enter the compile phase, sends the task to be compiled to the compiler, and the compiler compiles the task to be compiled;
- the method further includes:
- the capability comprises the compiler being able to simultaneously compile a first number of thresholds of tasks of the same type and a second number of thresholds of tasks that can be simultaneously compiled, wherein the first The quantity threshold is less than or equal to the second quantity threshold;
- the step of determining the current compiled state of the compiler includes:
- the project information includes a type of compiled task
- the compiler information includes an IP address of each compiler, a name of the compiler, a compiled task type, and a currently remaining compilation space;
- the compilation task information includes information of a compiler that is working and its compiled task information.
- the method further includes: when the result of the first determination is yes, determining, by a second time, whether the number of tasks currently compiled by the compiler is greater than or equal to a second quantity threshold, and the result of the second determination If yes, set the task to be compiled to continue waiting.
- the method further includes: when the result of the second determination is no, determining, by a third time, whether the task currently compiled by the compiler is the same as the type of the task to be compiled, and the result of the third determination If not, the task to be compiled is set to enter the compile phase, and the task to be compiled is further sent to the compiler.
- the method further includes: when the result of the third determination is YES, determining, by a fourth time, whether the number of tasks of the same type as the task to be compiled is greater than or equal to the first number threshold, and at the fourth When the result of the second judgment is no, the task to be compiled is set to enter the compiling stage, and the task to be compiled is further sent to the compiler, and when the result of the fourth judgment is YES, the waiting is set. Compile the task to continue waiting.
- another technical solution adopted by the present invention is to provide a method for dynamically allocating a compiler, the method comprising: initiating a task to be compiled, and storing the task to be compiled, thereby marking the task to be compiled as Waiting state, waiting for the compiler to compile; obtaining the compile command, judging the current compile state of the compiler, and setting the task to be compiled to continue waiting or entering the compiling phase according to the current compile state, wherein when set to continue waiting, Continue to store the task to be compiled.
- the task to be compiled is sent to the compiler, and the compiler compiles the task to be compiled.
- the method further includes: when storing the task to be compiled, further establishing three data tables for separately recording project information, compiler information, and compiling task information.
- the project information includes a type of compiled task
- the compiler information includes an IP address of each compiler, a name of the compiler, a compiled task type, and a currently remaining compilation space;
- the compilation task information includes information of a compiler that is working and its compiled task information.
- the method further includes: acquiring a compiler compiling task capability, wherein the capability includes a first number threshold of the compiler capable of simultaneously compiling the same type of task and a second number threshold of the task capable of simultaneously compiling at the same time, wherein the first quantity threshold
- the step of determining the current compiled state of the compiler includes: determining, for the first time, whether the number of tasks currently compiled by the compiler is greater than or equal to the first number of thresholds, and when the result of the first determination is negative
- the task to be compiled is set to enter the compile phase, and the task to be compiled is further sent to the compiler.
- the method further includes: when the result of the first determination is yes, determining whether the number of tasks currently compiled by the compiler is greater than or equal to the second number threshold, and when the result of the second determination is yes, Set the task to be compiled to continue waiting.
- the method further includes: when the result of the second judgment is no, determining whether the task currently compiled by the compiler is the same as the type of the task to be compiled, and is to be compiled when the result of the third judgment is no.
- the task is set to enter the compile phase and further the task to be compiled is sent to the compiler.
- the method further includes: when the result of the third determination is yes, determining whether the number of tasks of the same type as the task to be compiled is greater than or equal to the first quantity threshold for the fourth time, and the result of the fourth determination is no.
- the task to be compiled is set to enter the compile phase, and the task to be compiled is further sent to the compiler.
- the result of the fourth judgment is yes, the task to be compiled is set to continue waiting.
- another technical solution adopted by the present invention is to provide a system for dynamically allocating a compiler, the system comprising: a customization device for initiating a task to be compiled, and further initiating a compile command; a database, For storing a task to be compiled; a distribution device for marking a task to be compiled stored in the database as a wait state, waiting for the compiler to compile, and determining the current compiled state of the compiler when the compile command is obtained, and According to the current compilation state, the task to be compiled is set to continue to wait or enter the compile phase, wherein when set to continue to wait, the database will continue to store the task to be compiled, and when set to enter the compile phase, the distribution device sends the task to be compiled to In the compiler, the compiler compiles the compilation task.
- the distribution device further includes: an obtaining unit, configured to acquire a compiler compiling task capability, wherein the capability includes a first number threshold of the compiler capable of simultaneously compiling the same type of task and a second threshold of the task capable of simultaneously compiling at the same time, The first quantity threshold is less than or equal to the second quantity threshold; the first determining unit is configured to determine whether the number of tasks currently compiled by the compiler is greater than or equal to the first quantity threshold; and the allocation unit determines the result in the first determining unit If no, the task to be compiled is set to enter the compile phase, and the task to be compiled is further sent to the compiler.
- an obtaining unit configured to acquire a compiler compiling task capability, wherein the capability includes a first number threshold of the compiler capable of simultaneously compiling the same type of task and a second threshold of the task capable of simultaneously compiling at the same time, The first quantity threshold is less than or equal to the second quantity threshold; the first determining unit is configured to determine whether the number of tasks currently compiled by the compiler
- the distribution device further includes: a second determining unit, configured to further determine, when the first determination unit determines that the result is YES, whether the number of tasks currently compiled by the compiler is greater than or equal to a second number threshold; the allocation unit is in the second When the result of the judgment unit is YES, the task to be compiled is set to continue waiting.
- a second determining unit configured to further determine, when the first determination unit determines that the result is YES, whether the number of tasks currently compiled by the compiler is greater than or equal to a second number threshold; the allocation unit is in the second When the result of the judgment unit is YES, the task to be compiled is set to continue waiting.
- the allocating device further includes: a third determining unit, configured to further determine, when the second determining unit determines that the result is no, whether the task currently compiled by the compiler is the same as the type of the task to be compiled; the allocating unit is in the third determining unit When the result of the judgment is no, the task to be compiled is set to enter the compile phase, and the task to be compiled is further sent to the compiler.
- a third determining unit configured to further determine, when the second determining unit determines that the result is no, whether the task currently compiled by the compiler is the same as the type of the task to be compiled.
- the distribution device further includes: a fourth determining unit, configured to further determine, when the third determination unit determines that the result is YES, whether the number of tasks of the same type as the task to be compiled is greater than or equal to the first quantity threshold; When the result of the fourth determining unit is negative, the task to be compiled is set to enter the compiling stage, and the task to be compiled is further sent to the compiler, and when the result of the fourth determining unit is YES, the task to be compiled is set to continue. wait.
- a fourth determining unit configured to further determine, when the third determination unit determines that the result is YES, whether the number of tasks of the same type as the task to be compiled is greater than or equal to the first quantity threshold.
- the method of the dynamic allocation compiler of the present invention is specifically as follows: firstly, the task to be compiled is started, and the task to be compiled is stored, and then the task to be compiled is marked as a waiting state. Waiting for the compiler to compile, obtain the compile command, and determine the current compile state of the compiler, and further set the task to be compiled to continue waiting or enter the compile phase according to the current compile state, wherein, when set to continue waiting, it will continue The task to be compiled is stored. When it is set to enter the compile stage, the task to be compiled is sent to the compiler, and the compiler compiles the task to be compiled. Therefore, the present invention can automatically allocate compilation tasks according to the current compiled state of the compiler, thereby achieving efficient use of the compiler and reducing the error rate.
- FIG. 1 is a flowchart of a method for dynamically allocating a compiler according to an embodiment of the present invention
- FIG. 2 is a flowchart of another method for dynamically allocating a compiler according to an embodiment of the present invention
- FIG. 3 is a flowchart of still another method for dynamically allocating a compiler according to an embodiment of the present invention.
- FIG. 4 is a schematic structural diagram of a system for dynamically allocating a compiler according to an embodiment of the present invention.
- FIG. 1 is a flowchart of a method for dynamically allocating a compiler according to an embodiment of the present invention. As shown in FIG. 1, the method of this embodiment includes the following steps:
- Step S1 Initiating a task to be compiled, and storing the task to be compiled, and then marking the task to be compiled as a waiting state, waiting for the compiler to compile.
- two field attribute values are preset, which are auto_flag and wait_flag, respectively, wherein the settings of the values of auto_flag and wait_flag include the following two cases:
- the second case: setting the value of auto_flag to 0 means that the task is in the compiled state, the default is 1; when the value of wait_flag is 0, the task is in the waiting state, and the default is 1.
- this step first sets the value of auto_flag of the task to be compiled to 0, and the value of wait_flag is set to 1 to indicate the wait state.
- Step S2 Obtain a compile command, determine a current compile state of the compiler, and set a task to be compiled to continue to wait or enter a compile phase according to the current compile state, wherein when set to continue to wait, the task to be compiled will continue to be stored.
- the task to be compiled is sent to the compiler, and the compiler compiles the compile task.
- the embodiment further acquires the capability of the compiler compile task, wherein the capability includes a first number threshold of the compiler capable of simultaneously compiling the same type of task and a second number threshold of the task that can be simultaneously compiled, wherein the first quantity threshold is less than Or equal to the second number threshold.
- step S2 is a flowchart of another method for dynamically allocating a compiler according to an embodiment of the present invention. As shown in FIG. 2, step S2 specifically includes the following determining steps:
- Step S21 It is judged whether the number of tasks currently compiled by the compiler is greater than or equal to the first number threshold.
- step S22 if the result of the determination is negative, the process goes to step S22, and when the result of the determination is YES, the process goes to step S23.
- Step S22 Set the task to be compiled to enter the compile phase, and further send the task to be compiled to the compiler.
- the value of auto_flag of the task to be compiled is set to 1, and the value of wait_flag is set to 0 to indicate that it enters the compile phase.
- Step S23 It is judged whether the number of tasks currently compiled by the compiler is greater than or equal to the second number threshold.
- step S24 if the result of the determination is YES, the process goes to step S24, and if the result of the determination is NO, the process goes to step S25.
- Step S24 Set the task to be compiled to continue waiting.
- the settings include two cases:
- the first case is: determining that the number of tasks currently compiled by the compiler is greater than or equal to the number of the second number of thresholds, the waiting state of the task to be compiled is set to the sleep phase, that is, the auto_flag of the task to be compiled is The value is set to 0 and the value of wait_flag is set to 0. Until the number of tasks currently compiled by the compiler is greater than the number of second thresholds, the value of auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 1.
- the second case if the number of tasks currently compiled by the compiler is greater than the number of the second number of thresholds is 1, the value of auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 1.
- a waiting time is further set, for example, it may be 2 minutes, and if the waiting time is reached, the scanning and judgment are repeated.
- Step S25 It is judged whether the task currently compiled by the compiler is the same as the type of the task to be compiled.
- step S26 if the result of the determination is negative, the process goes to step S26, and when the result of the determination is YES, the process goes to step S27.
- Step S26 Set the task to be compiled to enter the compile phase, and further send the task to be compiled to the compiler.
- the value of auto_flag of the task to be compiled is set to 1, and the value of wait_flag is set to 0 to indicate that it enters the compile phase.
- Step S27 It is determined whether the number of tasks of the same type as the task to be compiled is greater than or equal to the first number threshold.
- step S28 if the result of the determination is negative, the process goes to step S28, and when the result of the determination is YES, the process goes to step S29.
- Step S28 Set the task to be compiled to enter the compile phase, and further send the task to be compiled to the compiler.
- the value of auto_flag of the task to be compiled is set to 1, and the value of wait_flag is set to 0 to indicate that it enters the compile phase.
- Step S29 setting the task to be compiled to continue waiting.
- the specific settings include the following two situations:
- step S27 if it is determined in step S27 that the number of tasks of the same type as the task to be compiled is greater than the first number of thresholds is greater than or equal to 2, the waiting state of the task to be compiled is set to the sleep phase, and will be The value of the auto_flag of the compile task is set to 0, and the value of wait_flag is set to 0. Until the number of tasks of the same type as the task to be compiled is greater than the first number of thresholds, the value of auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 1.
- the second case if the step S27 determines that the number of tasks of the same type as the task to be compiled is greater than the number of the first number of thresholds, the value of the auto_flag of the task to be compiled is set to 0, and the value of the wait_flag is set to 1. .
- a waiting time is further set, for example, it may be 2 minutes, and if the waiting time is reached, the scanning and judgment are repeated.
- the embodiment can dynamically allocate tasks to be compiled without manual intervention, first efficiently compiling and reducing the error rate.
- step S1 when the task to be compiled is stored in step S1, three data tables are further established, which are three tables of t_product, t_web_host_info, and t_web_create_perso, respectively, and record item information, compiler information, and compilation task information.
- the project information includes the type of compiled task.
- the compiler information includes the IP address of each compiler, the name of the compiler, the type of task compiled, and the remaining compilation space.
- the compiled task information includes information about the working machine that is working and its compiled task information.
- the compiler Before setting the compile task state in step S2, the compiler needs to be selected.
- the specific process is as follows: first determine whether there is a spare compiler. If it is determined that there is no spare compiler, a compiler is randomly selected to be associated with the task to be compiled stored in step S1, that is, the task to be compiled stored in step S1 is sent to the randomly selected compiler; or the working machine is further determined to be working. Compile the task, and send the task to be compiled stored in step S1 to the compiler with fewer compilation tasks. Preferably, it is sent to a compiler that has fewer compilation tasks of the same type as the task to be compiled.
- the free compiler is greater than or equal to two. If it is greater than or equal to two, randomly select a compiler to compile. If there is only one, select the compiler to treat Compile the task to compile.
- the embodiment can dynamically allocate the compiler and dynamically allocate the tasks to be compiled, achieve high efficiency of compilation, and reduce the error rate due to manual participation.
- FIG. 3 is a flowchart of still another method for dynamically allocating a compiler according to an embodiment of the present invention. It should be noted that, in this embodiment, the number of tasks that the compiler can compile at the same time is one, and the maximum number of tasks that can be simultaneously compiled is two.
- the method of this embodiment includes the following steps:
- Step S30 Initiating a task to be performed.
- the tasks to be tasked are 1, 2, 3, ... n, and n is a natural number.
- Step S31 It is judged whether there is a spare compiler. If the result of the determination is NO, the process jumps to step S32, and if the result of the determination is NO, the process proceeds to step S33.
- Step S32 Select one of the compilers, wherein the selection principle is as described above, and details are not described herein again. Then step S35 is executed to obtain the IP address of the compiler.
- Step S33 It is judged whether the spare compiler is greater than or equal to two. If the result of the determination is yes, the process goes to step S34, and if the result of the determination is no, the process goes to step S35.
- Step S34 Select one of the compilers. Then step S35 is executed to obtain the IP address of the compiler.
- Step S35 Obtain the IP address of the compiler.
- Step S36 The standby task is set to the waiting state. Step S36 may also be set between step S30 and step 31.
- Step S37 Scan the compiled state of the compiler. Specifically, it is the number of compile tasks that scan the compiler.
- Step S38 It is judged whether the compiling task is greater than two. However, if the result of the determination is YES, the process goes to step S39, and if the result of the determination is NO, the process goes to step S40.
- Step S39 Set to the waiting state, and the waiting time is 2 minutes. If the waiting time reaches 2 minutes, the process returns to step S37 to rescan the compiled state of the compiler.
- step S39 The setting of the waiting state of the task to be compiled in step S39 is that the value of auto_flag is set to 0, and the value of wait_flag is set to 0.
- Step S40 Determine whether the compile task is two. However, if the result of the determination is negative, the process proceeds to step S41, and if the result of the determination is YES, the process proceeds to step S42.
- Step S41 The setting enters the compile phase, and the task is sent to the corresponding compiler.
- the setting of the task to be compiled in step S41 is that the value of auto_flag is set to 1, and the value of wait_flag is set to zero.
- Step S42 It is judged whether the task types are the same, and if the result of the determination is YES, the process goes to step S39, and if the result of the determination is NO, the process jumps to step S41.
- step S39 the value of the setting of step S39 is that the value of auto_flag is set to 0, and the value of wait_flag is set to 1.
- FIG. 4 is a schematic structural diagram of a system for dynamically allocating a compiler according to an embodiment of the present invention.
- the system 10 of the dynamic allocation compiler of the present embodiment includes a customization device 11, a database 12, and a distribution device 13.
- the customization device 11 is configured to initiate a task to be compiled, as shown in FIG. 4, the task to be compiled, the task to be compiled 2, the task to be compiled n (n is a natural number), and further initiates a compile command.
- the database 12 is used to store tasks to be compiled. And the database stores three data tables, namely t_product, t_web_host_info, and t_web_create_perso, which record project information, compiler information, and compilation task information.
- t_product namely t_product, t_web_host_info, and t_web_create_perso
- the content of the project information, the compiler information, and the compilation task information are respectively as described above, and are not described here.
- the allocating device 13 is configured to mark the task to be compiled stored in the database 12 as a waiting state, waiting for the compiler to compile, and when obtaining the compile command, determining the current compiling state of the compiler 100, and according to the current compiling state. Setting the task to be compiled to continue waiting or entering the compiling phase, wherein when set to continue waiting, the database 12 will continue to store the task to be compiled, and when set to enter the compiling phase, the distributing device 13 sends the task to be compiled to the compiling machine 100. In the middle, the compiler 100 compiles the task to be compiled.
- the specific method for setting the task to be compiled to wait state and entering the compile phase is: preset two field attribute values, respectively auto_flag and wait_flag, wherein the settings of the values of auto_flag and wait_flag include the following two cases:
- the second case: setting the value of auto_flag to 0 means that the task is in the compiled state, the default is 1; when the value of wait_flag is 0, the task is in the waiting state, and the default is 1.
- the allocating means 13 first sets the value of auto_flag of the task to be compiled stored in the database 12 to 0, and the value of wait_flag is set to 1 to indicate the waiting state.
- the value of auto_flag is also set to 0, and the value of wait_flag is set to 1, or the value of auto_flag is set to 0, and the value of wait_flag is set to 0.
- the value of auto_flag is set to 1 and the value of wait_flag to 0.
- the allocating device 13 further includes an obtaining unit 131, a determining unit 132, and an allocating unit 133.
- the obtaining unit 131 is configured to acquire the capability of the compiler 100 to compile a task, wherein the capability includes the first number threshold of the compiler capable of simultaneously compiling the same type of tasks and the second threshold of the tasks that can be simultaneously compiled at the same time, wherein A quantity threshold is less than or equal to the second number threshold.
- the determining unit 132 is configured to determine whether the number of tasks currently compiled by the compiler 100 is greater than or equal to the first number threshold.
- the distribution unit 133 sets the task to be compiled to enter the compile phase when the result of the judgment by the judging unit 132 is NO, and further transmits the task to be compiled to the compiler 100. Specifically, the value of auto_flag of the task to be compiled is set to 1, and the value of wait_flag is set to 0 to indicate that it enters the compile phase.
- the distribution device 13 further includes a determination unit 134.
- the determining unit 134 is configured to further determine whether the number of tasks currently compiled by the compiler 100 is greater than or equal to the second number threshold when the result of the determination by the determining unit 132 is YES.
- the allocating unit 133 sets the task to be compiled to continue waiting.
- the settings include two cases:
- the first case is: when it is determined that the number of tasks currently compiled by the compiler 100 is greater than or equal to the number of the second number of thresholds, the waiting state of the task to be compiled is set to the sleep phase, that is, the auto_flag of the task to be compiled is The value of the wait_flag is set to 0. Until the number of tasks currently compiled by the compiler 100 is greater than the number of second number thresholds, the value of auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 1.
- the second case if the number of currently compiled tasks of the compiler 100 is greater than the number of the second number of thresholds is 1, the value of the auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 1.
- a waiting time is further set, for example, it may be 2 minutes, and if the waiting time is reached, the scanning and judgment are performed again.
- the allocating device 13 further includes a determining unit 135, configured to further determine, when the result of the determining by the determining unit 134 is negative, whether the task currently compiled by the compiler 100 is the same as the type of the task to be compiled.
- the allocating unit 133 sets the task to be entered into the compile phase when the result of the judgment by the judging unit 135 is negative, and further transmits the task to be compiled to the compiling machine 100.
- the value of auto_flag of the task to be compiled is set to 1, and the value of wait_flag is set to 0 to indicate that it enters the compile phase.
- the allocating device 13 further includes a determining unit 136, configured to further determine, when the result of the determining by the determining unit 135 is YES, whether the number of tasks of the same type as the task to be compiled is greater than or equal to the first number threshold.
- the allocating unit 133 sets the task to be compiled to enter the compiling phase when the result of the judging unit 136 is negative, and further transmits the task to be compiled to the compiling machine 100.
- the value of auto_flag of the task to be compiled is set to 1, and the value of wait_flag is set to 0 to indicate that it enters the compile phase.
- the allocating unit 133 sets the task to be compiled to continue waiting.
- the specific settings include the following two situations:
- the determining unit 136 determines that the number of tasks of the same type as the task to be compiled is greater than the first number of thresholds, the number of tasks is greater than or equal to 2, and the waiting state of the task to be compiled is set to the sleep phase.
- the value of auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 0.
- the value of auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 1.
- the second case if the determining unit 136 determines that the number of tasks of the same type as the task to be compiled is greater than the number of the first number of thresholds, the value of auto_flag of the task to be compiled is set to 0, and the value of wait_flag is set to 1.
- a waiting time is further set, for example, it may be 2 minutes, and if the waiting time is reached, the scanning and judgment are performed again.
- the dynamic allocation compiler of the present invention is dynamically allocated according to the situation of compiling the current compilation task, and does not need to specify the compiler specifically for each compilation task. Further, the compiling task is continuous during the compiling process, and a task is automatically scanned to the next task after the completion of the task. In the case where the compiling task is queued, the compiling machine does not have a long time idle resource waste. Further, a compiler can support two or more compilation tasks simultaneously. Multiple compilation tasks can be performed simultaneously on different compilers without interfering with each other. Further, the entire compilation process does not require any manual operation, and there is no manual intervention, and the error rate is reduced. Further, the compilation task will automatically start to find the compiler after submitting. For a large number of compilation tasks, the efficiency of the compiler is obviously improved, and the problem that one compiler can only process one compilation task at the same time can be solved.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
- Stored Programmes (AREA)
Abstract
一种动态分配编译机的系统及其方法,该方法包括:发起待编译任务,并将待编译任务进行存储,进而将待编译任务标示为等待状态,以等待编译机进行编译(S1);获取编译命令,判断编译机的当前编译状态,并根据当前编译状态来设置待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,将继续存储待编译任务,当设置为进入编译阶段时,将待编译任务发送到编译机中,由编译机对待编译任务进行编译(S2)。通过上述方式能够自动分配编译任务,实现编译机的高效使用及降低出错率。
Description
【技术领域】
本发明涉及编译机技术领域,尤其是涉及一种动态分配编译机的系统及其方法。
【背景技术】
如今智能终端正在高速发展,并越来越普及,智能终端上运行的软件程序发布频率也要求越来越高。软件发布需要编译机来完成,如何在有限的编译机资源情况下实现高效的软件发布是我们一直在探讨的问题。
目前大多数厂商使用的还是静态配置编译机的方式。静态配置编译机的方式具体为:把现有的编译机部署在集成系统(比如Jenkins等软件集成系统)中,没有使用数据库维护,每次发布软件时需要手动选择某一台编译机。该种方式有如下弊端:编译机使用效率低以及需要人工干预,造成成本较高及出错率高。
【发明内容】
本发明主要解决的技术问题是提供一种动态分配编译机的系统及其方法,能够自动分配编译任务,实现编译机的高效使用及降低出错率。
为解决上述技术问题,本发明采用的一个技术方案是:提供一种动态分配编译机的方法,其中,所述方法包括:发起待编译任务,并将所述待编译任务进行存储,进而将所述待编译任务标示为等待状态,以等待所述编译机进行编译,其中,在存储所述待编译任务时,进一步建立三个数据表,用于分别记录项目信息、编译机信息、编译任务信息;
获取编译命令,判断所述编译机的当前编译状态,并根据所述当前编译状态来设置所述待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,将继续存储所述待编译任务,当设置为进入编译阶段时,将所述待编译任务发送到所述编译机中,由所述编译机对所述待编译任务进行编译;
所述方法还包括:
获取所述编译机编译任务的能力,其中所述能力包括所述编译机能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,所述第一数量阈值小于或等于所述第二数量阈值;
所述判断所述编译机的当前编译状态的步骤包括:
第一次判断所述编译机当前编译的任务的数量是否大于或等于所述第一数量阈值,并在第一判断的结果为否时,将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
其中,所述项目信息包括编译的任务的类型;
所述编译机信息包括各编译机的IP地址、编译机的名称、编译的任务类型以及目前剩余的编译空间;
所述编译任务信息包括正在工作的编译机的信息和其编译的任务信息。
其中,所述方法还包括:在第一次判断的结果为是时,第二次判断所述编译机当前编译的任务的数量是否大于或等于第二数量阈值,并在第二次判断的结果为是时,设置所述待编译任务为继续等待。
其中,所述方法还包括:在第二次判断的结果为否时,第三次判断所述编译机当前编译的任务是否与所述待编译任务的类型相同,并在第三次判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
其中,所述方法还包括:在第三次判断的结果为是时,第四次判断与所述待编译任务相同类型的任务的数量是否大于或等于所述第一数量阈值,并在第四次判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中,在第四次判断的结果为是时,设置所述待编译任务为继续等待。
为解决上述技术问题,本发明采用的另一个技术方案是:提供一种动态分配编译机的方法,该方法包括:发起待编译任务,并将待编译任务进行存储,进而将待编译任务标示为等待状态,以等待编译机进行编译;获取编译命令,判断编译机的当前编译状态,并根据当前编译状态来设置待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,将继续存储待编译任务,当设置为进入编译阶段时,将待编译任务发送到编译机中,由编译机对待编译任务进行编译。
其中,所述方法还包括:在存储所述待编译任务时,进一步建立三个数据表,用于分别记录项目信息、编译机信息、编译任务信息。
其中,所述项目信息包括编译的任务的类型;
所述编译机信息包括各编译机的IP地址、编译机的名称、编译的任务类型以及目前剩余的编译空间;
所述编译任务信息包括正在工作的编译机的信息和其编译的任务信息。
其中,方法还包括:获取编译机编译任务的能力,其中能力包括编译机能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,第一数量阈值小于或等于第二数量阈值;判断编译机的当前编译状态的步骤包括:第一次判断编译机当前编译的任务的数量是否大于或等于第一数量阈值,并在第一判断的结果为否时,将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中。
其中,方法还包括:在第一次判断的结果为是时,第二次判断编译机当前编译的任务的数量是否大于或等于第二数量阈值,并在第二次判断的结果为是时,设置待编译任务为继续等待。
其中,方法还包括:在第二次判断的结果为否时,第三次判断编译机当前编译的任务是否与待编译任务的类型相同,并在第三次判断的结果为否时将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中。
其中,方法还包括:在第三次判断的结果为是时,第四次判断与待编译任务相同类型的任务的数量是否大于或等于第一数量阈值,并在第四次判断的结果为否时将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中,在第四次判断的结果为是时,设置待编译任务为继续等待。
为解决上述技术问题,本发明采用的又一个技术方案是:提供一种动态分配编译机的系统,该系统包括:客制化装置,用于发起待编译任务,并进一步发起编译命令;数据库,用于存储待编译任务;分配装置,用于将存储在数据库中的待编译任务标示为等待状态,以等待编译机进行编译,并在获取到编译命令时,判断编译机的当前编译状态,并根据当前编译状态来设置待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,数据库将继续存储待编译任务,当设置为进入编译阶段时,分配装置将待编译任务发送到编译机中,由编译机对待编译任务进行编译。
其中,分配装置进一步包括:获取单元,用于获取编译机编译任务的能力,其中能力包括编译机能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,第一数量阈值小于或等于第二数量阈值;第一判断单元,用于判断编译机当前编译的任务的数量是否大于或等于第一数量阈值;分配单元,在第一判断单元判断的结果为否时,将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中。
其中,分配装置进一步包括:第二判断单元,用于在第一判断单元判断的结果为是时,进一步判断编译机当前编译的任务的数量是否大于或等于第二数量阈值;分配单元在第二判断单元判断的结果为是时,设置待编译任务为继续等待。
其中,分配装置进一步包括:第三判断单元,用于在第二判断单元判断的结果为否时,进一步判断编译机当前编译的任务是否与待编译任务的类型相同;分配单元在第三判断单元判断的结果为否时将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中。
其中,分配装置进一步包括:第四判断单元,用于在第三判断单元判断的结果为是时,进一步判断与待编译任务相同类型的任务的数量是否大于或等于第一数量阈值;分配单元在第四判断单元判断的结果为否时将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中,在第四判断单元判断的结果为是时,设置待编译任务为继续等待。
本发明的有益效果是:区别于现有技术的情况,本发明的动态分配编译机的方法具体为:首先发起待编译任务,并将待编译任务进行存储,进而将待编译任务标示为等待状态,以等待编译机进行编译,获取编译命令,并判断编译机的当前编译状态,进一步根据当前编译状态来设置待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,将继续存储待编译任务,当设置为进入编译阶段时,将待编译任务发送到编译机中,由编译机对待编译任务进行编译。因此,本发明能够根据编译机的当前编译状态自动分配编译任务,实现编译机的高效使用及降低出错率。
【附图说明】
图1是本发明实施例提供的一种动态分配编译机的方法的流程图;
图2是本发明实施例提供的另一种动态分配编译机的方法的流程图;
图3是本发明实施例提供的又一种动态分配编译机的方法的流程图;
图4是本发明实施例提供的一种动态分配编译机的系统的结构示意图。
【具体实施方式】
请参阅图1,图1是本发明实施例提供的一种动态分配编译机的方法的流程图。如图1所示,本实施例的方法包括以下步骤:
步骤S1:发起待编译任务,并将待编译任务进行存储,进而将待编译任务标示为等待状态,以等待编译机进行编译。
具体的,预设两个字段属性值,分别为auto_flag和wait_flag,其中,auto_flag和wait_flag的值的设置包括以下两种情况:
第一种情况:auto_flag的值为1时表示该待待任务处于编译状态,即进入编译阶段,默认为0;wait_flag的值为1时表示该待任务处于等待状态,默认为0。
第二种情况:设置auto_flag的值为0时表示该待任务处于编译状态,默认为1;wait_flag的值为0时表示该待任务处于等待状态,默认为1。
本实施例中,为了方便描述,下文关于auto_flag和wait_flag的值所代表的含义都将以第一种情况为例说明。
因此本步骤首先将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1,以标示为等待状态。
步骤S2:获取编译命令,判断编译机的当前编译状态,并根据当前编译状态来设置待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,将继续存储待编译任务,当设置为进入编译阶段时,将待编译任务发送到编译机中,由编译机对待编译任务进行编译。
本实施例还进一步获取编译机编译任务的能力,其中能力包括编译机能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,第一数量阈值小于或等于第二数量阈值。
其中步骤S2的具体判断过程请参阅图2,图2是本发明实施例提供的另一种动态分配编译机的方法的流程图。如图2所示,步骤S2具体包括以下判断步骤:
步骤S21:判断编译机当前编译的任务的数量是否大于或等于第一数量阈值。
本步骤中,在判断的结果为否时跳转到步骤S22,在判断的结果为是时跳转到步骤S23。
步骤S22:将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中。
具体的,将待编译任务的auto_flag的值设置为1,且wait_flag的值设置为0,以标示为进入编译阶段。
步骤S23:判断编译机当前编译的任务的数量是否大于或等于第二数量阈值。
本步骤中,在判断的结果为是时跳转到步骤S24,在判断的结果为否时跳转到步骤S25。
步骤S24:设置待编译任务为继续等待。
具体为设置包括两种情况:
第一种情况:判断到编译机当前编译的任务的数量大于第二数量阈值的数量为大于或等于2,则将待编译任务此时的等待状态设置为睡眠阶段,即将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为0。直到编译机当前编译的任务的数量大于第二数量阈值的数量为1,再将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
第二种情况:若编译机当前编译的任务的数量大于第二数量阈值的数量为1,将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
本步骤中,还进一步设置一等待时间,例如可以为2分钟,若等待时间到则再重新进行扫描和判断。
步骤S25:判断编译机当前编译的任务是否与待编译任务的类型相同。
本步骤中,在判断的结果为否时跳转到步骤S26,在判断的结果为是时跳转到步骤S27。
步骤S26:将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中。
具体的,将待编译任务的auto_flag的值设置为1,且wait_flag的值设置为0,以标示为进入编译阶段。
步骤S27:判断与待编译任务相同类型的任务的数量是否大于或等于第一数量阈值。
本步骤中,在判断的结果为否时跳转到步骤S28,在判断的结果为是时跳转到步骤S29。
步骤S28:将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机中。
具体的,将待编译任务的auto_flag的值设置为1,且wait_flag的值设置为0,以标示为进入编译阶段。
步骤S29:设置待编译任务为继续等待。
其中,具体设置包括以下两种情况:
第一种情况:若步骤S27判断到与待编译任务相同类型的任务的数量大于第一数量阈值的数量为大于或等于2,则将待编译任务此时的等待状态设置为睡眠阶段,将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为0。直到与待编译任务相同类型的任务的数量大于第一数量阈值的数量为1,再将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
第二种情况:若步骤S27判断到与待编译任务相同类型的任务的数量大于第一数量阈值的数量为1,则将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
本步骤中,还进一步设置一等待时间,例如可以为2分钟,若等待时间到则再重新进行扫描和判断。
因此,本实施例可以动态的分配待编译任务,无需人工干预,首先高效的编译以及降低出错率。
本实施例中,在步骤S1存储待编译任务时,还进一步建立三个数据表,分别为t_product、t_web_host_info、t_web_create_perso这三张表,分别记录项目信息、编译机信息、编译任务信息。其中,项目信息包括编译的任务的类型。编译机信息包括各编译机的IP地址、编译机的名称、编译的任务类型以及目前剩余的编译空间等。编译任务信息包括正在工作的编译机的信息和其编译的任务信息。
在步骤S2设置编译任务状态之前需要选择编译机,具体过程为:首先判断是否有空余的编译机。若判断到没有空余的编译机,则随机选择一个编译机与步骤S1存储的待编译任务关联,即将步骤S1存储的待编译任务发送到随机选择的编译机中;或者进一步判断正在工作的编译机的编译任务,并将步骤S1存储的待编译任务发送到编译任务较少的编译机中。其中,优选发送到与待编译任务同类型的编译任务较少的编译机中。
若判断到有空余的编译机,则进一步判断空余的编译机是否大于或等于两个,若大于或等于两个,则随机选择一个对待编译任务进行编译,若只有一个,就选择该编译机对待编译任务进行编译。
其中,在给待编译任务选择好对应的编译机之后,都需要获取选择的编译机的IP地址,然后才将待编译任务发送到对应的编译机中。
因此本实施例可以动态的分配编译机和动态的分配待编译任务,实现编译的高效率以及降低由于人工参与的出错率。
请参阅图3,图3是本发明实施例提供的又一种动态分配编译机的方法的流程图。值得注意的是,本实施例举例编译机能够同时编译相同的任务的数量为1个,能够同时编译任务的最大数量为2个。
如图3所示,本实施例的方法包括以下步骤:
步骤S30:发起待任务。其中待任务为1,2,3,…n个,n为自然数。
步骤S31:判断是否有空余的编译机。并在判断的结果为否是跳转到步骤S32,在判断的结果为否时跳转到步骤S33。
步骤S32:选择其中一台编译机,其中选择的原则如前文所述,在此不再赘述。然后执行步骤S35,获取编译机的IP地址。
步骤S33:判断空余的编译机是否大于或等于2台。在判断的结果为是时跳转到步骤S34,在判断的结果为否时跳转到步骤S35,
步骤S34:选择其中一台编译机。然后执行步骤S35,获取编译机的IP地址。
步骤S35:获取编译机的IP地址。
步骤S36:将待任务设置为等待状态。其中步骤S36还可以设置在步骤S30和步骤31之间。
步骤S37:扫描编译机的编译状态。具体就是扫描编译机的在编译任务的数量。
步骤S38:判断在编译任务是否大于两个。其中,在判断的结果为是时跳转到步骤S39,在判断的结果为否时跳转到步骤S40。
步骤S39:设置为等待状态,并且等待时间为2分钟。若等待时间达到2分钟,则返回到步骤S37,重新扫描编译机的编译状态。
其中,步骤S39的待编译任务的等待状态的设置为auto_flag的值设置为0,且wait_flag的值设置为0。
步骤S40:判断在编译任务是否为两个。其中,在判断的结果为否时跳转到步骤S41,在判断的结果为是时跳转到步骤S42。
步骤S41:设置进入编译阶段,并将任务发送到对应的编译机中。其中,步骤S41的待编译任务的设置为auto_flag的值设置为1,且wait_flag的值设置为0。
步骤S42:判断任务类型是否相同,并在判断的结果为是时跳转到步骤S39,在判断的结果为否是跳转到步骤S41。
其中,本步骤跳转到步骤S39时,步骤S39的设置为auto_flag的值设置为0,且wait_flag的值设置为1。
请参阅图4,图4是本发明实施例提供的一种动态分配编译机的系统的结构示意图。如图4所示,本实施例的动态分配编译机的系统10包括客制化装置11、数据库12以及分配装置13。
其中,客制化装置11用于发起待编译任务,如图4所示的待编译任务1、待编译任务2…待编译任务n(n为自然数),并进一步发起编译命令。
数据库12用于存储待编译任务。并且数据库中存储有三个数据表,分别为t_product、t_web_host_info、t_web_create_perso这三张表,分别记录项目信息、编译机信息、编译任务信息。其中,项目信息、编译机信息以及编译任务信息包含的内容分别如前文所述,在此不再赘述。
分配装置13用于将存储在数据库12中的待编译任务标示为等待状态,以等待编译机进行编译,并在获取到编译命令时,判断编译机100的当前编译状态,并根据当前编译状态来设置待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,数据库12将继续存储待编译任务,当设置为进入编译阶段时,分配装置13将待编译任务发送到编译机100中,由编译机100对待编译任务进行编译。
其中设置待编译任务为等待状态和进入编译阶段的具体方法为:预设两个字段属性值,分别为auto_flag和wait_flag,其中,auto_flag和wait_flag的值的设置包括以下两种情况:
第一种情况:auto_flag的值为1时表示该待任务处于编译状态,即进入编译阶段,默认为0;wait_flag的值为1时表示该待任务处于等待状态,默认为0。
第二种情况:设置auto_flag的值为0时表示该待任务处于编译状态,默认为1;wait_flag的值为0时表示该待任务处于等待状态,默认为1。
本实施例中,为了方便描述,下文关于auto_flag和wait_flag的值所代表的含义都将以第一种情况为例说明。
因此分配装置13首先将存储在数据库12中的待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1,以标示为等待状态。当设置为继续等待时,同样设置auto_flag的值设置为0,且wait_flag的值设置为1,或者auto_flag的值设置为0,且wait_flag的值设置为0。当设置为进入编译阶段时,将设置auto_flag的值设置为1,且wait_flag的值设置为0。
可选的,分配装置13进一步包括获取单元131、判断单元132以及分配单元133。其中,获取单元131用于获取编译机100编译任务的能力,其中能力包括编译机100能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,第一数量阈值小于或等于第二数量阈值。判断单元132用于判断编译机100当前编译的任务的数量是否大于或等于第一数量阈值。分配单元133在判断单元132判断的结果为否时,将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机100中。具体设置为将待编译任务的auto_flag的值设置为1,且wait_flag的值设置为0,以标示为进入编译阶段。
进一步的,分配装置13还包括判断单元134。判断单元134用于在判断单元132判断的结果为是时,进一步判断编译机100当前编译的任务的数量是否大于或等于第二数量阈值。分配单元133在判断单元134判断的结果为是时,设置待编译任务为继续等待。具体为设置包括两种情况:
第一种情况:判断到编译机100当前编译的任务的数量大于第二数量阈值的数量为大于或等于2,则将待编译任务此时的等待状态设置为睡眠阶段,即将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为0。直到编译机100当前编译的任务的数量大于第二数量阈值的数量为1,再将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
第二种情况:若编译机100当前编译的任务的数量大于第二数量阈值的数量为1,将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
本实施例中,还进一步设置一等待时间,例如可以为2分钟,若等待时间到则再重新进行扫描和判断。
进一步的,分配装置13还包括判断单元135,用于在判断单元134判断的结果为否时,进一步判断编译机100当前编译的任务是否与待编译任务的类型相同。分配单元133在判断单元135判断的结果为否时将待任务设置为进入编译阶段,并进一步将待编译任务发送到编译机100中。具体的,将待编译任务的auto_flag的值设置为1,且wait_flag的值设置为0,以标示为进入编译阶段。
进一步的,分配装置13还包括判断单元136,用于在判断单元135判断的结果为是时,进一步判断与待编译任务相同类型的任务的数量是否大于或等于第一数量阈值。分配单元133在判断单元136判断的结果为否时将待编译任务设置为进入编译阶段,并进一步将待编译任务发送到编译机100中。具体的,将待编译任务的auto_flag的值设置为1,且wait_flag的值设置为0,以标示为进入编译阶段。
分配单元133在判断单元136判断的结果为是时,设置待编译任务为继续等待。其中,具体设置包括以下两种情况:
第一种情况:若判断单元136判断到与待编译任务相同类型的任务的数量大于第一数量阈值的数量为大于或等于2,则将待编译任务此时的等待状态设置为睡眠阶段,将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为0。直到与待编译任务相同类型的任务的数量大于第一数量阈值的数量为1,再将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
第二种情况:若判断单元136判断到与待编译任务相同类型的任务的数量大于第一数量阈值的数量为1,则将待编译任务的auto_flag的值设置为0,且wait_flag的值设置为1。
本实施例中,还进一步设置一等待时间,例如可以为2分钟,若等待时间到则再重新进行扫描和判断。
综上所述,本发明的动态分配编译机的方案是在根据编译当前编译任务的情况进行动态分配的,不需要每次的编译任务都具体指定编译机。进一步的,编译任务在编译过程中是持续的,一个任务完成之后会自动扫描到下一个任务,在有编译任务排队的情况下,编译机不会出现长时间空闲资源浪费的情况。进一步的,一台编译机可支持同时进行两个或者两个以上的编译任务。多个编译任务可以在不同的编译机上同时进行,互不干扰。进一步的,整个编译过程不需要手动进行任何操作,没有人工干预,出错率降低。进一步的,编译任务只要提交之后就会开始自动寻找编译机,对于大量编译任务同时进行的情况,编译机的效率有明显的提高,可以解决一台编译机只能同时处理一个编译任务的问题。
以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
Claims (17)
- 一种动态分配编译机的方法,其中,所述方法包括:发起待编译任务,并将所述待编译任务进行存储,进而将所述待编译任务标示为等待状态,以等待所述编译机进行编译,其中,在存储所述待编译任务时,进一步建立三个数据表,用于分别记录项目信息、编译机信息、编译任务信息;获取编译命令,判断所述编译机的当前编译状态,并根据所述当前编译状态来设置所述待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,将继续存储所述待编译任务,当设置为进入编译阶段时,将所述待编译任务发送到所述编译机中,由所述编译机对所述待编译任务进行编译;所述方法还包括:获取所述编译机编译任务的能力,其中所述能力包括所述编译机能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,所述第一数量阈值小于或等于所述第二数量阈值;所述判断所述编译机的当前编译状态的步骤包括:第一次判断所述编译机当前编译的任务的数量是否大于或等于所述第一数量阈值,并在第一判断的结果为否时,将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
- 根据权利要求1所述的方法,其中,所述项目信息包括编译的任务的类型;所述编译机信息包括各编译机的IP地址、编译机的名称、编译的任务类型以及目前剩余的编译空间;所述编译任务信息包括正在工作的编译机的信息和其编译的任务信息。
- 根据权利要求1所述的方法,其中,所述方法还包括:在第一次判断的结果为是时,第二次判断所述编译机当前编译的任务的数量是否大于或等于第二数量阈值,并在第二次判断的结果为是时,设置所述待编译任务为继续等待。
- 根据权利要求3所述的方法,其中,所述方法还包括:在第二次判断的结果为否时,第三次判断所述编译机当前编译的任务是否与所述待编译任务的类型相同,并在第三次判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
- 根据权利要求4所述的方法,其中,所述方法还包括:在第三次判断的结果为是时,第四次判断与所述待编译任务相同类型的任务的数量是否大于或等于所述第一数量阈值,并在第四次判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中,在第四次判断的结果为是时,设置所述待编译任务为继续等待。
- 一种动态分配编译机的方法,其中,所述方法包括:发起待编译任务,并将所述待编译任务进行存储,进而将所述待编译任务标示为等待状态,以等待所述编译机进行编译;获取编译命令,判断所述编译机的当前编译状态,并根据所述当前编译状态来设置所述待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,将继续存储所述待编译任务,当设置为进入编译阶段时,将所述待编译任务发送到所述编译机中,由所述编译机对所述待编译任务进行编译。
- 根据权利要求6所述的方法,其中,所述方法还包括:在存储所述待编译任务时,进一步建立三个数据表,用于分别记录项目信息、编译机信息、编译任务信息。
- 根据权利要求7所述的方法,其中,所述项目信息包括编译的任务的类型;所述编译机信息包括各编译机的IP地址、编译机的名称、编译的任务类型以及目前剩余的编译空间;所述编译任务信息包括正在工作的编译机的信息和其编译的任务信息。
- 根据权利要求6所述的方法,其中,所述方法还包括:获取所述编译机编译任务的能力,其中所述能力包括所述编译机能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,所述第一数量阈值小于或等于所述第二数量阈值;所述判断所述编译机的当前编译状态的步骤包括:第一次判断所述编译机当前编译的任务的数量是否大于或等于所述第一数量阈值,并在第一判断的结果为否时,将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
- 根据权利要求9所述的方法,其中,所述方法还包括:在第一次判断的结果为是时,第二次判断所述编译机当前编译的任务的数量是否大于或等于第二数量阈值,并在第二次判断的结果为是时,设置所述待编译任务为继续等待。
- 根据权利要求10所述的方法,其中,所述方法还包括:在第二次判断的结果为否时,第三次判断所述编译机当前编译的任务是否与所述待编译任务的类型相同,并在第三次判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
- 根据权利要求11所述的方法,其中,所述方法还包括:在第三次判断的结果为是时,第四次判断与所述待编译任务相同类型的任务的数量是否大于或等于所述第一数量阈值,并在第四次判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中,在第四次判断的结果为是时,设置所述待编译任务为继续等待。
- 一种动态分配编译机的系统,其中,所述系统包括:客制化装置,用于发起待编译任务,并进一步发起编译命令;数据库,用于存储所述待编译任务;分配装置,用于将存储在所述数据库中的待编译任务标示为等待状态,以等待所述编译机进行编译,并在获取到所述编译命令时,判断所述编译机的当前编译状态,并根据所述当前编译状态来设置所述待编译任务为继续等待还是进入编译阶段,其中,当设置为继续等待时,所述数据库将继续存储所述待编译任务,当设置为进入编译阶段时,所述分配装置将所述待编译任务发送到所述编译机中,由所述编译机对所述待编译任务进行编译。
- 根据权利要求13所述的系统,其中,所述分配装置进一步包括:获取单元,用于获取所述编译机编译任务的能力,其中所述能力包括所述编译机能够同时编译相同类型的任务的第一数量阈值以及最多能同时编译的任务的第二数量阈值,其中,所述第一数量阈值小于或等于所述第二数量阈值;第一判断单元,用于判断所述编译机当前编译的任务的数量是否大于或等于所述第一数量阈值;分配单元,在所述第一判断单元判断的结果为否时,将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
- 根据权利要求14所述的系统,其中,所述分配装置进一步包括:第二判断单元,用于在所述第一判断单元判断的结果为是时,进一步判断所述编译机当前编译的任务的数量是否大于或等于第二数量阈值;所述分配单元在所述第二判断单元判断的结果为是时,设置所述待编译任务为继续等待。
- 根据权利要求15所述的系统,其中,所述分配装置进一步包括:第三判断单元,用于在所述第二判断单元判断的结果为否时,进一步判断所述编译机当前编译的任务是否与所述待编译任务的类型相同;所述分配单元在所述第三判断单元判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中。
- 根据权利要求16所述的系统,其中,所述分配装置进一步包括:第四判断单元,用于在所述第三判断单元判断的结果为是时,进一步判断与所述待编译任务相同类型的任务的数量是否大于或等于所述第一数量阈值;所述分配单元在第四判断单元判断的结果为否时将所述待编译任务设置为进入编译阶段,并进一步将所述待编译任务发送到所述编译机中,在第四判断单元判断的结果为是时,设置所述待编译任务为继续等待。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US15/318,639 US10810048B2 (en) | 2015-10-13 | 2016-06-08 | Systems and methods for dynamic allocation of compilation machines |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510658136.6A CN105373430A (zh) | 2015-10-13 | 2015-10-13 | 一种动态分配编译机的系统及其方法 |
| CN201510658136.6 | 2015-10-13 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2017063374A1 true WO2017063374A1 (zh) | 2017-04-20 |
Family
ID=55375655
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2016/085248 Ceased WO2017063374A1 (zh) | 2015-10-13 | 2016-06-08 | 一种动态分配编译机的系统及其方法 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US10810048B2 (zh) |
| CN (1) | CN105373430A (zh) |
| WO (1) | WO2017063374A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114968201A (zh) * | 2021-02-23 | 2022-08-30 | 腾讯科技(深圳)有限公司 | 一种编译方法、编译装置、计算机设备及存储介质 |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105373430A (zh) * | 2015-10-13 | 2016-03-02 | 惠州Tcl移动通信有限公司 | 一种动态分配编译机的系统及其方法 |
| US11157338B2 (en) | 2019-10-30 | 2021-10-26 | International Business Machines Corporation | Throttling using message partitioning and buffering |
| WO2021146898A1 (zh) * | 2020-01-21 | 2021-07-29 | 深圳元戎启行科技有限公司 | 编译方法和装置、计算机设备、计算机可读存储介质 |
| CN111610977B (zh) * | 2020-05-19 | 2024-06-25 | 腾讯科技(深圳)有限公司 | 一种编译方法和相关装置 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP0908818A2 (en) * | 1997-10-06 | 1999-04-14 | Sun Microsystems Inc. | Method and apparatus for performing byte-code optimization during pauses |
| CN101290581A (zh) * | 2008-05-16 | 2008-10-22 | 北京星网锐捷网络技术有限公司 | 编译系统及方法 |
| CN103019772A (zh) * | 2012-11-23 | 2013-04-03 | 东方网力科技股份有限公司 | 一种软件开发中的自动化编译方法及系统 |
| CN103440136A (zh) * | 2013-09-05 | 2013-12-11 | 迈普通信技术股份有限公司 | 分布式编译的方法及系统 |
| CN104657204A (zh) * | 2013-11-22 | 2015-05-27 | 华为技术有限公司 | 短任务处理方法、装置及操作系统 |
| CN105373430A (zh) * | 2015-10-13 | 2016-03-02 | 惠州Tcl移动通信有限公司 | 一种动态分配编译机的系统及其方法 |
Family Cites Families (14)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5440747A (en) * | 1993-09-27 | 1995-08-08 | Hitachi America, Ltd. | Data processor with control logic for storing operation mode status and associated method |
| JP3927600B2 (ja) * | 1995-05-30 | 2007-06-13 | コーポレーション フォー ナショナル リサーチ イニシアチブス | 分散タスク実行のためのシステム |
| US7203747B2 (en) * | 2001-05-25 | 2007-04-10 | Overture Services Inc. | Load balancing system and method in a multiprocessor system |
| US7328294B2 (en) * | 2001-12-03 | 2008-02-05 | Sun Microsystems, Inc. | Methods and apparatus for distributing interrupts |
| US8037474B2 (en) * | 2005-09-27 | 2011-10-11 | Sony Computer Entertainment Inc. | Task manager with stored task definition having pointer to a memory address containing required code data related to the task for execution |
| US8458661B2 (en) * | 2006-03-31 | 2013-06-04 | Ebay Inc. | Distributed parallel build system |
| US8234236B2 (en) * | 2009-06-01 | 2012-07-31 | International Business Machines Corporation | System and method for efficient allocation of resources in virtualized desktop environments |
| CN102232282B (zh) * | 2010-10-29 | 2014-03-26 | 华为技术有限公司 | 一种实现数据中心资源负载均衡的方法及装置 |
| US9323319B2 (en) * | 2011-06-29 | 2016-04-26 | Nec Corporation | Multiprocessor system and method of saving energy therein |
| CN103176774A (zh) * | 2011-12-21 | 2013-06-26 | 中国移动通信集团广东有限公司 | 应用程序的编译方法、装置以及系统 |
| CN104123184B (zh) * | 2013-04-28 | 2017-12-22 | 国际商业机器公司 | 一种用于为构建过程中的任务分配资源的方法和系统 |
| US20150178125A1 (en) * | 2013-12-23 | 2015-06-25 | Oracle International Corporation | Reducing synchronization of tasks in latency-tolerant task-parallel systems |
| US9424077B2 (en) * | 2014-11-14 | 2016-08-23 | Successfactors, Inc. | Throttle control on cloud-based computing tasks utilizing enqueue and dequeue counters |
| US10049126B2 (en) * | 2015-09-06 | 2018-08-14 | Mellanox Technologies Tlv Ltd. | Cuckoo hashing with selectable hash |
-
2015
- 2015-10-13 CN CN201510658136.6A patent/CN105373430A/zh active Pending
-
2016
- 2016-06-08 WO PCT/CN2016/085248 patent/WO2017063374A1/zh not_active Ceased
- 2016-06-08 US US15/318,639 patent/US10810048B2/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP0908818A2 (en) * | 1997-10-06 | 1999-04-14 | Sun Microsystems Inc. | Method and apparatus for performing byte-code optimization during pauses |
| CN101290581A (zh) * | 2008-05-16 | 2008-10-22 | 北京星网锐捷网络技术有限公司 | 编译系统及方法 |
| CN103019772A (zh) * | 2012-11-23 | 2013-04-03 | 东方网力科技股份有限公司 | 一种软件开发中的自动化编译方法及系统 |
| CN103440136A (zh) * | 2013-09-05 | 2013-12-11 | 迈普通信技术股份有限公司 | 分布式编译的方法及系统 |
| CN104657204A (zh) * | 2013-11-22 | 2015-05-27 | 华为技术有限公司 | 短任务处理方法、装置及操作系统 |
| CN105373430A (zh) * | 2015-10-13 | 2016-03-02 | 惠州Tcl移动通信有限公司 | 一种动态分配编译机的系统及其方法 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114968201A (zh) * | 2021-02-23 | 2022-08-30 | 腾讯科技(深圳)有限公司 | 一种编译方法、编译装置、计算机设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| US20170286166A1 (en) | 2017-10-05 |
| US10810048B2 (en) | 2020-10-20 |
| CN105373430A (zh) | 2016-03-02 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2017063374A1 (zh) | 一种动态分配编译机的系统及其方法 | |
| WO2018036167A1 (zh) | 测试任务执行机分配方法、装置、服务器和存储介质 | |
| WO2012034486A1 (zh) | 一种家庭网络中应用终端的软件安装和升级方法及系统 | |
| WO2013133621A1 (ko) | 이종의 운영체제를 사용하는 가상화 시스템의 전력 관리 방법 및 장치 | |
| WO2014092375A1 (en) | Method and apparatus for controlling access between home device and external server in home network system | |
| WO2016169390A1 (zh) | 应用安全防护方法、终端、存储介质 | |
| WO2012025011A1 (zh) | 软件升级系统及方法、计算机存储介质 | |
| WO2014044136A1 (zh) | 基于分布式数据的并发处理方法、系统和计算机存储介质 | |
| WO2014003505A1 (ko) | 디바이스 소셜리티 구성 시스템 및 방법 | |
| WO2015174609A1 (ko) | 라이브러리 업데이트 방법, 이를 위한 단말 및 시스템 | |
| WO2010147362A2 (en) | Widget activation and communication method | |
| WO2015135260A1 (zh) | 一种智能电视访问电视节目和应用程序的方法及系统 | |
| WO2020119062A1 (zh) | 预装应用管理方法、装置及存储介质 | |
| WO2013154398A1 (ko) | 소프트웨어 정의 라디오 어플리케이션의 배포, 설치 및 실행 방법 | |
| WO2014042357A1 (ko) | 화면 동기 제어 시스템, 이를 이용한 화면 동기 방법 및 장치 | |
| WO2020237859A1 (zh) | 基于nbd设备的数据迁移方法、装置、设备及存储介质 | |
| WO2009136740A2 (ko) | OSGi 서비스 플랫폼에 원격으로 설치된 번들에 대한 바인딩 정보를 관리하는 방법 및 장치 | |
| WO2020062615A1 (zh) | 显示面板的伽马值调节方法、装置及显示设备 | |
| WO2012070900A2 (ko) | 개인 장치간 이벤트 및 데이터 공유 시스템 | |
| WO2021012487A1 (zh) | 跨系统的信息同步方法、用户设备、存储介质及装置 | |
| WO2016013815A1 (ko) | 데이터 운용 방법 및 전자 장치 | |
| WO2018097442A1 (ko) | 모바일 단말을 이용한 화상 형성 장치의 무선 연결 설정 방법 및 이를 수행하기 위한 화상 형성 장치 | |
| WO2021187818A1 (ko) | 전자 장치 및 전자 장치의 테마를 부분적으로 운용하는 방법 | |
| WO2015142087A1 (ko) | 스마트 기기를 제어하는 로봇 및 로봇을 통한 스마트 기기 제어 시스템 | |
| WO2019117535A1 (ko) | 외부 전자 장치와의 통신을 위한 전자 장치 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| WWE | Wipo information: entry into national phase |
Ref document number: 15318639 Country of ref document: US |
|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16854759 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 16854759 Country of ref document: EP Kind code of ref document: A1 |