[go: up one dir, main page]

CN114064225A - Self-adaptive scheduling method, device, computer storage medium and system - Google Patents

Self-adaptive scheduling method, device, computer storage medium and system Download PDF

Info

Publication number
CN114064225A
CN114064225A CN202010761677.2A CN202010761677A CN114064225A CN 114064225 A CN114064225 A CN 114064225A CN 202010761677 A CN202010761677 A CN 202010761677A CN 114064225 A CN114064225 A CN 114064225A
Authority
CN
China
Prior art keywords
task
executors
executor
processed
idle state
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.)
Pending
Application number
CN202010761677.2A
Other languages
Chinese (zh)
Inventor
张悦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202010761677.2A priority Critical patent/CN114064225A/en
Publication of CN114064225A publication Critical patent/CN114064225A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a self-adaptive scheduling method, a self-adaptive scheduling device, a computer storage medium and a self-adaptive scheduling system, wherein the method comprises the steps of acquiring a task to be processed in a task list; sequentially judging whether a plurality of task executors included in the integrated module are in an idle state or not according to the tasks to be processed; when the plurality of task executors are all in a non-idle state, the number of the task executors in the integrated module is expanded; scheduling a newly added task executor from the expanded integrated module, and controlling the newly added task executor to execute the task to be processed; in this way, the integration module can adaptively adjust the number of task executors according to the service scale in the task list, thereby providing a dynamic telescopic continuous integration environment and improving the task concurrent processing capacity; the defect that the number of task processors must be kept fixed after the continuous integrated system is started is avoided, and the problem of solidification of continuous integrated processing capacity is solved.

Description

一种自适应调度方法、装置、计算机存储介质及系统An adaptive scheduling method, device, computer storage medium and system

技术领域technical field

本申请涉及计算机软件开发技术领域,尤其涉及一种自适应调度方法、装置、计算机存储介质及系统。The present application relates to the technical field of computer software development, and in particular, to an adaptive scheduling method, device, computer storage medium and system.

背景技术Background technique

Jenkins是一个开源的持续集成系统,通过这个平台,可以对自己的项目以及代码进行大规模的编译、测试以及进行项目发布,给软件开发团队带来极大的便利性。这里,Jenkins提供了一个开放易用的软件平台,使软件的持续集成变成可能。Jenkins is an open source continuous integration system. Through this platform, you can compile, test and release your own projects and codes on a large scale, which brings great convenience to the software development team. Here, Jenkins provides an open and easy-to-use software platform that makes continuous software integration possible.

实际使用中,Jenkins系统一般采用主备(master-slave)模式实现集成环境,在master-slave模式下,master节点为Jenkins系统的控制节点,slave节点为Jenkins系统的任务节点,执行具体的任务,相当于Jenkins的任务执行器。其中,slave节点中可以包含多个slaver以达到并行处理任务的功能,slaver的数量可以根据需求进行增加或者减少,这种结构虽然可以做到一定程度的并行处理,但是存在以下缺点:持续集成环境相对固定,面对不同的持续集成任务需求,需要各个节点的单独配置。所以,目前仍需要一种能够自适应伸缩的持续集成环境以应对动态的业务规模。In actual use, the Jenkins system generally adopts the master-slave mode to realize the integrated environment. In the master-slave mode, the master node is the control node of the Jenkins system, and the slave node is the task node of the Jenkins system to perform specific tasks. Equivalent to Jenkins' task executor. Among them, the slave node can contain multiple slaves to achieve the function of parallel processing tasks, and the number of slaves can be increased or decreased according to requirements. Although this structure can achieve a certain degree of parallel processing, it has the following disadvantages: continuous integration environment Relatively fixed, in the face of different continuous integration task requirements, individual configuration of each node is required. Therefore, there is still a need for an adaptive and scalable continuous integration environment to cope with dynamic business scales.

发明内容SUMMARY OF THE INVENTION

为解决上述技术问题,本申请实施例提供了一种自适应调度方法、装置、计算机存储介质及系统,能够根据业务规模自适应调整任务执行器的数量,从而提供了动态伸缩的持续集成环境。To solve the above technical problems, the embodiments of the present application provide an adaptive scheduling method, device, computer storage medium and system, which can adaptively adjust the number of task executors according to the business scale, thereby providing a dynamically scalable continuous integration environment.

本申请的技术方案是这样实现的:The technical solution of the present application is realized as follows:

第一方面,本申请实施例提供了一种自适应调度方法,该方法包括:In a first aspect, an embodiment of the present application provides an adaptive scheduling method, and the method includes:

获取任务列表中的待处理任务;Get the pending tasks in the task list;

根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;According to the to-be-processed task, sequentially determine whether the multiple task executors included in the integrated module are in an idle state;

当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;When the multiple task executors are all in a non-idle state, expanding the number of task executors in the integrated module;

从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。The newly added task executor is scheduled from the expanded integration module, and the newly added task executor is controlled to execute the to-be-processed task.

第二方面,本申请实施例提供了一种自适应调度装置,该自适应调度装置包括获取单元、判断单元、扩展单元和调度单元;其中,In a second aspect, an embodiment of the present application provides an adaptive scheduling device, where the adaptive scheduling device includes an acquisition unit, a judgment unit, an extension unit, and a scheduling unit; wherein,

获取单元,配置为获取任务列表中的待处理任务;An acquisition unit, configured to acquire pending tasks in the task list;

判断单元,配置为根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;a judging unit, configured to sequentially judge whether a plurality of task executors included in the integrated module are in an idle state according to the tasks to be processed;

扩展单元,配置为当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;an expansion unit, configured to expand the number of task executors in the integrated module when the multiple task executors are all in a non-idle state;

调度单元,配置为从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。The scheduling unit is configured to schedule the newly added task executor from the expanded integrated module, and control the newly added task executor to execute the to-be-processed task.

第三方面,本申请实施例提供了一种自适应调度装置,该自适应调度装置包括存储器和处理器;其中,In a third aspect, an embodiment of the present application provides an adaptive scheduling apparatus, where the adaptive scheduling apparatus includes a memory and a processor; wherein,

所述存储器,用于存储能够在所述处理器上运行的计算机程序;the memory for storing a computer program executable on the processor;

所述处理器,用于在运行所述计算机程序时,执行如第一方面所述方法的步骤。The processor is configured to execute the steps of the method according to the first aspect when running the computer program.

第四方面,本申请实施例提供了一种计算机存储介质,所述计算机存储介质存储有自适应调度程序,该自适应调度程序被至少一个处理器执行时实现如第一方面所述方法的步骤。In a fourth aspect, an embodiment of the present application provides a computer storage medium, where the computer storage medium stores an adaptive scheduler, and when the adaptive scheduler is executed by at least one processor, implements the steps of the method according to the first aspect .

第五方面,本申请实施例提供一种系统,该系统至少包括如第二方面或第三方面所述的自适应调度装置。In a fifth aspect, an embodiment of the present application provides a system, where the system at least includes the adaptive scheduling apparatus described in the second aspect or the third aspect.

本申请实施例提供了一种自适应调度方法、装置、计算机存储介质及系统,该方法包括获取任务列表中的待处理任务;根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务;这样,集成模块能够根据任务列表中的业务规模对任务执行器数量进行自适应调整,从而提供了一种动态伸缩的持续集成环境,使得任务并发处理能力得到提高;避免持续集成系统启动后必须保持固定任务处理器数量的弊端,解决了持续集成处理能力的固化问题;避免增加额外的集群管理工具去管理多个任务执行器,简化了连接过程和连接管理的成本。Embodiments of the present application provide an adaptive scheduling method, device, computer storage medium, and system. The method includes acquiring tasks to be processed in a task list; and according to the tasks to be processed, sequentially judging multiple Whether the task executor is in an idle state; when the multiple task executors are all in a non-idle state, expand the number of task executors in the integrated module; schedule the newly added task executor from the expanded integrated module, and control the The newly added task executor executes the to-be-processed task; in this way, the integration module can adaptively adjust the number of task executors according to the business scale in the task list, thereby providing a dynamically scalable continuous integration environment, making The concurrent processing capability of tasks is improved; it avoids the disadvantage that a fixed number of task processors must be maintained after the continuous integration system is started, and solves the problem of curing the processing capability of continuous integration; avoids adding additional cluster management tools to manage multiple task executors, which simplifies the The cost of the connection process and connection management.

附图说明Description of drawings

图1为相关技术方案中提供的一种master-slave模式下集成系统的结构示意图;1 is a schematic structural diagram of an integrated system in a master-slave mode provided in a related technical solution;

图2为相关技术方案中提供的另一种master-slave模式下集成系统的结构示意图;2 is a schematic structural diagram of an integrated system in another master-slave mode provided in the related technical solution;

图3为本申请实施例提供的一种自适应调度方法的流程示意图;FIG. 3 is a schematic flowchart of an adaptive scheduling method provided by an embodiment of the present application;

图4为本申请实施例提供的一种集成系统的结构示意图;4 is a schematic structural diagram of an integrated system provided by an embodiment of the present application;

图5为本申请实施例提供的另一种自适应调度方法的流程示意图;FIG. 5 is a schematic flowchart of another adaptive scheduling method provided by an embodiment of the present application;

图6为本申请实施例提供的又一种自适应调度方法的流程示意图;FIG. 6 is a schematic flowchart of another adaptive scheduling method provided by an embodiment of the present application;

图7为本申请实施例提供的再一种自适应调度方法的流程示意图;FIG. 7 is a schematic flowchart of still another adaptive scheduling method provided by an embodiment of the present application;

图8为本申请实施例提供的一种自适应调度装置的组成结构示意图;FIG. 8 is a schematic diagram of the composition and structure of an adaptive scheduling apparatus provided by an embodiment of the present application;

图9为本申请实施例提供的另一种自适应调度装置的组成结构示意图;FIG. 9 is a schematic diagram of the composition and structure of another adaptive scheduling apparatus provided by an embodiment of the present application;

图10为本申请实施例提供的一种自适应调度的具体硬件结构示例;FIG. 10 is an example of a specific hardware structure of an adaptive scheduling provided by an embodiment of the present application;

图11为本申请实施例提供的一种系统的结构示意图。FIG. 11 is a schematic structural diagram of a system provided by an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.

