WO2011137672A1 - Method and device for task execution based on database - Google Patents

Method and device for task execution based on database Download PDF

Info

Publication number
WO2011137672A1
WO2011137672A1 PCT/CN2011/070456 CN2011070456W WO2011137672A1 WO 2011137672 A1 WO2011137672 A1 WO 2011137672A1 CN 2011070456 W CN2011070456 W CN 2011070456W WO 2011137672 A1 WO2011137672 A1 WO 2011137672A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
database connection
acquired
executed
execution
Prior art date
Application number
PCT/CN2011/070456
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 WO2011137672A1 publication Critical patent/WO2011137672A1/en

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention discloses a method and device for task execution based on database. The method includes: adding a database connection; obtaining a task to be executed from a task group by the database connection; and judging whether a foreground task of the obtained task is executed successfully. The obtained task is executed by the database connection, if the foreground task of the obtained task is executed successfully. The task to be executed is continuously obtained from the task group by the database connection, if the foreground task of the obtained task is not executed successfully. The present invention allows dynamic control over concurrency of data processing.

Description

基于数据库的任务执行方法^置 技术领域 本发明涉及通信领域, 具体而言, 涉及一种基于数据库的任务执行方法 及装置。 背景技术 在应用软件开发过程中, 常常用到关系型数据库以便存储和处理数据。 在相关技术中, 通常在数据库的一个数据库连接中串行执行各个数据处理的 任务, 这种处理方式执行任务效率低, 并且当任务处理发生错误时, 需要全 部重新执行, 也不能从错误发生处恢复执行。 为此, 相关技术中提出了一种多个数据库任务并行执行的方法, 其将数 据处理的任务划分到不同分组内, 归属于不同分组的任务之间并行执行, 各 分组中的任务相互独立, 从而减少了任务之间的依赖性, 缩短了执行任务所 需的时间。 但是, 这种方法存在以下不足: 该方法中组和组之间实现了并行执行, 但组内子任务仍是串行执行, 不能实现具有复杂的执行依赖关系的任务的执 行, 例如, 若某个任务 C的前置任务是并行的两个任务 A和任务 B, 则该方 法不能实现 A任务和 B任务并行执行后, 再执行 C任务的数据处理的情况; 另外, 这种方法预先进行分组, 每组执行任务的执行顺序固定, 且分组的数 量固定, 也就是说, 数据处理的并发度是固定的, 不能随硬件资源而动态调 整。 发明内容 本发明的主要目的在于提供一种基于数据库的任务执行方法及装置, 以 至少解决上述问题。 根据本发明的一个方面,提供了一种基于数据库的任务执行方法, 包括: 加入数据库连接; 数据库连接从任务组中获取待执行的任务; 以及判断获取 的任务的前置任务是否全部执行成功, 若是, 则数据库连接执行获取的任务, 若不是, 数据库连接继续从任务组中获取待执行的任务。 优选地, 数据库连接从任务组中获取待执行的任务包括: 数据库连接对 任务组的查询操作类型的记录行加锁; 数据库连接获取到满足预定条件的任 务, 其中, 预定条件包括: 获取的任务的执行结果状态为初始化或重新打开; 数据库连接将获取的任务的执行结果状态设置为选中; 数据库连接对查询操 作类型的记录行解锁。 优选地, 判断获取的任务的前置任务未全部执行成功之后, 还包括: 数 据库连接将获取的任务的执行结果状态置为重新打开。 优选地, 将获取的任务的执行结果状态置为重新打开的同时, 还将获取 的任务加入前置任务临时表, 预定条件还包括获取的任务不在前置任务临时 表中。 优选地, 执行获取的任务包括: 数据库连接将获取的任务的执行结果状 态置为运行, 并执行获取的任务的运行指令。 优选地, 在执行获取的任务的运行指令成功的情况下, 还包括: 数据库 连接对任务组的删除操作类型的记录行加锁; 数据库连接将获取的任务的执 行结果状态置为成功, 并删除前置任务临时表中的任务; 数据库连接对任务 组的删除操作类型的记录行解锁。 优选地, 在执行获取的任务的运行指令失败的情况下, 还包括: 数据库 连接将获取的任务的执行结果状态置为失败, 并将获取的任务的后置任务的 执行结果状态置为依赖性失败。 优选地, 在数据库连接从当前任务组中获取待执行的任务失败, 或者, 执行获取的任务之后, 还包括: 判断执行成功的任务数量和执行失败的任务 数量之和是否等于任务组中的任务总数,或者, 判断用户是否发出停止指令, 若是, 则停止执行, 若不是, 返回从任务组中获取待执行的任务的步骤。 优选地, 数据库连接从当前任务组中获取待执行的任务失败包括: 数据 库连接接收到用于指示加锁等待超时的通知; 或者, 数据库连接接收到用于 指示任务组中不存在待执行的任务的通知。 优选地, 判断获取的任务的前置任务是否全部执行成功包括: 根据预先 设置的任务组中任务之间的依赖关系确定获取的任务的前置任务; 判断前置 任务是否全部执行成功。 根据本发明的另一个方面, 提供了一种基于数据库的任务执行装置, 包 括: 加入模块, 设置为加入数据库连接; 获取模块, 设置为从任务组中获取 待执行的任务; 判断模块, 设置为判断获取的任务的前置任务是否全部执行 成功; 调度模块, 设置为在判断模块的判断结果为是的情况下, 调度执行模 块, 在判断模块的判断结果为否的情况下, 调度获取模块; 执行模块, 设置 为执行获取的任务。 通过本发明, 釆用加入的数据库连接从任务组中获取待执行的任务, 并 判断该任务的前置任务是否全部执行成功, 若是, 则执行所述获取的任务, 若不是, 继续从任务组中获取待执行的任务, 解决了相关技术中数据处理并 发度固定导致处理灵活度低的问题, 能够动态控制数据处理的并发度。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部 分, 本发明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的 不当限定。 在附图中: 图 1是根据本发明实施例的基于数据库的任务执行方法的流程图; 图 2是根据本发明实施例的基于数据库的任务执行装置的结构框图; 图 3是根据本发明实施例 1的用于实现基于数据库的任务执行方法的装 置的详细结构框图; 图 4是根据本发明实施例 2的执行模块中各子模块的执行过程的流程 图; 图 5是才艮据本发明实施例 4的具有网状依赖关系的任务的组成结构示意 图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在 不冲突的情况下, 本申请中的实施例及实施例中的特征可以相互组合。 图 1是根据本发明实施例的基于数据库的任务执行方法的流程图, 如图 1所示, 该方法包括以下步 4聚: 步骤 S 102, 加入数据库连接; 步骤 S 104 , 该数据库连接从任务组中获取待执行的任务; 以及 步骤 S 106, 判断获取的任务的前置任务是否全部执行成功, 若是, 则该 数据库连接执行获取的任务, 若不是, 该数据库连接继续从任务组中获取待 执行的任务。 相关技术中, 釆用预先将待执行的任务分组, 在组内通过串行方式执行 该组中的任务, 不同组之间的任务并行执行的方式, 实现了数据的并发处理, 但是, 该方法需要预先规定并发连接数量, 无法实现灵活配置, 而且无法支 持对混合关系的任务的执行。 本发明实施例提供的方法中, 新加入的数据库 连接首先获取待执行的任务, 再根据对前置任务是否全部执行成功的判断结 果, 决定后续处理。 该方法中, 数据库连接可以在任何时候加入, 即, 在数 据处理的过程中, 随时可以加入用于处理任务的线程, 支持数据库连接的动 态增加或减少, 从而动态地调整数据处理的并发度。 另外, 通过判断前置任 务是否全部执行成功, 保证了混合关系任务的执行逻辑, 能够实现网状依赖 关系的数据计算。 优选地, 步骤 S 104可以包括: 步骤 S 1042, 数据库连接对任务组的查询操作类型的记录行加锁; 步骤 S 1044, 数据库连接获取到满足预定条件的任务, 其中, 预定条件 包括: 获取的任务的执行结果状态为初始化或重新打开; 步骤 S 1046, 数据库连接将获取的任务的执行结果状态设置为选中; 步骤 S 1048, 数据库连接对查询操作类型的记录行解锁。 通过该方法, 能够保证一个待执行的任务在同一时刻仅被一个数据库连 接获取, 防止不同的数据库连接获取到相同的任务所导致的执行混乱, 保证 了系统的健壮性。 优选地, 判断获取的任务的前置任务未全部执行成功之后, 还包括: 数 据库连接将获取的任务的执行结果状态置为重新打开。 通过该方法, 能够保 证后续的数据库连接 (可能为该数据库连接本身) 获取到该任务。 优选地, 将获取的任务的执行结果状态置为重新打开的同时, 还将获取 的任务加入前置任务临时表, 预定条件还包括获取的任务不在前置任务临时 表中。 通过该方法的设定, 能够防止该数据库连接反复抓取同一个前置任务 未全部执行成功的任务, 最终导致该数据库连接在一段时间内进入无意义的 循环状态的情况, 提高了数据库连接的处理效率。 优选地, 执行获取的任务的过程包括: 数据库连接将获取的任务的执行 结果状态置为运行, 并执行获取的任务的运行指令。 通过将该任务的执行结 果状态置为运行, 可以保证该任务在运行过程中不会被其他的数据库连接抓 取到, 保证了系统的健壮性。 优选地, 在执行获取的任务的运行指令成功的情况下, 还包括: 数据库 连接对任务组的删除操作类型的记录行加锁; 数据库连接将获取的任务的执 行结果状态置为成功, 并删除前置任务临时表中的任务; 数据库连接对任务 组的删除操作类型的记录行解锁。 通过在执行成功的情况下, 删除前置任务 临时表中的任务, 保证了数据库连接能够继续尝试抓取之前抓取又释放的任 务(该任务的前置任务在当时未全部执行成功), 提高了系统的运行效率, 并 且, 通过删除锁的机制, 防止多个数据库连接同时执行删除操作, 保证了系 统的健壮性。 优选地, 在执行获取的任务的运行指令失败的情况下, 还包括: 数据库 连接将获取的任务的执行结果状态置为失败, 并将获取的任务的后置任务的 执行结果状态置为依赖性失败。 通过设置当前获取的任务以及其后置任务的 执行状态, 能够防止以上任务被再次抓取到,在任务无法执行成功的情况下, 防止浪费系统的资源, 同时, 能够标识出现失败的任务, 以便后续从该失败 任务处继续执行, 提高了系统的运行效率。 优选地, 在数据库连接从当前任务组中获取待执行的任务失败, 或者, 执行获取的任务之后, 还包括: 判断执行成功的任务数量和执行失败的任务 数量之和是否等于任务组中的任务总数,或者, 判断用户是否发出停止指令, 若是, 则停止执行, 若不是, 返回从任务组中获取待执行的任务的步骤。 该 方法能够自动判断是否停止执行,或者根据用户的指令来确定是否停止执行, 提高了系统的可控性。 优选地, 数据库连接从当前任务组中获取待执行的任务失败包括: 数据 库连接接收到用于指示加锁等待超时的通知; 或者, 数据库连接接收到用于 指示任务组中不存在待执行的任务的通知。 在数据库连接加锁等待超时或任 务组中不存在需要执行的任务的时候, 判断是否需要停止执行, 能够防止系 统资源的浪费。 优选地, 判断获取的任务的前置任务是否全部执行成功包括: 根据预先 设置的任务组中任务之间的依赖关系确定获取的任务的前置任务; 判断前置 任务是否全部执行成功。 通过该方法, 依照任务之间的关系来执行任务, 能 够实现串行关系、 并行关系以及串行和并行混合关系的任务的执行。 图 2是根据本发明实施例的基于数据库的任务执行装置的结构框图, 该 装置包括: 加入模块 21 , 设置为加入数据库连接; 获取模块 22 , 设置为从 任务组中获取待执行的任务; 判断模块 23 , 设置为判断获取的任务的前置任 务是否全部执行成功; 调度模块 24 , 设置为在判断模块 23的判断结果为是 的情况下, 调度执行模块 25 , 在判断模块 23的判断结果为否的情况下, 调 度获取模块 22 ; 执行模块 25 , 设置为执行获取的任务。 相关技术中需要预先规定并发连接数量, 无法实现灵活配置, 而且无法 支持对混合关系的任务的执行。 本发明实施例提供的装置中, 新加入的数据 库连接首先执行获取模块 22 , 获取待执行的任务, 再根据判断模块 23进行 的前置任务是否全部执行成功的判断结果, 决定后续处理。 数据库连接可以 在任何时候加入, 即, 在数据处理的过程中, 随时可以加入用于处理任务的 线程, 支持数据库连接的动态增加或减少, 从而动态地调整数据处理的并发 度。 另外, 通过判断模块 23判断前置任务是否全部执行成功, 保证了混合 关系任务的执行逻辑, 能够实现网状依赖关系的数据计算。 下面描述的实施例 1-4 , 综合了上述多个优选实施例的技术方案。 实施例 1 图 3是根据本发明实施例 1的用于实现基于数据库的任务执行方法的装 置的详细结构框图, 如图 3所示, 该装置包括: 输入模块、 执行模块和输出 模块三部分, 其中: The present invention relates to the field of communications, and in particular to a database-based task execution method and apparatus. BACKGROUND OF THE INVENTION In application software development processes, relational databases are often used to store and process data. In the related art, each data processing task is usually performed serially in a database connection of a database. This processing method performs task inefficiently, and when the task processing error occurs, it needs to be completely re-executed, and cannot be from the occurrence of an error. Resume execution. To this end, a related method for parallel execution of multiple database tasks is proposed in the related art, which divides the tasks of data processing into different groups, and tasks belonging to different groups are executed in parallel, and tasks in each group are independent of each other. This reduces the dependency between tasks and shortens the time required to perform tasks. However, this method has the following disadvantages: In this method, parallel execution is implemented between groups and groups, but sub-tasks in the group are still serially executed, and execution of tasks with complex execution dependencies cannot be implemented, for example, if The predecessor task of task C is two tasks A and B in parallel, and the method cannot implement the data processing of the C task after the parallel execution of the A task and the B task; in addition, the method is grouped in advance. The execution order of each group of execution tasks is fixed, and the number of groups is fixed. That is to say, the degree of concurrency of data processing is fixed and cannot be dynamically adjusted with hardware resources. SUMMARY OF THE INVENTION A primary object of the present invention is to provide a database-based task execution method and apparatus to solve at least the above problems. According to an aspect of the present invention, a database-based task execution method is provided, including: joining a database connection; obtaining a task to be executed from a task group; and determining whether the pre-task of the acquired task is all successfully executed, If so, the database connection performs the acquired task. If not, the database connection continues to obtain the task to be executed from the task group. Preferably, the database connection obtains the task to be executed from the task group, including: the database connection locks the record row of the query operation type of the task group; the database connection acquires the task that meets the predetermined condition, wherein the predetermined condition includes: the acquired task The execution result status is initialized or reopened; the database connection sets the execution result status of the acquired task to selected; the database connection unlocks the record line of the query operation type. Preferably, after determining that the pre-task of the acquired task is not all successfully executed, the method further includes: the database connection sets the execution result status of the acquired task to be re-opened. Preferably, when the execution result status of the acquired task is set to be re-opened, the acquired task is added to the pre-task temporary table, and the predetermined condition further includes that the acquired task is not in the pre-task temporary table. Preferably, the performing the obtaining task comprises: the database connection setting the execution result status of the acquired task to run, and executing the running instruction of the acquired task. Preferably, in the case that the running instruction of the executed task is successful, the method further includes: the database connection locks the record line of the deletion operation type of the task group; the database connection sets the execution result status of the acquired task to be successful, and deletes The task in the pre-task temporary table; the database connection unlocks the record line of the delete operation type of the task group. Preferably, in the case that the running instruction of the executed task fails, the method further includes: the database connection sets the execution result status of the acquired task to a failure, and sets the execution result status of the acquired task's post task to a dependency. failure. Preferably, after the database connection obtains the task to be executed from the current task group, or after performing the acquired task, the method further includes: determining whether the sum of the number of successfully executed tasks and the number of failed tasks is equal to the task in the task group. The total number, or, determines whether the user issues a stop command, and if so, stops execution, and if not, returns the step of obtaining the task to be executed from the task group. Preferably, the database connection obtaining the task to be executed from the current task group fails includes: the database connection receiving the notification for indicating the lock waiting timeout; or the database connection receiving the task for indicating that there is no pending task in the task group announcement of. Preferably, determining whether the pre-task of the acquired task is all successfully executed comprises: determining a pre-task of the acquired task according to a dependency relationship between the tasks in the pre-set task group; determining whether the pre-task task is all successfully executed. According to another aspect of the present invention, a database-based task execution apparatus is provided, including: an adding module, configured to join a database connection; an obtaining module, configured to obtain a task to be executed from the task group; and a determining module, being set to Determining whether the pre-task of the acquired task is all successfully executed; the scheduling module is configured to: when the judgment result of the judging module is yes, scheduling the execution module, and if the judgment result of the judging module is no, scheduling the acquisition module; Execution module, set to perform the acquired task. According to the present invention, the task to be executed is obtained from the task group by using the added database connection, and it is determined whether the pre-task of the task is all executed successfully. If yes, the acquired task is executed, and if not, the task group is continued. Obtaining the task to be executed solves the problem that the data processing concurrency is fixed in the related art, resulting in low processing flexibility, and can dynamically control the concurrency of data processing. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set to illustrate,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, In the drawings: FIG. 1 is a flowchart of a database-based task execution method according to an embodiment of the present invention; FIG. 2 is a structural block diagram of a database-based task execution apparatus according to an embodiment of the present invention; A detailed structural block diagram of an apparatus for implementing a database-based task execution method of Example 1; FIG. 4 is a flowchart of an execution process of each sub-module in an execution module according to Embodiment 2 of the present invention; A schematic diagram of the composition of a task having a network dependency relationship of Embodiment 4. BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, the present invention will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. FIG. 1 is a flowchart of a database-based task execution method according to an embodiment of the present invention. As shown in FIG. 1, the method includes the following steps: Step S102, adding a database connection; step S104, the database connection acquires a task to be executed from the task group; and step S106, determining whether the pre-task of the acquired task is all executed successfully, and if so, the database connection is executed. The acquired task, if not, the database connection continues to get the task to be executed from the task group. In the related art, the tasks to be executed are grouped in advance, the tasks in the group are performed in a serial manner in the group, and the tasks in different groups are executed in parallel, thereby realizing concurrent processing of data, but the method The number of concurrent connections needs to be pre-defined, flexible configuration is not possible, and the execution of tasks for mixed relationships cannot be supported. In the method provided by the embodiment of the present invention, the newly added database connection first obtains the task to be executed, and then determines the subsequent processing according to whether the pre-task is successfully executed. In this method, the database connection can be added at any time, that is, in the process of data processing, the thread for processing the task can be added at any time, and the dynamic increase or decrease of the database connection is supported, thereby dynamically adjusting the concurrency of the data processing. In addition, by judging whether the pre-tasks are all executed successfully, the execution logic of the hybrid relationship task is ensured, and the data calculation of the mesh dependency relationship can be realized. Preferably, the step S104 may include: Step S1042, the database connection locks the record row of the query operation type of the task group; Step S1044, the database connection acquires a task that satisfies the predetermined condition, wherein the predetermined condition includes: The execution result status of the task is initialized or reopened; in step S1046, the database connection sets the execution result status of the acquired task to selected; in step S1048, the database connection unlocks the record line of the query operation type. With this method, it is ensured that a task to be executed is acquired by only one database connection at the same time, preventing execution confusion caused by different database connections to obtain the same task, and ensuring the robustness of the system. Preferably, after determining that the pre-task of the acquired task is not all successfully executed, the method further includes: the database connection sets the execution result status of the acquired task to be re-opened. With this method, it is possible to ensure that subsequent database connections (possibly for the database connection itself) get the task. Preferably, when the execution result status of the acquired task is set to be re-opened, the acquired task is added to the pre-task temporary table, and the predetermined condition further includes that the acquired task is not in the pre-task temporary table. By setting the method, the database connection can be prevented from repeatedly capturing tasks that are not successfully executed by the same predecessor task, and finally the database connection enters a meaningless loop state for a period of time, thereby improving the database connection. Processing efficiency. Preferably, the process of executing the acquired task includes: the database connection sets the execution result state of the acquired task to run, and executes the running instruction of the acquired task. By setting the execution result status of the task to run, it can be guaranteed that the task will not be captured by other database connections during the running process, which ensures the robustness of the system. Preferably, in the case that the running instruction of the executed task is successful, the method further includes: the database connection locks the record line of the deletion operation type of the task group; the database connection sets the execution result status of the acquired task to be successful, and deletes The task in the pre-task temporary table; the database connection unlocks the record line of the delete operation type of the task group. By deleting the tasks in the pre-task temporary table in the case of successful execution, it is guaranteed that the database connection can continue to try to grab the previously grabbed and released tasks (the pre-task of the task was not fully executed at the time), improve The operating efficiency of the system, and the mechanism of deleting the lock, prevents multiple database connections from simultaneously performing the delete operation, and ensures the robustness of the system. Preferably, in the case that the running instruction of the executed task fails, the method further includes: the database connection sets the execution result status of the acquired task to a failure, and sets the execution result status of the acquired task's post task to a dependency. failure. By setting the currently acquired task and the execution status of its post task, it is possible to prevent the above task from being crawled again, to prevent wasting system resources if the task cannot be successfully executed, and at the same time, to identify the failed task, so that Subsequent execution from the failed task improves the efficiency of the system. Preferably, after the database connection obtains the task to be executed from the current task group, or after performing the acquired task, the method further includes: determining whether the sum of the number of successfully executed tasks and the number of failed tasks is equal to the task in the task group. The total number, or, determines whether the user issues a stop command, and if so, stops execution, and if not, returns the step of obtaining the task to be executed from the task group. The method can automatically determine whether to stop execution, or determine whether to stop execution according to the user's instruction, thereby improving the controllability of the system. Preferably, the failure of the database connection to obtain the task to be executed from the current task group comprises: the database connection receiving the notification for indicating the lock waiting timeout; or the database connection is received for Indicates that there are no notifications for the task to be executed in the task group. When the database connection lock wait timeout or there is no task to be executed in the task group, it is determined whether it is necessary to stop execution, which can prevent waste of system resources. Preferably, determining whether the pre-task of the acquired task is all successfully executed comprises: determining a pre-task of the acquired task according to a dependency relationship between the tasks in the pre-set task group; determining whether the pre-task task is all successfully executed. By this method, tasks are executed in accordance with the relationship between tasks, and the execution of tasks of serial relationships, parallel relationships, and serial and parallel mixed relationships can be realized. 2 is a structural block diagram of a database-based task execution apparatus according to an embodiment of the present invention. The apparatus includes: an adding module 21 configured to join a database connection; an obtaining module 22 configured to obtain a task to be executed from the task group; The module 23 is configured to determine whether the pre-task of the acquired task is all successfully executed. The scheduling module 24 is configured to, when the judgment result of the judging module 23 is YES, the scheduling execution module 25, and the judgment result of the judging module 23 is In the case of no, the scheduling acquisition module 22; the execution module 25 is set to perform the acquired task. In the related art, it is necessary to pre-specify the number of concurrent connections, which cannot implement flexible configuration, and cannot support the execution of tasks of mixed relationships. In the device provided by the embodiment of the present invention, the newly added database connection first executes the obtaining module 22, obtains the task to be executed, and determines the subsequent processing according to whether the pre-task task performed by the determining module 23 is all successfully executed. The database connection can be added at any time, that is, in the process of data processing, the thread for processing the task can be added at any time, and the dynamic increase or decrease of the database connection is supported, thereby dynamically adjusting the concurrency of the data processing. In addition, the judging module 23 judges whether all the pre-tasks are successfully executed, ensures the execution logic of the hybrid relationship task, and can implement data calculation of the mesh dependency relationship. The embodiments 1-4 described below combine the technical solutions of the above-described plurality of preferred embodiments. Embodiment 1 FIG. 3 is a detailed structural block diagram of an apparatus for implementing a database-based task execution method according to Embodiment 1 of the present invention. As shown in FIG. 3, the apparatus includes: an input module, an execution module, and an output module. among them:
( 1 ) 输入模块, 设置为接受将执行任务数据输入到任务表, 将任务依 赖关系数据输入到任务关系表,以及将加锁用途数据输入到任务锁表的操作。 优选地, 输入模块还可以用于产生一个任务组, 指定一个任务组标签, 以任 务组标签作为组标识以实现混合执行的数据隔离。 具体地, 执行任务数据包含序号、 任务组、 任务名、 任务执行指令、 执 行结果状态等; 任务依赖数据包含序号、 前置任务名、 后续任务名、 任务组 的信息数据等; 任务锁数据包含序号、 锁名、 锁类型、 任务组的信息数据等。 输入模块为每个任务组产生增加、 删除、 修改、 查询操作类型的四行记录。 需要说明的是, 在包含混合关系类型的任务的情况下, 任务依赖数据包 含的前置任务名可能有多个。 (1) The input module is set to accept the input of the execution task data into the task table, the input of the task dependency data into the task relationship table, and the input of the lock usage data into the task lock table. Preferably, the input module is further configured to generate a task group, specify a task group label, and use the task group label as the group identifier to implement data isolation of the hybrid execution. Specifically, the execution task data includes a sequence number, a task group, a task name, a task execution instruction, an execution result status, and the like; the task dependency data includes a sequence number, a pre-task name, a subsequent task name, information data of the task group, and the like; the task lock data includes Serial number, lock name, lock type, information data of task group, etc. The input module generates four rows of records for each task group to add, delete, modify, and query operation types. It should be noted that, in the case of a task containing a mixed relationship type, the task dependency data may have multiple predecessor names.
( 2 ) 执行模块, 设置为按照任务依赖关系数据, 实现多个数据库连接 混合执行多个任务。 具体地, 图 4是根据本发明实施例 2的执行模块中各子 模块的执行过程的流程图, 如图 4所示, 该模块包含了四个子模块, 分别为 任务获取子模块、 依赖控制子模块、 执行任务子模块、 退出控制子模块。 执行模块中,一个数据库连接先执行任务获取子模块获得一个执行任务, 然后执行依赖控制子模块, 分析获得任务的执行依赖关系, 分析该任务是否 可以执行, 若可以执行, 再执行执行任务子模块, 获得任务运行指令, 执行 任务运行指令; 最后执行退出控制子模块, 分析一个数据库连接是否能退出 执行模块, 不再做执行。 (2) Execution module, set to perform multiple database connections according to task dependency data, and perform multiple tasks. Specifically, FIG. 4 is a flowchart of an execution process of each submodule in an execution module according to Embodiment 2 of the present invention. As shown in FIG. 4, the module includes four submodules, namely, a task acquisition submodule and a dependency control subroutine. Module, Execute Task Submodule, Exit Control Submodule. In the execution module, a database connection first executes the task to obtain the sub-module to obtain an execution task, and then executes the dependency control sub-module, analyzes and obtains the execution dependency of the task, analyzes whether the task can be executed, and if executed, executes the execution task sub-module. , obtain the task running instruction, execute the task running instruction; finally execute the exit control sub-module, analyze whether a database connection can exit the execution module, and no longer perform execution.
( 3 ) 输出模块, 设置为输出任务执行结果和任务节点展现、 节点布局 数据等。 在该基于数据库的任务执行装置中, 先执行输入模块, 以便输入任务数 据和任务依赖关系数据; 然后启动多个数据库连接; 每个数据库连接执行模 块的一个函数, 完成各个任务的执行, 以便根据依赖关系实现混合执行; 最 后执行输出模块, 输出任务执行结果和任务节点展现、 节点布局数据等。 实施例 2 以下结合实施例 1中提供的基于数据库的任务执行装置的结构描述基于 数据库的任务执行方法, 该方法包括以下步骤: 步骤 1 , 一个数据库连接执行输入模块, 该输入模块生成一个任务组, 接受执行任务、 任务关系数据的输入, 并给每个任务组产生用于加锁的四行 ΐ己录。 步骤 2, —个数据库连接执行模块, 具体地, 如图 4所示, 按照以下的 顺序执行执行模块中的各子模块: 1 ) 一个数据库连接对任务组的查询操作类型的记录行整行加锁; (3) Output module, set to output task execution result and task node presentation, node layout data, and so on. In the database-based task execution apparatus, an input module is first executed to input task data and task dependency data; and then multiple database connections are started; each database is connected to a function of the execution module to complete execution of each task, so as to Dependencies implement hybrid execution; finally execute the output module, output task execution results and task node presentation, node layout data, and so on. Embodiment 2 The following describes a database-based task execution method in conjunction with the structure of the database-based task execution apparatus provided in Embodiment 1, the method comprising the following steps: Step 1: A database connection execution input module, the input module generates a task group , accept the input of the task, the task relationship data, and generate a four-line record for each task group. Step 2, a database connection execution module, specifically, as shown in FIG. 4, each sub-module in the execution module is executed in the following order: 1) A database connection locks the entire row of the record row of the query operation type of the task group;
2 ) 一个数据库连接从该任务组的执行任务数据中取得一个没有执行的 任务, 该任务是满足运行错误代码等于 -1 , 错误次数小于 5次(可配置), 任 务执行结果状态是初始化和重新打开, 且不在前置任务临时表中的任务; 当 没有执行任务时, 返回一个" NOTASK (即, 无任务) "标签的任务, 当加锁 等待超时, 返回一个" TIMEOUT (即, 超时) ,,标签的任务; 2) A database connection obtains an unexecuted task from the task group's execution task data, the task is to satisfy the running error code equal to -1, the error number is less than 5 times (configurable), and the task execution result status is initialized and re A task that is open, and not in the predecessor task temporary table; when no task is executed, returns a task of "NOTASK (ie, no task)" tag, when the lock waits for a timeout, returns a "TIMEOUT (ie, timeout), , the task of the label;
3 ) 该数据库连接对该任务组的查询操作标签的记录行解锁; 3) The database connection unlocks the record line of the query operation tag of the task group;
4 ) 若步骤 2 ) 中数据库连接得到一个执行任务, 则直接进入步骤 5 ) 执行依赖控制子模块; 若步骤 2 ) 中数据库连接获取到的是" NOTASK"标签 的任务或" TIMEOUT"标签的任务,则直接转入步骤 9 )执行退出控制子模块; 4) If the database connection in step 2) gets an execution task, go directly to step 5) Execute the dependency control sub-module; if the database connection in step 2) gets the task of the "NOTASK" tag or the task of the "TIMEOUT" tag , then go directly to step 9) to execute the exit control sub-module;
5 ) 依赖控制子模块功能根据任务关系表分析步骤 2 ) 中获取的任务是 否有前置任务在等待, 具体地, 判断全部的前置任务是否都执行成功了, 若 判断结果是真, 直接进入步骤 6 )执行执行任务子模块, 若判断结果是假, 则释放该任务, 将该任务的执行结果状态设置成重新打开, 同时把数据插入 前置任务临时表, 防止本数据库连接和其他数据库连接重新抓取到该任务, 直接进入步骤 9 ) 执行退出控制子模块; 5) Dependent control sub-module function According to the task relationship table, whether the task acquired in step 2) has a pre-task waiting, specifically, whether all the pre-task tasks are executed successfully, and if the judgment result is true, directly enter Step 6) Execute the execution task sub-module. If the judgment result is false, release the task, set the execution result status of the task to re-open, and insert data into the pre-task temporary table to prevent the database connection and other database connections. Re-crawl the task, go directly to step 9) Execute the exit control sub-module;
6 ) 一个数据库连接将获取到的任务的执行结果状态更新为运行, 并执 行该任务的运行指令; 6) A database connection updates the execution result status of the acquired task to run, and executes the running instruction of the task;
7 ) 若该任务执行成功, 则该数据库连接对该任务组的删除操作标签的 记录行整行加锁, 得到该锁后, 更新该任务的执行结果状态为成功, 同时把 前置任务临时表中本连接数据删除, 其他连接的后续任务全部删除; 若该任 务运行失败, 错误次数小于 5次, 更新该任务的执行结果状态是重新打开, 错误次数加上 1 , 当错误次数等于 5次, 该任务的后续任务的执行结果状态 设置成依赖性失败, 运行次数等于 100, 该任务的执行结果状态设置成失败, 运行次数等于 5; 7) If the task is successfully executed, the database connection locks the entire row of the record row of the delete operation tag of the task group, and after obtaining the lock, the execution result of the task is updated to be successful, and the pre-task temporary table is added. In the middle of this connection data deletion, all subsequent tasks of the other connections are deleted; if the task fails to run, the number of errors is less than 5 times, the status of the execution result of updating the task is reopened, the number of errors is increased by 1, and the number of errors is equal to 5 times. The execution result status of the subsequent tasks of the task is set to the dependency failure, the running times are equal to 100, the execution result status of the task is set to failure, and the running times are equal to 5;
8 ) 该数据库连接对该任务组的删除操作标签的记录行解锁。 8) The database connection unlocks the record line of the delete operation tag of the task group.
9 ) 一个数据库连接分析任务表数据, 当执行任务的成功个数加上执行 任务的失败个数等于总执行任务数, 或者, 用户千预发出停止指令, 则设置 轮询条件为假, 退出执行模块; 若不是, 在轮询条件为真的情况下, 继续轮 询执行, 执行下一次轮询执行, 即, 返回步骤 1 ) 继续执行。 步骤 3 , —个数据库连接执行输出模块, 输出任务执行结果、 任务节点 展现、 节点布局数据等。 实施例 3 该实施例描述了一种具体实现过程中, 用户通过该基于数据库的任务执 行装置实现混合关系运算的过程: 步骤 1 , 用数据库客户端工具或应用, 连接到数据库, 执行录入模块, 输入执行任务数据、 输入任务关系数据, 或者, 任务数据和任务关系数据预 先已经进入临时表, 仅仅将临时表的内容更新到任务表和任务关系表。 步骤 2, 用数据库客户端工具或应用, 连接到数据库, 执行执行模块的 接口函数 sp_set_loop, 参数是任务组名称, 启动了一个执行数据库连接。 步骤 3 , 用与步骤 2相同的方式, 启动其他数据库连接, 实现多任务混 合执行。 需要说明的是, 上述方法中以任务组来隔离数据, 在数据库资源许可的 前提下, 可以同时多个任务组工作, 工作组之间独立工作, 以便应用于不同 项目的数据处理。 实施例 4 图 5是才艮据本发明实施例 4的具有网状依赖关系的任务的组成结构示意 图, 如图 5所示, 该任务组包含了 9个任务, 该实施例结合以上实施例 1-3 提供的方案, 对具有如图 5所示的任务关系的任务组进行处理的详细过程进 行了描述, 包括以下的步 4聚: 步骤 1 , 开始计算时, 通过实施例 3步骤 2中所述的启动数据库连接的 方式, 启动了一个数据库连接 (记为进程 a ) 处理任务; 步骤 2, 按照任务的层级值, 先后执行 、 E、 G任务 (A、 E、 G任务 的层级相同, 先后顺序可以随机确定, 或者, 按照其他预先设定的规则进行 确定;); 步骤 3 , 进程 a获取了符合实施例 2中描述的规则的 B任务, 判定其前 置任务 A任务执行成功, 则执行 B任务; 步骤 4, 通过实施例 3步骤 2中所述的启动数据库连接的方式, 又增加 了一个数据库连接 (记为进程 b ); 步骤 5 , 进程 b获取任务, 按照任务间依赖关系, 能够满足前置任务均 执行成功的条件的任务仅有 F或者是 H任务,假定进程 b将获取的 F任务送 入依赖控制子单元, 依赖控制子单元判定 F任务可执行, 则进程 b执行 F任 务; 在进程 b执行 F任务的同时, 进程 a执行完了 B任务, 进程 a获取了 H 任务, 按照任务间依赖关系, H任务满足执行条件, 则进程 a执行 H任务; 步骤 6, 进程 a已执行完了 H任务,但是进程 b执行的 F任务尚未完成, 进程 a进行任务抓取后, 判断抓取到的任务不满足前置任务已执行成功的条 件, 不能执行抓取到的任务, 则进行等待, 优选地, 还可以将抓取到的任务 加入前置任务临时表; 步骤 7, 进程 b执行完 F任务后, 进程 a选择到 C任务后执行, 进程 b 选择到 K任务后执行; 步骤 8, 进程 a完成 C任务后, 抓取到 D任务, 但是 D任务的前置任务 K尚在执行中, 进程 a没有任务可做, 在等待, 优选地, 可以将任务 D加入 前置任务临时表; 步骤 9, 进程 b完成 K任务后, 进程 b选择到 D任务, 进程 a在等待; 步骤 10, 进程 b完成 D任务后, 退出控制子单元判定进程 b应当退出计 算, 则进程 b会话结束, 同时, 退出控制子单元判定进程 a应当退出计算, 进程 a会话结束。 综上所述, 本发明实施例提供的方案在数据处理的过程中, 随时可以加 入用于处理任务的线程, 支持数据库连接的动态增加或减少, 从而能够动态 的调整数据处理的并发度, 并且, 能够实现网状依赖关系的数据计算。 另夕卜, 该方法仅需要一个关系型数据库, 不需要格外的应用服务支持即可实现, 使 用简单。 需要说明的是, 在附图的流程图示出的步骤可以在诸如一组执行机可执 行指令的执行机系统中执行, 并且, 虽然在流程图中示出了逻辑顺序, 但是 在某些情况下, 可以以不同于此处的顺序执行所示出或描述的步骤。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可 以用通用的执行装置来实现, 它们可以集中在单个的执行装置上, 或者分布 在多个执行装置所组成的网络上, 可选地, 它们可以用执行装置可执行的程 序代码来实现, 从而, 可以将它们存储在存储装置中由执行装置来执行, 或 者将它们分别制作成各个集成电路模块, 或者将它们中的多个模块或步骤制 作成单个集成电路模块来实现。 这样, 本发明不限制于任何特定的硬件和软 件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本 领域的技术人员来说, 本发明可以有各种更改和变化。 凡在本发明的^"神和 原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护 范围之内。 9) A database connection analyzes the task table data. When the number of successful tasks is increased, the number of failed execution tasks is equal to the total number of executed tasks, or the user pre-posts a stop command, If the polling condition is false, exit the execution module; if not, continue polling execution if the polling condition is true, and execute the next polling execution, that is, return to step 1) to continue execution. Step 3, a database connection execution output module, output task execution result, task node presentation, node layout data, and the like. Embodiment 3 This embodiment describes a process in which a user implements a hybrid relationship operation by using the database-based task execution device in a specific implementation process: Step 1, using a database client tool or an application, connecting to a database, and executing an input module, The input task data is input, the task relationship data is input, or the task data and the task relationship data have entered the temporary table in advance, and only the contents of the temporary table are updated to the task table and the task relationship table. Step 2: Connect to the database with the database client tool or application, execute the interface function sp_set_loop of the execution module, the parameter is the task group name, and start an execution database connection. Step 3: In the same way as step 2, start other database connections to implement multi-task hybrid execution. It should be noted that in the above method, the task group is used to isolate data. Under the premise of database resource permission, multiple task groups can work at the same time, and the working groups work independently to apply to data processing of different projects. Embodiment 4 FIG. 5 is a schematic structural diagram of a task having a network dependency according to Embodiment 4 of the present invention. As shown in FIG. 5, the task group includes nine tasks, and the embodiment is combined with Embodiment 1 above. -3 provides a detailed process for processing a task group having the task relationship as shown in FIG. 5, including the following steps: Step 1, when starting the calculation, by the second step in Embodiment 3 The method of starting the database connection starts a database connection (recorded as process a) to process the task; step 2, according to the hierarchical value of the task, successively execute, E, G tasks (A, E, G tasks have the same level, successively The order can be determined randomly, or determined according to other pre-set rules;); Step 3: The process a obtains the B task that meets the rules described in Embodiment 2, and determines that the pre-task A task is successfully executed, and then executes the B task; Step 4, the startup database connection described in step 2 of Embodiment 3 is performed. The way, another database connection is added (denoted as process b); Step 5, process b acquires the task, according to the inter-task dependency relationship, the task that can satisfy the condition that the pre-task execution is successful only has F or H task. It is assumed that the process b sends the acquired F task to the dependency control subunit, and the dependency control subunit determines that the F task is executable, and the process b executes the F task; while the process b executes the F task, the process a executes the B task, and the process a Obtaining the H task, according to the inter-task dependency, the H task satisfies the execution condition, then the process a executes the H task; Step 6, the process a has completed the H task, but the F task executed by the process b has not been completed, and the process a performs the task After the process is performed, it is judged that the captured task does not satisfy the condition that the pre-task has been successfully executed, and the captured task cannot be executed, and then waits, preferably, Add the captured task to the pre-task temporary table; Step 7, after the process b executes the F task, the process a selects to execute after the C task, and the process b selects to execute after the K task; Step 8, the process a completes the C task After that, the D task is captured, but the pre-task K of the D task is still being executed, and the process a has no tasks to do, waiting, preferably, the task D can be added to the pre-task temporary table; Step 9, process b After the K task is completed, the process b selects the D task, and the process a waits; Step 10, after the process b completes the D task, the exit control subunit determines that the process b should exit the calculation, then the process b session ends, and at the same time, the control subunit is exited. It is determined that process a should exit the calculation and process a session ends. In summary, the solution provided by the embodiment of the present invention can add a thread for processing a task at any time during the data processing process, and support dynamic increase or decrease of the database connection, thereby dynamically adjusting the concurrency of the data processing, and , can achieve data calculation of mesh dependencies. In addition, the method only needs a relational database, which can be implemented without special application service support, and is simple to use. It should be noted that the steps shown in the flowchart of the accompanying drawings may be executed in an execution machine system such as a set of executable instructions, and although the logical sequence is shown in the flowchart, in some cases The steps shown or described may be performed in a different order than here. It will be apparent to those skilled in the art that the various modules or steps of the present invention described above can be implemented by a general-purpose execution device, which can be centralized on a single execution device or distributed over a network of multiple execution devices. Alternatively, they may be implemented by program code executable by the execution device, so that they may be stored in the storage device by the execution device, or they may be separately fabricated into individual integrated circuit modules, or they may be Multiple modules or steps are made into a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software. The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the scope of the present invention are intended to be included within the scope of the present invention.

