Task scheduling method, system and equipment based on Jenkins platform and storage medium

By installing a concurrency control plug-in on the Jenkins platform and setting a concurrency limit, the task queuing problem during multi-task concurrency is solved and the task execution efficiency is improved, especially in the Pipeline task type.

CN120670152APending Publication Date: 2025-09-19HEBEI HAPPY CONSUMPTION FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510752683.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

On the Jenkins platform, there is a problem of long task queuing time when multiple tasks are running concurrently, especially in the Pipeline task type. Existing technologies cannot effectively control the number of concurrency, resulting in low task execution efficiency.

Method used

By installing the concurrency control plug-in in the Jenkins platform and setting the concurrency limit, the concurrency control plug-in parses the concurrent task attribute information, obtains the total number of executors and the maximum concurrency of a single node, controls the concurrent execution of tasks on the node, and avoids warehouse conflicts.

Benefits of technology

It implements concurrency limits on Jenkins Pipeline tasks, solves the single-node bottleneck problem, shortens task waiting time, and improves task execution efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670152A_ABST
    Figure CN120670152A_ABST
Patent Text Reader

Abstract

The invention provides a task scheduling method based on a Jenkins platform, and relates to the technical field of computer application. The Jenkins platform is provided with a concurrency control plug-in. The task scheduling method comprises the following steps: acquiring a queue item in a task queue; analyzing the queue item to obtain concurrent task attribute information and concurrent executable information; when the concurrent task attribute information is not null and the concurrent executable information is true, obtaining the total number of actuators and the maximum concurrent number of single nodes according to the concurrent task attribute information; when the total number of the actuators is greater than zero, obtaining a Jenkins node and the number of Jenkins Pipeline tasks corresponding to the queue item operated on the Jenkins node; and when the number of the Jenkins Pipeline tasks corresponding to the queue item operated on the Jenkins node is smaller than the maximum concurrency number of the single node, calling an executor on the Jenkins node to execute the Jenkins Pipeline tasks corresponding to the queue item. By adopting the method and the device, Jenkins Pipeline task concurrency limitation can be realized, so that the queuing waiting time is shortened, and the task execution efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and more specifically, to a task scheduling method, system, device and storage medium based on a Jenkins platform. Background Art

[0002] In daily software project processes, different Maven (automated build tool) build tasks (also known as jobs in Jenkins, collectively referred to as tasks in this application, and task types are uniformly referred to as Pipeline) are applied in different scenarios at multiple stages. For example:

[0003] Scenario 1: During the R&D phase, developers need to package the project into a jar package and upload the jar package to a Maven private server for use by other projects. This packaging process requires Maven packaging.

[0004] Scenario 2: During the testing phase, it's necessary to check whether the components (JAR packages) that the R&D project depends on comply with security and usage specifications. Sonar checks (an automated process for code quality testing and defect prevention) are also performed to determine if there are any security vulnerabilities or defects. Both dependency checks and Sonar checks rely on Maven plugins and are implemented using Maven compilation.

[0005] Scenario 3: During the R&D and testing phases, both developers and testers need to package their code into Docker images for deployment and testing in their respective environments. This packaging process relies on Maven. Furthermore, the Maven plugin is also required to check the existence of the Maven plugin version.

[0006] As can be seen, Maven is used in multiple tasks and scenarios, and Maven relies on the local Maven repository during the compilation process. Furthermore, in the above scenarios, the JAR packages generated during the compilation process are unpublished. Therefore, to prevent the compilation of multiple tasks from interfering with each other, each compilation must clean up the JAR packages generated, essentially cleaning up the Maven repository. This requires setting up different repositories for different tasks. However, when running concurrent tasks, there's a risk that one task might just download the JAR package only to have it cleared by another task. Therefore, to ensure the smooth progress of tasks, multiple people executing the same task must queue up. If many people need to execute the task, the queue time will increase, resulting in reduced efficiency.

