WO2014173339A1 - 一种任务调度服务***及方法 - Google Patents

一种任务调度服务***及方法 Download PDF

Info

Publication number
WO2014173339A1
WO2014173339A1 PCT/CN2014/077702 CN2014077702W WO2014173339A1 WO 2014173339 A1 WO2014173339 A1 WO 2014173339A1 CN 2014077702 W CN2014077702 W CN 2014077702W WO 2014173339 A1 WO2014173339 A1 WO 2014173339A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
scheduling
priority
module
component module
Prior art date
Application number
PCT/CN2014/077702
Other languages
English (en)
French (fr)
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 WO2014173339A1 publication Critical patent/WO2014173339A1/zh

Links

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 invention relates to the field of communications, and more particularly to a task scheduling service system and method. Background technique
  • the voice mailbox includes new mail phone notification, guest timed message, outbound call fetching, schedule reminder and other timed tasks. Some of these timed tasks are business operations specified by the user at the date and time, and some are caused by the user's specified date and time business operations. Subsequent processing, some of which are implemented by internal task mechanisms for implementing a function.
  • timing tasks is based on the internal processing steps of the business application layer, which increases the complexity of the business application module, resulting in strong coupling between the business application layer and the data structure, data distribution and module relationships within the system, and Continuous expansion and change will result in repeated development tests of the same function, reducing R&D efficiency, and making it difficult to ensure product quality and performance.
  • the technical problem to be solved by the present invention is to provide a task scheduling service system and method.
  • the processing logic of the business application layer can be simplified, and the execution efficiency and user experience of the task scheduling service can be improved.
  • an embodiment of the present invention provides a task scheduling service system and method, where the task scheduling service system includes:
  • the task invoking module is set to: initiate a task scheduling request
  • the service interface component module is configured to: create a task according to the task scheduling request, and create a corresponding scheduling task record in the database;
  • the task scanning component module is configured to: scan the scheduled task record, calculate the task priority according to the task scheduling priority algorithm, and then put the task into the corresponding priority queue;
  • the task queue component module is configured to: select a task to be executed in the priority queue according to a priority queue element dequeue algorithm;
  • the task execution module is set to: execute the current task to be executed.
  • the task scheduling service system further includes:
  • the task statistics module is configured to: obtain and count the total number of task scheduling requests initiated by the task invoking module in the scheduling period, and the number of tasks successfully executed by the task execution module and the number of tasks that fail to execute.
  • the WEB management module is configured to: configure the scheduling rules of the task, system parameters, and query the processing progress of the current task.
  • the service interface component module is configured to: when creating a task, calculate a startup time and a task number for the task according to the task scheduling algorithm.
  • the service interface component module is further configured to: receive a task execution result report of the task execution module, and respond to the task execution module to perform task retry or perform task return processing on the task that fails to perform.
  • the service interface component module is further configured to: when the task is retried, calculate a restart time of the task according to the task scheduling rule calculation algorithm.
  • the task scheduling rule calculation algorithm includes: a current system time when the task is created
  • the service interface component module is configured to: when performing task receipt processing, return the task receipt information to the task invoking module according to the information of the task.
  • the service interface component module is further configured to: move the task that ends the execution to the history table for saving.
  • the task scanning component module is further configured to: when scanning a timeout and expired task, report the task result to the service interface component module, so that the service interface component module performs a task retry or performs a task for timeout and expired tasks. Receipt processing of tasks.
  • the task queue component module is further configured to: when the startup task is abnormal, report the task result to the service interface component module, so that the service interface component module performs task retry or task receipt processing on the task that initiates the abnormality. .
  • the task scheduling priority algorithm includes: a system level priority corresponding to a task type of the new task * 2 + a task priority flag + 1.
  • the priority queue element outbound algorithm includes: The task queue component module extracts the task processing from each task queue one by one according to the scheduling priority of each queue, first processes the tasks in the high priority queue, and then processes the low priority. The tasks in the level queue, then loop.
  • An embodiment of the present invention further provides a task scheduling method, including:
  • the task scheduling method further includes: calculating, when the task is retried, a restart time of the task according to the task rule algorithm.
  • the foregoing embodiment of the present invention initiates a task scheduling request by using a task invoking module; the service interface component module creates a task according to the task scheduling request, and creates a corresponding scheduling task record in the database; the task scanning component module processes the scheduling task The record is scanned, the task priority is calculated according to the task scheduling priority algorithm, and the task is placed in the corresponding priority queue; the task queue component module selects the current execution in the priority queue according to the priority queue element dequeue algorithm.
  • the task execution module executes the task to be executed currently; simplifies the processing logic of the business application layer, improves the execution efficiency of the task scheduling service, and enhances the differentiated experience of external users for different priority task scheduling services. . BRIEF abstract
  • FIG. 1 is a structural diagram of a task scheduling service system according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of a method for implementing task scheduling according to an embodiment of the present invention
  • FIG. 5 is a flowchart of a method for scheduling a task according to an embodiment of the present invention.
  • the call of the present invention for the existing timing tasks is based on the problem that the business application layer performs internal processing and is inefficient, and provides a task scheduling service system and method.
  • an embodiment of the present invention provides a task scheduling service system, including: a task invoking end module 101, configured to initiate a task scheduling request;
  • the service interface component module 102 is configured to create a task according to the task scheduling request, and create a corresponding scheduling task record in the database;
  • the task scanning component module 103 is configured to scan the scheduled task record, calculate a task priority according to a task scheduling priority algorithm, and then put the task into a corresponding priority queue;
  • the task queue component module 104 is configured to select a task to be executed in the priority queue according to a priority queue element dequeue algorithm
  • the task execution module 105 is configured to execute the task to be executed currently.
  • the foregoing embodiment of the present invention initiates a task scheduling request by using a task invoking module; the service interface component module creates a task according to the task scheduling request, and creates a corresponding scheduling task record in the database; the task scanning component module processes the scheduling task The record is scanned, the task priority is calculated according to the task scheduling priority algorithm, and the task is placed in the corresponding priority queue; the task queue component module selects the current execution in the priority queue according to the priority queue element dequeue algorithm.
  • the task execution module executes the current task to be executed; not only simplifies the processing logic of the business application layer, but also improves the execution efficiency of the task scheduling service, and also enhances the differentiated experience of external users for different priority task scheduling services. .
  • the embodiment of the task scheduling service system of the present invention may further include:
  • the task statistics module 106 is configured to obtain a total number of task scheduling requests initiated by the task invoking module in the scheduling period, a number of tasks successfully executed by the task execution module, and a number of tasks that fail to execute.
  • the WEB management module 107 is configured to configure scheduling rules of the task, system parameters, and query processing progress of the current task.
  • the service interface component module 102 is specifically configured to: calculate a startup time and a task number for the task according to the task scheduling algorithm.
  • the service interface component module 102 is further configured to: receive a task execution result report of the task execution module 105, respond to the task execution module 105, perform task retry on the task that fails to perform, or perform a receipt process of the task.
  • the service interface component module 102 is further configured to: when the task is retried, calculate a restart time of the task according to the task scheduling rule calculation algorithm.
  • the task scheduling rule calculation algorithm specifically refers to: the current system time when the task is created + the maximum startup delay duration * (the sum of the task counts of all the scheduling priorities greater than the new task scheduling priority).
  • the service interface component module 102 When the service interface component module 102 performs the task receipt processing, it is specifically configured to: return the task receipt information to the task invoking end module 101 according to the information of the task.
  • the service interface component module 102 is further configured to: move the task that ends the execution to a history table to save.
  • the task scanning component module 103 is further configured to: when scanning a timeout and expired task, report the task result to the service interface component module 102, so that the service interface component module 102 performs a task retry on the timeout and expired tasks or Carry out the receipt processing of the task.
  • the task queue component module 104 is further configured to: when the startup task has an abnormality, report the task result to the service interface component module 102, so that the service interface component module 102 performs a task retry or a task receipt for the task that initiates the abnormality. deal with.
  • the task scheduling priority algorithm specifically refers to: a system level priority corresponding to a task type of a new task * 2 + task priority flag + 1.
  • the priority queue element dequeue algorithm specifically refers to: the task queue component module 104 extracts the task processing from each task queue one by one according to the scheduling priority of each queue, and first processes the tasks in the high priority queue, and the processing is low. The tasks in the priority queue are then looped.
  • a specific flowchart of the method for implementing the task scheduling service system according to the present invention mainly includes the following steps:
  • Step 201 The WEB management module 107 is mainly responsible for configuring task scheduling rules, including tasks. The system-level priority, the forbidden scheduling time, the retry interval, and the maximum number of retries, and the like; Step 202, the task invoking module 101 sends a task scheduling request to the service interface component module 102, and the type of the current scheduling task needs to be specified in the request message. Whether the field of the scheduling result receipt is required, and the scheduling task startup time field is optional;
  • Step 203 After receiving the task scheduling request, the service interface component module 102 calculates the startup time of the task according to the task scheduling rule calculation algorithm, and creates a corresponding task scheduling record in the database; wherein, each scheduling priority in the statistical period is required.
  • the task counter calculates the ratio of the number of tasks for each scheduling priority to the total number of tasks.
  • Step 204 The task scanning component 103 queries the task that meets the task start condition according to the task scheduling priority algorithm, scans the task scheduling record, and puts the task scheduling record into the corresponding task priority queue; wherein, for example, system level priority The level is 3 (0, 1, 2). Each task type is divided into two types: normal and emergency (0, 1). Therefore, the maximum scheduling priority level of the whole system is 6, but considering the possible extension. The system-level priority number, so the task scheduling service can configure the maximum number of scheduling system-level priorities it supports. The default is 6.
  • Step 205 The task queue component module 104 calls out the task that meets the requirements in the priority queue according to the queue function of the priority queue element, and sends the task to the task execution module 105.
  • the task priority queue element dequeue algorithm includes: The task queue component takes the task processing from each task queue one by one according to the scheduling priority of each queue, processes the high priority queue first, then processes the low priority queue, and then loops. Each round of the loop takes the elements from the corresponding queue according to the priority values 6, 5, 4, 3, 2, 1;
  • Step 206 after receiving the task scheduling execution request, the task execution module 105 triggers the intelligent network platform to perform task scheduling, and feeds the execution result to the service interface component module 102;
  • Step 207 the service interface component module 102 determines whether the scheduling is successful, if successful, proceeds to step 208; if it fails, proceeds to step 209;
  • Step 208 the service interface component module 102 determines whether the task scheduling request requires a receipt. If the receipt is required, the process proceeds to step 210; if not, the process proceeds to step 214, and the current task scheduling ends, and the service interface component module 102 imports the scheduled task. In the task history table;
  • Step 209 the service interface component module 102 determines whether the number of retries of the scheduled task has exceeded the maximum number of retries, if yes, returns to step 208; if not, proceeds to step 212, by the service The interface component module 102 calculates the task retry start time for the task scan component module 103 to scan; Step 210, the service interface component module 102 determines whether the receipt execution result is successful to the task call end 101, and if successful, proceeds to step 214, the task Scheduling end, service interface component module
  • the scheduling task is imported into the task history table; if not, the process proceeds to step 213, where the task retry receipt time is calculated by the service interface component module 102 for scanning by the task scanning component module 103.
  • tasks that request scheduling from the service interface component module 102 can be divided into two phases: task execution and task receipt during the creation and execution process:
  • the first is that the service interface component module 102 creates a task in the task table, and needs to wait for execution after the task is created;
  • the task execution module 105 executes the task
  • the task call end 101 actively cancels the task
  • the task execution module 105 returns that the task execution is successful
  • the execution fails, and can be divided into: the task execution module 105 returns the task execution failure; the task queue component module 104 returns the task startup failure; the task in the waiting state times out;
  • Tasks in the task table require a receipt. There are usually four situations in the task receipt phase: Waiting for a receipt, the receipt fails but can be retried;
  • the task statistics module 106 obtains the task counters of the respective scheduling priorities in the scheduling period, and calculates the proportion of the tasks of the respective scheduling priorities to the total number of tasks.
  • the algorithm uses the proportion of the total number of tasks according to each scheduling priority to the total number of tasks of all scheduling priorities to calculate the task start of each scheduling priority. time.
  • an embodiment of the present invention further provides a task scheduling method, including: Step 501: Initiate a task scheduling request.
  • Step 502 Create a task according to the task scheduling request, and create a corresponding scheduling task record in the database.
  • Step 503 Scan the scheduled task record, calculate the task priority according to the task scheduling priority algorithm, and then put the task into the corresponding priority queue.
  • Step 504 selects a task to be executed in the priority queue according to a priority queue element out queue algorithm
  • Step 505 performs the task currently to be executed.
  • the foregoing embodiment may further include:
  • the execution result is returned to the task service interface component module 102.
  • the service interface component module 102 moves the completed task to the task history table for saving. Further, the task scheduling method further includes: when the task is retried, the service interface component should calculate the restart time of the task according to the task rule algorithm.
  • the task scheduling method further includes: for the task that ends and requests the receipt, the service interface component should return the task receipt information to the task invoking end according to the task information.
  • the embodiment of the method is an embodiment corresponding to the above system. All the implementation processes in the above system embodiment are applicable to the embodiment of the method, and the same technical effects can be achieved.
  • the task scheduling service system and method according to the embodiments of the present invention are based on the idea of system layered construction, and the intermediate service layer is responsible for interacting with internal modules to implement scheduling of scheduled tasks.
  • the scheduling of tasks is more intelligent and real-time, and supports multiple deployments of the task scheduling system module; functions such as forbidden call period and start-up delay can be set; The difference in priority task scheduling services.
  • the system configuration is simple and effective, and the operation is convenient; the business application layer processing logic is simplified, and the management is improved.
  • the efficiency of the dispatching service is realized; the WEB interface of parameter configuration is realized, which is convenient for administrators to manage and maintain; the data statistics platform is adopted, and the statistics of system user quantity, performance and stability are more clear and evidence-based.
  • the above embodiments of the present invention not only simplify the processing logic of the service application layer, but also improve the execution efficiency of the task scheduling service, and also enhance the differentiation of external user scheduling services for different priority tasks.