Claims

权 利 要 求 书 Claim
1. 一种基于数据库的任务执行方法, 包括: 1. A database-based task execution method, including:
加入数据库连接;  Join the database connection;
所述数据库连接从任务组中获取待执行的任务; 以及 判断所述获取的任务的前置任务是否全部执行成功, 若是, 则所 述数据库连接执行所述获取的任务, 若不是, 所述数据库连接继续从 所述任务组中获取待执行的任务。  The database connection obtains a task to be executed from the task group; and determines whether the pre-task of the acquired task is all successfully executed, and if so, the database connection performs the acquired task, and if not, the database The connection continues to obtain the task to be executed from the task group.
2. 才艮据权利要求 1所述的方法, 其中, 所述数据库连接从任务组中获取 待执行的任务包括: 2. The method according to claim 1, wherein the obtaining, by the database connection, the task to be executed from the task group comprises:
所述数据库连接对所述任务组的查询操作类型的记录行加锁; 所述数据库连接获取到满足预定条件的任务, 其中, 所述预定条 件包括: 所述获取的任务的执行结果状态为初始化或重新打开; 所述数据库连接将所述获取的任务的执行结果状态设置为选中; 所述数据库连接对所述查询操作类型的记录行解锁。  The database connection locks the record row of the query operation type of the task group; the database connection acquires a task that satisfies a predetermined condition, wherein the predetermined condition includes: the execution result state of the acquired task is initialization Or reopening; the database connection sets the execution result status of the acquired task to be selected; and the database connection unlocks the record line of the query operation type.
3. 根据权利要求 2所述的方法, 其中, 判断所述获取的任务的前置任务 未全部执行成功之后, 还包括: 所述数据库连接将所述获取的任务的 执行结果状态置为重新打开。 The method according to claim 2, wherein, after determining that the pre-task of the acquired task is not all successfully executed, the method further comprises: the database connection setting the execution result status of the acquired task to being re-opened .
4. 根据权利要求 3所述的方法, 其中, 将所述获取的任务的执行结果状 态置为重新打开的同时, 还将所述获取的任务加入前置任务临时表, 所述预定条件还包括所述获取的任务不在所述前置任务临时表中。 The method according to claim 3, wherein, when the execution result status of the acquired task is set to be reopened, the acquired task is further added to the pre-task temporary table, and the predetermined condition further includes The acquired task is not in the pre-task temporary table.
5. 根据权利要求 4所述的方法, 其中, 执行所述获取的任务包括: 所述数据库连接将所述获取的任务的执行结果状态置为运行, 并 执行所述获取的任务的运行指令。 The method according to claim 4, wherein the performing the acquiring task comprises: the database connection setting an execution result state of the acquired task to run, and executing a running instruction of the acquired task.
6. 根据权利要求 5所述的方法, 其中, 在执行所述获取的任务的运行指 令成功的情况下, 还包括: The method according to claim 5, wherein, in the case that the running instruction of the acquired task is successful, the method further includes:
所述数据库连接对所述任务组的删除操作类型的记录行加锁; 所述数据库连接将所述获取的任务的执行结果状态置为成功, 并 删除所述前置任务临时表中的任务; The database connection locks a record row of a deletion operation type of the task group; The database connection sets the execution result status of the acquired task to be successful, and deletes the task in the pre-task temporary table;
所述数据库连接对所述任务组的删除操作类型的记录行解锁。  The database connection unlocks a record line of a deletion operation type of the task group.
7. 根据权利要求 5所述的方法, 其中, 在执行所述获取的任务的运行指 令失败的情况下, 还包括: The method according to claim 5, wherein, in the case that the running instruction of the acquired task fails, the method further includes:
所述数据库连接将所述获取的任务的执行结果状态置为失败, 并 将所述获取的任务的后置任务的执行结果状态置为依赖性失败。  The database connection sets the execution result status of the acquired task to a failure, and sets the execution result status of the post task of the acquired task to a dependency failure.
8. 才艮据权利要求 2所述的方法, 其中, 在所述数据库连接从所述当前任 务组中获取待执行的任务失败, 或者, 执行所述获取的任务之后, 还 包括: 8. The method according to claim 2, wherein, after the database connection obtains a task to be executed from the current task group, or after performing the acquired task, the method further includes:
判断执行成功的任务数量和执行失败的任务数量之和是否等于所 述任务组中的任务总数, 或者, 判断用户是否发出停止指令, 若是, 则停止执行, 若不是, 返回从所述任务组中获取待执行的任务的步骤。  Determining whether the sum of the number of successfully executed tasks and the number of failed tasks is equal to the total number of tasks in the task group, or determining whether the user issues a stop instruction, and if so, stopping execution, if not, returning from the task group Get the steps of the task to be performed.
9. 才艮据权利要求 8所述的方法, 其中, 所述数据库连接从所述当前任务 组中获取待执行的任务失败包括: 9. The method according to claim 8, wherein the obtaining, by the database connection, the task to be executed from the current task group fails comprises:
所述数据库连接接收到用于指示加锁等待超时的通知; 或者, 所述数据库连接接收到用于指示所述任务组中不存在待执行的任 务的通知。  The database connection receives a notification for indicating a lock wait timeout; or the database connection receives a notification indicating that there is no task to be executed in the task group.
10. 根据权利要求 1所述的方法, 其中, 判断所述获取的任务的前置任务 是否全部执行成功包括: 10. The method according to claim 1, wherein determining whether the pre-task of the acquired task is all successfully executed comprises:
根据预先设置的所述任务组中任务之间的依赖关系确定所述获取 的任务的前置任务;  Determining a pre-task of the acquired task according to a dependency relationship between tasks in the task group set in advance;
判断所述前置任务是否全部执行成功。  It is determined whether all of the pre-tasks are successfully executed.
11. 一种基于数据库的任务执行装置, 包括: 11. A database-based task execution device, comprising:
加入模块, 用于加入数据库连接;  Add a module to join the database connection;
获取模块, 用于从任务组中获取待执行的任务; 判断模块, 用于判断所述获取的任务的前置任务是否全部执行成 功; 调度模块, 用于在所述判断模块的判断结果为是的情况下, 调度 执行模块, 在所述判断模块的判断结果为否的情况下, 调度所述获取 模块; An obtaining module, configured to obtain a task to be executed from the task group, and a determining module, configured to determine whether all the pre-tasks of the acquired task are successfully executed; a scheduling module, configured to: when the determination result of the determining module is yes, scheduling an execution module, if the determination result of the determining module is negative, scheduling the acquiring module;
所述执行模块, 用于执行所述获取的任务。  The execution module is configured to perform the acquired task.
PCT/CN2011/070456 2010-05-05 2011-01-21 Method and device for task execution based on database WO2011137672A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010173441A CN101853182A (en) 2010-05-05 2010-05-05 Task execution method and device based on database
CN201010173441.3 2010-05-05

