WO2019237586A1 - Method and apparatus for managing scheduled tasks, computer device and storage medium - Google Patents

Method and apparatus for managing scheduled tasks, computer device and storage medium Download PDF

Info

Publication number
WO2019237586A1
WO2019237586A1 PCT/CN2018/109381 CN2018109381W WO2019237586A1 WO 2019237586 A1 WO2019237586 A1 WO 2019237586A1 CN 2018109381 W CN2018109381 W CN 2018109381W WO 2019237586 A1 WO2019237586 A1 WO 2019237586A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
timing
timing task
scheduled
preset database
Prior art date
Application number
PCT/CN2018/109381
Other languages
French (fr)
Chinese (zh)
Inventor
丁文祥
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019237586A1 publication Critical patent/WO2019237586A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Definitions

  • the present application relates to the field of computer technology, and in particular, to a method, an apparatus, a computer device, and a storage medium for timing task management.
  • the server cluster generally includes multiple hosts and a host group composed of multiple hosts.
  • the host needs to execute There are more and more scheduled tasks.
  • the existing timing tasks are tasks that are distributed and run separately on each host. Such timing tasks are prone to repeated execution and cause abnormalities, so it is not easy to manage.
  • This application provides a method, an apparatus, a computer device, and a storage medium for managing scheduled tasks to facilitate the management of multiple scheduled tasks.
  • the add page corresponding to the added scheduled task is displayed;
  • timing task added by a user through the adding page, wherein the timing task includes at least one host identifier
  • timing task management apparatus including:
  • the page display unit is configured to display an added page corresponding to the added scheduled task if a trigger operation of the added scheduled task is detected;
  • a task saving unit configured to save the acquired timing task to a preset database
  • a second obtaining unit configured to traverse a scheduled task in the preset database at preset intervals to obtain a scheduled task that meets a scheduled execution condition
  • the present application further provides a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor.
  • the processor implements the program when the program is executed. The steps of the timed task management method according to any one of the present application.
  • the present application further provides a storage medium, wherein the storage medium stores a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute the application Provide any of the steps of the method for managing a scheduled task.
  • FIG. 1 is a schematic flowchart of a timing task management method according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of sub-steps of the timing task management method in FIG. 1; FIG.
  • FIG. 3 is a schematic flowchart of a timing task management method according to another embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a timing task management method according to another embodiment of the present application.
  • FIG. 5 is a schematic block diagram of a timing task management apparatus according to an embodiment of the present application.
  • FIG. 6 is a schematic block diagram of a timing task management apparatus according to another embodiment of the present application.
  • FIG. 8 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a timing task management method according to an embodiment of the present application.
  • the timing task management method includes steps S101 to S105.
  • the trigger operation for adding a timed task may be a preset control or a preset operation.
  • a trigger instruction is generated when a user clicks on the preset control, and an add page is displayed according to the trigger instruction.
  • the add page is a web interface, and the web interface includes a plurality of task parameter input boxes, and the plurality of task parameter input boxes are used by a user to input corresponding task parameters, where the task parameters are related parameters of the scheduled task.
  • specific task parameters are obtained through a task parameter input field on the add page; and a timing task is generated according to the task parameters.
  • the scheduled task includes at least one host identifier, and the host identifier may include a host name or an IP address, for example, the host name is CNSH231162, and the IP address is 10.31.64.12.
  • a host group identifier may also be included, and the host group identifier includes multiple host identifiers.
  • step S102 includes sub-steps S102a and S102b.
  • S102a Obtain corresponding task parameters through the task parameter column on the add page.
  • the task parameters include: script name, host ID, task type, interval time, and execution time.
  • S102b Generate timing based on the task parameters. task.
  • obtaining the scheduled task added by the user through the adding page includes: saving multiple task parameters entered by the user through the task parameter bar on the adding page If a trigger operation for adding a task confirmation is detected, generating a timing task group according to the plurality of task parameters, wherein the timing task group includes a plurality of timing tasks.
  • the preset database is used to save scheduled tasks.
  • a Celery tool can be used, the Celery tool is added to the Web platform, and the Celery asynchronous message queue is set as the preset database.
  • the saving the acquired timing tasks to a preset database includes: saving the acquired timing tasks in a Celery asynchronous message queue. This can facilitate the management of the timing task.
  • the preset time can be set according to time requirements, such as 1 second or 2 seconds.
  • the timing task that meets the timing execution conditions may be: a timing task that differs from the execution time of the timing task by a set time.
  • the timing task is a timing task that satisfies the timing execution condition.
  • S105 Send a timing task that meets the timing execution condition to a host in the timing task, and identify a host corresponding to the timing task so that the host executes the timing task.
  • a timing task that meets the timing execution condition is sent to a host corresponding to the host identifier in the timing task to trigger the host to execute specific content of the timing task, such as executing an echo.sh script.
  • specific content of the timing task such as executing an echo.sh script.
  • the adding page corresponding to the adding timing task is displayed; the timing page added by the user is obtained through the adding page; the acquired timing task is saved to a preset database; Let the time traverse the timing tasks in the preset database to obtain the timing tasks that meet the timing execution conditions; and send the timing tasks that meet the timing execution conditions to the host corresponding to the host identifier in the timing task so that the host executes The timing task.
  • This method realizes the centralized management of timing tasks, and can periodically execute the desired tasks on any target host, avoiding the repeated execution of timing tasks, and improving the user experience.
  • FIG. 3 is a schematic flowchart of a timing task management method according to another embodiment of the present application.
  • the method for managing a scheduled task includes steps S201 to S209.
  • the adding page is a web page interface.
  • the web page interface includes multiple task parameter input boxes.
  • the multiple task parameter input boxes are used by a user to input corresponding task parameters.
  • the task parameters are related to the scheduled task. parameter.
  • the corresponding task parameters are obtained through the task parameter input field on the add page; and a scheduled task is generated according to the task parameters, and the task parameters include: a script name, a host identifier, a task type, an interval time, and an execution time Wait.
  • the preset database may be a Celery asynchronous message queue; and storing the acquired timing tasks in a preset database includes: saving the acquired timing tasks in a Celery asynchronous message queue.
  • generating the timing task table according to the timing task includes: generating the timing task table according to the timing task according to the host identifier in the timing task; or, according to the timing task according to the execution of the timing task. Time to generate a scheduled task list. This makes it easy for users to view and manage which hosts are performing those scheduled tasks.
  • the scheduled task table is displayed. Specifically, it can be displayed in the order of host IDs, or according to the execution time. To facilitate users to view and manage.
  • the timing task is a timing task that satisfies the timing execution condition.
  • a timing task that meets the timing execution condition is sent to a host corresponding to the host identifier in the timing task, so as to trigger the host to execute specific content of the timing task, such as executing an echo.sh script.
  • specific content of the timing task such as executing an echo.sh script.
  • the result information includes an execution status, such as a successful or unsuccessful execution of a scheduled task, and of course, the result information may further include other information.
  • the result information is correspondingly stored in the timing task table.
  • the result information is correspondingly saved to a timed task in the timed task table, so that the user can view it subsequently.
  • the method of the above embodiment implements centralized management of timing tasks, and can periodically execute tasks that are desired to be executed on any target host. At the same time, it can also display all the timing tasks and the execution result information of the timing tasks through the timing task table, thereby further To improve the user experience.
  • FIG. 4 is a schematic flowchart of a timing task management method according to an embodiment of the present application.
  • the timing task management method includes steps S301 to S309.
  • the added page is a Web page
  • the Web page includes multiple task parameter input boxes, and the multiple task parameter input boxes are used for a user to input corresponding task parameters, and the task parameters are the tasks of the timed task.
  • the task parameters are the tasks of the timed task.
  • the task parameters include: a script name, a host identifier, a task type, an interval time, and an execution time.
  • the method determines whether a corresponding scheduled task exists in the preset database according to the task parameter; for example, determines whether a similar scheduled task exists in the preset database according to a script name, an execution time, and a host identifier; if If there is a corresponding timing task in the preset database, step S304 is performed; if there is no corresponding timing task in the preset database, step S305 is performed. This can avoid repeatedly performing the same timing task.
  • a prompt message is output to remind the user that there is a corresponding timing task, and jumps to the timing task table and displays the corresponding timing task and corresponding task in the timing task table. parameter.
  • the prompt information may be voice prompt information or text prompt information.
  • the prompt information is output and jump to the timed task table, and the corresponding timed task and corresponding task parameters are displayed in the timed task table, it is beneficial for the user to further confirm whether there are exactly the same timed task. This can avoid repeatedly performing the same timing task.
  • the acquired timing task is saved to the preset database.
  • the preset database is a Celery asynchronous message queue.
  • the acquired timing tasks are stored in the Celery asynchronous message queue.
  • the timing task in the timing task table is updated according to the timing task of the preset database to ensure synchronization between the two.
  • the timed task table is displayed in a specific display manner. For example, it can be displayed in order of host IDs, or it can be displayed according to execution time. To facilitate users to view and manage.
  • the timing task is a timing task that satisfies the timing execution condition.
  • a timing task that meets the timing execution condition is sent to a host corresponding to the host identifier in the timing task, so as to trigger the host to execute specific content of the timing task, such as executing an echo.sh script.
  • specific content of the timing task such as executing an echo.sh script.
  • the method of the above embodiment implements centralized management of timing tasks, and can periodically execute a desired task on any target host. At the same time, it also automatically determines whether there is a similar timing task, which avoids repeated execution of timing tasks. This further improves the user experience.
  • FIG. 5 is a schematic block diagram of a timing task management apparatus according to an embodiment of the present application.
  • the timing task management apparatus 400 includes a page display unit 401, a first acquisition unit 402, a task storage unit 403, a second acquisition unit 404, and a task execution unit 405.
  • the page display unit 401 is configured to display an added page corresponding to the added scheduled task if a trigger operation of adding the scheduled task is detected.
  • the first obtaining unit 402 is configured to obtain a timing task added by a user through the adding page, where the timing task includes at least one host identifier.
  • the task saving unit 403 is configured to save the acquired timing task to a preset database.
  • the task saving unit 403 is specifically configured to: save the obtained timing task to a Celery asynchronous message queue, and the Celery asynchronous message queue is stored in a preset database.
  • the second obtaining unit 404 is configured to traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
  • the task execution unit 405 is configured to send a timing task that satisfies the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
  • FIG. 6 is a schematic block diagram of another timing task management apparatus according to an embodiment of the present application.
  • the timing task management apparatus 500 includes: a page display unit 501, a first acquisition unit 502, a task storage unit 503, a task table generation unit 504, a task table display unit 505, a second acquisition unit 506, and a task execution unit. 507.
  • the page display unit 501 is configured to display an addition page corresponding to the added timing task if a trigger operation of adding the timing task is detected.
  • a first obtaining unit 502 is configured to obtain a timing task added by a user through the adding page, where the timing task includes at least one host identifier.
  • the task saving unit 503 is configured to save the acquired timing task to a preset database.
  • a task table generating unit 504 is configured to generate a timing task table according to the timing task.
  • the task list display unit 507 is configured to display the timed task list if a trigger operation for viewing a timed task is detected.
  • the second obtaining unit 506 is configured to traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
  • the task execution unit 507 is configured to send a timing task that satisfies the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
  • the result receiving unit 508 is configured to receive result information fed back by the host after executing the timing task.
  • a result saving unit 509 is configured to correspondingly save the result information to the timing task table.
  • FIG. 7 is a schematic block diagram of another timing task management apparatus according to an embodiment of the present application.
  • the timing task management device 600 includes a page display unit 601, a first acquisition unit 602, a task determination unit 603, an output jump unit 604, a task storage unit 605, a task table update unit 606, and a task table display unit. 607.
  • the page display unit 601 is configured to display an added page corresponding to the added scheduled task if a trigger operation of adding the scheduled task is detected.
  • a first obtaining unit 602 is configured to obtain a timing task added by a user through the adding page, where the timing task includes task parameters, and the task parameters include a script name, a host identifier, a task type, an interval time, and an execution time.
  • a task determination unit 603 is configured to determine whether a corresponding timing task exists in the preset database according to the task parameters.
  • An output jump unit 604 is configured to output a prompt message to remind the user that a corresponding timed task exists if the preset task exists in the preset database, and jump to the timed task table and display the corresponding timed task table. Scheduled tasks and corresponding task parameters.
  • the task saving unit 605 is configured to save the acquired timing task to the preset database if there is no corresponding timing task in the preset database.
  • a task table updating unit 606 is configured to update the timing task table according to the timing tasks of the preset database.
  • a task list display unit 607 is configured to display the timed task list if a trigger operation for viewing a timed task is detected.
  • the second obtaining unit 608 is configured to traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
  • a task execution unit 609 is configured to send a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
  • the above apparatus may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in FIG. 8.
  • FIG. 8 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • the computer device 700 may be a terminal or a server.
  • the computer device 700 includes a processor 720, a memory, and a network interface 750 connected through a system bus 710.
  • the memory may include a non-volatile storage medium 730 and an internal memory 740.
  • the non-volatile storage medium 730 can store an operating system 731 and a computer program 732.
  • the computer program 732 When executed, it can cause the processor 720 to execute any one of the timing task management methods.
  • the processor 720 is used to provide computing and control capabilities to support the operation of the entire computer device 700.
  • the internal memory 740 provides an environment for running the computer program 732 in the non-volatile storage medium 730.
  • the processor 720 can execute any method of timing task management.
  • the network interface 750 is used for network communication, such as sending assigned tasks.
  • the structure shown in FIG. 8 is only a block diagram of a part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer equipment 700 to which the scheme of the present application is applied.
  • the specific computer equipment 700 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
  • the processor 720 is configured to run program code stored in a memory to implement the following steps:
  • an adding page corresponding to the adding timing task is displayed; the timing task added by the user is obtained through the adding page, wherein the timing task includes at least one host identifier; the acquired timing task is saved to A preset database; traversing a scheduled task in the preset database at preset intervals to obtain a scheduled task that meets the scheduled execution condition; and sending a scheduled task that meets the scheduled execution condition to the host identifier corresponding to the scheduled task
  • the host causes the host to perform the timing task.
  • the processor 720 is configured to run the program code stored in the memory to implement the saving of the acquired timing task to preset data, and further implement the following steps:
  • the timed task table is displayed.
  • the processor 720 is configured to run the program code stored in the memory to implement the timing task acquired through the adding page, and specifically implement the following steps:
  • the corresponding task parameters are obtained through the task parameter bar on the add page, where the task parameters include: script name, host ID, task type, interval time, and execution time; and
  • the processor 720 is configured to run the program code stored in the memory to implement the saved timing task to a preset database, and further implement the following steps:
  • the acquired timing task is saved to the preset database.
  • the processor 720 is configured to run the program code stored in the memory to implement whether to determine whether there is a corresponding timing task in the preset database according to the task parameter, and further implement the following steps:
  • the processor 720 is configured to run program code stored in a memory to implement the sending of a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task such that After the host executes the timing task, it also implements the following steps:
  • the result information is correspondingly stored in the timing task table.
  • the processor 720 is configured to run the program code stored in the memory to implement the saving of the acquired timing task to a preset database, and specifically implement the following steps:
  • the acquired timing task is stored in a Celery asynchronous message queue, and the Celery asynchronous message queue is stored in a preset database.
  • the processor 720 may be a central processing unit (CPU), and the processor 720 may also be another general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor, or the processor may be any conventional processor.
  • FIG. 8 does not constitute a limitation on the computer device 700, and may include more or fewer components than shown in the figure, or combine some components, or different components. Layout.
  • the computer program can be stored in a storage medium, which is a computer-readable medium. Read storage media.
  • the computer program may be stored in a storage medium of a computer system and executed by at least one processor in the computer system, so as to implement process steps including the embodiments of the methods described above.
  • the computer-readable storage medium may be any medium that can store program code, such as a magnetic disk, an optical disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk, or an optical disk.
  • program code such as a magnetic disk, an optical disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk, or an optical disk.
  • timing task management apparatus and method may be implemented in other manners.
  • the embodiments of the timing task management apparatus described above are merely exemplary.
  • the division of each unit is only a logical function division, and there may be another division manner in actual implementation.
  • multiple units or components may be combined or integrated into another system, or some features may be ignored or not implemented.
  • the units in the apparatus of the embodiment of the present application may be combined, divided, and deleted according to actual needs.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of this application is essentially a part that contributes to the existing technology, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a storage medium. Included are instructions for causing a computer device (which may be a personal computer, a terminal, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.

Abstract

A method and apparatus for managing scheduled tasks, a computer device and a storage medium. The method comprises: if a triggering operation of adding a scheduled task is detected, displaying an addition page corresponding to the addition of a scheduled task (S101); acquiring the scheduled task added by a user through the addition page, wherein the scheduled task comprises at least one host identifier (S102); storing the acquired scheduled task in a preset database (S103); traversing the scheduled tasks in the preset database at an interval of preset time so as to acquire the scheduled task meeting a scheduled execution condition (S104); and sending the scheduled task meeting the scheduled execution condition to a host corresponding to the host identifier in the scheduled task, so that the host executes the scheduled task (S105).

Description

定时任务管理方法、装置、计算机设备及存储介质Timing task management method, device, computer equipment and storage medium
本申请要求于2018年6月13日提交中国专利局、申请号为201810607794.6、发明名称为“定时任务管理方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority from a Chinese patent application filed with the Chinese Patent Office on June 13, 2018, with application number 201810607794.6, and the invention name is "Timed Task Management Method, Apparatus, Computer Equipment, and Storage Medium", the entire contents of which are incorporated by reference. Incorporated in this application.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种定时任务管理方法、装置、计算机设备及存储介质。The present application relates to the field of computer technology, and in particular, to a method, an apparatus, a computer device, and a storage medium for timing task management.
背景技术Background technique
目前,随着互联网技术的发展,对各种Web平台对应的服务器集群的运维管理越来越重要,该服务器集群一般包括多个主机以及多个主机组成的主机组等,其中该主机需要执行的定时任务也变的越来越多。然而,现有定时任务都是分布在各个主机上单独运行的任务,这种定时任务容易造成重复执行,导致异常,因此不便于管理。At present, with the development of Internet technology, the operation and maintenance management of server clusters corresponding to various Web platforms is becoming increasingly important. The server cluster generally includes multiple hosts and a host group composed of multiple hosts. The host needs to execute There are more and more scheduled tasks. However, the existing timing tasks are tasks that are distributed and run separately on each host. Such timing tasks are prone to repeated execution and cause abnormalities, so it is not easy to manage.
发明内容Summary of the Invention
本申请提供了一种定时任务管理方法、装置、计算机设备及存储介质,以方便管理多个定时任务。This application provides a method, an apparatus, a computer device, and a storage medium for managing scheduled tasks to facilitate the management of multiple scheduled tasks.
第一方面,本申请提供了一种定时任务管理方法,其包括:In a first aspect, the present application provides a method for managing a scheduled task, which includes:
若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面;If a trigger operation for adding a scheduled task is detected, the add page corresponding to the added scheduled task is displayed;
通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识;Obtaining a timing task added by a user through the adding page, wherein the timing task includes at least one host identifier;
将获取到的定时任务保存至预设数据库;Save the obtained scheduled tasks to a preset database;
间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及Traverse the scheduled tasks in the preset database at preset intervals to obtain the scheduled tasks that meet the timing execution conditions; and
将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。Sending a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task so that the host executes the timing task.
第二方面,本申请提供了一种定时任务管理装置,其包括:In a second aspect, the present application provides a timing task management apparatus, including:
页面显示单元,用于若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面;The page display unit is configured to display an added page corresponding to the added scheduled task if a trigger operation of the added scheduled task is detected;
第一获取单元,用于通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识;A first obtaining unit, configured to obtain a timing task added by a user through the adding page, where the timing task includes at least one host identifier;
任务保存单元,用于将获取到的定时任务保存至预设数据库;A task saving unit, configured to save the acquired timing task to a preset database;
第二获取单元,用于间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及A second obtaining unit, configured to traverse a scheduled task in the preset database at preset intervals to obtain a scheduled task that meets a scheduled execution condition; and
任务执行单元,用于将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。A task execution unit is configured to send a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
第三方面,本申请还提供了一种计算机设备,其包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述程序时实现本申请提供的任意一项所述的定时任务管理方法的步骤。According to a third aspect, the present application further provides a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor implements the program when the program is executed. The steps of the timed task management method according to any one of the present application.
第四方面,本申请还提供了一种存储介质,其中所述存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行本申请提供的任意一项所述的定时任务管理方法的步骤。According to a fourth aspect, the present application further provides a storage medium, wherein the storage medium stores a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute the application Provide any of the steps of the method for managing a scheduled task.
本申请实施例通过在检测到添加定时任务的触发操作时,显示添加定时任务对应的添加页面;通过所述添加页面获取用户添加的定时任务;将获取到的定时任务保存至预设数据库;间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及将满足定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机以使得所述主机执行所述定时任务。该方法实现了定时任务的集中管理,可在任一目标主机上定时执行想要执行的任务,避免了定时任务的重复执行,同时提高了用户的体验。In the embodiment of the present application, when a trigger operation for adding a timing task is detected, an adding page corresponding to the adding timing task is displayed; the adding page is used to obtain the timing task added by the user; the acquired timing task is saved to a preset database; an interval Traverse the scheduled tasks in the preset database for a preset time to obtain a scheduled task that meets the scheduled execution conditions; and send the scheduled task that meets the scheduled execution conditions to a host corresponding to the host identifier in the scheduled task so that the host And execute the timing task. The method realizes the centralized management of timing tasks, and can periodically execute the desired tasks on any target host, avoiding the repeated execution of the timing tasks, and improving the user experience.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the drawings used in the description of the embodiments are briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application. For ordinary technicians, other drawings can be obtained based on these drawings without paying creative labor.
图1是本申请一实施例提供的一种定时任务管理方法的示意流程图;FIG. 1 is a schematic flowchart of a timing task management method according to an embodiment of the present application; FIG.
图2是图1中定时任务管理方法的子步骤示意流程图;FIG. 2 is a schematic flowchart of sub-steps of the timing task management method in FIG. 1; FIG.
图3是本申请另一实施例提供的一种定时任务管理方法的示意流程图;FIG. 3 is a schematic flowchart of a timing task management method according to another embodiment of the present application; FIG.
图4是本申请又一实施例提供的一种定时任务管理方法的示意流程图;4 is a schematic flowchart of a timing task management method according to another embodiment of the present application;
图5是本申请一实施例提供的一种定时任务管理装置的示意性框图;5 is a schematic block diagram of a timing task management apparatus according to an embodiment of the present application;
图6是本申请另一实施例提供的一种定时任务管理装置的示意性框图;6 is a schematic block diagram of a timing task management apparatus according to another embodiment of the present application;
图7是本申请又一实施例提供的一种定时任务管理装置的示意性框图;7 is a schematic block diagram of a timing task management apparatus according to another embodiment of the present application;
图8是本申请一实施例提供的一种计算机设备的示意性框图。FIG. 8 is a schematic block diagram of a computer device according to an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In the following, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and the appended claims, the terms "including" and "comprising" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude one or The presence or addition of a number of other features, wholes, steps, operations, elements, components, and / or sets thereof.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terminology used in the description of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should be further understood that the term "and / or" used in the specification of the application and the appended claims refers to any combination of one or more of the listed items and all possible combinations, and includes these combinations .
请参阅图1,图1是本申请一实施例提供的一种定时任务管理方法的示意流程图。如图1所示,该定时任务管理方法包括步骤S101~S105。Please refer to FIG. 1, which is a schematic flowchart of a timing task management method according to an embodiment of the present application. As shown in FIG. 1, the timing task management method includes steps S101 to S105.
S101、若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面。S101. If a trigger operation of adding a timed task is detected, an adding page corresponding to the timed task is displayed.
在本实施例中,该添加定时任务的触发操作可以为一个预设控件或预设操作等,比如检测到用户点击该预设控件时生成触发指令,根据所述触发指令显示添加页面,所述添加页面为一个网页界面,该网页界面包括多个任务参数输 入框,多个所述任务参数输入框用于用户输入相应的任务参数,其中所述任务参数为所述定时任务的相关参数。In this embodiment, the trigger operation for adding a timed task may be a preset control or a preset operation. For example, a trigger instruction is generated when a user clicks on the preset control, and an add page is displayed according to the trigger instruction. The add page is a web interface, and the web interface includes a plurality of task parameter input boxes, and the plurality of task parameter input boxes are used by a user to input corresponding task parameters, where the task parameters are related parameters of the scheduled task.
S102、通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识。S102. Obtain a timing task added by a user through the adding page, where the timing task includes at least one host identifier.
在本实施例中,具体是通过所述添加页面上的任务参数输入栏获取相应的任务参数;并根据所述任务参数生成定时任务。其中该定时任务包括至少一个主机标识,该主机标识可以包括主机名或IP地址等,比如主机名为:CNSH231162、IP地址为:10.31.64.12。当然也可以包括一个主机组标识,所述主机组标识包括多个主机标识。In this embodiment, specific task parameters are obtained through a task parameter input field on the add page; and a timing task is generated according to the task parameters. The scheduled task includes at least one host identifier, and the host identifier may include a host name or an IP address, for example, the host name is CNSH231162, and the IP address is 10.31.64.12. Of course, a host group identifier may also be included, and the host group identifier includes multiple host identifiers.
其中,基于所述任务参数生成定时任务,具体如图2所示,即步骤S102包括子步骤S102a和S102b。其中,S102a、通过所述添加页面上的任务参数栏获取相应的任务参数,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间;S102b、根据所述任务参数生成定时任务。A timing task is generated based on the task parameters, as shown in FIG. 2 in detail, that is, step S102 includes sub-steps S102a and S102b. S102a: Obtain corresponding task parameters through the task parameter column on the add page. The task parameters include: script name, host ID, task type, interval time, and execution time. S102b: Generate timing based on the task parameters. task.
在一实施例中,为了方便用户的操作以及日后的管理,所述通过所述添加页面获取用户添加的定时任务,包括:保存用户通过所述添加页面上的任务参数栏输入的多个任务参数;若检测到添加任务确认的触发操作时,根据所述多个任务参数生成定时任务组,其中所述定时任务组包括多个定时任务。In an embodiment, in order to facilitate user operations and future management, obtaining the scheduled task added by the user through the adding page includes: saving multiple task parameters entered by the user through the task parameter bar on the adding page If a trigger operation for adding a task confirmation is detected, generating a timing task group according to the plurality of task parameters, wherein the timing task group includes a plurality of timing tasks.
S103、将获取到的定时任务保存至预设数据库。S103. Save the acquired timing task to a preset database.
在本实施例中,该预设数据库为用于保存定时任务的,具体可以采用Celery工具,将该Celery工具添加至Web平台中,将所述Celery异步消息队列设为所述预设数据库。所述将获取到的定时任务保存至预设数据库,包括:将获取到的定时任务均保存在Celery异步消息队列中。由此可方便对所述定时任务进行管理。In this embodiment, the preset database is used to save scheduled tasks. Specifically, a Celery tool can be used, the Celery tool is added to the Web platform, and the Celery asynchronous message queue is set as the preset database. The saving the acquired timing tasks to a preset database includes: saving the acquired timing tasks in a Celery asynchronous message queue. This can facilitate the management of the timing task.
S104、间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务。S104. Traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
在本实施例中,所述预设时间可以根据时间需要进行设定,比如1秒或2秒等。满足定时执行条件的定时任务可以为:距离定时任务的执行时间相差设定时间的定时任务。当定时任务的执行时间达到设定时间时,该定时任务即为满足所述定时执行条件的定时任务。In this embodiment, the preset time can be set according to time requirements, such as 1 second or 2 seconds. The timing task that meets the timing execution conditions may be: a timing task that differs from the execution time of the timing task by a set time. When the execution time of the timing task reaches a set time, the timing task is a timing task that satisfies the timing execution condition.
S105、将满足所述定时执行条件的定时任务发送至所述定时任务中的主机 标识对应的主机使得所述主机执行所述定时任务。S105. Send a timing task that meets the timing execution condition to a host in the timing task, and identify a host corresponding to the timing task so that the host executes the timing task.
在本实施例中,将满足定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机,以触发所述主机执行该定时任务的具体内容,比如执行echo.sh脚本。由此可实现在任意目标主机上定时执行想要执行的任务,同时还实现了定时任务的集中管理。In this embodiment, a timing task that meets the timing execution condition is sent to a host corresponding to the host identifier in the timing task to trigger the host to execute specific content of the timing task, such as executing an echo.sh script. In this way, the desired task can be executed on any target host at a fixed time, and centralized management of the timing task is also realized.
上述实施例通过在检测到添加定时任务的触发操作时,显示添加定时任务对应的添加页面;通过所述添加页面获取用户添加的定时任务;将获取到的定时任务保存至预设数据库;间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及将满足定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机以使得所述主机执行所述定时任务。该方法实现了定时任务的集中管理,可在任意目标主机上定时执行想要执行的任务,避免了定时任务的重复执行,同时提高了用户的体验。In the above embodiment, when a trigger operation for adding a timing task is detected, the adding page corresponding to the adding timing task is displayed; the timing page added by the user is obtained through the adding page; the acquired timing task is saved to a preset database; Let the time traverse the timing tasks in the preset database to obtain the timing tasks that meet the timing execution conditions; and send the timing tasks that meet the timing execution conditions to the host corresponding to the host identifier in the timing task so that the host executes The timing task. This method realizes the centralized management of timing tasks, and can periodically execute the desired tasks on any target host, avoiding the repeated execution of timing tasks, and improving the user experience.
请参阅图3,图3是本申请另一实施例提供的一种定时任务管理方法的示意流程图。如图3所示,该定时任务管理方法包括步骤S201~S209。Please refer to FIG. 3, which is a schematic flowchart of a timing task management method according to another embodiment of the present application. As shown in FIG. 3, the method for managing a scheduled task includes steps S201 to S209.
S201、若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面。S201. If a trigger operation for adding a timed task is detected, an adding page corresponding to the timed task is displayed.
其中,所述添加页面为一个网页界面,该网页界面包括多个任务参数输入框,多个所述任务参数输入框用于用户输入相应的任务参数,所述任务参数为所述定时任务的相关参数。The adding page is a web page interface. The web page interface includes multiple task parameter input boxes. The multiple task parameter input boxes are used by a user to input corresponding task parameters. The task parameters are related to the scheduled task. parameter.
S202、通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识。S202. Obtain a timing task added by the user through the adding page, where the timing task includes at least one host identifier.
具体地,通过所述添加页面上的任务参数输入栏获取相应的任务参数;并根据所述任务参数生成定时任务,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间等。Specifically, the corresponding task parameters are obtained through the task parameter input field on the add page; and a scheduled task is generated according to the task parameters, and the task parameters include: a script name, a host identifier, a task type, an interval time, and an execution time Wait.
S203、将获取到的定时任务保存至预设数据库。S203. Save the acquired timing task to a preset database.
具体地,所述预设数据库可以为Celery异步消息队列;所述将获取到的定时任务保存至预设数据库,包括:将获取到的定时任务均保存在Celery异步消息队列中。Specifically, the preset database may be a Celery asynchronous message queue; and storing the acquired timing tasks in a preset database includes: saving the acquired timing tasks in a Celery asynchronous message queue.
S204、根据所述定时任务生成定时任务表。S204. Generate a timing task table according to the timing task.
具体地,所述根据所述定时任务生成定时任务表,包括:根据所述定时任务按照所述定时任务中的主机标识生成定时任务表;或者,根据所述定时任务按照所述定时任务的执行时间生成定时任务表。由此,以便于用户进行查看管理,了解哪些主机执行了那些定时任务。Specifically, generating the timing task table according to the timing task includes: generating the timing task table according to the timing task according to the host identifier in the timing task; or, according to the timing task according to the execution of the timing task. Time to generate a scheduled task list. This makes it easy for users to view and manage which hosts are performing those scheduled tasks.
在一实施例中,所述定时任务表包括任务重启控件;若检测到用户点击所述任务重启控件,显示任务重启输入框,所述任务重启输入框用于输入主机标识;根据用户输入的主机标识在所述定时任务表中以预设显示方式显示所述主机标识对应的定时任务;获取用户选择的定时任务并激活所述定时任务。其中所述预设显示方式比如为通过红色字体的方式显示。由此,不仅可以避免了用户添加定时任务是重复操作,还可以准确快速地添加定时任务。In one embodiment, the timed task list includes a task restart control; if it is detected that the user clicks the task restart control, a task restart input box is displayed, and the task restart input box is used to input a host identifier; The identifier displays a timer task corresponding to the host identifier in a preset display manner in the timer task table; obtaining a timer task selected by a user and activating the timer task. The preset display mode is, for example, displaying in a red font. Therefore, it is not only avoided that the user adds a timed task to be a repetitive operation, but also a timed task can be added accurately and quickly.
S205、若检测到查看定时任务的触发操作,显示所述定时任务表。S205. If a triggering operation of viewing the timing task is detected, display the timing task table.
具体地,查看定时任务的触发操作,比如为:用户点击查看定时任务。当用户点击查看定时任务,即显示所述定时任务表。具体可以主机标识排序的方式显示,也可按照执行时间的显示。以方便用户进行查看和管理。Specifically, to view the trigger operation of the timing task, for example, the user clicks to view the timing task. When the user clicks to view the scheduled task, the scheduled task table is displayed. Specifically, it can be displayed in the order of host IDs, or according to the execution time. To facilitate users to view and manage.
S206、间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务。S206: Traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
具体地,当定时任务的执行时间达到设定时间时,该定时任务即为满足所述定时执行条件的定时任务。Specifically, when the execution time of the timing task reaches a set time, the timing task is a timing task that satisfies the timing execution condition.
S207、将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。S207. Send a timing task that meets the timing execution condition to a host corresponding to the host identifier in the timing task, so that the host executes the timing task.
具体地,将满足定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机,以触发所述主机执行该定时任务的具体内容,比如执行echo.sh脚本。由此可实现在任意目标主机上定时执行想要执行的任务,同时还实现了定时任务的集中管理。Specifically, a timing task that meets the timing execution condition is sent to a host corresponding to the host identifier in the timing task, so as to trigger the host to execute specific content of the timing task, such as executing an echo.sh script. In this way, the desired task can be executed on any target host at a fixed time, and centralized management of the timing task is also realized.
S208、接收所述主机执行完所述定时任务后反馈的结果信息。S208. Receive result information fed back by the host after executing the timing task.
具体地,所述结果信息包括执行状态,比如定时任务执行成功或执行失败等,当然该结果信息还可包括其他信息。Specifically, the result information includes an execution status, such as a successful or unsuccessful execution of a scheduled task, and of course, the result information may further include other information.
S209、将所述结果信息对应保存至所述定时任务表中。S209. The result information is correspondingly stored in the timing task table.
具体地,是将所述结果信息对应保存至所述定时任务表的定时任务中,以便用户后续查看。Specifically, the result information is correspondingly saved to a timed task in the timed task table, so that the user can view it subsequently.
上述实施例的方法实现了定时任务的集中管理,可在任意目标主机上定时执行想要执行的任务,同时还可通过定时任务表展示所有的定时任务以及定时任务的执行结果信息,由此进一步地提高了用户的体验。The method of the above embodiment implements centralized management of timing tasks, and can periodically execute tasks that are desired to be executed on any target host. At the same time, it can also display all the timing tasks and the execution result information of the timing tasks through the timing task table, thereby further To improve the user experience.
请参阅图4,图4是本申请一实施例提供的一种定时任务管理方法的示意流程图。如图4所示,该定时任务管理方法包括步骤S301~S309。Please refer to FIG. 4, which is a schematic flowchart of a timing task management method according to an embodiment of the present application. As shown in FIG. 4, the timing task management method includes steps S301 to S309.
S301、若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面。S301. If a trigger operation of adding a scheduled task is detected, an add page corresponding to the added scheduled task is displayed.
具体地,所述添加页面为一个Web网页,该Web网页包括多个任务参数输入框,多个所述任务参数输入框用于用户输入相应的任务参数,所述任务参数为所述定时任务的相关参数。Specifically, the added page is a Web page, and the Web page includes multiple task parameter input boxes, and the multiple task parameter input boxes are used for a user to input corresponding task parameters, and the task parameters are the tasks of the timed task. Related parameters.
S302、通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括任务参数。S302. Obtain a timing task added by a user through the adding page, where the timing task includes task parameters.
具体地,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间。Specifically, the task parameters include: a script name, a host identifier, a task type, an interval time, and an execution time.
S303、根据所述任务参数判断所述预设数据库是否存在相应的定时任务。S303. Determine whether a corresponding timing task exists in the preset database according to the task parameter.
具体地,所述根据所述任务参数判断所述预设数据库是否存在相应的定时任务;比如,根据脚本名称、执行时间以及主机标识判断所述预设数据库是否存在类似的定时任务;若所述预设数据库存在相应的定时任务,执行步骤S304;若所述预设数据库未存在相应的定时任务,则执行步骤S305。由此可以避免重复执行相同的定时任务。Specifically, the method determines whether a corresponding scheduled task exists in the preset database according to the task parameter; for example, determines whether a similar scheduled task exists in the preset database according to a script name, an execution time, and a host identifier; if If there is a corresponding timing task in the preset database, step S304 is performed; if there is no corresponding timing task in the preset database, step S305 is performed. This can avoid repeatedly performing the same timing task.
S304、输出提示信息并跳转至定时任务表,其中所述定时任务表为根据所述预设数据库中的定时任务生成的表。S304. Output the prompt information and jump to the timing task table, where the timing task table is a table generated according to the timing tasks in the preset database.
具体地,若所述预设数据库存在相应的定时任务,输出提示信息以提示用户存在相应的定时任务,并跳转至所述定时任务表并在定时任务表中显示相应的定时任务及对应任务参数。Specifically, if there is a corresponding timing task in the preset database, a prompt message is output to remind the user that there is a corresponding timing task, and jumps to the timing task table and displays the corresponding timing task and corresponding task in the timing task table. parameter.
具体地,所述提示信息可以为语音提示信息或文字提示信息等。在输出提示信息后并跳转至所述定时任务表,同时在所述定时任务表中显示相应的定时任务及对应任务参数,有利于用户进一步确认是否真的存在完全相同的定时任务。由此可以避免重复执行相同的定时任务。Specifically, the prompt information may be voice prompt information or text prompt information. After the prompt information is output and jump to the timed task table, and the corresponding timed task and corresponding task parameters are displayed in the timed task table, it is beneficial for the user to further confirm whether there are exactly the same timed task. This can avoid repeatedly performing the same timing task.
S305、将获取到的定时任务保存至预设数据库。S305. Save the acquired timing task to a preset database.
具体地,若所述预设数据库未存在相应的定时任务,将获取到的定时任务保存至预设数据库。所述预设数据库为Celery异步消息队列,具体是将获取到的定时任务均保存在Celery异步消息队列中。Specifically, if there is no corresponding timing task in the preset database, the acquired timing task is saved to the preset database. The preset database is a Celery asynchronous message queue. Specifically, the acquired timing tasks are stored in the Celery asynchronous message queue.
S306、根据所述预设数据库的定时任务更新所述定时任务表。S306. Update the timing task table according to the timing task of the preset database.
具体是,根据所述预设数据库的定时任务更新所述定时任务表中的定时任务,以确保两者之间的同步。Specifically, the timing task in the timing task table is updated according to the timing task of the preset database to ensure synchronization between the two.
S307、若检测到查看定时任务的触发操作,显示所述定时任务表。S307. If a triggering operation of viewing the timing task is detected, display the timing task table.
具体地,若检测到查看定时任务的触发操作,以特定显示方式显示所述定时任务表。比如,以主机标识排序的方式显示,也可按照执行时间的显示。以方便用户进行查看和管理。Specifically, if a triggering operation for viewing a timed task is detected, the timed task table is displayed in a specific display manner. For example, it can be displayed in order of host IDs, or it can be displayed according to execution time. To facilitate users to view and manage.
S308、间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务。S308. Traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
具体地,当定时任务的执行时间达到设定时间时,该定时任务即为满足所述定时执行条件的定时任务。Specifically, when the execution time of the timing task reaches a set time, the timing task is a timing task that satisfies the timing execution condition.
S309、将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。S309. Send a timing task that meets the timing execution condition to a host corresponding to the host identifier in the timing task, so that the host executes the timing task.
具体地,将满足定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机,以触发所述主机执行该定时任务的具体内容,比如执行echo.sh脚本。由此可实现在任意目标主机上定时执行想要执行的任务,同时还实现了定时任务的集中管理。Specifically, a timing task that meets the timing execution condition is sent to a host corresponding to the host identifier in the timing task, so as to trigger the host to execute specific content of the timing task, such as executing an echo.sh script. In this way, the desired task can be executed on any target host at a fixed time, and centralized management of the timing task is also realized.
上述实施例的方法实现了定时任务的集中管理,可在任意目标主机上定时执行想要执行的任务,同时还自动判断是否存在相类似的定时任务,避免了定时任务的重复执行。由此进一步地提高了用户的体验。The method of the above embodiment implements centralized management of timing tasks, and can periodically execute a desired task on any target host. At the same time, it also automatically determines whether there is a similar timing task, which avoids repeated execution of timing tasks. This further improves the user experience.
请参阅图5,图5是本申请实施例提供的一种定时任务管理装置的示意性框图。如图5所示,定时任务管理装置400包括:页面显示单元401、第一获取单元402、任务保存单元403、第二获取单元404和任务执行单元405。Please refer to FIG. 5, which is a schematic block diagram of a timing task management apparatus according to an embodiment of the present application. As shown in FIG. 5, the timing task management apparatus 400 includes a page display unit 401, a first acquisition unit 402, a task storage unit 403, a second acquisition unit 404, and a task execution unit 405.
页面显示单元401,用于若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面。The page display unit 401 is configured to display an added page corresponding to the added scheduled task if a trigger operation of adding the scheduled task is detected.
第一获取单元402,用于通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识。The first obtaining unit 402 is configured to obtain a timing task added by a user through the adding page, where the timing task includes at least one host identifier.
在一实施例中,第一获取单元402包括:参数获取子单元4021和任务生成子单元4022。其中,参数获取子单元4021,用于通过所述添加页面上任务参数栏获取相应的任务参数,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间;任务生成子单元4022,用于根据所述任务参数生成定时任务。In an embodiment, the first obtaining unit 402 includes: a parameter obtaining subunit 4021 and a task generating subunit 4022. The parameter obtaining subunit 4021 is configured to obtain corresponding task parameters through the task parameter bar on the add page. The task parameters include: script name, host ID, task type, interval time, and execution time; task generation subunit 4022, configured to generate a timing task according to the task parameter.
任务保存单元403,用于将获取到的定时任务保存至预设数据库。The task saving unit 403 is configured to save the acquired timing task to a preset database.
其中,任务保存单元403,具体用于:将获取到的定时任务保存至Celery异步消息队列中,所述Celery异步消息队列保存在预设数据库中。The task saving unit 403 is specifically configured to: save the obtained timing task to a Celery asynchronous message queue, and the Celery asynchronous message queue is stored in a preset database.
第二获取单元404,用于间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务。The second obtaining unit 404 is configured to traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
任务执行单元405,用于将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。The task execution unit 405 is configured to send a timing task that satisfies the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
请参阅图6,图6是本申请实施例提供的另一种定时任务管理装置的示意性框图。如图6所示,定时任务管理装置500包括:页面显示单元501、第一获取单元502、任务保存单元503、任务表生成单元504、任务表显示单元505、第二获取单元506、任务执行单元507、结果接收单元508和结果保存单元509。Please refer to FIG. 6, which is a schematic block diagram of another timing task management apparatus according to an embodiment of the present application. As shown in FIG. 6, the timing task management apparatus 500 includes: a page display unit 501, a first acquisition unit 502, a task storage unit 503, a task table generation unit 504, a task table display unit 505, a second acquisition unit 506, and a task execution unit. 507. A result receiving unit 508 and a result storing unit 509.
页面显示单元501,用于若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面。The page display unit 501 is configured to display an addition page corresponding to the added timing task if a trigger operation of adding the timing task is detected.
第一获取单元502,用于通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识。A first obtaining unit 502 is configured to obtain a timing task added by a user through the adding page, where the timing task includes at least one host identifier.
任务保存单元503,用于将获取到的定时任务保存至预设数据库。The task saving unit 503 is configured to save the acquired timing task to a preset database.
任务表生成单元504,用于根据所述定时任务生成定时任务表。A task table generating unit 504 is configured to generate a timing task table according to the timing task.
任务表显示单元507,用于若检测到查看定时任务的触发操作,显示所述定时任务表。The task list display unit 507 is configured to display the timed task list if a trigger operation for viewing a timed task is detected.
第二获取单元506,用于间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务。The second obtaining unit 506 is configured to traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
任务执行单元507,用于将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。The task execution unit 507 is configured to send a timing task that satisfies the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
结果接收单元508,用于接收所述主机执行完所述定时任务后反馈的结果信息。The result receiving unit 508 is configured to receive result information fed back by the host after executing the timing task.
结果保存单元509,用于将所述结果信息对应保存至所述定时任务表中。A result saving unit 509 is configured to correspondingly save the result information to the timing task table.
请参阅图7,图7是本申请实施例提供的又一种定时任务管理装置的示意性框图。如图7所示,定时任务管理装置600包括:页面显示单元601、第一获取单元602、任务判断单元603、输出跳转单元604、任务保存单元605、任务表更新单元606、任务表显示单元607、第二获取单元608和任务执行单元609。Please refer to FIG. 7, which is a schematic block diagram of another timing task management apparatus according to an embodiment of the present application. As shown in FIG. 7, the timing task management device 600 includes a page display unit 601, a first acquisition unit 602, a task determination unit 603, an output jump unit 604, a task storage unit 605, a task table update unit 606, and a task table display unit. 607. The second obtaining unit 608 and the task execution unit 609.
页面显示单元601,用于若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面。The page display unit 601 is configured to display an added page corresponding to the added scheduled task if a trigger operation of adding the scheduled task is detected.
第一获取单元602,用于通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括任务参数,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间。A first obtaining unit 602 is configured to obtain a timing task added by a user through the adding page, where the timing task includes task parameters, and the task parameters include a script name, a host identifier, a task type, an interval time, and an execution time.
任务判断单元603,用于根据所述任务参数判断所述预设数据库是否存在相应的定时任务。A task determination unit 603 is configured to determine whether a corresponding timing task exists in the preset database according to the task parameters.
输出跳转单元604,用于若所述预设数据库存在相应的定时任务,输出提示信息以提示用户存在相应的定时任务,并跳转至所述定时任务表并在定时任务表中显示相应的定时任务及对应任务参数。An output jump unit 604 is configured to output a prompt message to remind the user that a corresponding timed task exists if the preset task exists in the preset database, and jump to the timed task table and display the corresponding timed task table. Scheduled tasks and corresponding task parameters.
任务保存单元605,用于若所述预设数据库未存在相应的定时任务,将获取到的定时任务保存至预设数据库。The task saving unit 605 is configured to save the acquired timing task to the preset database if there is no corresponding timing task in the preset database.
任务表更新单元606,用于根据所述预设数据库的定时任务更新所述定时任务表。A task table updating unit 606 is configured to update the timing task table according to the timing tasks of the preset database.
任务表显示单元607,用于若检测到查看定时任务的触发操作,显示所述定时任务表。A task list display unit 607 is configured to display the timed task list if a trigger operation for viewing a timed task is detected.
第二获取单元608,用于间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务。The second obtaining unit 608 is configured to traverse the timing tasks in the preset database at preset intervals to obtain timing tasks that meet the timing execution conditions.
任务执行单元609,用于将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。A task execution unit 609 is configured to send a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的定时任务管理装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of the description, for the specific working process of the timing task management device and unit described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not described herein again.
上述装置可以实现为一种计算机程序的形式,计算机程序可以在如图8所示的计算机设备上运行。The above apparatus may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in FIG. 8.
请参阅图8,图8是本申请实施例提供的一种计算机设备的示意性框图。该计算机设备700设备可以是终端或服务器。Please refer to FIG. 8, which is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 700 may be a terminal or a server.
参照图8,该计算机设备700包括通过系统总线710连接的处理器720、存储器和网络接口750,其中,存储器可以包括非易失性存储介质730和内存储器740。Referring to FIG. 8, the computer device 700 includes a processor 720, a memory, and a network interface 750 connected through a system bus 710. The memory may include a non-volatile storage medium 730 and an internal memory 740.
该非易失性存储介质730可存储操作系统731和计算机程序732。该计算机程序732被执行时,可使得处理器720执行任意一种定时任务管理方法。The non-volatile storage medium 730 can store an operating system 731 and a computer program 732. When the computer program 732 is executed, it can cause the processor 720 to execute any one of the timing task management methods.
该处理器720用于提供计算和控制能力,支撑整个计算机设备700的运行。The processor 720 is used to provide computing and control capabilities to support the operation of the entire computer device 700.
该内存储器740为非易失性存储介质730中的计算机程序732的运行提供环境,该计算机程序732被处理器720执行时,可使得处理器720执行任意一种定时任务管理方法。The internal memory 740 provides an environment for running the computer program 732 in the non-volatile storage medium 730. When the computer program 732 is executed by the processor 720, the processor 720 can execute any method of timing task management.
该网络接口750用于进行网络通信,如发送分配的任务等。本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备700的限定,具体的计算机设备700可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。其中,所述处理器720用于运行存储在存储器中的程序代码,以实现如下步骤:The network interface 750 is used for network communication, such as sending assigned tasks. Those skilled in the art can understand that the structure shown in FIG. 8 is only a block diagram of a part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer equipment 700 to which the scheme of the present application is applied. The specific computer equipment 700 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. The processor 720 is configured to run program code stored in a memory to implement the following steps:
若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面;通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识;将获取到的定时任务保存至预设数据库;间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。If a triggering operation of adding a timing task is detected, an adding page corresponding to the adding timing task is displayed; the timing task added by the user is obtained through the adding page, wherein the timing task includes at least one host identifier; the acquired timing task is saved to A preset database; traversing a scheduled task in the preset database at preset intervals to obtain a scheduled task that meets the scheduled execution condition; and sending a scheduled task that meets the scheduled execution condition to the host identifier corresponding to the scheduled task The host causes the host to perform the timing task.
在一实施例中,所述处理器720用于运行存储在存储器中的程序代码以实现所述将获取到的定时任务保存至预设数据之后,还实现如下步骤:In an embodiment, the processor 720 is configured to run the program code stored in the memory to implement the saving of the acquired timing task to preset data, and further implement the following steps:
根据所述定时任务生成定时任务表;Generating a timing task table according to the timing task;
若检测到查看定时任务的触发操作,显示所述定时任务表。If a triggering operation for viewing a timed task is detected, the timed task table is displayed.
在一实施例中,所述处理器720用于运行存储在存储器中的程序代码以实现所述通过所述添加页面获取添加的定时任务时,具体实现如下步骤:In an embodiment, the processor 720 is configured to run the program code stored in the memory to implement the timing task acquired through the adding page, and specifically implement the following steps:
通过所述添加页面上任务参数栏获取相应的任务参数,其中,所述任务参 数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间;以及The corresponding task parameters are obtained through the task parameter bar on the add page, where the task parameters include: script name, host ID, task type, interval time, and execution time; and
根据所述任务参数生成定时任务。Generate a timing task according to the task parameters.
在一实施例中,所述处理器720用于运行存储在存储器中的程序代码以实现所述将获取到的定时任务保存至预设数据库之前,还实现如下步骤:In an embodiment, the processor 720 is configured to run the program code stored in the memory to implement the saved timing task to a preset database, and further implement the following steps:
根据所述任务参数判断所述预设数据库是否存在相应的定时任务;Determining whether there is a corresponding timing task in the preset database according to the task parameter;
若所述预设数据库未存在相应的定时任务,将获取到的定时任务保存至预设数据库。If there is no corresponding timing task in the preset database, the acquired timing task is saved to the preset database.
在一实施例中,所述处理器720用于运行存储在存储器中的程序代码以实现所述根据所述任务参数判断所述预设数据库是否存在相应的定时任务之后,还实现如下步骤:In an embodiment, the processor 720 is configured to run the program code stored in the memory to implement whether to determine whether there is a corresponding timing task in the preset database according to the task parameter, and further implement the following steps:
若所述预设数据库存在相应的定时任务,输出提示信息以提示用户存在相应的定时任务,并跳转至所述定时任务表并在所述定时任务表中显示相应的定时任务及对应任务参数。If there is a corresponding timing task in the preset database, output a prompt message to remind the user that the corresponding timing task exists, and jump to the timing task table and display the corresponding timing task and corresponding task parameters in the timing task table .
在一实施例中,所述处理器720用于运行存储在存储器中的程序代码以实现所述将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务之后,还实现如下步骤:In an embodiment, the processor 720 is configured to run program code stored in a memory to implement the sending of a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task such that After the host executes the timing task, it also implements the following steps:
接收所述主机执行完所述定时任务后反馈的结果信息;以及Receiving result information fed back by the host after executing the timing task; and
将所述结果信息对应保存至所述定时任务表中。The result information is correspondingly stored in the timing task table.
在一实施例中,所述处理器720用于运行存储在存储器中的程序代码以实现所述将获取到的定时任务保存至预设数据库时,具体实现如下步骤:In an embodiment, the processor 720 is configured to run the program code stored in the memory to implement the saving of the acquired timing task to a preset database, and specifically implement the following steps:
将获取到的定时任务保存至Celery异步消息队列中,所述Celery异步消息队列保存在预设数据库中。The acquired timing task is stored in a Celery asynchronous message queue, and the Celery asynchronous message queue is stored in a preset database.
应当理解,在本申请实施例中,处理器720可以是中央处理单元(Central Processing Unit,CPU),该处理器720还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 720 may be a central processing unit (CPU), and the processor 720 may also be another general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor.
本领域技术人员可以理解,图8中示出的计算机设备700结构并不构成对计算机设备700的限定,可以包括比图示更多或更少的部件,或者组合某些部 件,或者不同的部件布置。Those skilled in the art can understand that the structure of the computer device 700 shown in FIG. 8 does not constitute a limitation on the computer device 700, and may include more or fewer components than shown in the figure, or combine some components, or different components. Layout.
本领域普通技术人员可以理解的是实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,计算机程序可存储于一存储介质中,该存储介质为计算机可读存储介质。如本申请实施例中,该计算机程序可存储于计算机系统的存储介质中,并被该计算机系统中的至少一个处理器执行,以实现包括如上述各方法的实施例的流程步骤。Those of ordinary skill in the art can understand that the implementation of all or part of the processes in the methods of the foregoing embodiments can be accomplished by a computer program instructing related hardware. The computer program can be stored in a storage medium, which is a computer-readable medium. Read storage media. As in the embodiment of the present application, the computer program may be stored in a storage medium of a computer system and executed by at least one processor in the computer system, so as to implement process steps including the embodiments of the methods described above.
该计算机可读存储介质可以是磁碟、光盘、U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The computer-readable storage medium may be any medium that can store program code, such as a magnetic disk, an optical disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk, or an optical disk.
在本申请所提供的几个实施例中,应该理解到,所揭露的定时任务管理装置和方法,可以通过其它的方式实现。例如,以上所描述的定时任务管理装置实施例仅仅是示意性的。例如,各个单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。In the several embodiments provided in this application, it should be understood that the disclosed timing task management apparatus and method may be implemented in other manners. For example, the embodiments of the timing task management apparatus described above are merely exemplary. For example, the division of each unit is only a logical function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not implemented.
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。The steps in the method of the embodiment of the present application can be adjusted, combined, and deleted according to actual needs.
本申请实施例装置中的单元可以根据实际需要进行合并、划分和删减。The units in the apparatus of the embodiment of the present application may be combined, divided, and deleted according to actual needs.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,终端,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。If the integrated unit is implemented in the form of a software functional unit and 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 application is essentially a part that contributes to the existing technology, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a storage medium. Included are instructions for causing a computer device (which may be a personal computer, a terminal, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific implementation of this application, but the scope of protection of this application is not limited to this. Any person skilled in the art can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements should be covered by the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种定时任务管理方法,其包括:A timing task management method includes:
    若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面;If a trigger operation for adding a scheduled task is detected, the add page corresponding to the added scheduled task is displayed;
    通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识;Obtaining a timing task added by a user through the adding page, wherein the timing task includes at least one host identifier;
    将获取到的定时任务保存至预设数据库;Save the obtained scheduled tasks to a preset database;
    间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及Traverse the scheduled tasks in the preset database at preset intervals to obtain the scheduled tasks that meet the timing execution conditions; and
    将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。Sending a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task so that the host executes the timing task.
  2. 根据权利要求1所述的定时任务管理方法,其中,所述将获取到的定时任务保存至预设数据之后,还包括:The timing task management method according to claim 1, wherein after saving the acquired timing task to preset data, further comprising:
    根据所述定时任务生成定时任务表;Generating a timing task table according to the timing task;
    若检测到查看定时任务的触发操作,显示所述定时任务表。If a triggering operation for viewing a timed task is detected, the timed task table is displayed.
  3. 根据权利要求1所述的定时任务管理方法,其中,所述通过所述添加页面获取添加的定时任务,包括:The timing task management method according to claim 1, wherein the acquiring the added timing task through the adding page comprises:
    通过所述添加页面上任务参数栏获取相应的任务参数,其中,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间;以及The corresponding task parameters are obtained through the task parameter bar on the add page, wherein the task parameters include: script name, host ID, task type, interval time, and execution time; and
    根据所述任务参数生成定时任务。Generate a timing task according to the task parameters.
  4. 根据权利要求3所述的定时任务管理方法,其中,所述将获取到的定时任务保存至预设数据库之前,还包括:The method for managing a scheduled task according to claim 3, wherein before saving the acquired scheduled task to a preset database, further comprising:
    根据所述任务参数判断所述预设数据库是否存在相应的定时任务;Determining whether there is a corresponding timing task in the preset database according to the task parameter;
    若所述预设数据库未存在相应的定时任务,将获取到的定时任务保存至预设数据库。If there is no corresponding timing task in the preset database, the acquired timing task is saved to the preset database.
  5. 根据权利要求4所述的定时任务管理方法,其中,所述根据所述任务参数判断所述预设数据库是否存在相应的定时任务之后,还包括:The method for managing a scheduled task according to claim 4, wherein after determining whether a corresponding scheduled task exists in the preset database according to the task parameter, further comprising:
    若所述预设数据库存在相应的定时任务,输出提示信息以提示用户存在相应的定时任务,并跳转至所述定时任务表并在所述定时任务表中显示相应的定时任务及对应任务参数。If there is a corresponding timing task in the preset database, output a prompt message to remind the user that the corresponding timing task exists, and jump to the timing task table and display the corresponding timing task and corresponding task parameters in the timing task table .
  6. 根据权利要求1所述的定时任务管理方法,其中,所述将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务之后,还包括:The timing task management method according to claim 1, wherein after the timing task that satisfies the timing execution condition is sent to a host corresponding to a host identifier in the timing task so that the host executes the timing task, Also includes:
    接收所述主机执行完所述定时任务后反馈的结果信息;以及Receiving result information fed back by the host after executing the timing task; and
    将所述结果信息对应保存至所述定时任务表中。The result information is correspondingly stored in the timing task table.
  7. 根据权利要求1所述的定时任务管理方法,其中,所述将获取到的定时任务保存至预设数据库,包括:The timing task management method according to claim 1, wherein the saving the acquired timing task to a preset database comprises:
    将获取到的定时任务保存至Celery异步消息队列中。Save the obtained scheduled task to the Celery asynchronous message queue.
  8. 一种定时任务管理装置,其包括:A timing task management device includes:
    页面显示单元,用于若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面;The page display unit is configured to display an added page corresponding to the added scheduled task if a trigger operation of the added scheduled task is detected;
    第一获取单元,用于通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识;A first obtaining unit, configured to obtain a timing task added by a user through the adding page, where the timing task includes at least one host identifier;
    任务保存单元,用于将获取到的定时任务保存至预设数据库;A task saving unit, configured to save the acquired timing task to a preset database;
    第二获取单元,用于间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及A second obtaining unit, configured to traverse a scheduled task in the preset database at preset intervals to obtain a scheduled task that meets a scheduled execution condition; and
    任务执行单元,用于将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。A task execution unit is configured to send a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task, so that the host executes the timing task.
  9. 一种计算机设备,其包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
    若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面;If a trigger operation for adding a scheduled task is detected, the add page corresponding to the added scheduled task is displayed;
    通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识;Obtaining a timing task added by a user through the adding page, wherein the timing task includes at least one host identifier;
    将获取到的定时任务保存至预设数据库;Save the obtained scheduled tasks to a preset database;
    间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件的定时任务;以及Traverse the scheduled tasks in the preset database at preset intervals to obtain the scheduled tasks that meet the timing execution conditions; and
    将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。Sending a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task so that the host executes the timing task.
  10. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机 程序时实现所述将获取到的定时任务保存至预设数据之后,还实现以下步骤:The computer device according to claim 9, wherein after the processor executes the computer program to implement the saving of the acquired timing task to preset data, the following steps are further implemented:
    根据所述定时任务生成定时任务表;Generating a timing task table according to the timing task;
    若检测到查看定时任务的触发操作,显示所述定时任务表。If a triggering operation for viewing a timed task is detected, the timed task table is displayed.
  11. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机程序时实现所述通过所述添加页面获取添加的定时任务时,具体实现以下步骤:The computer device according to claim 9, wherein when the processor executes the computer program to realize the timing task obtained through the adding page, the following steps are specifically implemented:
    通过所述添加页面上任务参数栏获取相应的任务参数,其中,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间;以及The corresponding task parameters are obtained through the task parameter bar on the add page, wherein the task parameters include: script name, host ID, task type, interval time, and execution time; and
    根据所述任务参数生成定时任务。Generate a timing task according to the task parameters.
  12. 根据权利要求11所述的计算机设备,其中,所述处理器执行所述计算机程序时实现所述将获取到的定时任务保存至预设数据库之前,还实现以下步骤:The computer device according to claim 11, wherein, before the processor executes the computer program to implement the saving of the acquired timing task to a preset database, the following steps are further implemented:
    根据所述任务参数判断所述预设数据库是否存在相应的定时任务;Determining whether there is a corresponding timing task in the preset database according to the task parameter;
    若所述预设数据库未存在相应的定时任务,将获取到的定时任务保存至预设数据库。If there is no corresponding timing task in the preset database, the acquired timing task is saved to the preset database.
  13. 根据权利要求12所述的计算机设备,其中,所述处理器执行所述计算机程序时实现所述根据所述任务参数判断所述预设数据库是否存在相应的定时任务之后,还实现以下步骤:The computer device according to claim 12, wherein when the processor executes the computer program, the processor executes the computer program to determine whether a preset task exists in the preset database according to the task parameter, and further implements the following steps:
    若所述预设数据库存在相应的定时任务,输出提示信息以提示用户存在相应的定时任务,并跳转至所述定时任务表并在所述定时任务表中显示相应的定时任务及对应任务参数。If there is a corresponding timing task in the preset database, output a prompt message to remind the user that the corresponding timing task exists, and jump to the timing task table and display the corresponding timing task and corresponding task parameters in the timing task table .
  14. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机程序时实现所述将获取到的定时任务保存至预设数据库时,具体实现:将获取到的定时任务保存至Celery异步消息队列中。The computer device according to claim 9, wherein when the processor executes the computer program to implement the saving of the acquired timing task to a preset database, the specific implementation is: to save the acquired timing task to Celery In an asynchronous message queue.
  15. 一种计算机存储介质,其中,所述计算机存储介质存储有计算机程序,所述计算机程序被处理器执行时使所述处理器执行以下步骤:A computer storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, causes the processor to perform the following steps:
    若检测到添加定时任务的触发操作,显示添加定时任务对应的添加页面;If a trigger operation for adding a scheduled task is detected, the add page corresponding to the added scheduled task is displayed;
    通过所述添加页面获取用户添加的定时任务,其中所述定时任务包括至少一个主机标识;Obtaining a timing task added by a user through the adding page, wherein the timing task includes at least one host identifier;
    将获取到的定时任务保存至预设数据库;Save the obtained scheduled tasks to a preset database;
    间隔预设时间遍历所述预设数据库中的定时任务以获取满足定时执行条件 的定时任务;以及Traverse the scheduled tasks in the preset database at preset intervals to obtain the scheduled tasks that meet the timing execution conditions; and
    将满足所述定时执行条件的定时任务发送至所述定时任务中的主机标识对应的主机使得所述主机执行所述定时任务。Sending a timing task that meets the timing execution condition to a host corresponding to a host identifier in the timing task so that the host executes the timing task.
  16. 根据权利要求15所述的计算机存储介质,其中,所述计算机程序被处理器执行时使所述处理器执行所述将获取到的定时任务保存至预设数据之后,还执行以下步骤:The computer storage medium according to claim 15, wherein when the computer program is executed by the processor, the processor executes the saved timing task to preset data, and further performs the following steps:
    根据所述定时任务生成定时任务表;若检测到查看定时任务的触发操作,显示所述定时任务表。Generate a timing task table according to the timing task; if a trigger operation for viewing a timing task is detected, display the timing task table.
  17. 根据权利要求15所述的计算机存储介质,其中,所述计算机程序被处理器执行时使所述处理器执行所述通过所述添加页面获取添加的定时任务,还执行以下步骤:The computer storage medium according to claim 15, wherein when the computer program is executed by a processor, the processor causes the processor to execute the timed task obtained through the adding page, and further performs the following steps:
    通过所述添加页面上任务参数栏获取相应的任务参数,其中,所述任务参数包括:脚本名称、主机标识、任务类型、间隔时间和执行时间;以及The corresponding task parameters are obtained through the task parameter bar on the add page, wherein the task parameters include: script name, host ID, task type, interval time, and execution time; and
    根据所述任务参数生成定时任务。Generate a timing task according to the task parameters.
  18. 根据权利要求17所述的计算机存储介质,其中,所述计算机程序被处理器执行时使所述处理器执行所述将获取到的定时任务保存至预设数据库之前,还执行以下步骤:The computer storage medium according to claim 17, wherein when the computer program is executed by the processor, the processor executes the following steps before the processor executes the saved timing task to a preset database:
    根据所述任务参数判断所述预设数据库是否存在相应的定时任务;Determining whether there is a corresponding timing task in the preset database according to the task parameter;
    若所述预设数据库未存在相应的定时任务,将获取到的定时任务保存至预设数据库。If there is no corresponding timing task in the preset database, the acquired timing task is saved to the preset database.
  19. 根据权利要求18所述的计算机存储介质,其中,所述计算机程序被处理器执行时使所述处理器执行所述根据所述任务参数判断所述预设数据库是否存在相应的定时任务之后,还执行以下步骤:The computer storage medium according to claim 18, wherein when the computer program is executed by a processor, the processor executes the processor to determine whether there is a corresponding timing task in the preset database according to the task parameter, and Perform the following steps:
    若所述预设数据库存在相应的定时任务,输出提示信息以提示用户存在相应的定时任务,并跳转至所述定时任务表并在所述定时任务表中显示相应的定时任务及对应任务参数。If there is a corresponding timing task in the preset database, output a prompt message to remind the user that the corresponding timing task exists, and jump to the timing task table and display the corresponding timing task and corresponding task parameters in the timing task table .
  20. 根据权利要求15所述的计算机存储介质,其中,所述计算机程序被处理器执行时使所述处理器执行所述将获取到的定时任务保存至预设数据库时,具体执行:将获取到的定时任务保存至Celery异步消息队列中。The computer storage medium according to claim 15, wherein when the computer program is executed by a processor, causing the processor to execute the saved timing task to a preset database, the specific execution is: Scheduled tasks are saved to the Celery asynchronous message queue.
PCT/CN2018/109381 2018-06-13 2018-10-09 Method and apparatus for managing scheduled tasks, computer device and storage medium WO2019237586A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810607794.6 2018-06-13
CN201810607794.6A CN108762911A (en) 2018-06-13 2018-06-13 Timing task management method, apparatus, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2019237586A1 true WO2019237586A1 (en) 2019-12-19

Family

ID=64021573

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/109381 WO2019237586A1 (en) 2018-06-13 2018-10-09 Method and apparatus for managing scheduled tasks, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN108762911A (en)
WO (1) WO2019237586A1 (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542598B (en) * 2018-11-08 2021-03-16 泰康保险集团股份有限公司 Timed task management method and device
CN109359211A (en) * 2018-11-13 2019-02-19 平安科技(深圳)有限公司 Data-updating method, device, computer equipment and the storage medium of interactive voice
CN109598427B (en) * 2018-11-23 2022-03-01 泰康保险集团股份有限公司 Robot management method and device and electronic equipment
CN110069329A (en) * 2019-04-15 2019-07-30 北京达佳互联信息技术有限公司 A kind of task processing method, device, server and storage medium
CN113302593A (en) * 2019-05-16 2021-08-24 深圳市欢太科技有限公司 Task processing method, device and system, electronic equipment and storage medium
CN110196765A (en) * 2019-05-30 2019-09-03 苏州浪潮智能科技有限公司 Timed task processing method, device, equipment and computer readable storage medium
CN111078525A (en) * 2019-10-11 2020-04-28 中国平安财产保险股份有限公司 Method and device for adjusting system running time, computer equipment and storage medium
CN111026531B (en) * 2019-12-04 2024-02-27 深圳前海环融联易信息科技服务有限公司 Task repeated transmission processing method and device, computer equipment and storage medium
CN111414153A (en) * 2020-03-27 2020-07-14 四川虹美智能科技有限公司 Configurable planned task processing method and device
CN111708625A (en) * 2020-06-16 2020-09-25 中国建设银行股份有限公司 Multi-user task execution method, device, equipment and storage medium
CN111831380A (en) * 2020-07-16 2020-10-27 浙江三维通信科技有限公司 Task execution method and device, storage medium and electronic device
CN111815200A (en) * 2020-07-31 2020-10-23 深圳壹账通智能科技有限公司 Task scheduling method and device, computer equipment and storage medium
CN112463348B (en) * 2021-01-27 2021-06-15 北京搜狐新媒体信息技术有限公司 Timed task processing method and device
CN112925622A (en) * 2021-02-26 2021-06-08 北信源系统集成有限公司 System timing task processing method and device, electronic equipment and storage medium
CN112862452A (en) * 2021-03-02 2021-05-28 岭东核电有限公司 Method and device for executing work order equivalence, computer equipment and storage medium
CN113722057A (en) * 2021-03-12 2021-11-30 京东数字科技控股股份有限公司 Big data cluster processing method and system, electronic device and storage medium
CN113076186B (en) * 2021-05-07 2023-07-28 泰康保险集团股份有限公司 Task processing method, device, electronic equipment and storage medium
CN113448749B (en) * 2021-06-04 2023-03-24 山东英信计算机技术有限公司 Method, system, device and medium for optimizing execution of expected timing task
CN113590216B (en) * 2021-07-19 2024-03-19 上海淇玥信息技术有限公司 Timing task centralized management method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101510163A (en) * 2009-04-07 2009-08-19 金蝶软件(中国)有限公司 Processing method and system for planning task
CN103645909A (en) * 2013-12-30 2014-03-19 中国烟草总公司湖南省公司 Handling method and device for timed task
CN105677331A (en) * 2015-12-30 2016-06-15 浙江大华系统工程有限公司 Task execution method and device
CN107608774A (en) * 2017-09-08 2018-01-19 新智云数据服务有限公司 A kind of method for scheduling task, device, equipment and storage medium
CN107748695A (en) * 2017-10-24 2018-03-02 平安科技(深圳)有限公司 Timed task processing method, device, storage medium and computer equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329820B (en) * 2016-04-28 2019-12-20 杭州海康威视数字技术股份有限公司 Task processing method and device for cluster system
CN106406993B (en) * 2016-09-06 2019-11-15 努比亚技术有限公司 A kind of timing task management method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101510163A (en) * 2009-04-07 2009-08-19 金蝶软件(中国)有限公司 Processing method and system for planning task
CN103645909A (en) * 2013-12-30 2014-03-19 中国烟草总公司湖南省公司 Handling method and device for timed task
CN105677331A (en) * 2015-12-30 2016-06-15 浙江大华系统工程有限公司 Task execution method and device
CN107608774A (en) * 2017-09-08 2018-01-19 新智云数据服务有限公司 A kind of method for scheduling task, device, equipment and storage medium
CN107748695A (en) * 2017-10-24 2018-03-02 平安科技(深圳)有限公司 Timed task processing method, device, storage medium and computer equipment

Also Published As

Publication number Publication date
CN108762911A (en) 2018-11-06

Similar Documents

Publication Publication Date Title
WO2019237586A1 (en) Method and apparatus for managing scheduled tasks, computer device and storage medium
CN108255653B (en) Product testing method and terminal thereof
CN108566290B (en) Service configuration management method, system, storage medium and server
JP6011479B2 (en) Application management apparatus, application management system, and program
WO2020000761A1 (en) Task management method and apparatus, computer device and storage medium
US20200333930A1 (en) Information processing method, terminal, server, and computer storage medium
WO2018191849A1 (en) Cloud management platform, virtual machine management method and system thereof
TW201814609A (en) Information pushing
JP2007334580A (en) Support device, program, information processing system and support method
WO2021022714A1 (en) Message processing method for cross-block chain node, device, apparatus and medium
CN114201197A (en) Firmware upgrading method and device, electronic equipment and readable storage medium
WO2019161620A1 (en) Application dependency update method, terminal and device, and storage medium
AU2022374279A1 (en) Table processing method and apparatus, electronic device, medium, and program product
CN113076186B (en) Task processing method, device, electronic equipment and storage medium
TWI668634B (en) Software container based systems and methods for providing cloud services
CN109948332A (en) A kind of physical machine login password remapping method and device
CN107682389B (en) Method, terminal and computer readable storage medium for executing network request
US20130138856A1 (en) Method and apparatus for node hot-swapping
US20140115134A1 (en) Recommending a policy for an it asset
CN112363980A (en) Data processing method and device for distributed system
CN109302336B (en) Mail generation method and device, computer equipment and storage medium
CN110893616B (en) Remote control method and device, computer equipment and storage medium
US20170255473A1 (en) Non-Intrusive Restart of a Task Manager
EP3723343A1 (en) Resource processing method and system, storage medium and electronic device
US20230350712A1 (en) Bmc parameter configuration and effect-taking method and apparatus, device, and medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18922536

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18922536

Country of ref document: EP

Kind code of ref document: A1