Jenkins是开源的持续集成系统,通过这个平台,可以对项目以及代码进行大规模的编译、测试以及进行项目发布,给软件开发团队带来极大的便利性。Jenkins提供一个开放易用的软件平台,使软件的持续集成变成可能。Jenkins is an open source continuous integration system. Through this platform, projects and codes can be compiled, tested and released on a large scale, bringing great convenience to software development teams. Jenkins provides an open and easy-to-use software platform that makes continuous software integration possible.

在Jenkins平台的开发过程中,一般采用master节点和slave节点组合完成相应的任务,其中,master节点主要负责控制方面的工作,比如管理slave节点以及向slave节点分配任务。实际使用中,在面对大规模的持续集成需求的时候,单一master节点或者单一master节点单挂单点的slave节点(即一个master仅对应一个单独的slaver)的持续集成结构很难满足业务的需求,所以通常情况下持续集成环境的结构是的分布化和集群化的。In the development process of the Jenkins platform, a combination of master nodes and slave nodes is generally used to complete the corresponding tasks. Among them, the master node is mainly responsible for control work, such as managing slave nodes and assigning tasks to slave nodes. In actual use, in the face of large-scale continuous integration requirements, the continuous integration structure of a single master node or a single master node with a single slave node (that is, a master only corresponds to a single slave) is difficult to meet the needs of the business. , so usually the structure of continuous integration environment is distributed and clustered.

参见图1,其示出了相关技术方案中提供的一种master-slave模式下集成系统的结构示意图,如图1所示,当采用master-slave模式实现集成环境时,master节点为Jenkins系统的控制节点,slave节点为Jenkins系统的任务节点,slave节点中的slaver的数量可以根据需求进行增加或者减少;另外,也有部分开发人员选择利用Docker代替slave节点,参见图2,其示出了相关技术方案中提供的另一种master-slave模式下集成系统的结构示意图,如图2所示,master节点依然作为控制节点,将slave的节点换成Docker容器,并将Docker容器通过jnlp或者ssh与master相连可以实现稳定的环境隔离进行不同的持续集成任务的并行执行,然后这些集成系统都存在以下两个缺点:Referring to FIG. 1, it shows a schematic structural diagram of an integrated system in a master-slave mode provided in a related technical solution. As shown in FIG. 1, when the master-slave mode is used to implement the integrated environment, the master node is the Jenkins system. The control node, the slave node is the task node of the Jenkins system, the number of slaves in the slave node can be increased or decreased according to the demand; in addition, some developers choose to use Docker instead of the slave node, see Figure 2, which shows related technologies Another schematic diagram of the structure of the integrated system in master-slave mode provided in the scheme, as shown in Figure 2, the master node is still used as the control node, the slave node is replaced with a Docker container, and the Docker container is connected to the master through jnlp or ssh The connection can achieve stable environment isolation for the parallel execution of different continuous integration tasks, and these integration systems have the following two disadvantages:

(1)持续集成环境相对固定;对一个固定的集成系统而言,当配置完成启动后,无法在运行过程中再次增减slaver的数量;所以,面对不同的持续集成任务需求,需要各个节点的单独配置;(1) The continuous integration environment is relatively fixed; for a fixed integration system, after the configuration is completed and started, the number of slaves cannot be increased or decreased during the operation process; therefore, in the face of different continuous integration task requirements, each node is required individual configuration;

(2)这种结构的slave节点一旦发生故障或者错误,需要逐一查找并进行手动修复,浪费大量时间。(2) Once the slave node of this structure is faulty or wrong, it needs to be searched one by one and repaired manually, which wastes a lot of time.

Docker是一个开源的容器的应用引擎,让开发者可以打包应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的环境中,也可以实现虚拟化。Docker容器完全使用沙箱机制,相互之间不会有任何接口。Docker的应用场景主要有以下四类:(1)网页应用的自动化打包和发布;(2)自动化测试和持续集成、发布;(3)在服务型环境中部署和调整数据库或其他的后台应用;(4)从头编译或者扩展现有的OpenShift或OpenShift平台来搭建单独的平台服务环境,其中,OpenShift和OpenShift都是面向开源开发人员开放的平台。Docker is an open source container application engine that allows developers to package applications and dependencies into a portable image, which can then be distributed to any popular environment, and can also be virtualized. Docker containers are completely sandboxed and do not have any interface with each other. The application scenarios of Docker mainly include the following four categories: (1) automated packaging and release of web applications; (2) automated testing and continuous integration and release; (3) deployment and adjustment of databases or other background applications in a service-based environment; (4) Compile or extend the existing OpenShift or OpenShift platform from scratch to build a separate platform service environment, where both OpenShift and OpenShift are open platforms for open source developers.

基于此,本申请实施例提供了一种自适应调度方法,通过获取任务列表中的待处理任务;根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务;这样,能够根据任务列表中的业务规模对集成模块中任务执行器数量进行自适应调整,从而提供了一种动态伸缩的持续集成环境,使得任务并发处理能力得到提高;避免持续集成系统启动后必须保持固定任务处理器数量的弊端,解决了持续集成处理能力的固化问题;避免增加额外的集群管理工具去管理多个任务执行器,简化了连接过程和连接管理的成本。Based on this, an embodiment of the present application provides an adaptive scheduling method, by acquiring the tasks to be processed in the task list; according to the tasks to be processed, it is sequentially judged whether multiple task executors included in the integration module are in an idle state ; When the multiple task executors are in a non-idle state, expand the number of task executors in the integrated module; schedule the newly added task executor from the expanded integrated module, and control the execution of the newly added task In this way, the number of task executors in the integration module can be adaptively adjusted according to the business scale in the task list, thereby providing a dynamically scalable continuous integration environment and improving the concurrent processing capability of tasks ;Avoid the disadvantage that a fixed number of task processors must be maintained after the continuous integration system is started, and solve the curing problem of continuous integration processing capacity; Avoid adding additional cluster management tools to manage multiple task executors, simplifying the connection process and connection management. cost.

在本申请的一实施例中,参见图3,其示出了本申请实施例提供的一种自适应调度方法的流程示意图,如图3所示,该方法可以包括:In an embodiment of the present application, referring to FIG. 3 , it shows a schematic flowchart of an adaptive scheduling method provided by an embodiment of the present application. As shown in FIG. 3 , the method may include:

S101:获取任务列表中的待处理任务;S101: Obtain pending tasks in the task list;

需要说明的是,为了满足大规模业务需求,持续集成系统的结构是分布化以及集群化的。在master-slave模式下的持续集成系统中,存在用于完成控制任务的master节点和用于完成具体业务的slave节点。在本实施例中,将每一个具体的slaver容器化得到任务执行器,而这些多个任务执行器的整体又容器化为集成模块。也就是说,在本实施例中,以任务执行器代替了原有的单独的slaver,但是相对于master节点来说,直接连接和管理的是集成模块而非具体的多个任务执行器,所以,master节点的控制任务并没有因此变得更加复杂,但是多个任务执行器通过自适应调度方法能够更高效的完成所分配的任务。同时,由于多个任务执行器是通过本实施例所述的自适应调度方法完成调度的,无需借助复杂的集群管理工具,也不必考虑集群管理工具与master节点的结合问题,所以减少了系统的复杂性。It should be noted that, in order to meet large-scale business requirements, the structure of continuous integration system is distributed and clustered. In the continuous integration system in the master-slave mode, there are master nodes for completing control tasks and slave nodes for completing specific services. In this embodiment, each specific slave is containerized to obtain a task executor, and the entirety of these multiple task executors is containerized into an integrated module. That is to say, in this embodiment, the original separate slave is replaced by a task executor, but compared to the master node, the integrated module is directly connected and managed instead of specific multiple task executors, so , the control task of the master node does not become more complicated, but multiple task executors can complete the assigned tasks more efficiently through the adaptive scheduling method. At the same time, since multiple task executors are scheduled through the adaptive scheduling method described in this embodiment, there is no need to resort to complex cluster management tools, and it is not necessary to consider the combination of cluster management tools and master nodes, thus reducing the system workload. Complexity.

需要说明的是,持续集成环境是为了完成所分配的任务而存在的,用于记录这些任务的信息就形成了任务列表。对于任务列表而言,其中的任务是有序存在的。一般情况下,任务列表中的任务是根据接收的时间进行排序的,也就是说先接收的任务排在任务列表的前部,后接收的任务排在任务列表的后部,当然,在具有插队机制的系统中,任务可能是根据紧急程度进行排序的,这种情况也在本申请的保护范围之内。具体地,在将接收到的任务写入任务列表时会对接收到的任务进行赋值,以便对任务进行标识和排序。It should be noted that the continuous integration environment exists to complete the assigned tasks, and the information used to record these tasks forms the task list. For the task list, the tasks in it are in order. In general, the tasks in the task list are sorted according to the time of receipt, that is to say, the tasks received first are in the front of the task list, and the tasks received later are in the back of the task list. In the system of the mechanism, the tasks may be ordered according to the degree of urgency, which is also within the protection scope of the present application. Specifically, when the received tasks are written into the task list, the received tasks are assigned values, so as to identify and sort the tasks.

S102:根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;S102: According to the to-be-processed task, sequentially determine whether the multiple task executors included in the integrated module are in an idle state;

需要说明的是,根据所述待处理任务,需要依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;在这里,“依次”表示按照一定的顺序,这个顺序是预设设定的,最常见的是按照任务执行器的编号从小到大,编号一般是在任务执行器建立的时候生成的。It should be noted that, according to the tasks to be processed, it is necessary to sequentially determine whether the multiple task executors included in the integrated module are in an idle state; here, "sequentially" means in a certain order, and this order is a preset setting The most common one is to follow the number of the task executor from small to large, and the number is generally generated when the task executor is created.

还需要说明的是,在此,“依次”的内涵中还包括,在对每个任务执行器判断之后,需要考察判断结果是否符合下一步条件,如果符合即可进行下一步而非接着对下一个任务执行器继续进行判断。It should also be noted that here, the connotation of "sequentially" also includes that after judging each task executor, it is necessary to check whether the judgment result meets the conditions of the next step, and if so, proceed to the next step instead of the next step. A task executor continues to make judgments.