Publications (1)

Publication Number Publication Date
WO2011137672A1 true WO2011137672A1 (en) 2011-11-10

Family

ID=42804688

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/070456 WO2011137672A1 (en) 2010-05-05 2011-01-21 Method and device for task execution based on database

Country Status (2)

Country Link
CN (1) CN101853182A (en)
WO (1) WO2011137672A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577560A (en) * 2013-10-24 2014-02-12 华为技术有限公司 Method and device for inputting data base operating instructions
CN105893122A (en) * 2015-08-25 2016-08-24 乐视网信息技术(北京)股份有限公司 Data processing operation scheduling method, device and system

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853182A (en) * 2010-05-05 2010-10-06 中兴通讯股份有限公司 Task execution method and device based on database
CN102043669B (en) * 2010-12-22 2013-01-09 中国农业银行股份有限公司 Workflow concurrency mode control method and device
CN102955684B (en) * 2011-08-17 2016-08-10 中国移动通信集团山东有限公司 A kind of service operation method and device
CN102981904B (en) * 2011-09-02 2016-08-03 阿里巴巴集团控股有限公司 A kind of method for scheduling task and system
CN103677751B (en) * 2012-09-06 2016-12-21 阿里巴巴集团控股有限公司 Tasks in parallel treating method and apparatus
CN102880473A (en) * 2012-09-28 2013-01-16 五八有限公司 Method and device for task execution based on quartz framework
CN103197970A (en) * 2013-04-12 2013-07-10 中国银行股份有限公司 Method for triggering jobs with multiple mechanisms running and bank data processing system
CN103761148B (en) * 2014-01-26 2017-04-05 北京京东尚科信息技术有限公司 The control method of cluster timer-triggered scheduler task
CN104484167B (en) * 2014-12-05 2018-03-09 广州华多网络科技有限公司 Task processing method and device
CN105068912B (en) * 2015-07-29 2020-05-01 北京京东尚科信息技术有限公司 Method and device for executing webpage task
CN105912387A (en) * 2015-08-25 2016-08-31 乐视网信息技术(北京)股份有限公司 Method and device for dispatching data processing operation
CN107239326A (en) * 2016-03-28 2017-10-10 平安科技(深圳)有限公司 Accept insurance multithreading batch processing method and system
CN106874031B (en) * 2017-01-03 2020-08-28 海信视像科技股份有限公司 Method and device for starting system program of terminal equipment
CN107784479A (en) * 2017-02-16 2018-03-09 平安科技(深圳)有限公司 A kind of business flow processing method and apparatus
CN106990943A (en) * 2017-03-30 2017-07-28 微梦创科网络科技(中国)有限公司 Parallel task treating method and apparatus
CN108667872B (en) * 2017-03-31 2021-04-30 北京京东尚科信息技术有限公司 Archiving method and device for scheduling server
CN108549652B (en) * 2018-03-08 2021-10-29 北京三快在线科技有限公司 Hotel dynamic data acquisition method and device, electronic equipment and readable storage medium
CN110795479A (en) * 2019-10-08 2020-02-14 中国建设银行股份有限公司 Method and device for distributed ETL scheduling based on data
CN117114628B (en) * 2023-10-20 2024-02-13 广东电网有限责任公司梅州供电局 Temporary plan identification method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070283351A1 (en) * 2006-05-31 2007-12-06 Degenaro Louis R Unified job processing of interdependent heterogeneous tasks
CN101470631A (en) * 2007-12-27 2009-07-01 新奥特(北京)视频技术有限公司 Task ranking apparatus
CN101667147A (en) * 2009-07-27 2010-03-10 浪潮电子信息产业股份有限公司 Multitasking controllable automatic snapshot method
CN101853182A (en) * 2010-05-05 2010-10-06 中兴通讯股份有限公司 Task execution method and device based on database

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425024A (en) * 2008-10-24 2009-05-06 中国移动通信集团山东有限公司 Multitasking method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070283351A1 (en) * 2006-05-31 2007-12-06 Degenaro Louis R Unified job processing of interdependent heterogeneous tasks
CN101470631A (en) * 2007-12-27 2009-07-01 新奥特(北京)视频技术有限公司 Task ranking apparatus
CN101667147A (en) * 2009-07-27 2010-03-10 浪潮电子信息产业股份有限公司 Multitasking controllable automatic snapshot method
CN101853182A (en) * 2010-05-05 2010-10-06 中兴通讯股份有限公司 Task execution method and device based on database

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577560A (en) * 2013-10-24 2014-02-12 华为技术有限公司 Method and device for inputting data base operating instructions
CN105893122A (en) * 2015-08-25 2016-08-24 乐视网信息技术(北京)股份有限公司 Data processing operation scheduling method, device and system