[0007] Currently, the only way to resolve the queuing issue is to add more Jenkins nodes and, when concurrency is needed, dispatch tasks to other nodes. In other words, when Jenkins is running on a single node, tasks are not concurrent; when running on multiple nodes, tasks are concurrent, and each node can only execute one concurrent task. However, currently, controlling the maximum concurrency of a single node is only supported in Jenkins Freestyle projects and multi-configuration projects (Matrix). Setting the maximum number of concurrent tasks on a single Jenkins node is not supported for Pipeline-type tasks. Summary of the Invention

[0008] To address at least some of the problems in the prior art described above, embodiments of the present invention provide a task scheduling method, system, storage medium, device, and computer program product based on the Jenkins platform. By installing a plug-in that implements concurrency limit functionality into Jenkins, it is possible to set the number of concurrent tasks and thereby enable concurrency limits for Jenkins Pipeline tasks. Furthermore, task concurrency control can significantly shorten queue waiting times and improve task execution efficiency.

[0009] According to a first aspect of the present invention, an embodiment of the present invention provides a task scheduling method based on a Jenkins platform, wherein the Jenkins platform is installed with a concurrency control plug-in, and the task scheduling method includes: obtaining a queue item in a task queue, wherein the queue item includes the total number of executors and the maximum concurrency number of a single node; parsing the queue item to obtain concurrent task attribute information and concurrent executable information; when the concurrent task attribute information is not empty and the concurrent executable information is true, obtaining the total number of executors and the maximum concurrency number of a single node according to the concurrent task attribute information; when the total number of executors is greater than zero, obtaining a first Jenkins node and the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node; when the number of JenkinsPipeline tasks corresponding to the queue item running on the first Jenkins node is less than the maximum concurrency number of a single node, calling the executor on the first Jenkins node to execute the Jenkins Pipeline task corresponding to the queue item.

[0010] According to the above embodiment of the present invention, by installing a plugin that implements concurrency limit functionality into Jenkins and applying the concurrency information obtained from queue items, Jenkins Pipeline task concurrency limits can be implemented. Furthermore, task concurrency control can resolve single-node bottlenecks, shorten task execution wait times, and improve task execution efficiency.

[0011] In some embodiments of the present invention, the task scheduling method further includes: when the executor on the first Jenkins node is unavailable, traversing other Jenkins nodes on the Jenkins platform except the first Jenkins node and determining whether the executors on the other Jenkins nodes are available; when the executors on the other Jenkins nodes are all unavailable, putting the queue item back into the task queue.

[0012] In some embodiments of the present invention, the queue item also includes a JenkinsPipeline task corresponding to the queue item, and the Jenkins Pipeline task corresponding to the queue item is a JenkinsPipeline task for building a project, and the Jenkins Pipeline task includes Maven configuration and repository information.

[0013] In some embodiments of the present invention, the maximum concurrent number of a single node is at least 1.

[0014] According to the above embodiment of the present invention, by setting the maximum concurrency of a single node to 1, it is possible to achieve only one build of the same task on each node without affecting other tasks, effectively solving the warehouse conflict problem when multiple tasks are built concurrently.

[0015] According to the second aspect of the present invention, an embodiment of the present invention provides a task scheduling system based on a Jenkins platform, wherein the Jenkins platform is installed with a concurrency control plug-in, and the task scheduling system includes: a queue item acquisition module, used to obtain queue items in the task queue, wherein the queue items include the total number of executors and the maximum concurrency number of a single node; a concurrency information acquisition module, used to parse the queue items to obtain concurrent task attribute information and concurrent executable information; a task scheduling module, used to perform the following operations: when the concurrent task attribute information is not empty and the concurrent executable information is true, obtain the total number of executors and the maximum concurrency number of a single node according to the concurrent task attribute information; when the total number of executors is greater than zero, obtain the first Jenkins node and the number of JenkinsPipeline tasks corresponding to the queue item running on the first Jenkins node; when the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node is less than the maximum concurrency number of a single node, call the executor on the first Jenkins node to execute the Jenkins Pipeline task corresponding to the queue item.