进一步地,在一些实施例中,所述任务执行器包括Docker容器。Further, in some embodiments, the task executor includes a Docker container.

需要说明的是,Docker是一个开源的容器的应用引擎,让开发者可以打包应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的环境中,也可以实现虚拟化。Docker容器完全使用沙箱机制,相互之间不会有任何接口。Docker的应用场景主要有以下四类:(1)Web应用的自动化打包和发布;(2)自动化测试和持续集成、发布;(3)在服务型环境中部署和调整数据库或其他的后台应用;(4)从头编译或者扩展现有的OpenShift或Cloud Foundry平台来搭建单独的PaaS环境。It should be noted that Docker is an open source container application engine that allows developers to package applications and dependencies into a portable image, and then publish them to any popular environment, which can also be virtualized. Docker containers are completely sandboxed and do not have any interface with each other. The application scenarios of Docker mainly include the following four categories: (1) automated packaging and release of web applications; (2) automated testing and continuous integration and release; (3) deployment and adjustment of databases or other background applications in a service-based environment; (4) Compile or extend the existing OpenShift or Cloud Foundry platform from scratch to build a separate PaaS environment.

在本实施例中,Docker提供了一个沙盒环境进行持续集成,从而避免了环境的手动配置和修复,Docker还实现了稳定的环境隔离,可以通过不同的Docker容器内的实现不同的持续集成任务真正的并行。In this embodiment, Docker provides a sandbox environment for continuous integration, thereby avoiding manual configuration and repair of the environment. Docker also achieves stable environment isolation, and different continuous integration tasks can be implemented in different Docker containers. true parallelism.

需要说明的是,在本实施例中,集成模块包括多个任务执行器,也就是包括多个Docker容器,每个Docker容器用于执行多个具体的业务需求。其中,集成模块其实相当于现有技术中单挂单点的slave节点,所以也可以称之为Salve Docker,Salve Docker内部再次分布式形成多个独立的任务执行器,即Docker0、Docker1...到Dockern,而这些Docker0、Docker1...到Dockern通过本实施例所述的自适应调度方法进行集成。It should be noted that, in this embodiment, the integration module includes multiple task executors, that is, includes multiple Docker containers, and each Docker container is used to execute multiple specific business requirements. Among them, the integration module is actually equivalent to the single-point slave node in the existing technology, so it can also be called the Salve Docker. The Salve Docker is distributed again to form multiple independent task executors, namely Docker0, Docker1...to Dockern, and these Docker0, Docker1... to Dockern are integrated through the adaptive scheduling method described in this embodiment.

参见图4,其示出了本申请实施例中的一种集成系统的结构示意图,如图4所示,自适应调度系统至少包括master主机(相当于master节点)和Salve Docker(即集成模块),其中master节点是通过master主机实现的,即Jenkins普通的物理主机,也可以是容器化的Jenkins+Docker构造的master;Salve Docker与master主机直接相连,也就是master主机无需对每个任务执行器进行管理,可以简化连接操作和降低连接管理的成本。Referring to FIG. 4, it shows a schematic structural diagram of an integrated system in the embodiment of the present application. As shown in FIG. 4, the adaptive scheduling system at least includes a master host (equivalent to a master node) and a Salve Docker (ie an integrated module) , in which the master node is implemented by the master host, that is, the ordinary physical host of Jenkins, or the master constructed by containerized Jenkins+Docker; the Salve Docker is directly connected to the master host, that is, the master host does not need to perform each task executor. Managed to simplify connection operations and reduce the cost of connection management.

另外,Salve Docker一般独占一个物理主机,同样是Docker容器化的,同时SalveDocker内部又包括多个独立的Docker容器化的任务执行器,分布式形成Docker0、Docker1...到Dockern的布局,而多个Docker容器化的任务执行器利用前述的集成方法进行管理,无需额外的集群管理工具。In addition, Salve Docker generally monopolizes a physical host, which is also containerized by Docker. At the same time, SalveDocker includes multiple independent Docker containerized task executors, which are distributed to form the layout of Docker0, Docker1... to Dockern, and many A Docker containerized task executor is managed using the aforementioned integrated approach, eliminating the need for additional cluster management tools.

进一步地,在一些实施例中,在步骤S101之前,该方法还可以包括:Further, in some embodiments, before step S101, the method may further include:

初始化所述集成模块,以使得所述集成模块包括有至少一个任务执行器。The integration module is initialized such that the integration module includes at least one task executor.

需要说明的是,对于持续集成系统而言,在建立之初并不能确定其接收到的任务量,所以如果建立之初开启较多的任务执行器,将会在任务需求很少的情况下导致处理能力的浪费和硬件的额外消耗;但是如果开启较少的任务执行器,将会在任务需求多时导致处理能力较低,无法及时完成任务需求。本实施例中的自适应调度方法可以保证运行过程中任务执行器数量能够相对于任务需求的自适应增减,也就是说,集成模块中任务执行器的数量是变化的,所以在最初进行初始化时,可以仅得到包含有一个任务执行器的集成模块,然后根据业务规模,任务执行器的数量会相应变化,既能够减少处理能力的浪费又增加了任务的最大并发处理数。当然,在集成模块初始化时,也可以得到其他数量的任务执行器,如两个或者三个;同时,在集成模块初始化时,还需要设置查询变量和任务执行器数量这两个参数,以便于后续对于任务执行器进行管理。一般,查询变量用i表示,同时i也表示了集成模块内任务执行器的序号,初始化后i的取值为0;任务执行器数量以n表示,i为大于或等于0且小于n的正整数。It should be noted that, for a continuous integration system, the amount of tasks it receives cannot be determined at the beginning of its establishment, so if more task executors are opened at the beginning of establishment, it will lead to less task requirements. Waste of processing power and additional consumption of hardware; however, if fewer task executors are turned on, the processing power will be low when the task demand is large, and the task demand cannot be completed in time. The adaptive scheduling method in this embodiment can ensure that the number of task executors can be adaptively increased or decreased relative to the task requirements during operation, that is to say, the number of task executors in the integrated module changes, so the initialization is initially performed. , you can only get an integrated module containing one task executor, and then according to the business scale, the number of task executors will change accordingly, which can not only reduce the waste of processing power but also increase the maximum number of concurrent processing tasks. Of course, when the integration module is initialized, other numbers of task executors, such as two or three, can also be obtained; at the same time, when the integration module is initialized, two parameters, query variables and the number of task executors, need to be set to facilitate the Subsequent management of task executors. Generally, the query variable is represented by i, and i also represents the serial number of the task executor in the integrated module. After initialization, the value of i is 0; the number of task executors is represented by n, and i is a positive value greater than or equal to 0 and less than n. Integer.

S103:当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;S103: when the multiple task executors are all in a non-idle state, expand the number of task executors in the integrated module;

需要说明的是,如果获取到集成模块中所有的任务执行器都处于非空闲状态,那就说明当前任务执行器的数量不足以应对现有的任务需求,所以需要扩展集成模块,也就是需要扩展任务执行器的数量。同时,由于Docker容器是沙箱机制的,而且完全独立,所以新建Docker容器是易于完成的操作。It should be noted that if all the task executors obtained in the integrated module are in a non-idle state, it means that the current number of task executors is not enough to meet the existing task requirements, so the integration module needs to be expanded, that is, the need to expand The number of task executors. At the same time, since the Docker container is sandboxed and completely independent, creating a new Docker container is an easy operation.

进一步地,在一些实施例中,步骤S103,具体可以包括:Further, in some embodiments, step S103 may specifically include:

在所述集成模块中建立新增的任务执行器,并将所述集成模块内任务执行器数量进行加一处理,以扩展所述集成模块内所包括的任务执行器数量。A new task executor is established in the integration module, and the number of task executors in the integration module is increased by one, so as to expand the number of task executors included in the integration module.

需要说明的是,在集成模块中建立新增的任务执行器后,同时需要对集成模块中任务执行器数量进行变更,否则后续无法正确对新增的任务执行器进行管理。It should be noted that, after the newly added task executor is established in the integrated module, the number of task executors in the integrated module needs to be changed at the same time, otherwise the newly added task executor cannot be managed correctly in the future.

S104:从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。S104: Schedule the newly added task executor from the expanded integration module, and control the newly added task executor to execute the to-be-processed task.

需要说明的是,由于新增任务执行器必定处于空闲状态,所以建立完成后即可从集成模块调度新增的任务执行器,将待处理任务分配给新增任务执行器去完成,结束此次任务分配。It should be noted that since the newly added task executor must be in an idle state, after the establishment is completed, the newly added task executor can be scheduled from the integration module, and the pending tasks are assigned to the newly added task executor for completion, and the end of this time. Task Assignment.

实际使用中,虽然也有部分开发人员选择利用Docker代替slave节点,如图2所示,但是这种情况下只是将slave和Docker容器进行了置换,其后果是master节点原来控制的多个slaver变成了控制多个Docker容器,多个Docker容器并没有整体化,master节点控制的复杂性上升,仍然要借助单独的集群管理工具比如swarm或者kubernetes才能完成。另外现有技术中也有将Docker容器的拓扑进行转换,比如将master节点进行容器化,转换后完成持续集成的任务,但是仍然无法实现动态伸缩的功能。In actual use, although some developers choose to use Docker instead of slave nodes, as shown in Figure 2, in this case, only the slave and Docker containers are replaced. The consequence is that the multiple slaves originally controlled by the master node become In order to control multiple Docker containers, multiple Docker containers are not integrated, and the complexity of master node control increases, which can still be accomplished with the help of separate cluster management tools such as swarm or kubernetes. In addition, in the prior art, the topology of the Docker container is also converted, for example, the master node is containerized, and the continuous integration task is completed after the conversion, but the function of dynamic scaling still cannot be realized.

这些Jenkins持续集成系统的容器化本质上并没有针对大规模项目和代码的持续集成需求进行调度上的优化,没有采用特定的算法提高持续集成的并行处理的效率,具体存在以下不足之处:In essence, the containerization of these Jenkins continuous integration systems does not optimize scheduling for the continuous integration requirements of large-scale projects and codes, and does not use specific algorithms to improve the efficiency of continuous integration parallel processing. The specific shortcomings are as follows:

(1)需要额外添加集群管理工具,比如swarm或者kubernetes来进行对集群化的slave节点进行额外的管理。这样会添加额外的管理资源与管理的成本进行部署;(1) Additional cluster management tools, such as swarm or kubernetes, need to be added to perform additional management of clustered slave nodes. This will add additional management resources and management costs to deploy;

(2)slave的节点数量预设固定,处理能力相对固化,如果启动过多的容器处理持续集成的任务,面对并发任务需求就会造成预置启动容器过多,导致一定程度上的资源的浪费;(2) The number of slave nodes is fixed by default, and the processing capacity is relatively solid. If too many containers are started to process continuous integration tasks, there will be too many preset startup containers in the face of concurrent task requirements, resulting in a certain degree of resource consumption. waste;

(3)如果启动较少的容器进行自适应调度任务,面对较大规模的任务需求,较少的容器进无法充分的提高并行处理的效率,造成处理能力的不足。(3) If fewer containers are started for adaptive scheduling tasks, in the face of larger-scale task requirements, fewer containers cannot fully improve the efficiency of parallel processing, resulting in insufficient processing capacity.

而本申请中,将持续集成系统的每一个具体的任务节点进行Docker容器化,形成任务执行器,并将整体的任务执行器再容器化形成如Slave Docker节点,也就是说SlaveDocker节点内再次的分布式容器化,形成Docker0、Docker1...到Dockern的布局。这样,master节点仍然连接单一的Slave Docker节点,简化连接操作复杂性并且降低连接管理的成本,无需借助额外的集群管理工具;而Slave Docker节点的通过本实施例所述的自适应调算法进行内部的Docker调度,通过感知业务量的规模,通过自适应调度方法来调整任务执行器的数量。以此来最大化持续集成平台的并发处理能力,具有以下显著优点:In this application, each specific task node of the continuous integration system is containerized by Docker to form a task executor, and the overall task executor is re-contained to form a Slave Docker node, that is to say, the SlaveDocker node is re-contained. Distributed containerization, forming the layout of Docker0, Docker1... to Dockern. In this way, the master node is still connected to a single Slave Docker node, which simplifies the complexity of the connection operation and reduces the cost of connection management, without the need for additional cluster management tools; while the Slave Docker node uses the adaptive adjustment algorithm described in this embodiment for internal Docker scheduling, by sensing the scale of the business volume, adjusts the number of task executors through an adaptive scheduling method. This maximizes the concurrent processing capability of the continuous integration platform, which has the following significant advantages:

(1)相比将容器化持续集成相对固定的处理能力;本申请设计动态化处理能力;相比业内做法,此机制可实现各自处理步骤的灵活、高效率调用;(1) Compared with the relatively fixed processing capability of containerized continuous integration; this application designs dynamic processing capability; compared with the industry practice, this mechanism can realize flexible and efficient invocation of respective processing steps;

(2)通过高效调度算法实现根据处理需求的最大的自适应处理效率;(2) The maximum adaptive processing efficiency according to processing requirements is achieved through efficient scheduling algorithms;

(3)由于任务执行器的数量是根据处理需求灵活进行调整的,处于空闲态的任务执行器会被关闭,所以当Slave Docker节点发生故障,可以仅对其中处于开启状态的Docker进行故障定位和修复,无需逐一对所有的Docker进行寻找,能够提高故障修复的效率。(3) Since the number of task executors is flexibly adjusted according to the processing requirements, the task executors in the idle state will be closed, so when the Slave Docker node fails, only the Docker in the open state can be fault located and To repair, there is no need to search for all Dockers one by one, which can improve the efficiency of fault repair.

本实施例提供了一种自适应调度方法,通过获取任务列表中的待处理任务;根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务;这样,集成模块能够根据任务列表中的业务规模对任务执行器数量进行自适应调整,从而提供了一种动态伸缩的持续集成环境,使得任务并发处理能力得到提高;避免持续集成系统启动后必须保持固定任务处理器数量的弊端,解决了持续集成处理能力的固化问题;避免增加额外的集群管理工具去管理多个任务执行器,简化了连接过程和连接管理的成本。This embodiment provides an adaptive scheduling method, by acquiring the tasks to be processed in the task list; according to the tasks to be processed, it is judged in turn whether the multiple task executors included in the integrated module are in an idle state; When multiple task executors are in a non-idle state, expand the number of task executors in the integrated module; schedule newly added task executors from the expanded integrated module, and control the newly added task executors to execute the described Tasks to be processed; in this way, the integration module can adaptively adjust the number of task executors according to the business scale in the task list, thereby providing a dynamically scalable continuous integration environment, which improves the concurrent processing capability of tasks; avoids continuous integration systems The disadvantage of having to maintain a fixed number of task processors after startup solves the problem of curing the processing capacity of continuous integration; avoids adding additional cluster management tools to manage multiple task executors, and simplifies the connection process and connection management costs.

在本申请的另一实施例中,请参见图5,其示出了本申请实施例提供的另一种自适应调度方法的流程示意图,该自适应调度方法,可以包括:In another embodiment of the present application, please refer to FIG. 5 , which shows a schematic flowchart of another adaptive scheduling method provided by an embodiment of the present application. The adaptive scheduling method may include:

S201:判断集成模块中第i个任务执行器是否处于空闲状态;S201: Determine whether the i-th task executor in the integrated module is in an idle state;

需要说明的是,i对于任务执行器来说是表示任务执行器的编号,i为大于或等于0且小于n的正整数,n代表人物执行器的数量也就是说,在本实施例中根据编号“依次”进行任务执行器是否为空闲状态的判断,一般来说,建立时间越早的任务执行器编号越小,建立时间越晚的任务执行器编号越大。It should be noted that i represents the number of the task executor for the task executor, i is a positive integer greater than or equal to 0 and less than n, and n represents the number of character executors. The number is used to determine whether the task executor is in an idle state. Generally speaking, the number of the task executor with the earlier establishment time is smaller, and the number of the task executor with the later establishment time is larger.

还需要说明的是,通过i逐个对集成模块中的任务执行器进行判断,该步骤同时对应了上一实施例中“依次”的概念。在第i个任务执行器处于非空闲状态时,说明了第i个任务执行器已经被调用,这时候需要进行下一个任务执行器的判断。It should also be noted that the task executors in the integrated module are judged one by one through i, and this step also corresponds to the concept of "sequentially" in the previous embodiment. When the ith task executor is in a non-idle state, it indicates that the ith task executor has been called, and at this time, it is necessary to judge the next task executor.

这样,对于步骤S201,如果判断结果为否,表明了集成模块中第i个任务执行器处于非空闲状态,那么可以执行步骤S202;如果判断结果为是,表明了集成模块中第i个任务执行器处于空闲状态,那么可以执行步骤S203和S204。In this way, for step S201, if the judgment result is no, it indicates that the ith task executor in the integrated module is in a non-idle state, then step S202 can be executed; if the judgment result is yes, it indicates that the ith task executor in the integrated module executes If the device is in an idle state, steps S203 and S204 can be performed.

S202:当所述集成模块中第i个任务执行器处于非空闲状态时,执行i=i+1,返回步骤S201;S202: when the i-th task executor in the integrated module is in a non-idle state, execute i=i+1, and return to step S201;

在这里,如果第i个任务执行器处于非空闲状态,此时将查询变量进行加一操作,并返回步骤S201,以实现对下一任务执行器的查询。Here, if the ith task executor is in a non-idle state, the query variable is incremented by one, and the process returns to step S201 to query the next task executor.

S203:当所述集成模块中第i个任务执行器处于空闲状态时,从所述集成模块中调用所述第i个任务执行器;S203: when the ith task executor in the integrated module is in an idle state, call the ith task executor from the integrated module;

在这里,如果第i个任务执行器处于空闲状态,即可调用该任务执行器执行待处理任务。Here, if the ith task executor is idle, the task executor can be called to execute the pending task.

S204:控制所述第i个任务执行器执行所述待处理任务,结束对所述集成模块内未进行空闲状态判断的任务执行器是否处于空闲状态的判断。S204: Control the i-th task executor to execute the to-be-processed task, and end judging whether the task executor that has not been judging an idle state in the integrated module is in an idle state.

需要说明的是,如果集成模块中存在有空闲状态的任务执行器,那就说明当前任务执行器的数量足以应对现有的任务需求,无需增加任务执行器的数量,可以将待处理任务直接分配给处于空闲状态的任务执行器进行执行。此时,本次待处理任务已经得到分配,所以无需继续判断其余的任务执行器是否处于空闲状态,可结束本次流程。It should be noted that if there are idle task executors in the integration module, it means that the current number of task executors is sufficient to meet the existing task requirements, and there is no need to increase the number of task executors, and the tasks to be processed can be directly allocated. Executes the task executor that is in the idle state. At this point, the task to be processed this time has been allocated, so there is no need to continue to judge whether the remaining task executors are in an idle state, and this process can be ended.

本申请实施例提供了一种自适应调度方法,对前述实施例的具体实现进行了详细阐述,从中可以看出,集成模块能够根据任务列表中的业务规模对任务执行器数量进行自适应调整,从而提供了一种动态伸缩的持续集成环境,使得任务并发处理能力得到提高;避免持续集成系统启动后必须保持固定任务处理器数量的弊端,解决了持续集成处理能力的固化问题;避免增加额外的集群管理工具去管理多个任务执行器,简化了连接过程和连接管理的成本。The embodiment of the present application provides an adaptive scheduling method, and the specific implementation of the foregoing embodiment is described in detail, from which it can be seen that the integration module can adaptively adjust the number of task executors according to the business scale in the task list, Thereby, a dynamic scaling continuous integration environment is provided, which improves the concurrent processing capability of tasks; avoids the drawback that a fixed number of task processors must be maintained after the continuous integration system is started, and solves the curing problem of continuous integration processing capabilities; avoids adding additional Cluster management tools to manage multiple task executors, simplifying the connection process and the cost of connection management.

在本申请的又一实施例中,参见图6,其示出了本申请实施例提供的又一种自适应调度方法,如图6所示,该方法包括:In another embodiment of the present application, referring to FIG. 6 , it shows another adaptive scheduling method provided by the embodiment of the present application. As shown in FIG. 6 , the method includes:

S301:判断任务列表中是否存在待处理任务;S301: Determine whether there is a pending task in the task list;