Landscapes

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

Abstract

一种任务调度服务***及方法,所述任务调度服务***包括:任务调用端模块,设置为:发起任务调度请求;服务接口组件模块,设置为:根据所述任务调度请求,创建任务,并在数据库中创建对应的调度任务记录;任务扫描组件模块,设置为:对所述调度任务记录进行扫描,按照任务调度优先级算法计算任务优先级,再将任务放入对应的优先级队列中;任务队列组件模块,设置为:按照优先级队列元素出队列算法在所述优先级队列中选择当前要执行的任务;任务执行模块,设置为:执行所述当前要执行的任务。本发明实施例所提供的任务调度服务***及方法,使任务调度区分出优先级,提高了任务调度服务执行效率,同时也增强了用户对不同优先级任务调度服务的差别化体验。

Description

一种任务调度服务***及方法
技术领域
本发明涉及通信领域, 特别是指一种任务调度服务***及方法。 背景技术
近年来, 电子通信已经普及我们的日常生活。 其中语音信箱的应用也十 分广泛。 目前语音信箱包括新邮件电话通知、客人定时留言、外呼提取传真、 日程提醒等定时任务,这些定时任务有些是由用户指定日期时间的业务操作, 有些是由于用户指定日期时间的业务操作所引起的后续处理, 有些是为实现 某项功能釆用内部任务机制实现。
这些定时任务的调用都是基于业务应用层执行内部处理步骤, 增加了业 务应用模块的复杂度, 造成业务应用层与***内部的数据结构、 数据分布以 及模块间关系的强耦合, 而且由于业务通道不断扩展和变化, 会造成相同功 能的重复开发测试, 降低研发效率, 也 4艮难确保产品质量和性能。 发明内容
本发明要解决的技术问题是提供一种任务调度服务***及方法。 可以简 化业务应用层的处理逻辑, 提高任务调度服务的执行效率及用户体验。
为解决上述技术问题, 本发明的实施例提供一种任务调度服务***及方 法, 所述任务调度服务***包括:
任务调用端模块, 设置为: 发起任务调度请求;
服务接口组件模块, 设置为: 根据所述任务调度请求, 创建任务, 并在 数据库中创建对应的调度任务记录;
任务扫描组件模块, 设置为: 对所述调度任务记录进行扫描, 按照任务 调度优先级算法计算任务优先级, 再将任务放入对应的优先级队列中;
任务队列组件模块, 设置为: 按照优先级队列元素出队列算法在所述优 先级队列中选择当前要执行的任务; 任务执行模块, 设置为: 执行所述当前要执行的任务。
其中, 所述任务调度服务***还包括:
任务统计模块, 设置为: 获取和统计调度周期内的所述任务调用端模块 发起的任务调度请求总数以及所述任务执行模块执行成功的任务数和执行失 败的任务数。
WEB管理模块, 设置为: 配置任务的调度规则、 ***参数, 以及查询当 前任务的处理进度。
其中, 所述服务接口组件模块设置为: 在创建任务时, 应该按照任务调 度算法为任务计算启动时间和分配任务号。
其中, 所述服务接口组件模块还设置为: 接收所述任务执行模块的任务 执行结果报告、 响应所述任务执行模块对执行失败的任务进行任务重试或进 行任务的回执处理。
其中, 所述服务接口组件模块还设置为: 在任务重试时, 按照任务调度 规则计算算法计算任务的重新启动时间。
其中, 所述任务调度规则计算算法, 包括: 创建任务时当前的***时间
+最大启动延迟时长 * (大于新任务调度优先级的所有调度优先级的任务数 比例总和) 。
其中, 所述服务接口组件模块设置为: 进行任务回执处理时, 应该根据 任务的信息向任务调用端模块返回任务回执信息。
其中, 所述服务接口组件模块还设置为: 将执行结束的任务移动到历史 表中保存。
其中,所述任务扫描组件模块还设置为:在扫描到超时和过期的任务时, 向服务接口组件模块报告任务结果, 使所述服务接口组件模块对超时和过期 的任务进行任务重试或进行任务的回执处理。
其中, 所述任务队列组件模块还设置为: 在启动任务发生异常时, 向服 务接口组件模块报告任务结果, 使所述服务接口组件模块对启动异常的任务 进行任务重试或进行任务的回执处理。
其中, 所述任务调度优先级算法, 包括: 新任务的任务类型对应的*** 级优先级 * 2 +任务优先标志 + 1。 其中, 所述优先级队列元素出队列算法, 包括: 任务队列组件模块按照 各队列的调度优先级逐一从每个任务队列中取出任务处理, 先处理高优先级 队列中的任务, 再处理低优先级队列中的任务, 然后循环。
本发明的实施例还提供了一种任务调度方法, 包括:
发起任务调度请求;
根据所述任务调度请求, 创建任务, 并在数据库中创建对应的调度任务 记录;
对所述调度任务记录进行扫描, 按照任务调度优先级算法计算任务优先 级, 再将任务放入对应的优先级队列中;
按照优先级队列元素出队列算法, 在所述优先级队列中选择当前要执行 的任务;
执行当前要执行的任务。
其中, 所述任务调度方法还包括: 在任务重试时, 按照任务规则算法计 算任务的重新启动时间。
本发明实施例的上述技术方案的有益效果如下:
本发明的上述实施例通过任务调用端模块发起任务调度请求; 服务接口 组件模块根据所述任务调度请求, 创建任务, 并在数据库中创建对应的调度 任务记录; 任务扫描组件模块对所述调度任务记录进行扫描, 按照任务调度 优先级算法计算任务优先级, 再将任务放入对应的优先级队列中; 任务队列 组件模块按照优先级队列元素出队列算法在所述优先级队列中选择当前要执 行的任务; 任务执行模块执行所述当前要执行的任务; 既简化了业务应用层 的处理逻辑, 提高了任务调度服务执行效率, 同时还增强了外部用户对不同 优先级任务调度服务的差别化体验。 附图概述
图 1为本发明实施例所述任务调度服务***的结构图;
图 2、 图 3、 图 4为本发明实施例所述任务调度实现方法的具体流程图; 图 5为本发明实施例所述任务调度方法的流程图。 本发明的较佳实施方式
下面将结合附图及具体实施例进行详细描述。
本发明针对现有的定时任务的调用都是基于业务应用层执行内部处理且 效率很低的问题, 提供一种任务调度服务***及方法。
如图 1所示, 本发明的实施例提供一种任务调度服务***, 包括: 任务调用端模块 101 , 用于发起任务调度请求;
服务接口组件模块 102 , 用于根据所述任务调度请求, 创建任务, 并在 数据库中创建对应的调度任务记录;
任务扫描组件模块 103 , 用于对所述调度任务记录进行扫描, 按照任务 调度优先级算法计算任务优先级, 再将任务放入对应的优先级队列中;
任务队列组件模块 104 , 用于按照优先级队列元素出队列算法在所述优 先级队列中选择当前要执行的任务;
任务执行模块 105 , 用于执行所述当前要执行的任务。
本发明的上述实施例通过任务调用端模块发起任务调度请求; 服务接口 组件模块根据所述任务调度请求, 创建任务, 并在数据库中创建对应的调度 任务记录; 任务扫描组件模块对所述调度任务记录进行扫描, 按照任务调度 优先级算法计算任务优先级, 再将任务放入对应的优先级队列中; 任务队列 组件模块按照优先级队列元素出队列算法在所述优先级队列中选择当前要执 行的任务; 任务执行模块执行所述当前要执行的任务; 不仅简化了业务应用 层的处理逻辑, 提高了任务调度服务执行效率, 同时还增强了外部用户对不 同优先级任务调度服务的差别化体验。
其中, 再如图 1所示, 本发明的上述任务调度服务***的实施例还可以 包括:
任务统计模块 106, 用于获取调度周期内的所述任务调用端模块发起的 任务调度请求总数以及所述任务执行模块执行成功的任务数和执行失败的任 务数。
WEB管理模块 107 , 用于配置任务的调度规则、 ***参数以及查询当前 任务的处理进度。 所述服务接口组件模块 102在创建任务时, 具体用于: 按照任务调度算 法为任务计算启动时间和分配任务号。
所述服务接口组件模块 102还用于: 接收所述任务执行模块 105的任务 执行结果报告、 响应所述任务执行模块 105对执行失败的任务进行任务重试 或进行任务的回执处理。
所述服务接口组件模块 102还用于: 在任务重试时, 按照任务调度规则 计算算法计算任务的重新启动时间。
所述任务调度规则计算算法, 具体是指: 创建任务时当前的***时间 + 最大启动延迟时长 * (大于新任务调度优先级的所有调度优先级的任务数比 例总和) 。
所述服务接口组件模块 102进行任务回执处理时, 具体用于: 根据任务 的信息向任务调用端模块 101返回任务回执信息。
所述服务接口组件模块 102还用于: 将执行结束的任务移动到历史表中 保存。
所述任务扫描组件模块 103还用于: 在扫描到超时和过期的任务时, 向 服务接口组件模块 102报告任务结果, 使所述服务接口组件模块 102对超时 和过期的任务进行任务重试或进行任务的回执处理。
所述任务队列组件模块 104还用于: 在启动任务发生异常时, 向服务接 口组件模块 102报告任务结果, 使所述服务接口组件模块 102对启动异常的 任务进行任务重试或进行任务的回执处理。
所述任务调度优先级算法, 具体是指: 新任务的任务类型对应的***级 优先级 * 2 +任务优先标志 + 1。
所述优先级队列元素出队列算法, 具体是指: 任务队列组件模块 104按 照各队列的调度优先级逐一从每个任务队列中取出任务处理, 先处理高优先 级队列中的任务, 在处理低优先级队列中的任务, 然后循环。
下面结合图 2 -图 4具体说明上述***是如何运行实现的。
如图 2所示,为本发明所述任务调度服务***的实现方法的具体流程图, 主要有以下步骤:
步骤 201 , WEB管理模块 107主要负责配置任务调度规则, 包括任务 的***级优先级、 禁止调度时间、 重试间隔和最大重试次数等参数; 步骤 202, 任务调用端模块 101向服务接口组件模块 102发送任务调度 请求, 请求消息中需指定当前调度任务的类型、 是否需要将调度结果回执等 字段, 调度任务启动时间字段可选;
步骤 203 , 服务接口组件模块 102在接收任务调度请求后, 根据任务调 度规则计算算法计算任务的启动时间, 并在数据库中创建对应的任务调度记 录; 其中, 需要根据统计周期内的各个调度优先级的任务计数器, 计算出各 个调度优先级的任务数占总任务数的比例。
步骤 204, 任务扫描组件 103根据任务调度优先级算法查询出满足任务 启动条件的任务, 扫描其任务调度记录, 并将任务调度记录放入对应的任务 优先级队列中; 其中, 例如, ***级优先级为 3种(0、 1、 2 ) , 每种任务类 型分为普通和紧急 2种优先级(0、 1 ) , 故整个***的最大调度优先级级别 数为 6, 但考虑到后续可能扩展***级优先级数, 故任务调度服务可配置其 支持的最大调度***级优先级个数, 缺省为 6。
步骤 205 , 任务队列组件模块 104按照优先级队列元素出队列算法, 将 优先级队列中符合要求的任务调出,并发送给任务执行模块 105执行;其中, 任务优先级队列元素出队列算法包括: 任务队列组件按照各队列的调度优先 级数逐一从每个任务队列取出任务处理, 先处理高优先级队列, 再处理低优 先级队列, 然后循环。 每轮循环中按照优先级值 6、 5、 4、 3、 2、 1从对应的 队列中取出元素;
步骤 206, 任务执行模块 105在接收任务调度执行请求后, 触发智能网 平台进行任务调度, 并将执行结果反馈给服务接口组件模块 102;
步骤 207 , 由服务接口组件模块 102判断调度是否成功, 若成功则进入 步骤 208; 若失败则进入步骤 209;
步骤 208, 由服务接口组件模块 102判断任务调度请求是否需要回执, 若需要回执,则进入步骤 210;若不需要则进入步骤 214,本次任务调度结束, 服务接口组件模块 102将调度任务导入到任务历史表中;
步骤 209, 由服务接口组件模块 102判断调度任务的重试次数是否已超 过最大重试次数, 若超过则回到步骤 208; 若不超过则进入步骤 212 , 由服务 接口组件模块 102计算任务重试启动时间, 供任务扫描组件模块 103扫描; 步骤 210,由服务接口组件模块 102判断回执执行结果给任务调用端 101 是否成功, 若成功则进入步骤 214, 本次任务调度结束, 服务接口组件模块
102将调度任务导入到任务历史表中; 若不成功则进入步骤 213 , 由服务接口 组件模块 102计算任务重试回执时间, 供任务扫描组件模块 103扫描。
如图 3所示, 向服务接口组件模块 102请求调度的任务在创建和执行的 过程中, 可以分为任务执行和任务回执两个阶段:
首先是服务接口组件模块 102在任务表里创建任务, 任务创建之后需要 等待执行;
在等待执行的过程中会出现三种情况:
调度启动成功则由任务执行模块 105执行任务;
由任务调用端 101主动取消任务;
等待执行且超时;
在执行任务阶段通常会有三种结果:
执行成功, 任务执行模块 105返回任务执行成功;
执行失败, 可分为: 任务执行模块 105返回任务执行失败; 任务队列组 件模块 104返回任务启动失败; 等待状态的任务超时;
正在执行超时;
任务表中的任务都需要回执, 在任务回执阶段通常会有四种情况: 等待回执, 回执失败但可重试;
回执成功;
回执失败,回执失败且不可重试,或者回执失败且已超过最大重试次数; 回执超时, 等待回执超时;
如图 4所示, 根据任务统计模块 106获取调度周期内的各个调度优先级 的任务计数器, 计算出各个调度优先级的任务数占总任务数的比例。 为避免 某个调度优先级不存在任务却占用延迟时间片, 因此本算法釆用根据每个调 度优先级的任务数占所有调度优先级的任务总数比例, 来计算每个调度优先 级的任务启动时间。
如图 5所示, 本发明的实施例还提供一种任务调度方法, 包括: 步骤 501 , 发起任务调度请求;
步骤 502 , 根据所述任务调度请求, 创建任务, 并在数据库中创建对应 的调度任务记录;
步骤 503 , 对所述调度任务记录进行扫描, 按照任务调度优先级算法计 算任务优先级, 再将任务放入对应的优先级队列中;
步骤 504按照优先级队列元素出队列算法, 在所述优先级队列中选择当 前要执行的任务;
步骤 505执行当前要执行的任务。
进一步的, 上述实施例还可以进一步包括:
步骤 506任务执行成功后 ,将执行结果回执给任务服务接口组件模块 102; 步骤 507服务接口组件模块 102将结束的任务移动到任务历史表中保存。 进一步地, 所述任务调度方法, 还包括: 在任务重试时, 服务接口组件 应按照任务规则算法计算任务的重新启动时间。
进一步地, 所述任务调度方法, 还包括: 对于结束且要求回执的任务, 服务接口组件应根据任务信息向任务调用端返回任务回执信息。
该方法的实施例是与上述***对应的实施例, 上述***实施例中所有实 现流程均适用于该方法的实施例, 也能达到相同的技术效果。
以上所述是本发明的优选实施方式, 应当指出, 对于本技术领域的普通 技术人员来说, 在不脱离本发明所述原理的前提下, 还可以作出若干改进和 润饰, 这些改进和润饰也应视为本发明的保护范围。
工业实用性
本发明实施例所述的任务调度服务***及方法是基于***分层构建的思 想, 由中间服务层负责与内部模块交互实现定时任务的调度。 具体来讲, 第 一, 对于外部用户而言, 任务的调度更加智能实时, 而且支持任务调度*** 模块的多个部署; 可以设置禁呼时段、 启呼延迟等功能; 还能使用户体验到 不同优先级任务调度服务的差异性。 第二, 对于厂商和内部工程部署维护而 言, ***的配置简单有效, 操作方便; 简化业务应用层处理逻辑, 提高了任 务调度服务执行效率; 实现参数配置的 WEB界面化, 方便管理员的管理维 护;釆用数据统计平台,对***用户量、性能和稳定性的统计更加清晰有据。 本发明的上述实施例不仅简化了业务应用层的处理逻辑, 提高了任务调度服 务执行效率, 同时还增强了外部用户对不同优先级任务调度服务的差别化体