[0016] According to the above embodiment of the present invention, by installing a plugin that implements concurrency limit functionality into Jenkins and applying the concurrency information obtained from queue items, Jenkins Pipeline task concurrency limits can be implemented. Furthermore, task concurrency control can resolve single-node bottlenecks, shorten task execution wait times, and improve task execution efficiency.

[0017] In some embodiments of the present invention, the task scheduling module is further used to perform the following operations: when the executor on the first Jenkins node is unavailable, traverse other Jenkins nodes on the Jenkins platform except the first Jenkins node and determine whether the executors on the other Jenkins nodes are available; when the executors on the other Jenkins nodes are all unavailable, put the queue item back into the task queue.

[0018] In some embodiments of the present invention, the queue item also includes a JenkinsPipeline task corresponding to the queue item, and the Jenkins Pipeline task corresponding to the queue item is a JenkinsPipeline task for building a project, and the Jenkins Pipeline task includes Maven configuration and repository information.

[0019] In some embodiments of the present invention, the maximum concurrent number of a single node is at least 1.

[0020] According to the above embodiment of the present invention, by setting the maximum concurrency of a single node to 1, it is possible to achieve only one build of the same task on each node without affecting other tasks, effectively solving the warehouse conflict problem when multiple tasks are built concurrently.

[0021] According to the third aspect of the present invention, an embodiment of the present invention provides a computer-readable storage medium having computer-readable instructions stored thereon. When the computer-readable instructions are executed by a processor, the computer performs the following operations: the operations include the steps included in the task scheduling method based on the Jenkins platform as described in any one of the above embodiments.

[0022] According to a fourth aspect of the present invention, an embodiment of the present invention provides a computer device comprising a memory and a processor, wherein the memory is used to store one or more computer-readable instructions, wherein the one or more computer-readable instructions, when executed by the processor, can implement the task scheduling method based on the Jenkins platform as described in any one of the above embodiments.

[0023] According to a fifth aspect of the present invention, an embodiment of the present invention provides a computer program product comprising a computer program, which, when executed by a processor, implements the task scheduling method based on the Jenkins platform as described in any one of the above embodiments.

[0024] As can be seen from the foregoing, the Jenkins-based task scheduling method, system, storage medium, device, and computer program product provided by the embodiments of the present invention implement concurrency limits for Jenkins Pipeline tasks by installing a plug-in that implements concurrency limits into Jenkins and applying concurrency information obtained from queue items. Furthermore, task concurrency control can resolve single-node bottlenecks, shorten task execution wait times, and improve task execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 1 is a flow chart of a task scheduling method based on a Jenkins platform according to embodiment 1 of the present invention;

[0026] Figure 2 1 is a flow chart of a task scheduling method based on a Jenkins platform according to embodiment 2 of the present invention;

[0027] Figure 3 1 is a schematic diagram of the architecture of a task scheduling system based on the Jenkins platform according to Example 3 of the present invention. DETAILED DESCRIPTION

[0028] The various aspects of the present invention are described in detail below in conjunction with the accompanying drawings and specific embodiments. Among them, well-known modules, units and their connections, links, communications or operations are not shown or described in detail. In addition, the described features, architectures or functions can be combined in any manner in one or more embodiments. It should be understood by those skilled in the art that the various embodiments described below are only for illustration and are not intended to limit the scope of protection of the present invention. It can also be easily understood that the modules or units or processing methods in the various embodiments described herein and shown in the drawings can be combined and designed in various different configurations.

[0029] The following is a brief explanation of the terms used below.

[0030] Jenkins: An open source automation server.

[0031] Total number of executors: The total number of all executors in the Jenkins platform. One executor can only run one task. The total number of executors corresponds to the maximum number of concurrent tasks.

[0032] Master: The master node or main control node is the core control center of Jenkins, responsible for managing global operations such as task scheduling, plug-in management, and user permissions.

[0033] Agent: An agent node or execution node is a server that actually performs tasks (such as code compilation, testing, packaging, etc.) and is scheduled and managed by the master node.