这里,对于步骤S301,如果判断结果为否,则执行步骤S302;如果判断结果为是,则执行步骤S303。Here, for step S301, if the judgment result is no, step S302 is executed; if the judgment result is yes, step S303 is executed.

需要说明的是,对于任务列表而言,可能存在待处理任务,也可能不存在待处理任务,此时需要根据两种情况进行不同的应对。另外,步骤S301一般被设计为定时任务,以防止过于频繁的开启流程导致处理压力过大。It should be noted that, for the task list, there may or may not be tasks to be processed. In this case, different responses need to be made according to the two situations. In addition, step S301 is generally designed as a timed task, so as to prevent the excessively frequent opening process from causing excessive processing pressure.

S302:判断所述集成模块中的第N个任务执行器是否处于空闲状态;S302: Determine whether the Nth task executor in the integrated module is in an idle state;

在这里,对于步骤S303,如果判断结果为是,则执行步骤S304。Here, for step S303, if the judgment result is yes, step S304 is executed.

需要说明的是,在步骤S303中,所述第N个任务执行器的生成时间晚于所述集成模块中除第N个任务执行器之外的任务执行器的生成时间,N为大于1的正整数;It should be noted that, in step S303, the generation time of the Nth task executor is later than the generation time of the task executors except the Nth task executor in the integration module, and N is greater than 1. positive integer;

需要说明的是,在考虑是否需要关闭任务执行器时,主要是指考虑建立时间最晚的任务执行器是否需要被关闭,一般来说,建立时间最晚的任务执行器是根据预设编号进行确定的,即第N个任务执行器的生成时间晚于所述集成模块中除第N个任务执行器之外的任务执行器的生成时间。It should be noted that when considering whether to close the task executor, it mainly refers to whether the task executor with the latest establishment time needs to be closed. Generally speaking, the task executor with the latest establishment time is executed according to the preset number. It is determined that the generation time of the Nth task executor is later than the generation time of the task executors other than the Nth task executor in the integration module.

至于为何仅考虑建立时间最近的任务执行器,原因如下:任务执行器都具有用于标识的编号,一般来说,由于编程语言的特点,这些编号之间的间隔都是固定的,比如4个任务执行器分别编号1、2、3、4,在利用这些编号时,只要对查找值每次+1,即可寻找下一目标,所以很少出现编号中断的情况。基于此,在考虑任务执行器缩减的问题时,为了减少复杂性,仅检测最后一个任务执行器的工作状态,能够避免编号中断的问题。举例说明如下,存在预设编号为1、2、3、4的多个任务执行器,仅以预设编号为4的任务执行器为目标任务执行器,然后获取其工作状态,决定是否需要对其进行关闭;如果说也对预设编号为2的任务执行器进行工作状态的判断,那么在关闭预设编号为2的任务执行器时,就会出现编号中断的问题,可能会导致程序崩溃。As for why only the task executors with the latest establishment time are considered, the reasons are as follows: task executors all have numbers for identification. Generally speaking, due to the characteristics of programming languages, the intervals between these numbers are fixed, such as 4 The task executors are respectively numbered 1, 2, 3, and 4. When using these numbers, the next target can be found as long as the search value is +1 each time, so the numbering interruption rarely occurs. Based on this, when considering the problem of task executor reduction, in order to reduce the complexity, only the working state of the last task executor is detected, and the problem of number interruption can be avoided. An example is as follows. There are multiple task executors with preset numbers 1, 2, 3, and 4. Only the task executor with preset number 4 is the target task executor, and then its working status is obtained to determine whether it is necessary to It is closed; if the working status of the task executor with the preset number 2 is also judged, then when the task executor with the preset number 2 is closed, there will be a problem of number interruption, which may cause the program to crash. .

需要说明的是,通过判断第N个任务执行器的工作状态,从而决定是否对其进行关闭。如果第N个任务执行器不处于空闲状态,则无需对其进行关闭,可以直接结束此次流程。It should be noted that, by judging the working state of the Nth task executor, it is decided whether to close it. If the Nth task executor is not in an idle state, it does not need to be closed, and this process can be ended directly.

S303:关闭所述第N个任务执行器,并将所述集成模块内任务执行器数量进行减一处理,以缩减所述集成模块内任务执行器数量;S303: Turn off the Nth task executor, and reduce the number of task executors in the integrated module by one to reduce the number of task executors in the integrated module;

需要说明的是,如果第N个任务执行器处于空闲状态,就可以对其进行关闭,同时将任务执行器数量减1,使得集成模块中任务执行器的数量可以实时对应于当前的业务需求。It should be noted that if the Nth task executor is in an idle state, it can be closed, and the number of task executors is reduced by 1, so that the number of task executors in the integration module can correspond to current business requirements in real time.

S304:从所述任务列表中获取所述待处理任务;S304: Acquire the to-be-processed task from the task list;

需要说明的是,如果存在待处理任务,即可从所述任务列表中获取待处理任务控制合适的任务执行器进行执行。It should be noted that if there is a task to be processed, the task to be processed may be obtained from the task list to control a suitable task executor for execution.

S305:根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;S305: According to the task to be processed, sequentially determine whether the multiple task executors included in the integrated module are in an idle state;

需要说明的是,在获取待处理任务后,对集成模块中的任务执行器的状态进行逐个判断,以确定是否需要扩展任务执行器的数量。It should be noted that, after acquiring the tasks to be processed, the statuses of the task executors in the integration module are judged one by one to determine whether the number of task executors needs to be expanded.

S306:当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;S306: when the multiple task executors are all in a non-idle state, expand the number of task executors in the integrated module;

需要说明的是,当所述多个任务执行器均处于非空闲状态时,说明现有的任务执行器的数量不足以应对任务需求,所以需要扩展所述集成模块内任务执行器数量。It should be noted that when the multiple task executors are all in a non-idle state, it means that the number of existing task executors is insufficient to meet the task requirements, so the number of task executors in the integrated module needs to be expanded.

S307:从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。S307: Schedule the newly added task executor from the expanded integration module, and control the newly added task executor to execute the to-be-processed task.

需要说明的是,可以利用新增的任务执行器执行所述待处理任务,也就结束了本次自适应调度的流程。It should be noted that, the task to be processed can be executed by using the newly added task executor, which also ends the process of this adaptive scheduling.

这样,通过本实施例所述的自适应调度方法,实现了一种自适应可伸缩的持续集成方案,设计了一种持续集成结构并提供了根据业务规模动态化伸缩Docker容器数量实现动态化处理能力的机制,提供应用动态伸缩机制的持续集成的结构拓扑,克服了现有持续集成环境的以下缺点:In this way, through the adaptive scheduling method described in this embodiment, an adaptive and scalable continuous integration solution is realized, a continuous integration structure is designed, and dynamic processing is provided by dynamically scaling the number of Docker containers according to the business scale The capability mechanism provides the structural topology of continuous integration applying the dynamic scaling mechanism, which overcomes the following shortcomings of the existing continuous integration environment:

(1)分布式结构的master-slave拓扑的普通节点结构,无法实现持续集成环境的隔离,单点的slave的节点环境的破坏仍然需要手动的进行节点的恢复操作,从而影响整体自适应调度任务的执行效率;(1) The common node structure of the master-slave topology of the distributed structure cannot realize the isolation of the continuous integration environment. The destruction of the node environment of a single point slave still requires manual node recovery operations, thus affecting the overall adaptive scheduling task. execution efficiency;

(2)传统的如图2中进行的自适应调度系统,虽然每一个Docker容器简单的实现了稳定的环境隔离的slave功能节点,但是需要额外添加集群管理工具,增加了集群化的slave节点额外的管理成本,存在以下缺点:(a)要么预置启动多个容器处理自适应调度任务,面对并发任务需求,有可能预置启动过多的容器造成一定程度上的资源的浪费;(b)要么启动较少的容器进行自适应调度任务,面对较大规模的任务需求,较少的容器进行执行无法充分的提高并行处理的效率;(2) In the traditional adaptive scheduling system as shown in Figure 2, although each Docker container simply implements a stable environment-isolated slave function node, additional cluster management tools need to be added, adding additional clustered slave nodes. There are the following disadvantages: (a) multiple containers are pre-set to process adaptive scheduling tasks, and in the face of concurrent task requirements, it is possible to pre-set and start too many containers, resulting in a waste of resources to a certain extent; (b) ) or start fewer containers for adaptive scheduling tasks, and in the face of larger-scale task requirements, fewer containers for execution cannot fully improve the efficiency of parallel processing;

(3)通过Docker容器化的持续集成系统虽然实现了环境的隔离,但是缺乏动态调度工具的算法配合以及相关算法调动机制的调动;(3) Although the continuous integration system containerized by Docker achieves the isolation of the environment, it lacks the algorithm coordination of the dynamic scheduling tool and the mobilization of the related algorithm mobilization mechanism;

(4)现有的持续集成系统缺乏对slave的节点数量的动态调用的能力,也就是说Docker容器的数量没有动态的根据任务量的需求进行动态变化的机制。(4) The existing continuous integration system lacks the ability to dynamically call the number of slave nodes, that is to say, there is no mechanism for the number of Docker containers to dynamically change according to the needs of the task volume.

本申请实施例提供了一种自适应调度方法,对前述实施例的具体实现进行了详细阐述,从中可以看出,集成模块能够根据任务列表中的业务规模对任务执行器数量进行自适应调整,从而提供了一种动态伸缩的持续集成环境,使得任务并发处理能力得到提高;避免持续集成系统启动后必须保持固定任务处理器数量的弊端,解决了持续集成处理能力的固化问题;避免增加额外的集群管理工具去管理多个任务执行器,简化了连接过程和连接管理的成本。The embodiment of the present application provides an adaptive scheduling method, and the specific implementation of the foregoing embodiment is described in detail, from which it can be seen that the integration module can adaptively adjust the number of task executors according to the business scale in the task list, Thereby, a dynamic scaling continuous integration environment is provided, which improves the concurrent processing capability of tasks; avoids the drawback that a fixed number of task processors must be maintained after the continuous integration system is started, and solves the curing problem of continuous integration processing capabilities; avoids adding additional Cluster management tools to manage multiple task executors, simplifying the connection process and the cost of connection management.