Claims

权 利 要 求 书
1. 一种任务调度服务***, 包括:
任务调用端模块, 设置为: 发起任务调度请求;
服务接口组件模块, 设置为: 根据所述任务调度请求, 创建任务, 并在 数据库中创建对应的调度任务记录;
任务扫描组件模块, 设置为: 对所述调度任务记录进行扫描, 按照任务 调度优先级算法计算任务优先级, 再将任务放入对应的优先级队列中; 任务队列组件模块, 设置为: 按照优先级队列元素出队列算法在所述优 先级队列中选择当前要执行的任务;
任务执行模块, 设置为: 执行所述当前要执行的任务。
2. 根据权利要求 1所述的任务调度服务***, 其中, 还包括: 任务统计模块, 设置为: 获取调度周期内的所述任务调用端模块发起的 任务调度请求总数以及所述任务执行模块执行成功的任务数和执行失败的任 务数。
3. 根据权利要求 1所述的任务调度服务***, 其中, 还包括:
WEB管理模块,设置为: 配置任务的调度规则、 ***参数以及查询当前 任务的处理进度。
4. 根据权利要求 1所述的任务调度服务***, 其中, 所述服务接口组件 模块设置为: 在创建任务时, 按照任务调度算法为任务计算启动时间和分配 任务号。
5. 根据权利要求 1所述的任务调度服务***, 其中, 所述服务接口组件 模块还设置为: 接收所述任务执行模块的任务执行结果报告、 响应所述任务 执行模块对执行失败的任务进行任务重试或进行任务的回执处理。
6. 根据权利要求 5所述的任务调度服务***, 其中, 所述服务接口组件 模块还设置为: 在任务重试时, 按照任务调度规则计算算法计算任务的重新 启动时间。
7. 根据权利要求 6所述的任务调度服务***, 其中, 所述任务调度规则 计算算法, 包括: 创建任务时当前的***时间 +最大启动延迟时长 * (大于新任务调度优 先级的所有调度优先级的任务数比例总和) 。
8. 根据权利要求 5所述的任务调度服务***, 其中, 所述服务接口组件 模块设置为: 进行任务回执处理时, 根据任务的信息向任务调用端模块返回 任务回执信息。
9. 根据权利要求 1所述的任务调度服务***, 其中, 所述服务接口组件 模块还设置为: 将执行结束的任务移动到历史表中保存。
10. 根据权利要求 1所述的任务调度服务***, 其中, 所述任务扫描组 件模块还设置为: 在扫描到超时和过期的任务时, 向服务接口组件模块报告 任务结果, 使所述服务接口组件模块对超时和过期的任务进行任务重试或进 行任务的回执处理。
11. 根据权利要求 1所述的任务调度服务***, 其中, 所述任务队列组 件模块还设置为: 在启动任务发生异常时, 向服务接口组件模块报告任务结 果, 使所述服务接口组件模块对启动异常的任务进行任务重试或进行任务的 回执处理。
12. 根据权利要求 1所述的任务调度服务***, 其中, 所述任务调度优 先级算法, 包括:
新任务的任务类型对应的***级优先级 * 2 +任务优先标志 + 1。
13. 根据权利要求 1所述的任务调度服务***, 其中, 所述优先级队列 元素出队列算法, 包括:
任务队列组件模块按照各队列的调度优先级逐一从每个任务队列中取出 任务处理, 先处理高优先级队列中的任务, 再处理低优先级队列中的任务, 然后循环。
14. 一种任务调度方法, 包括:
发起任务调度请求;
根据所述任务调度请求, 创建任务, 并在数据库中创建对应的调度任务 记录;
对所述调度任务记录进行扫描, 按照任务调度优先级算法计算任务优先 级, 再将任务放入对应的优先级队列中; 按照优先级队列元素出队列算法, 在所述优先级队列中选择当前要执行 的任务;
执行当前要执行的任务。
15. 根据权利要求 14所述的任务调度方法, 其中, 还包括:
在任务重试时, 按照任务规则算法计算任务的重新启动时间。
PCT/CN2014/077702 2013-08-07 2014-05-16 一种任务调度服务***及方法 WO2014173339A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310342752.1A CN104346215A (zh) 2013-08-07 2013-08-07 一种任务调度服务***及方法
CN201310342752.1 2013-08-07