Also Published As

Publication number Publication date
CN101853182A (en) 2010-10-06

Similar Documents

Publication Publication Date Title
WO2011137672A1 (en) Method and device for task execution based on database
CN110532074B (en) Task scheduling method and system for multi-tenant mode SaaS service cluster environment
US20190235895A1 (en) Orchestration engine
JP4526412B2 (en) Task management method and apparatus in multiprocessor system
US7065765B2 (en) Serializing event handling in a threaded system with no wait states
US7386864B2 (en) Automatic serialization for event driven multi-threaded programs in an object structured system
CN104035786B (en) The optimization method and system of a kind of software timer
CN108804238B (en) Soft bus communication method based on remote procedure call
WO2013122815A1 (en) Coordination of processes in cloud computing environments
US20150120936A1 (en) Coordination of processes in cloud computing environments
US20020091695A1 (en) Remote computation framework
US7823158B2 (en) Adaptive scheduling and management of work processing in a target context in resource contention
WO2009089746A1 (en) Method, device and system for realizing task in cluster environment
CN113535362A (en) Distributed scheduling system architecture and micro-service workflow scheduling method
CN114756357B (en) Non-blocking distributed planned task scheduling method based on JVM (Java virtual machine)
JP4183712B2 (en) Data processing method, system and apparatus for moving processor task in multiprocessor system
CN111736809A (en) Distributed robot cluster network management framework and implementation method thereof
JPH09511858A (en) Parallel execution of requests in OSI agent
WO2023071291A1 (en) Task processing method and electronic device
US8473954B2 (en) Executing operations via asynchronous programming model
CN111930492A (en) Task flow scheduling method and system based on decoupling task data model
JPH04273555A (en) Commitment system
KR101102930B1 (en) Robot used software component apparatus and thread processing method using by it
JP2693916B2 (en) Task scheduling method
CN113010276A (en) Task scheduling method and device, terminal equipment and storage 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: 11777093

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

Country of ref document: EP

Kind code of ref document: A1