在本申请的再一实施例中,参见图7,其示出了本申请实施例提供的再一种自适应调度方法的流程示意图,如图7所示,该方法包括:In still another embodiment of the present application, referring to FIG. 7 , it shows a schematic flowchart of still another adaptive scheduling method provided by the embodiment of the present application. As shown in FIG. 7 , the method includes:

S401:初始化任务队列list,初始化预置Docker0,迭代变量i=0;n=1;S401: Initialize task queue list, initialize preset Docker0, iteration variable i=0; n=1;

需要说明的是,在系统启动的时候需要对任务队列list、任务执行器和迭代变量进行初始化,任务队列list用于记录待分配的任务,Docker0是启动时预先设置的任务执行器,n值对应于系统中任务执行器的数量,所以在初始化预置Docker0时需要将n值初始化为1,i值为调度任务中进行轮替查询的变量,初始化为0。也就是说,本实施例中,集成业务在开始时仅有一个Docker节点,无需初始化过多的预置节点,同时随着集成业务的数量Docker节点的数量可以动态的增加和减少,以最大化自适应调度系统的并发处理能力。It should be noted that the task queue list, task executor and iteration variables need to be initialized when the system starts. The task queue list is used to record the tasks to be assigned. Docker0 is the task executor preset at startup, and the value of n corresponds to It depends on the number of task executors in the system, so when initializing the preset Docker0, the value of n needs to be initialized to 1, and the value of i is the variable for rotation query in the scheduling task, which is initialized to 0. That is to say, in this embodiment, there is only one Docker node at the beginning of the integrated service, and there is no need to initialize too many preset nodes. At the same time, the number of Docker nodes can be dynamically increased and decreased with the number of integrated services, so as to maximize the number of Docker nodes. The concurrent processing capability of the adaptive scheduling system.

还需要说明的是,本实施例并不限定初始化时仅有一个预置Docker节点,如果预设在初始化时启动多个Docker也在本申请的保护范围之内,例如,如果预置2个Docker节点,那么S401可以包括:It should also be noted that this embodiment does not limit that there is only one preset Docker node during initialization. If multiple Dockers are preset to be started during initialization, it is also within the protection scope of this application. For example, if two Dockers are preset node, then S401 may include:

初始化任务队列list,初始化预置Docker0和初始化预置Docker1,迭代变量i=0,n=2。Initialize the task queue list, initialize the preset Docker0 and initialize the preset Docker1, and iterate variables i=0, n=2.

S402:判断是否有新任务;S402: Determine whether there is a new task;

这里,对于步骤S402来说,如果判断结果为是,那么可以执行步骤S403;如果判断结果为否,那么执行步骤S409;Here, for step S402, if the judgment result is yes, then step S403 can be executed; if the judgment result is no, then step S409 is executed;

需要说明的是,判断是否有新任务可以设置为定时任务,也可以采用监听机制,即定时判断是否有新任务,或者监听是否有新任务事件。It should be noted that to determine whether there is a new task, it can be set as a timed task, or a monitoring mechanism can be used, that is, to determine whether there is a new task regularly, or to monitor whether there is a new task event.

S403:将新任务插入任务队列list中并进行赋值;S403: Insert a new task into the task queue list and assign values;

需要说明的是,当检测到新任务后,将新任务插入任务队列list中,一般遵循先来后到的顺序进行插入,赋值的目的是为了标识不同的新任务并且作为新任务的指代。It should be noted that when a new task is detected, the new task is inserted into the task queue list, generally in a first-come, first-served order. The purpose of assignment is to identify different new tasks and serve as a reference to the new task.

S404:将list队列中的下一个待处理任务取出;S404: take out the next pending task in the list queue;

需要说明的是,待处理任务一般是list队列的表头任务,即待处理任务时按照一定顺序依次取出的。It should be noted that the tasks to be processed are generally the header tasks of the list queue, that is, the tasks to be processed are taken out in a certain order.

还需要说明的是,在此步骤S404是连续进行的,每次执行步骤S404之后,将待处理任务分配完毕之后需要再次取出下一个待处理任务,直至将list队列中的所有任务都进行分配完毕。It should also be noted that this step S404 is performed continuously. After each execution of step S404, the next task to be processed needs to be taken out again after the task to be processed is allocated, until all tasks in the list queue are allocated. .

S405:判断Docker0+i是否空闲;S405: Determine whether Docker0+i is free;

这里,对于步骤S402来说,如果判断结果为是,则执行步骤S406;如果判断结果为否,则执行步骤S407;Here, for step S402, if the judgment result is yes, execute step S406; if the judgment result is no, execute step S407;

需要说明的是,此时开始根据编号依次判断多个Docker容器的状态,进而决定是否需要扩展任务执行器的数量。It should be noted that, at this time, the status of multiple Docker containers is judged sequentially according to the number, and then it is determined whether the number of task executors needs to be expanded.

S406:将待处理任务分配给Docker0+i,重置i=0;S406: Allocate the task to be processed to Docker0+i, and reset i=0;

需要说明的是,如果判断到空闲状态的Docker,那么可以将待处理任务进行分配,此时本次待处理任务分配结束。It should be noted that if it is determined that the Docker is in an idle state, the tasks to be processed can be allocated, and the allocation of the tasks to be processed is ended at this time.

还需要说明的是,由于步骤S404是连续进行的,所以从整体来看,S406仅代表本次流程结束。It should also be noted that since step S404 is performed continuously, from an overall point of view, S406 only represents the end of this process.

S407:控制i=i+1,判断Docker0+i是否存在;S407: Control i=i+1, and judge whether Docker0+i exists;

这里,对应步骤S407来说,如果判断结果为是,则执行步骤S405;如果判断结果为否,则执行步骤S408;Here, corresponding to step S407, if the judgment result is yes, then step S405 is executed; if the judgment result is no, then step S408 is executed;

需要说明的是,如果当前的Docker0+i并不处于空闲状态,那么就要判断下一个Docker的工作状态;此需要考虑到当前的Docker0+i是系统中最后一个Docker,那么此时并不存在下一个Docker,所以在判断下一个Docker的工作状态之前,需要对其是否存在进行判定。It should be noted that if the current Docker0+i is not in an idle state, then it is necessary to judge the working state of the next Docker; this needs to consider that the current Docker0+i is the last Docker in the system, then it does not exist at this time. The next Docker, so before judging the working status of the next Docker, it is necessary to judge whether it exists.

S408:新建Docker0+i,将待处理任务分配给Docker0+i,重置i=0,;S408: Create a new Docker0+i, assign the pending tasks to Docker0+i, and reset i=0;

需要说明的是,如果不存在下一个Docker,说明当前的Docker数量并不足以应对当前的任务量,需要增加Docker的数量。具体的,新建Docker,并将待处理任务分配给新建立的Docker,同时,此处隐含的,需要对n进行加1。同样的,S408也代表着本次流程结束。It should be noted that if there is no next Docker, the current number of Docker is not enough to cope with the current task volume, and the number of Docker needs to be increased. Specifically, create a new Docker, and assign the tasks to be processed to the newly created Docker. At the same time, it is implied here that n needs to be incremented by 1. Similarly, S408 also represents the end of this process.

还需要说明的是,对于步骤S406和步骤S408来说,将待处理任务分配给任务执行器进行完成后,需要从任务队列list中取出下一待处理任务继续分配,直至任务队列list中不存在待处理任务。It should also be noted that, for steps S406 and S408, after the task to be processed is allocated to the task executor for completion, the next task to be processed needs to be taken out from the task queue list and continued to be allocated until the task queue list does not exist. pending tasks.

S409:判断Docker n-1是否空闲;S409: Determine whether Docker n-1 is idle;

这里,对于步骤S409来说,如果判断结果为是,那么可以执行步骤S410;如果判断结果为否,返回执行步骤S402;Here, for step S409, if the judgment result is yes, then step S410 can be executed; if the judgment result is no, return to execute step S402;

需要说明的是,如果不存在待处理任务,此时需要考虑是否需要缩减Docker的数量,具体的,需要考虑是否需要关闭Docker n-1。It should be noted that if there are no pending tasks, it is necessary to consider whether to reduce the number of Dockers. Specifically, it is necessary to consider whether to close Docker n-1.

S410:关闭Docker n-1,令n=n-1,返回执行步骤S402。S410: Turn off Docker n-1, set n=n-1, and return to step S402.

需要说明的是,如果Docker n-1处于空闲状态,为了避免处理量的浪费,可以对其进行关闭,并返回执行步骤S402。It should be noted that, if Docker n-1 is in an idle state, in order to avoid waste of processing capacity, it can be closed, and the process returns to step S402.

本申请实施例提供了一种自适应调度方法,对前述实施例的具体实现进行了详细阐述,从中可以看出,集成模块能够根据任务列表中的业务规模对任务执行器数量进行自适应调整,从而提供了一种动态伸缩的持续集成环境,使得任务并发处理能力得到提高;避免持续集成系统启动后必须保持固定任务处理器数量的弊端,解决了持续集成处理能力的固化问题;避免增加额外的集群管理工具去管理多个任务执行器,简化了连接过程和连接管理的成本。The embodiment of the present application provides an adaptive scheduling method, and the specific implementation of the foregoing embodiment is described in detail, from which it can be seen that the integration module can adaptively adjust the number of task executors according to the business scale in the task list, Thereby, a dynamic scaling continuous integration environment is provided, which improves the concurrent processing capability of tasks; avoids the drawback that a fixed number of task processors must be maintained after the continuous integration system is started, and solves the curing problem of continuous integration processing capabilities; avoids adding additional Cluster management tools to manage multiple task executors, simplifying the connection process and the cost of connection management.

本申请的再一实施例中,参见图8,其示出了本申请实施例提供的一种自适应调度装置50的组成结构示意图,如图8所示,该自适应调度装置50包括获取单元501、判断单元502、扩展单元503和调度单元504;其中,In yet another embodiment of the present application, referring to FIG. 8 , it shows a schematic structural diagram of an adaptive scheduling apparatus 50 provided by an embodiment of the present application. As shown in FIG. 8 , the adaptive scheduling apparatus 50 includes an acquisition unit 501, the judgment unit 502, the expansion unit 503 and the scheduling unit 504; wherein,