Publications (1)

Publication Number Publication Date
WO2014173339A1 true WO2014173339A1 (zh) 2014-10-30

Family

ID=51791069

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/077702 WO2014173339A1 (zh) 2013-08-07 2014-05-16 一种任务调度服务***及方法

Country Status (2)

Country Link
CN (1) CN104346215A (zh)
WO (1) WO2014173339A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106648845A (zh) * 2016-09-23 2017-05-10 努比亚技术有限公司 一种分布式任务调度***及方法
CN110309024A (zh) * 2019-04-23 2019-10-08 网宿科技股份有限公司 数据处理***及其执行数据处理任务的方法
CN110895488A (zh) * 2018-09-12 2020-03-20 北京奇虎科技有限公司 任务调度方法及装置
CN111240823A (zh) * 2020-01-16 2020-06-05 青岛农业大学 一种异地协同计算应用管理调度算法
CN111352728A (zh) * 2019-08-28 2020-06-30 北京大学(天津滨海)新一代信息技术研究院 一种数据服务集群的自适应调度方法
CN112667375A (zh) * 2020-12-22 2021-04-16 杭州东信北邮信息技术有限公司 一种基于大数据业务的任务调度方法及***
CN112764902A (zh) * 2021-01-21 2021-05-07 上海明略人工智能(集团)有限公司 任务调度方法及***
CN116109423A (zh) * 2023-04-11 2023-05-12 山东小数点信息技术有限公司 一种社会保险批量申报***及方法