[0034] Maven: Environment configuration (such as a specific version of the Maven tool).

[0035] Repository: Warehouse, usually refers to the Maven warehouse, used to store dependent jar packages and other components.

[0036] [Example 1]

[0037] Figure 1 1 is a flow chart of a task scheduling method based on a Jenkins platform according to embodiment 1 of the present invention.

[0038] like Figure 1 As shown, in Example 1 of the present invention, the Jenkins platform is installed with a concurrency control plug-in, and the task scheduling method based on the Jenkins platform may include at least the following steps S11, S12, S13, S14 and S15, which are described in detail below.

[0039] In step S11, a queue item in the task queue is obtained. The queue item includes the total number of executors and the maximum number of concurrent users per node. The queue item also includes the corresponding Jenkins Pipeline task. The Jenkins Pipeline task is a Jenkins Pipeline task used to build the project and includes Maven configuration and repository information.

[0040] In this embodiment, by installing a Jenkins plug-in that implements the concurrency limit function into Jenkins, the parameter configuration of the plug-in can be obtained in the Jenkins Pipeline task, and the corresponding concurrency information can be set in the parameter configuration, thereby enabling task concurrency and task limit.

[0041] In some embodiments, the maximum concurrency of a single node is at least 1. By setting the maximum concurrency of a single node to 1, only one build of the same task can be achieved on each node without affecting other tasks, effectively solving the repository conflict problem when multiple tasks are concurrently built; by setting the maximum concurrency of a single node to greater than 1, single-node task concurrency can be achieved.

[0042] In step S12, the queue item is parsed to obtain concurrent task attribute information and concurrent executable information.

[0043] In step S13, when the concurrent task attribute information is not empty and the concurrent executable information is true, the total number of executors and the maximum concurrency number of a single node are obtained according to the concurrent task attribute information.

[0044] In step S14, when the total number of executors is greater than zero, the first Jenkins node and the number of tasks corresponding to the queue item running on the first Jenkins node are obtained.

[0045] In step S15, when the number of tasks corresponding to the queue item running on the first Jenkins node is less than the maximum concurrency of a single node, the executor on the first Jenkins node is called to execute the task corresponding to the queue item.

[0046] In a further embodiment, when the executor on the first Jenkins node is unavailable, the Jenkins nodes other than the first Jenkins node on the Jenkins platform are traversed to determine whether the executors on the other Jenkins nodes are available. If the executors on the other Jenkins nodes are unavailable, the queue item is put back into the task queue. By traversing all Jenkins nodes and detecting the executor status of each node in a preset order, when it is detected that the current node has an available executor, the queue item is assigned to the available executor of the node; if no executor is available after traversing all nodes, the queue item is put back into the task queue.

[0047] Using the Jenkins platform-based task scheduling method described in Example 1 of the present invention, a plug-in that implements concurrency restriction is installed in Jenkins, and concurrency information obtained from queue items is used to implement concurrency restriction for Jenkins Pipeline tasks. Furthermore, task concurrency control can resolve single-node bottlenecks, shorten task execution wait times, and improve task execution efficiency.

[0048] [Example 2]

[0049] Figure 2 4 is a flow chart of a task scheduling method based on the Jenkins platform according to embodiment 2 of the present invention.

[0050] like Figure 2 As shown, in embodiment 2 of the present invention, the task scheduling method based on the Jenkins platform may include the following steps:

[0051] Step S21: Configure the total number of executors and the maximum number of concurrent tasks per node for the Jenkins Pipeline task in Jenkins with the concurrency control plug-in installed, save the Jenkins Pipeline task (job), generate a queue information Queue.Task after confirming the build, and place the information in the queue Queue. The plug-in rewrites the JenkinscanTake(Node node,Task task) method, which is the core method of concurrency control, and the task carries all the information on task execution. The task carries information on task execution including concurrency information and build information, and the concurrency information includes: whether concurrency is allowed and the maximum number of concurrencies; the build information is the build parameters, including: git address, git branch, build pom.xml path, build image, jdk version, etc.

[0052] In some implementations, when a task is confirmed to be built, a queue item is created and stored in a queue. The queue item contains all the information set for the task, such as concurrency information and Git information used during the build. The build information includes: Git address, Git branch, build pom.xml path, build image, JDK version, etc. The queue is scheduled on a first-in-first-out basis. When the current task is completed, it is removed from the queue and the next task is executed. During task execution, the queue item can be used to obtain all relevant information to be executed, and this information can be used to determine concurrency scenarios, etc.

[0053] Step S22: parse out the concurrent attribute information ThrottleJobProperty and the concurrent executable information ThrottleEnabled according to the task.

[0054] Step S23: The concurrent information obtained in step S22 is judged. When ThrottleJobProperty is empty, step S24 is executed. When ThrottleJobProperty is not empty and ThrottleEnabled is true, it is determined that the job needs to be executed concurrently, and step S25 is continued.

[0055] Step S24: When ThrottleJobProperty is empty, the concurrent logic is not executed, but the task is queued for execution.

[0056] Step S25: According to the concurrent task attributes, the total number of executors / maximum concurrency (maxConcurrentToal) and the maximum concurrency per node (maxConcurrentPerNodeToal) of the job are obtained. When the total number of executors is greater than zero, step S26 is executed.

[0057] Step S26: Obtain the number of Jenkins nodes and the number of jobs running on the Jenkins node. When the number of jobs running on the Jenkins node (totalRunCountOnNode) is less than the maximum concurrency of a single node, determine whether there is an available executor on the node. If there is an available executor on the node, execute the task on the executor and increase the totalRunCount (total number of running tasks) by one. If there is no executor, search for other available nodes. If all nodes are unavailable, re-place the task in the task queue. In this embodiment, when the total number of running tasks is consistent with the total number of executors, the task is no longer executed, but queued for execution.

[0058] The number of executors on a node is limited by the settings on the Jenkins page. For example, one or more executors can be set on a node, and the number of executors on the node can be obtained by obtaining the node. Furthermore, the executors on the node are traversed and checked to see if the executor is currently executing a task. If the executor is not currently executing a task, the current task is executed.

[0059] In this embodiment, the plug-in in step (1) references Jenkins-core (a jar package), which provides methods for obtaining node information, executor information, etc.

[0060] In some implementations, the maximum number of concurrent tasks on a single node is 1, which means that concurrency is not allowed on a single node. If a concurrent scenario occurs, tasks can be executed on other nodes.

[0061] Using the Jenkins platform-based task scheduling method described in Example 2 of the present invention, a plug-in that implements concurrency restriction is installed in Jenkins, and concurrency information obtained from queue items is used to implement concurrency restriction for Jenkins Pipeline tasks. Furthermore, task concurrency control can resolve single-node bottlenecks, shorten task execution wait times, and improve task execution efficiency.

[0062] At the same time, the present invention provides an example of implementing task scheduling using the task scheduling method based on the Jenkins platform described in Example 2:

[0063] First, the task execution environment is as follows:

[0064] 1. The server includes Agent and Master, and the Master is used first. The Agent has executors 1 and 2, and the Master has executors 3 and 4.

[0065] 2. Jenkins Pipeline tasks (jobs) include job1 (Maven1, repository1) and job2 (Maven2, repository2), both of which are pipeline projects.

[0066] 3. Projects (services) include: Project 1, Project 2, Project 3, and Project 4. Projects 1 to 4 are all Maven-type project tasks, which use Maven as the build tool, follow Maven's project structure and configuration specifications, and rely on Maven to complete tasks such as compilation, testing, and packaging.

[0067] 4. Maven: Maven1 (job1), Maven2 (job2).

[0068] 5. Scenario: A task runs only one build on a server, and it is assumed that initially, no other tasks are running.

[0069] Secondly, perform the following task scheduling steps in the task execution environment:

[0070] 1. Job1 builds project 1, the queue id is queue1_id1, the build is job1_id1, and occupies the Master server (such as executor 3);

[0071] 2. Project 2 needs to be built using job1, and the generated queue id is queue1_id2. Since job1_id1 is running on the Master, queue1_id2 cannot be run on the Master. There is no task on the Agent at this time, so it is executed on the Agent (such as Executor 1).

[0072] 3. Project 3 needs to be built using job2. Since the Maven and repository of job1 and job2 are independent, they can be executed on the Master (such as executor 4).

[0073] 4. Project 4 needs to be built using job2. Since job2 already exists in the Master, it is executed on the Agent (such as Executor 2).

[0074] [Example 3]

[0075] Figure 31 is a schematic diagram of the architecture of a task scheduling system based on the Jenkins platform according to Example 3 of the present invention.

[0076] like Figure 3 As shown, the task scheduling system based on the Jenkins platform includes: a queue item acquisition module 310, a concurrent information acquisition module 320, and a task scheduling module 330. The Jenkins platform is installed with a concurrency control plug-in.

[0077] The queue item acquisition module 310 is used to obtain queue items from the task queue. The queue items include the total number of executors and the maximum number of concurrent users per node. The queue items also include the corresponding Jenkins Pipeline tasks. The corresponding Jenkins Pipeline tasks are Jenkins Pipeline tasks used to build the project and include Maven configuration and repository information.

[0078] In this embodiment, by installing a Jenkins plug-in that implements the concurrency limit function into Jenkins, the parameter configuration of the plug-in can be obtained in the Jenkins Pipeline task, and the corresponding concurrency information can be set in the parameter configuration, thereby enabling task concurrency and task limit.

[0079] In some embodiments, the maximum concurrency of a single node is at least 1. By setting the maximum concurrency of a single node to 1, only one build of the same task can be achieved on each node without affecting other tasks, effectively solving the repository conflict problem when multiple tasks are concurrently built.

[0080] The concurrent information acquisition module 320 is used to parse the queue items to obtain concurrent task attribute information and concurrent executable information.

[0081] The task scheduling module 330 is used to perform the following operations: when the concurrent task attribute information is not empty and the concurrent executable information is true, obtain the total number of executors and the maximum concurrency of a single node according to the concurrent task attribute information; when the total number of executors is greater than zero, obtain the first Jenkins node and the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node; when the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node is less than the maximum concurrency of a single node, call the executor on the first Jenkins node to execute the Jenkins Pipeline task corresponding to the queue item.

[0082] In some embodiments, the task scheduling module is further used to perform the following operations: when the executor on the first Jenkins node is unavailable, traverse other Jenkins nodes on the Jenkins platform except the first Jenkins node and determine whether the executors on the other Jenkins nodes are available; when the executors on the other Jenkins nodes are all unavailable, put the queue item back into the task queue.

[0083] The Jenkins platform-based task scheduling system of Example 3 of the present invention implements concurrency limits for Jenkins Pipeline tasks by installing a plug-in that implements concurrency limits in Jenkins and applying concurrency information obtained from queue items. Furthermore, task concurrency control can resolve single-node bottlenecks, shorten task execution wait times, and improve task execution efficiency.

[0084] Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by combining software with a hardware platform. Based on this understanding, all or part of the contribution of the technical solution of the present invention to the background art can be embodied in the form of a software product. This computer software product can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present invention or certain parts of the embodiments.

[0085] Correspondingly, an embodiment of the present invention further provides a computer-readable storage medium having computer-readable instructions or a program stored thereon. When the computer-readable instructions or program are executed by a processor, the computer performs the following operations: the operations include the steps included in the task scheduling method based on the Jenkins platform as described in any of the above embodiments, which are not further described here. The storage medium may include, for example, an optical disk, a hard disk, a floppy disk, a flash memory, a magnetic tape, etc.

[0086] In addition, an embodiment of the present invention further provides a computer device including a memory and a processor, wherein the memory is configured to store one or more computer-readable instructions or programs, wherein the one or more computer-readable instructions or programs, when executed by the processor, can implement the Jenkins platform-based task scheduling method described in any of the above embodiments. The computer device can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or the like.