获取单元501,配置为获取任务列表中的待处理任务;an obtaining unit 501, configured to obtain tasks to be processed in the task list;

判断单元502,配置为根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;The judging unit 502 is configured to sequentially judge whether the multiple task executors included in the integrated module are in an idle state according to the tasks to be processed;

扩展单元503,配置为当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;an expansion unit 503, configured to expand the number of task executors in the integrated module when the multiple task executors are all in a non-idle state;

调度单元504,配置为从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。The scheduling unit 504 is configured to schedule the newly added task executor from the expanded integration module, and control the newly added task executor to execute the to-be-processed task.

在上述实施例中,该获取单元501,具体配置为判断任务列表中是否存在待处理任务;若所述任务列表中存在待处理任务,则从所述任务列表中获取所述待处理任务。In the above embodiment, the obtaining unit 501 is specifically configured to determine whether there is a task to be processed in the task list; if there is a task to be processed in the task list, obtain the task to be processed from the task list.

参见图9,其示出了本申请实施例提供的另一种自适应调度装置50的结构示意图,如图9所示,在上述实施例的基础上,该自适应调度装置50还包括缩减单元505,配置为若所述任务列表中不存在待处理任务,则判断所述集成模块中的第N个任务执行器是否处于空闲状态;其中,所述第N个任务执行器的生成时间晚于所述集成模块中除第N个任务执行器之外的任务执行器的生成时间,N为大于1的正整数;若所述集成模块中的第N个任务执行器处于空闲状态,则关闭所述第N个任务执行器,并将所述集成模块内任务执行器数量进行减一处理,以缩减所述集成模块内任务执行器数量。Referring to FIG. 9 , it shows a schematic structural diagram of another adaptive scheduling apparatus 50 provided by an embodiment of the present application. As shown in FIG. 9 , on the basis of the foregoing embodiment, the adaptive scheduling apparatus 50 further includes a reduction unit 505. Configure to determine whether the Nth task executor in the integration module is in an idle state if there is no task to be processed in the task list; wherein, the generation time of the Nth task executor is later than The generation time of the task executors other than the Nth task executor in the integrated module, N is a positive integer greater than 1; if the Nth task executor in the integrated module is in an idle state, all The Nth task executor is processed, and the number of task executors in the integration module is decremented by one, so as to reduce the number of task executors in the integration module.

在上述实施例中,该扩展单元503,具体配置为在所述集成模块中建立新增的任务执行器,并将所述集成模块内任务执行器数量进行加一处理,以扩展所述集成模块内所包括的任务执行器数量。In the above embodiment, the expansion unit 503 is specifically configured to create a new task executor in the integrated module, and increase the number of task executors in the integrated module by one, so as to expand the integrated module The number of task executors included.

如图9所示,在上述实施例的基础上,调度单元504,配置为若所述集成模块内的第i个任务执行器处于空闲状态,则从所述集成模块中调用所述第i个任务执行器;其中,i表示任务执行器的编号,i为大于或等于0的正整数;控制所述第i个任务执行器执行所述待处理任务,结束对所述集成模块内未进行空闲状态判断的任务执行器是否处于空闲状态的判断。As shown in FIG. 9 , on the basis of the above embodiment, the scheduling unit 504 is configured to call the i-th task executor from the integration module if the i-th task executor in the integration module is in an idle state task executor; wherein, i represents the number of the task executor, and i is a positive integer greater than or equal to 0; control the i-th task executor to execute the to-be-processed task, and end the integration module that is not idle Judging whether the task executor of the state judgment is in an idle state.

在上述实施例中,该自适应调度装置50还包括初始化单元506,配置为初始化所述集成模块,以使得所述集成模块包括有至少一个任务执行器。In the above embodiment, the adaptive scheduling apparatus 50 further includes an initialization unit 506 configured to initialize the integrated module, so that the integrated module includes at least one task executor.

在上述实施例中,所述任务执行器包括Docker容器。In the above embodiment, the task executor includes a Docker container.

可以理解地,在本实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。It can be understood that, in this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., of course, it may also be a module, and it may also be non-modular. Moreover, each component in this embodiment may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of software function modules.

所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or The part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product, the computer software product is stored in a storage medium, and includes several instructions for making a computer device (which can be It is a personal computer, a server, or a network device, etc.) or a processor (processor) that executes all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes: U disk, removable hard disk, Read Only Memory (ROM), Random Access Memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes.

因此,本实施例提供了一种计算机存储介质,该计算机存储介质存储有自适应调度程序,所述自适应调度程序被至少一个处理器执行时实现前述实施例中任一项所述的方法的步骤。Therefore, the present embodiment provides a computer storage medium storing an adaptive scheduler that implements the method described in any one of the preceding embodiments when the adaptive scheduler is executed by at least one processor. step.

基于上述的一种自适应调度装置50的组成以及计算机存储介质,参见图10,其示出了本申请实施例提供的一种自适应调度装置50的具体硬件结构示例,可以包括:通信接口601、存储器602和处理器603;各个组件通过总线系统604耦合在一起。可理解,总线系统604用于实现这些组件之间的连接通信。总线系统604除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图10中将各种总线都标为总线系统604。其中,通信接口601,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;Based on the composition of the above-mentioned adaptive scheduling apparatus 50 and the computer storage medium, see FIG. 10 , which shows a specific hardware structure example of an adaptive scheduling apparatus 50 provided by an embodiment of the present application, which may include: a communication interface 601 , memory 602 and processor 603 ; the various components are coupled together by a bus system 604 . It will be appreciated that the bus system 604 is used to implement connection communication between these components. In addition to the data bus, the bus system 604 also includes a power bus, a control bus and a status signal bus. However, for clarity of illustration, the various buses are labeled as bus system 604 in FIG. 10 . Among them, the communication interface 601 is used for receiving and sending signals in the process of sending and receiving information with other external network elements;

存储器602,用于存储能够在处理器603上运行的计算机程序;memory 602 for storing computer programs that can run on processor 603;

处理器603,用于在运行所述计算机程序时,执行:The processor 603 is configured to, when running the computer program, execute:

获取任务列表中的待处理任务;Get the pending tasks in the task list;

根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;According to the to-be-processed task, sequentially determine whether the multiple task executors included in the integrated module are in an idle state;

当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;When the multiple task executors are all in a non-idle state, expanding the number of task executors in the integrated module;

从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。The newly added task executor is scheduled from the expanded integration module, and the newly added task executor is controlled to execute the to-be-processed task.

可以理解,本申请实施例中的存储器602可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data RateSDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步链动态随机存取存储器(Synchronous link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的存储器602旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the memory 602 in this embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Wherein, the non-volatile memory may be Read-Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (Erasable PROM, EPROM), Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synchronous link DRAM, SLDRAM) And direct memory bus random access memory (Direct Rambus RAM, DRRAM). The memory 602 of the systems and methods described herein is intended to include, but not be limited to, these and any other suitable types of memory.

而处理器603可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器603中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器603可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(APPlication Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器602,处理器603读取存储器602中的信息,结合其硬件完成上述方法的步骤。The processor 603 may be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above-mentioned method can be completed by an integrated logic circuit of hardware in the processor 603 or an instruction in the form of software. The aforementioned processor 603 may be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA), or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art. The storage medium is located in the memory 602, and the processor 603 reads the information in the memory 602, and completes the steps of the above method in combination with its hardware.