Families Citing this family (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794077A (zh) * 2015-04-07 2015-07-22 无锡天脉聚源传媒科技有限公司 一种链表存储方法及***
CN106295927B (zh) * 2015-05-21 2022-07-05 北京京东尚科信息技术有限公司 给操作员分配任务的方法及装置
CN104915256B (zh) * 2015-06-05 2019-03-26 惠州Tcl移动通信有限公司 一种任务的实时调度实现方法及其***
CN106547635B (zh) * 2015-09-18 2020-10-09 阿里巴巴集团控股有限公司 一种作业的操作重试方法和装置
CN106557359B (zh) * 2015-09-30 2021-02-05 腾讯科技(深圳)有限公司 一种任务调度方法及***
CN106598705B (zh) * 2015-10-15 2020-08-11 菜鸟智能物流控股有限公司 一种异步任务的调度方法、装置、***以及电子设备
CN106570585B (zh) * 2016-05-25 2019-10-18 清华大学 一种面向自供能***的任务调度方法及能量管理装置
CN106407021A (zh) * 2016-07-01 2017-02-15 厦门易名科技股份有限公司 一种基于队列的业务请求处理方法
CN107688489B (zh) * 2016-08-03 2021-01-26 北京京东尚科信息技术有限公司 一种调度任务的方法和***
CN106790642A (zh) * 2017-01-10 2017-05-31 深圳淞鑫金融服务科技发展有限公司 大数据采集任务的调度方法及装置
CN108804209A (zh) * 2017-05-05 2018-11-13 中思博安科技(北京)有限公司 智能合约的调度方法及装置
CN109144683A (zh) * 2017-06-28 2019-01-04 北京京东尚科信息技术有限公司 任务处理方法、装置、***及电子设备
CN109388482A (zh) * 2017-08-11 2019-02-26 中兴通讯股份有限公司 任务的调度方法、装置及存储介质
CN107423918A (zh) * 2017-08-16 2017-12-01 广州环球梦电子商务股份有限公司 一种借卖平台商品任务调度方法和***
CN108255589A (zh) * 2017-08-29 2018-07-06 平安科技(深圳)有限公司 任务调度方法及服务器
CN107704323A (zh) * 2017-11-07 2018-02-16 广州探迹科技有限公司 一种网络爬虫任务调度方法及装置
CN109358956B (zh) * 2018-09-30 2021-03-16 上海保险交易所股份有限公司 服务调用方法
CN109669735B (zh) * 2018-12-07 2022-02-22 武汉斗鱼鱼乐网络科技有限公司 基于延时注册的应用启动方法、装置和存储介质
CN109783211A (zh) * 2018-12-14 2019-05-21 成都四方伟业软件股份有限公司 一种基于业务日志的批量任务调度***和调度方法
CN110109764A (zh) * 2019-05-15 2019-08-09 重庆天蓬网络有限公司 延时任务创建方法、装置、介质和电子设备
CN110362362A (zh) * 2019-07-24 2019-10-22 北京明略软件***有限公司 任务调度方法及装置、存储介质、电子装置
CN112130972A (zh) * 2020-08-24 2020-12-25 北京思特奇信息技术股份有限公司 一种任务处理的方法和***
CN112988428A (zh) * 2021-04-26 2021-06-18 南京蜂泰互联网科技有限公司 分布式消息异步通知中间件实现方法及***
CN113656157B (zh) * 2021-08-10 2024-04-23 北京锐安科技有限公司 一种分布式任务调度方法、装置、存储介质及电子设备
CN114625520B (zh) * 2022-05-16 2022-08-30 中博信息技术研究院有限公司 一种基于限流的分布式任务调度网关调度方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1536335A2 (en) * 2003-10-30 2005-06-01 Alcatel Intelligent scheduler for multi-level exhaustive scheduling of tasks
CN101510164A (zh) * 2009-03-25 2009-08-19 北京中星微电子有限公司 一种多业务调度方法、装置与***
CN101770402A (zh) * 2008-12-29 2010-07-07 ***通信集团公司 MapReduce***中的Map任务调度方法、设备及***
CN102096599A (zh) * 2009-12-14 2011-06-15 ***通信集团公司 一种多队列任务调度方法及相关***和设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100509794B1 (ko) * 2005-03-09 2005-08-23 주식회사 퓨전소프트 데이터베이스 관리시스템을 이용하는 작업들의 실시간 처리를 위한 스케줄링 방법
CN102196157B (zh) * 2010-03-02 2015-09-23 新奥特(北京)视频技术有限公司 一种电视台节目的发布***
CN102567106B (zh) * 2010-12-30 2014-10-01 ***通信集团云南有限公司 任务调度方法、***和装置
CN102122302B (zh) * 2011-03-11 2013-03-13 北京神舟航天软件技术有限公司 文档集中处理***及方法
CN103177035A (zh) * 2011-12-26 2013-06-26 ***股份有限公司 一种在数据库中查询数据的装置及方法
CN102880503B (zh) * 2012-08-24 2015-04-15 新浪网技术(中国)有限公司 数据分析***及数据分析方法
CN103197969B (zh) * 2013-03-27 2017-02-08 百度在线网络技术(北京)有限公司 一种分布式定时任务控制装置及方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1536335A2 (en) * 2003-10-30 2005-06-01 Alcatel Intelligent scheduler for multi-level exhaustive scheduling of tasks
CN101770402A (zh) * 2008-12-29 2010-07-07 ***通信集团公司 MapReduce***中的Map任务调度方法、设备及***
CN101510164A (zh) * 2009-03-25 2009-08-19 北京中星微电子有限公司 一种多业务调度方法、装置与***
CN102096599A (zh) * 2009-12-14 2011-06-15 ***通信集团公司 一种多队列任务调度方法及相关***和设备

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106648845A (zh) * 2016-09-23 2017-05-10 努比亚技术有限公司 一种分布式任务调度***及方法
CN110895488A (zh) * 2018-09-12 2020-03-20 北京奇虎科技有限公司 任务调度方法及装置
CN110895488B (zh) * 2018-09-12 2023-10-20 三六零科技集团有限公司 任务调度方法及装置
CN110309024B (zh) * 2019-04-23 2023-07-18 网宿科技股份有限公司 数据处理***及其执行数据处理任务的方法
CN110309024A (zh) * 2019-04-23 2019-10-08 网宿科技股份有限公司 数据处理***及其执行数据处理任务的方法
CN111352728A (zh) * 2019-08-28 2020-06-30 北京大学(天津滨海)新一代信息技术研究院 一种数据服务集群的自适应调度方法
CN111352728B (zh) * 2019-08-28 2023-10-03 北京大学(天津滨海)新一代信息技术研究院 一种数据服务集群的自适应调度方法
CN111240823A (zh) * 2020-01-16 2020-06-05 青岛农业大学 一种异地协同计算应用管理调度算法
CN112667375A (zh) * 2020-12-22 2021-04-16 杭州东信北邮信息技术有限公司 一种基于大数据业务的任务调度方法及***
CN112764902A (zh) * 2021-01-21 2021-05-07 上海明略人工智能(集团)有限公司 任务调度方法及***
CN112764902B (zh) * 2021-01-21 2024-03-29 上海明略人工智能(集团)有限公司 任务调度方法及***
CN116109423A (zh) * 2023-04-11 2023-05-12 山东小数点信息技术有限公司 一种社会保险批量申报***及方法
CN116109423B (zh) * 2023-04-11 2024-04-12 山东小数点信息技术有限公司 一种社会保险批量申报***及方法

Also Published As

Publication number Publication date
CN104346215A (zh) 2015-02-11

Similar Documents

Publication Publication Date Title
WO2014173339A1 (zh) 一种任务调度服务***及方法
CN106293950B (zh) 一种面向集群***的资源优化管理方法
CN106815066B (zh) 一种定时任务调度方法、装置及***
CN106293919A (zh) 一种时间触发的嵌入式任务调度装置与方法
CN103458131B (zh) 坐席登录、调度的方法及坐席中心
CN101102360B (zh) 一种自动回单方法
WO2012037760A1 (zh) 提升告警处理效率的方法、服务器及***
CN107491346A (zh) 一种应用的任务处理方法、装置及***
CN104954411A (zh) 分布式***共享网络资源的方法、终端及***
CN113535362B (zh) 一种分布式调度***架构和微服务工作流调度方法
CN106502767A (zh) 一种进程管理方法及其装置
CN112667383B (zh) 一种任务执行及调度方法、***、装置、计算设备及介质
CN105389207A (zh) 自适应数据请求处理方法、装置、任务调度器及***
CN107066339A (zh) 分布式作业管理器及分布式作业管理方法
CN102023899B (zh) 多线程数据同步方法及装置
WO2014173366A2 (zh) 一种实现电信能力群发的方法、装置及***
WO2016149945A1 (zh) 一种生命周期事件的处理方法及vnfm
CN101867647A (zh) 一种移动终端中并发冲突的处理方法及装置
CN100525211C (zh) 一种在网元管理***中实现集中调度的***
CN102573073B (zh) 一种终端物理层资源分配方法及***
CN105320563A (zh) 一种进程调度优化方法
WO2012174838A1 (zh) 一种网元消息并发处理方法及***
CN110377411B (zh) 一种面向分布式云的工作流任务调度方法和***
CN115391058B (zh) 一种基于sdn的资源事件处理方法、资源创建方法及***
Du et al. Research on service bus for distributed real-time control systems

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: 14788655

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: 14788655

Country of ref document: EP

Kind code of ref document: A1