[0087] Embodiments of the present invention also provide a computer program product comprising a computer program, the computer program including program code for executing the Jenkins-based task scheduling method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to cause the computer system to implement the Jenkins-based task scheduling method provided in the embodiments of the present disclosure.

[0088] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).

[0089] Finally, it should be noted that the above embodiments are intended only to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments may be modified or some of the technical features thereof may be replaced with equivalents. Such modifications or replacements do not deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention. Therefore, the scope of protection of the present invention shall be determined by the claims.

Claims

1. A task scheduling method based on the Jenkins platform, characterized in that: The Jenkins platform is installed with a concurrency control plug-in, wherein the task scheduling method includes: Get the queue items in the task queue, including the total number of executors and the maximum number of concurrent users on a single node; Parsing the queue item to obtain concurrent task attribute information and concurrent executable information; When the concurrent task attribute information is not empty and the concurrent executable information is true, obtaining the total number of executors and the maximum concurrent number of a single node according to the concurrent task attribute information; When the total number of executors is greater than zero, obtain the first Jenkins node and the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node; When the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node is less than the maximum concurrency of a single node, the executor on the first Jenkins node is called to execute the Jenkins Pipeline task corresponding to the queue item.

2. The task scheduling method according to claim 1, wherein: The task scheduling method further includes: When the executor on the first Jenkins node is unavailable, traverse other Jenkins nodes on the Jenkins platform except the first Jenkins node and determine whether the executors on the other Jenkins nodes are available. When the executors on the other Jenkins nodes are all unavailable, put the queue item back into the task queue.

3. The task scheduling method according to claim 1, wherein: The queue item also includes a Jenkins Pipeline task corresponding to the queue item. The Jenkins Pipeline task corresponding to the queue item is a Jenkins Pipeline task for building a project. The Jenkins Pipeline task includes Maven configuration and repository information.

4. The task scheduling method according to claim 3, wherein: The maximum concurrent number of a single node is at least 1.

5. A task scheduling system based on the Jenkins platform, characterized in that: The Jenkins platform is installed with a concurrency control plug-in, wherein the task scheduling system includes: The queue item acquisition module is used to obtain the queue items in the task queue, including the total number of executors and the maximum number of concurrent users on a single node. A concurrent information acquisition module, configured to parse the queue items to obtain concurrent task attribute information and concurrent executable information; The task scheduling module is used to perform the following operations: When the concurrent task attribute information is not empty and the concurrent executable information is true, obtaining the total number of executors and the maximum concurrent number of a single node according to the concurrent task attribute information; When the total number of executors is greater than zero, obtain the first Jenkins node and the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node; When the number of Jenkins Pipeline tasks corresponding to the queue item running on the first Jenkins node is less than the maximum concurrency of a single node, the executor on the first Jenkins node is called to execute the Jenkins Pipeline task corresponding to the queue item.

6. The task scheduling system according to claim 5, wherein: The task scheduling module is also used to perform the following operations: When the executor on the first Jenkins node is unavailable, traverse other Jenkins nodes on the Jenkins platform except the first Jenkins node and determine whether the executors on the other Jenkins nodes are available. When the executors on the other Jenkins nodes are all unavailable, put the queue item back into the task queue.

7. The task scheduling system according to claim 6, wherein: The queue item also includes a Jenkins Pipeline task corresponding to the queue item. The Jenkins Pipeline task corresponding to the queue item is a Jenkins Pipeline task for building a project. The Jenkins Pipeline task includes Maven configuration and repository information.

8. A computer-readable storage medium storing computer-readable instructions, characterized in that: The computer-readable instructions are executed by a processor to implement the task scheduling method according to any one of claims 1 to 4.

9. A computer device comprising a memory and a processor, The memory stores computer-readable instructions, characterized in that: The processor executes the computer-readable instructions to implement the task scheduling method according to any one of claims 1 to 4.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the task scheduling method according to any one of claims 1 to 4 is implemented.