[go: up one dir, main page]

CN113760491B - A task scheduling system, method, device and storage medium - Google Patents

A task scheduling system, method, device and storage medium Download PDF

Info

Publication number
CN113760491B
CN113760491B CN202011198034.8A CN202011198034A CN113760491B CN 113760491 B CN113760491 B CN 113760491B CN 202011198034 A CN202011198034 A CN 202011198034A CN 113760491 B CN113760491 B CN 113760491B
Authority
CN
China
Prior art keywords
task
scheduling
logic
data
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011198034.8A
Other languages
Chinese (zh)
Other versions
CN113760491A (en
Inventor
谢建雨
王伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011198034.8A priority Critical patent/CN113760491B/en
Publication of CN113760491A publication Critical patent/CN113760491A/en
Application granted granted Critical
Publication of CN113760491B publication Critical patent/CN113760491B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed 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 embodiment of the present invention discloses a task scheduling system, method, device and storage medium, the system includes: a database and at least one task subsystem, each task subsystem is deployed in a cluster server, each task subsystem includes a task scheduling module; wherein, a task processing unit of at least one scheduling task is registered in the task scheduling module, and a task processing logic corresponding to the scheduling task is registered in the task processing unit; the task scheduling module is used to add the task information of the scheduling task sent by the business end to the database when it is detected that the preset trigger logic is called by the business end; and the task information of the scheduling task read in the database is sent to the task processing unit, so that the task processing unit performs the task processing operation based on the task processing logic and outputs the generated task processing data. The embodiment of the present invention reduces the development difficulty of the task scheduling system and improves portability.

Description

Task scheduling system, method, device and storage medium
Technical Field
The embodiment of the invention relates to the technical field of internet systems, in particular to a task scheduling system, a task scheduling method, task scheduling equipment and a task scheduling storage medium.
Background
The existing task scheduling system mainly adopts a distributed implementation mode, and the distributed task scheduling system comprises a scheduling center system and a service system, wherein the scheduling center system is used for completing upper logic such as task management, distribution and monitoring, and the service system only needs to complete service execution logic.
In the process of implementing the present invention, the inventor finds that at least the following technical problems exist in the prior art:
The existing distributed task scheduling system requires that a developer also needs to set a related trigger scheduling mode of a scheduling center system independently after completing code development, so that code development and trigger configuration are respectively executed at a service end and a scheduling center system end, thereby increasing the workload of the developer, and increasing the development difficulty of the developer if the service end and the scheduling center system end adopt different development technologies. In addition, the existing task scheduling system focuses on the enhancement of the functionality and the universality of the scheduling center system after the decoupling of the scheduling center to meet the trigger setting of different service systems, so that the external dependency factors of the scheduling center system are excessive, and the portability of the task scheduling system is poor.
Disclosure of Invention
The embodiment of the invention provides a task scheduling system, a task scheduling method, a task scheduling device and a storage medium, which are used for reducing the development difficulty of a service system and improving the portability of the task scheduling system.
In a first aspect, an embodiment of the present invention provides a task scheduling system, where the system includes a database and at least one task subsystem, each task subsystem is deployed in a cluster server, and each task subsystem includes a task scheduling module;
Wherein, at least one task processing unit for dispatching tasks is registered in the task dispatching module, and task processing logic corresponding to dispatching tasks is registered in the task processing unit;
The task scheduling module is used for adding the received task information of the scheduling task sent by the service end to a database when the preset trigger logic is detected to be called by the service end, and sending the read task information of the scheduling task in the database to the task processing unit so that the task processing unit executes task processing operation based on the task processing logic and outputs the generated task processing data, wherein the preset trigger logic is used for triggering the adding operation of the task information of the scheduling task.
In a second aspect, an embodiment of the present invention further provides a task scheduling method, where the method includes:
when the preset trigger logic is detected to be called by a service end, the received task information of the scheduling task sent by the service end is added into a database, wherein the preset trigger logic is used for triggering the adding operation of the task information of the scheduling task;
and sending the read task information of the scheduling task in the database to a task processing unit so that the task processing unit executes task processing operation based on the task processing logic and outputs the generated task processing data.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
A memory for storing one or more programs;
The one or more programs, when executed by the one or more processors, cause the one or more processors to implement any of the task scheduling methods described above.
In a fourth aspect, embodiments of the present invention also provide a storage medium containing computer executable instructions which, when executed by a computer processor, are used to perform any of the task scheduling methods referred to above.
According to the embodiment of the invention, the preset task trigger scheduling logic is provided for the service end, and a new scheduling task is added when the service end is detected to call the preset task trigger scheduling logic, so that the problem that code development and trigger configuration are required to be respectively executed at the service end and the scheduling center system end when the service end develops the scheduling task is solved, and the development difficulty of a task scheduling system is reduced. Furthermore, the embodiment of the invention adopts the task scheduling system meeting the cluster architecture, and completes the scheduling work of scheduling tasks based on the database, so that the service codes and the operation configuration are managed in a centralized way, the problem of multiple external dependency factors of a scheduling center system in the distributed task scheduling system is solved, and the portability of the task scheduling system is improved.
Drawings
Fig. 1 is a schematic diagram of a task scheduling system according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a task scheduling system according to a second embodiment of the present invention.
Fig. 3 is a schematic diagram of a specific example of a task subsystem according to the second embodiment of the present invention.
Fig. 4 is a flowchart of a task scheduling method according to a third embodiment of the present invention.
Fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a schematic diagram of a task scheduling system according to an embodiment of the present invention, where the embodiment is applicable to scheduling and executing task logic of a scheduling task, and the system may be implemented in software and/or hardware, and the system may be configured in a server. The task scheduling system comprises a database 10 and at least one task subsystem 20, wherein each task subsystem 20 is deployed in a cluster server, and each task subsystem 20 respectively comprises a task scheduling module 201, wherein at least one task processing unit for scheduling tasks is registered in the task scheduling module 201, and task processing logic corresponding to the scheduled tasks is registered in the task processing unit;
The task scheduling module 201 is configured to add task information of a scheduled task sent by a service end to a database when a preset trigger logic is detected to be invoked by the service end, and send the read task information of the scheduled task in the database to the task processing unit, so that the task processing unit executes task processing operation based on the task processing logic and outputs generated task processing data, where the preset trigger logic is configured to trigger the task information adding operation of the scheduled task.
Exemplary types of databases 10 include, but are not limited to, hierarchical databases, relational databases, document oriented databases, key value store databases, or column store databases, among others. In one embodiment, database 10 may alternatively be a relational database. Specifically, the relational database may use a two-dimensional table composed of rows and columns to manage data, and uses SQL (Structured Query Language ) to operate on the data, and all the data generated by the task scheduling system provided in this embodiment may be stored in the database.
Wherein, each task subsystem 20 is deployed in a cluster server, and specifically, each task subsystem 20 supports a cluster architecture deployment. Wherein the cluster architecture represents that each task subsystem 20 operates as a cluster node in a respective independent server.
The preset task triggering logic is, for example, a static method related to JobManager (task management) components provided by the task scheduling module 201, and is logic used by the service end when the task scheduling system is exposed. Wherein, jobManager component is responsible for the dispatching and resource management of the whole cluster task, and the static method is a method formed by adding a static keyword before the class method. In one embodiment, optionally, a buried point unit is set for the preset task trigger logic, and whether the preset task trigger logic is invoked is detected through the buried point unit.
The service end may specifically set a trigger logic for scheduling tasks according to its own service requirement, and the trigger logic includes, but is not limited to, time period-based trigger, message notification-based trigger, or instant external condition-based trigger, where the instant external condition may be whether to perform task triggering after interaction with a third party system. When the service end detects that the triggering condition of the scheduling task is met, a preset task triggering logic provided by the task scheduling system is called to add the task information of the scheduling task into a database. When the trigger logic is trigger based on a time period, and the service end adopts a java program based on springboot frames to perform logic development, the trigger logic is set by using a spring timer provided by the java program. Specifically, a timer in the form of an "@ Scheduled" annotation is built based on received time rules defined based on the cron parameter, fixedDelay parameter, or fixedRate parameter.
On the basis of the above embodiment, optionally, the task scheduling module 201 is further configured to, when it is detected that the task subsystem 20 is started, obtain task information of a scheduled task in a task interface on the task scheduling module 201 and an instance bean class of task processing logic encapsulated with the scheduled task in the task scheduling interface, and register the scheduled task in the task processing unit based on the task information and the bean class.
The task interface and the task scheduling interface are interfaces exposed to the service end of the task scheduling system, and in one embodiment, the task interface is an optional IJob interface, and the task scheduling interface is a IJobHandler interface. Based on the above embodiments, the task subsystem 20 is optionally built based on springboot-starter mechanism. The benefit of this is that the task subsystem 20 built based on springboot-starter mechanism automatically registers the task information and bean class at the interface in the task processing unit at start-up. The starter is a settable project provided by springboot application development framework, and for example, a maven project management tool may be used to create a starter project, and after creation, each task subsystem 20 corresponds to a jar package.
On the basis of the embodiment, the task scheduling module 201 is optionally specifically configured to read task information of a scheduled task in a database based on a preset time interval through a single-thread executor service, package the task information of the scheduled task into an executable object and submit the executable object to a multi-thread executor service, and send the executable object to a task processing unit through the multi-thread executor service based on an exclusive mechanism of the database, where the exclusive mechanism of the database is used to control a unique multi-thread executor service in a plurality of task scheduling modules that read the task information of the scheduled task to execute a sending operation of the executable object.
Specifically, the task scheduling module 201 includes 2 executor services (ExecutorService) that serve single-threaded and multi-threaded executors, respectively. The preset time interval may be 1 minute, for example. The executable object (Runnable object) is an executable object of a process (Thread), and specifically, the executable object is sent to the task processing unit by calling a run method of the executable object. Specifically, when the multithreaded executor service receives a plurality of executable objects, each executable object is respectively sent to a task processing unit corresponding to each scheduling task. On the basis of the above-described embodiment, optionally, when the task processing unit completes the task processing operation, the processing state information based on the generated scheduled task is updated in the database 10. Illustratively, the processing state information includes success information, failure information, or exception information.
For example, after the task subsystem a and the task subsystem B both read the scheduling information of the scheduled task 1 in the database and encapsulate the scheduling information into the executable object, the task subsystem a and the task subsystem B claim the task information of the scheduled task 1 in the database, respectively, and if the task subsystem a has claimed the task information of the scheduled task 1, the task subsystem B cannot claim the task information of the scheduled task 1 again by the exclusive mechanism of the database, so that the multithreaded executor service in the task subsystem a sends the executable object corresponding to the scheduled task 1 to the task processing unit corresponding to the scheduled task 1 registered in the task subsystem a.
On the basis of the above embodiment, optionally, the task scheduling module 201 is further configured to, after reading task information of a scheduled task in the database, match the task information of the scheduled task with task information in a task processing unit registered in the task scheduling module 201, and use the task information of the scheduled task that is successfully matched as task information that can be packaged as an executable object.
The types and the numbers of the task processing units registered by the task scheduling module 201 in each task subsystem 20 in the task scheduling system in this embodiment may be the same or different. Specifically, the task processing units that can execute the scheduled task 1 are registered in the task subsystem a, or the task processing units that can execute the scheduled task 2 are registered in the task subsystem B. For example, when the task subsystem a reads the task information of the scheduled task 2, the task subsystem a does not perform the encapsulation operation on the task information of the scheduled task 2 if the task information of the scheduled task 2 is not matched with the task information of the task processing unit registered in the task subsystem.
According to the technical scheme, the preset task trigger scheduling logic is provided for the service end, and a new scheduling task is added when the service end is detected to call the preset task trigger scheduling logic, so that the problem that code development and trigger configuration are required to be executed at the service end and the scheduling center system end respectively when the service end develops the scheduling task is solved, and the development difficulty of a task scheduling system is reduced. Furthermore, the embodiment of the invention adopts the task scheduling system meeting the cluster architecture, and completes the scheduling work of scheduling tasks based on the database, so that the service codes and the operation configuration are managed in a centralized way, the problem of multiple external dependency factors of a scheduling center system in the distributed task scheduling system is solved, and the portability of the task scheduling system is improved.
Example two
Fig. 2 is a schematic diagram of a task scheduling system according to a second embodiment of the present invention, and the technical solution of this embodiment is further refinement based on the foregoing embodiment. Optionally, the task subsystem 20 further includes a statistics analysis module 202, and accordingly, the task scheduling module 201 is further configured to send task processing data to the statistics analysis module 202, where the statistics analysis module 202 is configured to perform asynchronous statistics analysis on the task processing data sent by each task scheduling module 201 and output a generated statistics analysis result, and preset task triggering logic is configured to trigger an adding operation of task information of a scheduled task.
Specifically, in this embodiment, each task subsystem 20 of the task scheduling system includes a statistical analysis module 202, and any statistical analysis module is selected as the statistical analysis module 202 of the task scheduling system, so as to perform asynchronous statistical analysis on the task processing data sent by each task subsystem 20, that is, each task subsystem 20 sends the generated task processing data to the same statistical analysis module 202 in the task scheduling system.
On the basis of the above embodiment, optionally, the task processing logic includes a call operation for calling the data reporting logic, and the task scheduling module 201 is specifically configured to, when detecting that the data reporting logic is called by the task processing logic during the task processing unit executes the task processing operation, send the generated task processing data corresponding to the data reporting logic to the statistical analysis module 202, where the data reporting logic is configured to trigger the statistical analysis module 202 to execute a receiving operation on the task processing data sent by the task processing unit.
The data reporting logic is an exemplary static method related to JobManager components provided by the task scheduling module 201, and is a logic used by the task scheduling system exposed to a service end. In one embodiment, optionally, a buried point unit is set for the data reporting logic, and the buried point unit detects whether the data reporting logic is invoked. The data reporting logic includes data reporting logic for successful data processing, data reporting logic for failed data processing, and data reporting logic for abnormal data processing, for example. Specifically, when the task processing unit performs task processing on the data 1 based on the task processing logic and the processing is successful, the task processing logic invokes the data reporting logic that the data processing is successful, and reports the data that the data 1 is successful, so that the statistical analysis module 202 receives the data that the data 1 is successful.
Based on the above embodiment, the statistical analysis module 202 is specifically configured to encapsulate the received task processing data into an executable object and submit the executable object to the single-threaded executor service in the statistical analysis module 202, and perform an asynchronous storage operation on the executable object using the single-threaded executor service.
Based on the above embodiment, the bean class is optionally further encapsulated with data statistics logic of the scheduled task, and the corresponding statistical analysis module 202 is further configured to register the data statistics logic of the scheduled task in the statistical analysis module 202 based on the bean class, so that the statistical analysis module 202 performs statistical analysis processing on the received task processing data based on the data statistics logic, and outputs the generated statistical analysis result. Specifically, a data statistics logic is constructed in a "@ JobStatistics annotation" form.
On the basis of the embodiment, the statistical analysis result comprises task overview data and/or verification success information, and the corresponding statistical analysis module is specifically used for generating task overview data based on a time window dimension and outputting the task overview data based on the acquired task processing data corresponding to the time window when the data statistics logic comprises the statistics logic based on the time window, and/or acquiring processing state data in the task processing data corresponding to the scheduling task and matching the processing state data with a state verification standard corresponding to the scheduling task when the data statistics logic comprises the statistics logic based on the task dimension, and generating the verification success information of the scheduling task and outputting the verification success information if the matching is successful.
In one embodiment, the time window based statistics logic performs a statistical analysis on a scheduled task basis, and the task summary data includes task processing data for each scheduled task within the time window. For example, the task overview data includes an amount of processing success data and an amount of processing failure data corresponding to the scheduled task 1, and an amount of processing success data and an amount of processing failure data corresponding to the scheduled task 2.
In one embodiment, the statistical logic based on task dimensions performs statistical analysis with a single scheduled task as an object, and the processing state data in the task processing data includes, but is not limited to, processing success data, processing failure data, and processing exception data. Wherein the state check criteria are criteria for characterizing overall state data of the scheduled task. For example, when the scheduling task corresponds to data 1, data 2, and data 3, the state check criteria define that the processing state data corresponding to data 1 and data 2 are successful states, and the processing state data corresponding to data 3 is not limited. And if the processing state data is respectively a data 1 success state, a data 2 success state and a data 3 success state based on the task dimension, the processing state data is matched with the state verification standard, and verification success information is generated. If the processing state data is the successful state of the data 1, the failed state of the data 2 and the successful state of the data 3 respectively, the processing state data is not matched with the state verification standard, and verification failure information is generated.
Fig. 3 is a schematic diagram of a specific example of a task subsystem according to the second embodiment of the present invention. As shown in fig. 3, the task subsystem includes a task scheduling module and a statistical analysis module, wherein the task scheduling module registers the task processing unit 1, the task processing unit 2, the task processing unit 3, and so on. In the process that the task processing unit executes task processing operation based on the task processing logic, the buried point unit detects the calling condition of the task processing unit for calling the data reporting logic, and when the data reporting logic is detected to be called, the statistical analysis module receives task processing data corresponding to the data reporting logic. Among the basic statistical indexes received by the statistical analysis module, the left 3 graphs without gray scales (namely, task creation time, start execution time and task end time) represent the data automatically acquired by the statistical analysis module, and the right 3 graphs with gray scales (namely, expected processing data, successful processing data and task error data) represent the task processing data sent by the task scheduling module and received based on the data reporting logic. The statistical analysis module performs statistical analysis based on the basic statistical indexes, and specifically, the statistical functions include task overview based on a time window (i.e. statistical logic based on a time window) and task dimension task success verification (i.e. statistical logic based on a task dimension). In this embodiment, the statistical analysis module has an analysis output function, and specifically, the service end receives the statistical analysis result by calling the http interface provided by the statistical analysis module, or the statistical analysis module actively sends the statistical analysis result to the service end in a form of mail, etc. The specific output mode of the statistical analysis module is not limited herein.
According to the technical scheme, the statistical analysis module is arranged to carry out statistical analysis on the task processing data sent by the task scheduling module, and the generated statistical analysis result is output, so that the problem of data statistics of the task scheduling system is solved. Furthermore, the task scheduling system of the embodiment solves the problem that the data reporting of the scheduling task needs to be independently set in the scheduling center system of the distributed scheduling system by exposing the data reporting logic to the service end for use, further reduces the workload and the working difficulty of developers, and further improves the portability of the task scheduling system by delivering the data reporting function to the service end for independent development and setting.
It should be noted that, in the embodiment of the task scheduling system, each unit and module included are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented, and the specific names of the functional units are only for convenience of distinguishing each other, and are not used for limiting the protection scope of the present invention.
Example III
Fig. 4 is a flowchart of a task scheduling method according to a third embodiment of the present invention, where the method may be adapted to perform scheduling and execution of task logic of a scheduled task, and the method may be configured in a task scheduling system according to any one of the foregoing embodiments, where the system may be implemented in software and/or hardware, and the system may be configured in a server. The specific implementation steps comprise:
And S310, when the preset trigger logic is detected to be called by the service end, the received task information of the scheduling task sent by the service end is added into a database.
In this embodiment, the preset trigger logic is used to trigger an adding operation of task information of the scheduled task.
In one embodiment, optionally, a buried point unit is set for the preset task trigger logic, and whether the preset task trigger logic is invoked is detected through the buried point unit.
S320, the task information of the scheduling task in the read database is sent to the task processing unit, so that the task processing unit executes task processing operation based on the task processing logic, and the generated task processing data is output.
In one embodiment, optionally, the task information of the scheduling task in the read database is sent to the task processing unit, and the method comprises the steps of reading the task information of the scheduling task in the database based on a preset time interval through a single-thread executor service, packaging the task information of the scheduling task into an executable object and then submitting the executable object to a multi-thread executor service, and sending the executable object to the task processing unit through the multi-thread executor service based on an exclusive mechanism of the database, wherein the exclusive mechanism of the database is used for controlling the unique multi-thread executor service in a plurality of task scheduling modules which read the task information of the scheduling task to execute the sending operation of the executable object.
In one embodiment, optionally, the method further comprises the step of matching task information of the scheduled task with task information in a task processing unit registered in a task scheduling module after the task information of the scheduled task in the database is read, and taking the task information of the scheduled task which is successfully matched as task information which can be packaged into an executable object.
In one embodiment, optionally, the method further comprises acquiring task information of the scheduled task in a task interface on the task scheduling module and an instance bean class of task processing logic packaged with the scheduled task in the task scheduling interface when the start of the task subsystem is detected, and registering the scheduled task in the task processing unit based on the task information and the bean class.
In one embodiment, the method optionally further comprises sending the generated task processing data to a statistical analysis module, so that the statistical analysis module performs asynchronous statistical analysis on the received task processing data sent by each task scheduling module, and outputs the generated statistical analysis result.
In one embodiment, optionally, the task processing logic includes a call operation for calling the data reporting logic, and correspondingly, the task processing logic sends the generated task processing data to the statistical analysis module, where the task processing module sends the generated task processing data corresponding to the data reporting logic to the statistical analysis module when detecting that the data reporting logic is called by the task processing logic in the process of executing the task processing operation by the task processing unit, and the data reporting logic is used for triggering the statistical analysis module to execute a receiving operation on the task processing data sent by the task processing unit.
According to the technical scheme, the preset task trigger scheduling logic is provided for the service end, and a new scheduling task is added when the service end is detected to call the preset task trigger scheduling logic, so that the problem that code development and trigger configuration are required to be executed at the service end and the scheduling center system end respectively when the service end develops the scheduling task is solved, and the workload and development difficulty of developers are reduced. Furthermore, the embodiment of the invention realizes the dispatching work of dispatching tasks based on the database, so that the service codes and the operation configuration are managed in a centralized way, the problem of more external dependence factors of a dispatching center system in the distributed task dispatching system is solved, and the portability of the task dispatching system is improved.
Example IV
Fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention, where the fourth embodiment of the present invention provides services for implementing the task scheduling method according to the foregoing embodiment of the present invention, and the task scheduling system according to the foregoing embodiment of the present invention may be configured. Fig. 5 shows a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 5 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 5, device 12 is in the form of a general purpose computing device. The components of device 12 may include, but are not limited to, one or more processors or processing units 16, a system memory 28, and a bus 18 that connects the various system components, including system memory 28 and processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard disk drive"). Although not shown in fig. 5, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with device 12, and/or any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, via network adapter 20. As shown in fig. 5, network adapter 20 communicates with other modules of device 12 over bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with device 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing a task scheduling method provided by an embodiment of the present invention.
Through the electronic equipment, the problem that the service end needs to be executed respectively at the service end and the dispatching center system end when the dispatching task is developed is solved, the workload and the development difficulty of developers are reduced, the problem that the external dependence factors of the dispatching center system in the distributed task dispatching system are more is solved, and the portability of the task dispatching system is improved.
Example five
A fifth embodiment of the present invention also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a task scheduling method, the method comprising:
When the preset trigger logic is detected to be called by the service end, task information of a scheduling task sent by the service end is added into a database, wherein the preset trigger logic is used for triggering the adding operation of the task information of the scheduling task;
And sending the read task information of the scheduling task in the database to a task processing unit so that the task processing unit executes task processing operation based on task processing logic and outputs the generated task processing data.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present invention is not limited to the above method operations, but may also perform the related operations in the task scheduling method provided in any embodiment of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (12)

1.一种任务调度系统,其特征在于,包括:数据库和至少一个任务子系统,各所述任务子系统部署于集群服务器中,各所述任务子系统分别包括任务调度模块;1. A task scheduling system, characterized in that it comprises: a database and at least one task subsystem, each of the task subsystems is deployed in a cluster server, and each of the task subsystems comprises a task scheduling module; 其中,在所述任务调度模块中注册有至少一种调度任务的任务处理单元,在所述任务处理单元中注册有对应调度任务的任务处理逻辑;Wherein, at least one task processing unit for scheduling tasks is registered in the task scheduling module, and task processing logic corresponding to the scheduling task is registered in the task processing unit; 所述任务调度模块,用于当检测到预设触发逻辑被业务端调用时,将接收到的所述业务端发送的调度任务的任务信息添加到数据库中;以及,将读取到的所述数据库中的调度任务的任务信息发送给任务处理单元,以使所述任务处理单元基于所述任务处理逻辑执行任务处理操作,并将生成的任务处理数据进行输出;其中,所述预设触发逻辑用于触发调度任务的任务信息的添加操作。The task scheduling module is used to add the task information of the scheduled task sent by the business end to the database when it detects that the preset trigger logic is called by the business end; and send the task information of the scheduled task read from the database to the task processing unit, so that the task processing unit performs the task processing operation based on the task processing logic and outputs the generated task processing data; wherein the preset trigger logic is used to trigger the operation of adding the task information of the scheduled task. 2.根据权利要求1所述的系统,其特征在于,所述任务调度模块,具体用于:2. The system according to claim 1, characterized in that the task scheduling module is specifically used to: 通过单线程执行器服务,基于预设时间间隔读取所述数据库中的调度任务的任务信息,将调度任务的任务信息封装为可运行对象后提交给多线程执行器服务;Through the single-threaded executor service, the task information of the scheduled task in the database is read based on a preset time interval, and the task information of the scheduled task is encapsulated as an executable object and submitted to the multi-threaded executor service; 通过多线程执行器服务,基于数据库的排他机制将所述可运行对象发送给任务处理单元;其中,所述数据库的排他机制用于控制读取到所述调度任务的任务信息的多个任务调度模块中的唯一多线程执行器服务执行可运行对象的发送操作。The executable object is sent to the task processing unit through a multi-threaded executor service based on an exclusive mechanism of a database; wherein the exclusive mechanism of the database is used to control the only multi-threaded executor service among the multiple task scheduling modules that read the task information of the scheduled task to execute the sending operation of the executable object. 3.根据权利要求2所述的系统,其特征在于,所述任务调度模块,还用于:3. The system according to claim 2, characterized in that the task scheduling module is further used to: 在读取到数据库中的调度任务的任务信息之后,将所述调度任务的任务信息与所述任务调度模块中注册的任务处理单元中的任务信息进行匹配,将匹配成功的调度任务的任务信息作为可封装为可运行对象的任务信息。After reading the task information of the scheduled task in the database, the task information of the scheduled task is matched with the task information in the task processing unit registered in the task scheduling module, and the task information of the successfully matched scheduled task is used as the task information that can be encapsulated as an executable object. 4.根据权利要求1所述的系统,其特征在于,所述任务调度模块,还用于:4. The system according to claim 1, characterized in that the task scheduling module is further used to: 在检测到任务子系统启动时,获取所述任务调度模块上的任务接口中的调度任务的任务信息以及任务调度接口中封装有调度任务的任务处理逻辑的实例bean类,并基于所述任务信息和所述bean类将调度任务注册在任务处理单元中。When it is detected that the task subsystem is started, the task information of the scheduled task in the task interface on the task scheduling module and the instance bean class that encapsulates the task processing logic of the scheduled task in the task scheduling interface are obtained, and the scheduled task is registered in the task processing unit based on the task information and the bean class. 5.根据权利要求4所述的系统,其特征在于,所述任务子系统还包括统计分析模块,相应的,所述任务调度模块还用于:将所述任务处理数据发送给统计分析模块,所述统计分析模块,用于对接收到的各所述任务调度模块发送的任务处理数据进行异步统计分析,将生成的统计分析结果进行输出。5. The system according to claim 4 is characterized in that the task subsystem also includes a statistical analysis module, and accordingly, the task scheduling module is also used to: send the task processing data to the statistical analysis module, and the statistical analysis module is used to perform asynchronous statistical analysis on the task processing data received from each of the task scheduling modules, and output the generated statistical analysis results. 6.根据权利要求5所述的系统,其特征在于,所述任务处理逻辑包含调用数据上报逻辑的调用操作,相应的,所述任务调度模块,具体用于:6. The system according to claim 5, characterized in that the task processing logic includes a calling operation of calling data reporting logic, and accordingly, the task scheduling module is specifically used to: 在所述任务处理单元执行任务处理操作的过程中,当检测到所述数据上报逻辑被所述任务处理逻辑调用时,将生成的与所述数据上报逻辑对应的任务处理数据发送给统计分析模块;其中,所述数据上报逻辑用于触发统计分析模块对任务处理单元发送的任务处理数据执行接收操作。During the process of the task processing unit performing task processing operations, when it is detected that the data reporting logic is called by the task processing logic, the generated task processing data corresponding to the data reporting logic is sent to the statistical analysis module; wherein, the data reporting logic is used to trigger the statistical analysis module to perform a receiving operation on the task processing data sent by the task processing unit. 7.根据权利要求5所述的系统,其特征在于,所述bean类还封装有调度任务的数据统计逻辑,相应的,所述统计分析模块,还用于:7. The system according to claim 5, characterized in that the bean class also encapsulates data statistics logic of the scheduling task, and accordingly, the statistical analysis module is also used to: 基于所述bean类,将所述调度任务的数据统计逻辑注册在统计分析模块中,以使所述统计分析模块基于所述数据统计逻辑,对接收到的任务处理数据进行统计分析处理,并将生成的统计分析结果进行输出。Based on the bean class, the data statistical logic of the scheduling task is registered in the statistical analysis module, so that the statistical analysis module performs statistical analysis on the received task processing data based on the data statistical logic, and outputs the generated statistical analysis results. 8.根据权利要求7所述的系统,其特征在于,所述统计分析结果包括任务总览数据和/或校验成功信息,相应的,所述统计分析模块,具体用于:8. The system according to claim 7, characterized in that the statistical analysis results include task overview data and/or verification success information, and accordingly, the statistical analysis module is specifically used to: 当所述数据统计逻辑包括基于时间窗口的统计逻辑时,基于获取到的与所述时间窗口对应的任务处理数据,生成基于时间窗口维度的任务总览数据,并将所述任务总览数据进行输出;When the data statistical logic includes statistical logic based on a time window, based on the acquired task processing data corresponding to the time window, task overview data based on a time window dimension is generated, and the task overview data is output; 和/或,and/or, 当所述数据统计逻辑包括基于任务维度的统计逻辑时,获取与调度任务对应的任务处理数据中的处理状态数据,并将所述处理状态数据与所述调度任务对应的状态校验标准进行匹配,如果匹配成功,则生成所述调度任务的校验成功信息,并将所述校验成功信息进行输出。When the data statistical logic includes statistical logic based on task dimensions, the processing status data in the task processing data corresponding to the scheduling task is obtained, and the processing status data is matched with the status verification standard corresponding to the scheduling task. If the match is successful, the verification success information of the scheduling task is generated and the verification success information is output. 9.根据权利要求4所述的系统,其特征在于,所述任务子系统是基于springboot-starter机制构建的。9. The system according to claim 4 is characterized in that the task subsystem is built based on the springboot-starter mechanism. 10.一种任务调度方法,其特征在于,应用于权利要求1-9任一项所述的任务调度系统中,所述方法包括:10. A task scheduling method, characterized in that it is applied to the task scheduling system according to any one of claims 1 to 9, and the method comprises: 当检测到预设触发逻辑被业务端调用时,将接收到的所述业务端发送的调度任务的任务信息添加到数据库中;其中,所述预设触发逻辑用于触发调度任务的任务信息的添加操作;When it is detected that the preset trigger logic is called by the service end, the task information of the scheduling task sent by the service end is added to the database; wherein the preset trigger logic is used to trigger the adding operation of the task information of the scheduling task; 将读取到的所述数据库中的调度任务的任务信息发送给任务处理单元,以使所述任务处理单元基于所述任务处理逻辑执行任务处理操作,并将生成的任务处理数据进行输出。The task information of the scheduled task read from the database is sent to the task processing unit, so that the task processing unit performs the task processing operation based on the task processing logic and outputs the generated task processing data. 11.一种电子设备,其特征在于,所述电子设备包括:11. An electronic device, characterized in that the electronic device comprises: 一个或多个处理器;one or more processors; 存储器,用于存储一个或多个程序;A memory for storing one or more programs; 当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求10所述的任务调度方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the task scheduling method as claimed in claim 10. 12.一种包含计算机可执行指令的存储介质,其特征在于,所述计算机可执行指令在由计算机处理器执行时用于执行如权利要求10所述的任务调度方法。12. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the task scheduling method according to claim 10 when executed by a computer processor.
CN202011198034.8A 2020-10-30 2020-10-30 A task scheduling system, method, device and storage medium Active CN113760491B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011198034.8A CN113760491B (en) 2020-10-30 2020-10-30 A task scheduling system, method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011198034.8A CN113760491B (en) 2020-10-30 2020-10-30 A task scheduling system, method, device and storage medium

Publications (2)

Publication Number Publication Date
CN113760491A CN113760491A (en) 2021-12-07
CN113760491B true CN113760491B (en) 2025-07-15

Family

ID=78785934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011198034.8A Active CN113760491B (en) 2020-10-30 2020-10-30 A task scheduling system, method, device and storage medium

Country Status (1)

Country Link
CN (1) CN113760491B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292141B (en) * 2022-09-29 2023-02-03 深圳联友科技有限公司 Scheduling abnormal early warning method and monitoring server based on sliding time window
CN117472530B (en) * 2023-10-25 2024-04-05 上海宽睿信息科技有限责任公司 Centralized management-based data intelligent scheduling method and system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984290A (en) * 2018-08-02 2018-12-11 北京京东金融科技控股有限公司 Method for scheduling task and system

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156920A (en) * 2011-04-20 2011-08-17 铁道部运输局 Task management dispatching system based on multi-dimensional law customization and task management dispatching method based on multi-dimensional law customization
CN103577256B (en) * 2013-11-21 2017-03-15 五八同城信息技术有限公司 Distributed timing task scheduling system
CN105468450B (en) * 2015-12-29 2019-02-05 华为技术有限公司 Task scheduling method and system
CN107025131B (en) * 2016-02-01 2020-12-29 腾讯科技(深圳)有限公司 Task scheduling method and device
CN106126332A (en) * 2016-06-27 2016-11-16 北京京东尚科信息技术有限公司 Distributed timing task scheduling system and method
CN107092523A (en) * 2017-04-14 2017-08-25 浙江数链科技有限公司 The dispatching method and system of timed task
CN107977586B (en) * 2017-12-22 2021-04-13 联想(北京)有限公司 Display content processing method, first electronic device and second electronic device
CN108647083B (en) * 2018-04-28 2020-03-31 京东数字科技控股有限公司 Task execution method, device, system, electronic equipment and computer readable medium
CN110895486B (en) * 2018-09-12 2022-08-12 北京奇虎科技有限公司 Distributed Task Scheduling System
CN111782351A (en) * 2019-07-18 2020-10-16 北京京东尚科信息技术有限公司 A method and device for distributed task scheduling

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984290A (en) * 2018-08-02 2018-12-11 北京京东金融科技控股有限公司 Method for scheduling task and system

Also Published As

Publication number Publication date
CN113760491A (en) 2021-12-07

Similar Documents

Publication Publication Date Title
CN109690524B (en) Data Serialization in Distributed Event Processing Systems
CN110716748B (en) Service processing method, device, computer readable medium and electronic equipment
US10146599B2 (en) System and method for a generic actor system container application
CN108595316B (en) Lifecycle management method, manager, device, and medium for distributed application
US20140372986A1 (en) Timed API Rules for Runtime Verification
US20070016893A1 (en) Tracking resource usage by applications
CN108108239A (en) Method and device for providing service function and computer readable storage medium
CN103559118A (en) Security auditing method based on aspect oriented programming (AOP) and annotation information system
CN116719622A (en) Service flow arranging method and service flow arranging system
US20240176593A1 (en) System and method for API driven rapid application development and execution
US8407713B2 (en) Infrastructure of data summarization including light programs and helper steps
CN115543735A (en) Log processing method, device, electronic device and storage medium
CN113760491B (en) A task scheduling system, method, device and storage medium
US10534640B2 (en) System and method for providing a native job control language execution engine in a rehosting platform
CN113157426A (en) Task scheduling method, system, equipment and storage medium
CN112256783A (en) Data export method and device, electronic equipment and storage medium
CN112313627B (en) Mapping mechanism of event to serverless function workflow instance
CN113553098A (en) Method, device and computer equipment for submitting Flink SQL job
US20220374398A1 (en) Object Creation from Schema for Event Streaming Platform
US8539512B2 (en) Transactional environments for event and data binding handlers
WO2019062020A1 (en) Asynchronous task unified processing method and apparatus, and storage medium
US20250086011A1 (en) Automation with composable asynchronous tasks
CN115499493B (en) Asynchronous transaction processing method, device, storage medium and computer equipment
CN117667421A (en) Implementation method, device, computer equipment and storage medium of distributed lock
WO2021051583A1 (en) Method and apparatus for transmitting and collecting variable, and computer-readable storage medium

Legal Events

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