可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(APPlication Specific Integrated Circuits,ASIC)、数字信号处理器(Digital SignalProcessing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(ProgrammableLogic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。It will be appreciated that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more Application Specific Integrated Circuits (ASIC), Digital Signal Processing (DSP), Digital Signal Processing Device (DSP Device, DSPD), programmable logic Devices (ProgrammableLogic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application or a combination thereof.

对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。For a software implementation, the techniques described herein may be implemented through modules (eg, procedures, functions, etc.) that perform the functions described herein. Software codes may be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

可选地,作为另一个实施例,处理器603还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法的步骤。Optionally, as another embodiment, the processor 603 is further configured to execute the steps of the method in any one of the foregoing embodiments when running the computer program.

基于上述自适应调度装置50的组成以及硬件结构示例,参见图11,其示出了本申请实施例提供的一种系统70的组成结构示意图。如图11所示,所述系统70至少包括前述实施例中任一项所述的自适应调度装置50。其中,该系统能够根据任务列表中的业务规模对集成模块中任务执行器数量进行自适应调整,从而提供了一种动态伸缩的持续集成环境,使得任务并发处理能力得到提高;避免持续集成系统启动后必须保持固定任务处理器数量的弊端,解决了持续集成处理能力的固化问题;避免增加额外的集群管理工具去管理多个任务执行器,简化了连接过程和连接管理的成本。Based on the composition and hardware structure example of the above-mentioned adaptive scheduling apparatus 50, see FIG. 11, which shows a schematic composition structure diagram of a system 70 provided by an embodiment of the present application. As shown in FIG. 11 , the system 70 includes at least the adaptive scheduling apparatus 50 described in any one of the foregoing embodiments. Among them, the system can adaptively adjust the number of task executors in the integration module according to the business scale in the task list, thereby providing a dynamic scaling continuous integration environment, improving the concurrent processing capability of tasks; avoiding continuous integration system startup Afterwards, the drawback of having to maintain a fixed number of task processors solves the problem of curing the continuous integration processing capability; it avoids adding additional cluster management tools to manage multiple task executors, and simplifies the connection process and connection management costs.

以上所述,仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the protection scope of the present application.

需要说明的是,在本申请中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this application, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements , but also other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.

本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined under the condition of no conflict to obtain new method embodiments.

本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。The features disclosed in the several product embodiments provided in this application can be combined arbitrarily without conflict to obtain a new product embodiment.

本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。The features disclosed in several method or device embodiments provided in this application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (11)

1.一种自适应调度方法,其特征在于,所述方法包括:1. An adaptive scheduling method, wherein the method comprises: 获取任务列表中的待处理任务;Get the pending tasks in the task list; 根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;According to the to-be-processed task, sequentially determine whether the multiple task executors included in the integrated module are in an idle state; 当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;When the multiple task executors are all in a non-idle state, expanding the number of task executors in the integrated module; 从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。The newly added task executor is scheduled from the expanded integration module, and the newly added task executor is controlled to execute the to-be-processed task. 2.根据权利要求1所述的方法,其特征在于,所述获取任务列表中的待处理任务,包括:2. The method according to claim 1, wherein the obtaining the tasks to be processed in the task list comprises: 判断任务列表中是否存在待处理任务;Determine whether there are pending tasks in the task list; 若所述任务列表中存在待处理任务,则从所述任务列表中获取所述待处理任务。If there is a to-be-processed task in the task list, acquire the to-be-processed task from the task list. 3.根据权利要求2所述的方法,其特征在于,在所述判断任务列表中是否存在待处理任务之后,所述方法还包括:3. The method according to claim 2, wherein after judging whether there is a task to be processed in the task list, the method further comprises: 若所述任务列表中不存在待处理任务,则判断所述集成模块中的第N个任务执行器是否处于空闲状态;其中,所述第N个任务执行器的生成时间晚于所述集成模块中除第N个任务执行器之外的任务执行器的生成时间,N为大于1的正整数;If there is no task to be processed in the task list, determine whether the Nth task executor in the integration module is in an idle state; wherein, the generation time of the Nth task executor is later than that of the integration module The generation time of the task executors except the Nth task executor in the N is a positive integer greater than 1; 若所述集成模块中的第N个任务执行器处于空闲状态,则关闭所述第N个任务执行器,并将所述集成模块内任务执行器数量进行减一处理,以缩减所述集成模块内任务执行器数量。If the N th task executor in the integrated module is in an idle state, the N th task executor is closed, and the number of task executors in the integrated module is reduced by one, so as to reduce the integrated module The number of internal task executors. 4.根据权利要求1所述的自适应调度方法,其特征在于,所述扩展所述集成模块内所包括的任务执行器数量,包括:4. The adaptive scheduling method according to claim 1, wherein the expanding the number of task executors included in the integration module comprises: 在所述集成模块中建立新增的任务执行器,并将所述集成模块内任务执行器数量进行加一处理,以扩展所述集成模块内所包括的任务执行器数量。A new task executor is established in the integration module, and the number of task executors in the integration module is increased by one, so as to expand the number of task executors included in the integration module. 5.根据权利要求1所述的自适应调度方法,其特征在于,所述依次判断集成模块内所包括的多个任务执行器是否处于空闲状态,包括:5. The adaptive scheduling method according to claim 1, wherein the step of judging whether multiple task executors included in the integrated module are in an idle state in turn comprises: 若所述集成模块内的第i个任务执行器处于空闲状态,则从所述集成模块中调用所述第i个任务执行器;其中,i表示任务执行器的编号,i为大于或等于0的正整数;If the ith task executor in the integrated module is in an idle state, the ith task executor is called from the integrated module; wherein, i represents the number of the task executor, and i is greater than or equal to 0 positive integer of ; 控制所述第i个任务执行器执行所述待处理任务,结束对所述集成模块内未进行空闲状态判断的任务执行器是否处于空闲状态的判断。The i-th task executor is controlled to execute the to-be-processed task, and the judgment on whether the task executor that has not been judging the idle state in the integrated module is in an idle state is ended. 6.根据权利要求1-5任一项所述的自适应调度方法,其特征在于,在所述获取任务列表中的待处理任务之前,所述方法还包括:6. The adaptive scheduling method according to any one of claims 1-5, characterized in that, before acquiring the tasks to be processed in the task list, the method further comprises: 初始化所述集成模块,以使得所述集成模块包括有至少一个任务执行器。The integration module is initialized such that the integration module includes at least one task executor. 7.根据权利要求6所述的自适应调度方法,其特征在于,所述任务执行器包括Docker容器。7. The adaptive scheduling method according to claim 6, wherein the task executor comprises a Docker container. 8.一种自适应调度装置,其特征在于,所述自适应调度装置包括获取单元、判断单元、扩展单元和调度单元;其中,8. An adaptive scheduling device, characterized in that the adaptive scheduling device comprises an acquisition unit, a judgment unit, an extension unit and a scheduling unit; wherein, 所述获取单元,配置为获取任务列表中的待处理任务;The obtaining unit is configured to obtain the tasks to be processed in the task list; 所述判断单元,配置为根据所述待处理任务,依次判断集成模块内所包括的多个任务执行器是否处于空闲状态;The judging unit is configured to sequentially judge whether the multiple task executors included in the integrated module are in an idle state according to the tasks to be processed; 所述扩展单元,配置为当所述多个任务执行器均处于非空闲状态时,扩展所述集成模块内任务执行器数量;the expansion unit, configured to expand the number of task executors in the integrated module when the multiple task executors are all in a non-idle state; 所述调度单元,配置为从扩展后的集成模块中调度新增的任务执行器,控制所述新增的任务执行器执行所述待处理任务。The scheduling unit is configured to schedule the newly added task executor from the expanded integration module, and control the newly added task executor to execute the to-be-processed task. 9.一种自适应调度装置,其特征在于,所述自适应调度装置包括存储器和处理器;其中,9. An adaptive scheduling device, characterized in that the adaptive scheduling device comprises a memory and a processor; wherein, 所述存储器,用于存储能够在所述处理器上运行的计算机程序;the memory for storing a computer program executable on the processor; 所述处理器,用于在运行所述计算机程序时,执行如权利要求1至7任一项所述方法的步骤。The processor is configured to execute the steps of the method according to any one of claims 1 to 7 when running the computer program. 10.一种计算机存储介质,其特征在于,所述计算机存储介质存储有自适应调度程序,所述自适应调度被至少一个处理器执行时实现如权利要求1至7任一项所述方法的步骤。10. A computer storage medium, characterized in that the computer storage medium stores an adaptive scheduler, and when the adaptive scheduler is executed by at least one processor, implements the method according to any one of claims 1 to 7. step. 11.一种系统,其特征在于,所述系统至少包括如权利要求8或9所述的自适应调度装置。11. A system, characterized in that the system comprises at least the adaptive scheduling apparatus according to claim 8 or 9.
CN202010761677.2A 2020-07-31 2020-07-31 Self-adaptive scheduling method, device, computer storage medium and system Pending CN114064225A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010761677.2A CN114064225A (en) 2020-07-31 2020-07-31 Self-adaptive scheduling method, device, computer storage medium and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010761677.2A CN114064225A (en) 2020-07-31 2020-07-31 Self-adaptive scheduling method, device, computer storage medium and system

Publications (1)

Publication Number Publication Date
CN114064225A true CN114064225A (en) 2022-02-18

Family

ID=80227769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010761677.2A Pending CN114064225A (en) 2020-07-31 2020-07-31 Self-adaptive scheduling method, device, computer storage medium and system

Country Status (1)

Country Link
CN (1) CN114064225A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116647530A (en) * 2023-06-06 2023-08-25 深圳花儿绽放网络科技股份有限公司 Automatic execution system for instant messaging task

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104539708A (en) * 2014-12-29 2015-04-22 杭州华为数字技术有限公司 Capacity reduction method, device and system for cloud platform resources
CN105245617A (en) * 2015-10-27 2016-01-13 江苏电力信息技术有限公司 A container-based server resource provisioning method
WO2018036167A1 (en) * 2016-08-22 2018-03-01 平安科技(深圳)有限公司 Test task executor assignment method, device, server and storage medium
CN111158855A (en) * 2019-12-19 2020-05-15 中国科学院计算技术研究所 Lightweight virtual clipping method based on micro-container and cloud function

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104539708A (en) * 2014-12-29 2015-04-22 杭州华为数字技术有限公司 Capacity reduction method, device and system for cloud platform resources
CN105245617A (en) * 2015-10-27 2016-01-13 江苏电力信息技术有限公司 A container-based server resource provisioning method
WO2018036167A1 (en) * 2016-08-22 2018-03-01 平安科技(深圳)有限公司 Test task executor assignment method, device, server and storage medium
CN111158855A (en) * 2019-12-19 2020-05-15 中国科学院计算技术研究所 Lightweight virtual clipping method based on micro-container and cloud function

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李文强: "《Docker+Kubernetes应用开发与快速上云》", 30 April 2020, 机械工业出版社, pages: 338 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116647530A (en) * 2023-06-06 2023-08-25 深圳花儿绽放网络科技股份有限公司 Automatic execution system for instant messaging task
CN116647530B (en) * 2023-06-06 2024-09-10 深圳花儿绽放网络科技股份有限公司 Automatic execution system for instant messaging task

Similar Documents

Publication Publication Date Title
CN103078941B (en) A kind of method for scheduling task of distributed computing system
CN103593242A (en) Resource sharing control system based on Yarn frame
CN116541134B (en) Deployment method and device for containers in multi-architecture clusters
CN111274033B (en) Resource deployment method, device, server and storage medium
CN116483546B (en) Distributed training task scheduling method, device, equipment and storage medium
JP2011511377A (en) A method for preloading settings of a heterogeneous information processing system that can be reconfigured into a memory hierarchy
CN113760543A (en) Resource management method, apparatus, electronic device, and computer-readable storage medium
CN114003346B (en) Task processing method, device, storage medium and program product
WO2022125217A1 (en) Saving and restoring pre-provisioned virtual machine states
CN114416322A (en) Task scheduling method and device based on double linked lists, electronic equipment and storage medium
CN115964170A (en) Resource scheduling method and device, electronic equipment and storage medium
US8732441B2 (en) Multiprocessing system
CN114064225A (en) Self-adaptive scheduling method, device, computer storage medium and system
CN112470088A (en) Control device
EP3200083B1 (en) Resource scheduling method and related apparatus
WO2022237419A1 (en) Task execution method and apparatus, and storage medium
CN116881012A (en) Container application vertical capacity expansion method, device, equipment and readable storage medium
CN114385502A (en) Offline prediction method, system, storage medium and terminal based on K8s cluster
Packwood et al. FPGA-based mixed-criticality execution platform for SystemJ and the Internet of Industrial Things
JPH09330243A (en) Computer system
CN120066949B (en) Compatibility testing methods, related devices and media
CN114924884B (en) A scheduling method, device and medium for batch scheduler
CN120354956B (en) Model reasoning acceleration method, device, storage medium and program product
KR102441045B1 (en) Method carried out in electronic control unit of the multi-core structure, and apparatus implementing the same method
CN120010790B (en) Storage device and control method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination