A task scheduling system, method, device and storage medium
The centralized task scheduling system with a unified database and preset trigger logic simplifies development and enhances portability by integrating task management across systems, addressing the complexity and dependency issues of existing distributed systems.
Patent Information
- Application Number
- CN202011198034.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-30
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2040-10-30
AI Technical Summary
The existing distributed task scheduling system requires developers to execute code development and trigger configurations on the business side and the scheduling center system side respectively, which increases the difficulty of development. In addition, there are too many external dependencies in the scheduling center system, resulting in poor portability.
It provides a task scheduling system that adopts cluster architecture and database management scheduling tasks, adds scheduling tasks when a call is detected on the business side through preset task trigger logic, and completes scheduling work based on the database, reducing development difficulty and centrally managing business code and running configuration.
It reduces the difficulty of developing the task scheduling system, improves the portability of the system, and solves the problem of many external dependencies of the dispatch center system.
Smart Images

Figure CN113760491B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of Internet systems, and in particular, to a task scheduling system, method, device, and storage medium. Background Art
[0002] Existing task scheduling systems mainly adopt a distributed implementation method. The distributed task scheduling system includes a scheduling center system and a business system. Among them, the scheduling center system completes the upper-layer logic such as task management, allocation, and monitoring, and the business system only needs to complete the business execution logic.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following technical problems:
[0004] Existing distributed task scheduling systems require developers to separately set the scheduling trigger method in the scheduling center system after completing the code development, so that the code development and trigger configuration are executed at the business side and the scheduling center system side respectively, thus increasing the workload of developers. If different development technologies are adopted at the business side and the scheduling center system side, it will also increase the development difficulty of developers. In addition, since existing task scheduling systems pay more attention to enhancing the functionality and generality of the scheduling center system after decoupling to meet the trigger settings of different business systems, there are too many external dependency factors in the scheduling center system, which in turn leads to poor portability of the task scheduling system. Summary of the Invention
[0005] The embodiments of the present invention provide a task scheduling system, method, device, and storage medium to reduce the development difficulty of the business system and improve the portability of the task scheduling system.
[0006] In a first aspect, the embodiments of the present invention provide a task scheduling system, which includes: 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 includes a task scheduling module;
[0007] Among them, at least one task processing unit of a scheduling task is registered in the task scheduling module, and the task processing logic corresponding to the scheduling task is registered in the task processing unit;
[0008] The task scheduling module is configured to, when detecting that a preset trigger logic is called by the business side, add the task information of the scheduling task sent by the business side received to the database; and send the task information of the scheduling task read from the database to the task processing unit, so that the task processing unit performs a 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 addition operation of the task information of the scheduling task.
[0009] In a second aspect, an embodiment of the present invention further provides a task scheduling method, which includes:
[0010] When it is detected that a preset trigger logic is called by the service side, add the task information of the scheduling task sent by the service side received to the database; wherein, the preset trigger logic is used to trigger the addition operation of the task information of the scheduling task;
[0011] Send the task information of the scheduling task read from the database to the task processing unit, so that the task processing unit performs a task processing operation based on the task processing logic and outputs the generated task processing data.
[0012] In a third aspect, an embodiment of the present invention further provides an electronic device, which includes:
[0013] One or more processors;
[0014] A memory for storing one or more programs;
[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above-mentioned task scheduling methods.
[0016] In a fourth aspect, an embodiment of the present invention further provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute any one of the above-mentioned task scheduling methods when executed by a computer processor.
[0017] By providing a preset task trigger scheduling logic to the service side, and adding a new scheduling task when it is detected that the service side calls the preset task trigger scheduling logic, the embodiment of the present invention solves the problem that the service side needs to execute code development and trigger configuration separately at the service side and the scheduling center system side when developing a scheduling task, and reduces the development difficulty of the task scheduling system. Further, by adopting a task scheduling system that meets the cluster architecture and completing the scheduling work of the scheduling task based on the database, the embodiment of the present invention enables the business code and running configuration to be centrally managed, solves the problem of many external dependency factors in the scheduling center system of the distributed task scheduling system, and improves the portability of the task scheduling system. Description of the Drawings
[0018] Figure 1 is a schematic diagram of a task scheduling system provided by Embodiment 1 of the present invention.
[0019] Figure 2 is a schematic diagram of a task scheduling system provided by Embodiment 2 of the present invention.
[0020] Figure 3 It is a schematic diagram of a specific example of a task subsystem provided in the second embodiment of the present invention.
[0021] Figure 4 It is a flowchart of a task scheduling method provided in the third embodiment of the present invention.
[0022] Figure 5 It is a schematic diagram of the structure of an electronic device provided in the fourth embodiment of the present invention. Detailed implementation manners
[0023] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present invention, rather than limiting the present invention. Additionally, it should be noted that for the sake of convenience of description, only parts related to the present invention rather than all structures are shown in the drawings.
[0024] Embodiment 1
[0025] Figure 1 It is a schematic diagram of a task scheduling system provided in the first embodiment of the present invention. This embodiment is applicable to scheduling and execution of the task logic of scheduling tasks. The system can be implemented in software and / or hardware and can be configured in a server. The task scheduling system includes: a database 10 and at least one task subsystem 20. Each task subsystem 20 is deployed in a cluster server, and each task subsystem 20 includes a task scheduling module 201 respectively; wherein, at least one task processing unit of scheduling tasks is registered in the task scheduling module 201, and the task processing logic corresponding to the scheduling tasks is registered in the task processing unit.
[0026] The task scheduling module 201 is configured to, when detecting that a preset trigger logic is called by the service end, add the task information of the scheduling task received from the service end to the database; and send the task information of the scheduling task read from the database to the task processing unit, so that the task processing unit performs task processing operations based on the task processing logic and outputs the generated task processing data; wherein, the preset trigger logic is used to trigger the addition operation of the task information of the scheduling task.
[0027] Among them, by way of example, the type of the database 10 includes but is not limited to hierarchical databases, relational databases, document-oriented databases, key-value storage databases, or column-store databases, etc. In one embodiment, optionally, the database 10 adopts a relational database. Specifically, the relational database can use a two-dimensional table composed of rows and columns to manage data and use SQL (Structured Query Language) to operate on the data. All data generated by the task scheduling system provided in this embodiment can be stored in the database.
[0028] Among them, each task subsystem 20 is deployed in a cluster server. Specifically, each task subsystem 20 supports cluster architecture deployment. Among them, the cluster architecture means that each task subsystem 20 runs as a cluster node in its respective independent server.
[0029] Among them, exemplarily, the preset task trigger logic is a static method provided by the task scheduling module 201 related to the JobManager (task management) component, and it is the logic exposed by this task scheduling system for the business side to use. The JobManager component is responsible for the scheduling and resource management of the entire cluster tasks. The static method refers to the method formed after adding the static keyword before the method of the class. In one embodiment, optionally, a logging unit is set for the preset task trigger logic, and the logging unit is used to detect whether the preset task trigger logic is called.
[0030] Among them, specifically, the business side can set the trigger logic of the scheduling task according to its own business needs. Exemplarily, the trigger logic includes but is not limited to triggering based on a time period, triggering based on a message notification, or triggering based on an immediate external condition. Among them, the immediate external condition can be to decide whether to trigger a task after interacting with a third-party system. When the business side detects that the trigger condition of the scheduling task is met, it calls the preset task trigger logic provided by this task scheduling system to add the task information of the scheduling task to the database. Among them, exemplarily, when the trigger logic is triggering based on a time period, and the business side uses a Java program based on the springboot framework for logic development, the spring timer provided by the Java program is used to set the trigger logic. Specifically, a timer in the form of an "@Scheduled" annotation is constructed based on the received time rules defined by cron parameters, fixedDelay parameters, or fixedRate parameters.
[0031] Based on the above embodiments, optionally, the task scheduling module 201 is further configured to: when detecting the startup of the task subsystem 20, obtain the task information of the scheduling task in the task interface on the task scheduling module 201 and the instance bean class encapsulating the task processing logic of the scheduling task in the task scheduling interface, and register the scheduling task in the task processing unit based on the task information and the bean class.
[0032] Among them, the task interface and the task scheduling interface are the interfaces exposed by this task scheduling system to the service side. In one embodiment, optionally, the task interface is the IJob interface, and the task scheduling interface is the IJobHandler interface. On the basis of the above embodiment, optionally, the task subsystem 20 is constructed based on the springboot-starter mechanism. The advantage of this setting is that the task subsystem 20 constructed based on the springboot-starter mechanism automatically registers the task information and bean classes at the interface in the task processing unit when starting up. Among them, the starter is a project that can be built provided by the springboot application development framework. Exemplarily, the maven project management tool can be used to create the starter project. After creation, each task subsystem 20 corresponds to a jar package.
[0033] On the basis of the above embodiment, optionally, the task scheduling module 201 is specifically configured to: read the task information of the scheduling tasks in the database based on a preset time interval through a single-thread executor service, encapsulate the task information of the scheduling tasks into a runnable object, and then submit it to the multi-thread executor service; send the runnable object to the task processing unit through the multi-thread executor service based on the exclusive mechanism of the database; wherein, the exclusive mechanism of the database is used to control the sending operation of the runnable object by the only multi-thread executor service among the multiple task scheduling modules that read the task information of the scheduling tasks.
[0034] Among them, specifically, the task scheduling module 201 includes two executor services (ExecutorService), namely a single-thread executor service and a multi-thread executor service. Among them, exemplarily, the preset time interval can be 1 minute. The runnable object (Runnable object) is an object that a process (Thread) can execute. Specifically, the runnable object is sent to the task processing unit by calling the run method of the runnable object. Specifically, when the multi-thread executor service receives multiple runnable objects, each runnable object is sent to the task processing unit corresponding to each scheduling task. On the basis of the above embodiment, optionally, when the task processing unit completes the task processing operation, the processing status information of the generated scheduling task is updated in the database 10. Exemplarily, the processing status information includes success information, failure information or exception information.
[0035] For example, when both task subsystem A and task subsystem B read the scheduling information of scheduling task 1 in the database and encapsulate it into a runnable object, task subsystem A and task subsystem B respectively claim the task information of scheduling task 1 in the database. If task subsystem A has already claimed the task information of scheduling task 1, the exclusive mechanism of the database makes it impossible for task subsystem B to claim the task information of scheduling task 1 again, so that the multi-threaded executor service in task subsystem A sends the runnable object corresponding to scheduling task 1 to the task processing unit registered in task subsystem A and corresponding to this scheduling task 1.
[0036] Based on the above embodiments, optionally, the task scheduling module 201 is further configured to: after reading the task information of the scheduling task in the database, match the task information of the scheduling task with the task information in the task processing units registered in the task scheduling module 201, and use the task information of the scheduling task with successful matching as the task information that can be encapsulated into a runnable object.
[0037] Among them, the types and quantities of the task processing units registered in the task scheduling module 201 of each task subsystem 20 in the task scheduling system of this embodiment may be the same or different. Specifically, the scheduling tasks that each task subsystem 20 can execute are exactly the same, or task subsystem A registers a task processing unit that can execute scheduling task 1, and task subsystem B registers a task processing unit that can execute scheduling task 2. For example, when task subsystem A reads the task information of scheduling task 2, the task information of scheduling task 2 does not match the task information of the task processing units registered in the task subsystem, so task subsystem A does not perform an encapsulation operation on the task information of scheduling task 2.
[0038] The technical solution of this embodiment provides a preset task trigger scheduling logic to the service end, and adds a new scheduling task when detecting that the service end calls this preset task trigger scheduling logic, which solves the problem that the service end needs to perform code development and trigger configuration separately at the service end and the scheduling center system end when developing scheduling tasks, and reduces the development difficulty of the task scheduling system. Further, the embodiment of the present invention adopts a task scheduling system that meets the cluster architecture and completes the scheduling work of scheduling tasks based on the database, so that the service code and running configuration are centrally managed, solves the problem of many external dependency factors in the scheduling center system of the distributed task scheduling system, and improves the portability of the task scheduling system.
[0039] Embodiment 2
[0040] Figure 2It is a schematic diagram of a task scheduling system provided in the second embodiment of the present invention. The technical solution of this embodiment is a further refinement based on the above embodiment. Optionally, the task subsystem 20 further includes a statistical analysis module 202. Correspondingly, the task scheduling module 201 is further configured to: send task processing data to the statistical analysis module 202. The statistical analysis module 202 is configured to perform asynchronous statistical analysis on the task processing data sent by each task scheduling module 201 received, and output the generated statistical analysis result; wherein, the preset task trigger logic is used to trigger the addition operation of the task information for scheduling tasks.
[0041] Specifically, in this embodiment, each task subsystem 20 of the task scheduling system includes a statistical analysis module 202. Any one of the statistical analysis modules is selected as the statistical analysis module 202 of the task scheduling system, which is used 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.
[0042] Based on the above embodiment, optionally, the task processing logic includes a calling operation for calling the data reporting logic. Correspondingly, the task scheduling module 201 is specifically configured to: during the process of the task processing unit executing the task processing operation, when it is detected that the data reporting logic is called by the task processing logic, send the generated task processing data corresponding to the data reporting logic to the statistical analysis module 202; wherein, the data reporting logic is used to trigger the statistical analysis module 202 to perform a receiving operation on the task processing data sent by the task processing unit.
[0043] Exemplarily, the data reporting logic is a static method provided by the task scheduling module 201 related to the JobManager component, which is the logic exposed by this task scheduling system for the business side to use. In one embodiment, optionally, a tracing unit is set for the data reporting logic, and the tracing unit is used to detect whether the data reporting logic is called. Exemplarily, the data reporting logic includes a data reporting logic for successful data processing, a data reporting logic for failed data processing, and a data reporting logic for abnormal data processing. Specifically, when the task processing unit performs task processing on data 1 based on the task processing logic and the processing is successful, the task processing logic calls the data reporting logic for successful data processing, and reports the data processed successfully for data 1, so that the statistical analysis module 202 receives the data processed successfully for data 1.
[0044] Based on the above embodiment, optionally, the statistical analysis module 202 is specifically configured to: encapsulate the received task processing data into a runnable object and submit it to the single-thread executor service in the statistical analysis module 202, and use the single-thread executor service to perform an asynchronous storage operation on the runnable object.
[0045] Based on the above embodiments, optionally, the bean class further encapsulates the data statistics logic of the scheduling task. Correspondingly, the statistical analysis module 202 is further configured to: based on the bean class, register the data statistics logic of the scheduling task in the statistical analysis module 202, 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 results. Specifically, the data statistics logic is constructed in the form of "@JobStatistics annotation".
[0046] Based on the above embodiments, optionally, the statistical analysis results include task overview data and / or verification success information. Correspondingly, the statistical analysis module is specifically configured to: when the data statistics logic includes the statistical logic based on the time window, generate task overview data based on the time window dimension based on the obtained task processing data corresponding to the time window, and output the task overview data; and / or, when the data statistics logic includes the statistical logic based on the task dimension, obtain the processing status data in the task processing data corresponding to the scheduling task, and match the processing status data with the status verification standard corresponding to the scheduling task. If the match is successful, generate the verification success information of the scheduling task and output the verification success information.
[0047] In one embodiment, the statistical analysis based on the time window statistic logic is performed on a per-scheduling-task basis, and the task overview data includes the task processing data of each scheduling task within the time window. For example, the task overview data includes the number of successfully processed data and the number of failed processed data corresponding to scheduling task 1, as well as the number of successfully processed data and the number of failed processed data corresponding to scheduling task 2.
[0048] In one embodiment, the statistical analysis based on the task dimension statistic logic is performed on a single scheduling task as the object. The processing status data in the task processing data includes, but is not limited to, successfully processed data, failed processed data, and abnormally processed data. The status verification standard is used to represent the standard of the overall status data of the scheduling task. For example, when the scheduling task corresponds to data 1, data 2, and data 3, the status verification standard defines that the processing status data corresponding to data 1 and data 2 are in the success state, and the processing status data corresponding to data 3 is not limited. If the processing status data obtained based on the task dimension is data 1 in the success state, data 2 in the success state, and data 3 in the success state, then the processing status data matches the above status verification standard, and the verification success information is generated. If the processing status data is data 1 in the success state, data 2 in the failed state, and data 3 in the success state, then the processing status data does not match the above status verification standard, and the verification failure information is generated.
[0049] Figure 3 It is a schematic diagram of a specific example of a task subsystem provided in the second embodiment of the present invention. As Figure 3 shown, the task subsystem includes a task scheduling module and a statistical analysis module. Among them, the task scheduling module is registered with task processing unit 1, task processing unit 2, task processing unit 3, and so on. During the process that the task processing unit executes the task processing operation based on the task processing logic, the calling situation of the data reporting logic called by the task processing unit is detected through the buried point unit. When it is detected that the data reporting logic is called, the statistical analysis module receives the task processing data corresponding to the data reporting logic. Among the basic statistical indicators received by the statistical analysis module, the 3 leftmost icons without grayscale (i.e., task creation time, start execution time, and task end time) represent the data automatically obtained by the statistical analysis module, and the 3 rightmost icons with grayscale (i.e., expected processed data, successfully processed data, and task error data) represent the task processing data sent by the task scheduling module received based on the data reporting logic. The statistical analysis module completes the statistical analysis based on the basic statistical indicators. Specifically, the statistical functions include task overview based on time window (i.e., statistical logic based on time window) and task dimension task success verification (i.e., statistical logic based on task dimension). In this embodiment, the statistical analysis module has an analysis output function. Specifically, the business side 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 business side in the form of an email or the like. The specific output method of the statistical analysis module is not limited here.
[0050] The technical solution of this embodiment solves the problem of data statistics of the task scheduling system by setting a statistical analysis module to perform statistical analysis on the task processing data sent by the task scheduling module and output the generated statistical analysis result. Further, the task scheduling system of this embodiment solves the problem that the data reporting of the scheduling task needs to be separately set in the scheduling center system of the distributed scheduling system by exposing the data reporting logic to the business side for use, further reducing the workload and work difficulty of developers. The data reporting function is handed over to the business side for independent development and setting, further improving the portability of the task scheduling system.
[0051] It should be noted that in the above embodiments of the task scheduling system, the included units and modules are only divided according to the functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the present invention.
[0052] Embodiment Three
[0053] Figure 4The figure is a flowchart of a task scheduling method provided in the third embodiment of the present invention. This embodiment is applicable to the scheduling and execution of the task logic of scheduling tasks. This method can be configured in the task scheduling system provided in any of the above embodiments. The system can be implemented in software and / or hardware, and the system can be configured in a server. The specific implementation steps are as follows:
[0054] S310. When it is detected that the preset trigger logic is called by the service end, add the task information of the scheduling task sent by the service end received to the database.
[0055] In this embodiment, the preset trigger logic is used to trigger the addition operation of the task information of the scheduling task.
[0056] In one embodiment, optionally, a buried point unit is set for the preset task trigger logic, and the buried point unit is used to detect whether the preset task trigger logic is called.
[0057] S320. Send the task information of the scheduling task read from the database to the task processing unit, so that the task processing unit performs task processing operations based on the task processing logic and outputs the generated task processing data.
[0058] In one embodiment, optionally, sending the task information of the scheduling task read from the database to the task processing unit includes: based on a preset time interval, reading the task information of the scheduling task in the database through a single-thread executor service, encapsulating the task information of the scheduling task into a runnable object and then submitting it to a multi-thread executor service; through the multi-thread executor service, sending the runnable object to the task processing unit based on the exclusive mechanism of the database; wherein, the exclusive mechanism of the database is used to control the sending operation of the runnable object by the only multi-thread executor service in multiple task scheduling modules that read the task information of the scheduling task.
[0059] In one embodiment, optionally, the method further includes: after reading the task information of the scheduling task in the database, matching the task information of the scheduling task with the task information in the task processing unit registered in the task scheduling module, and using the successfully matched task information of the scheduling task as the task information that can be encapsulated into a runnable object.
[0060] In one embodiment, optionally, the method further includes: when it is detected that the task subsystem is started, obtaining the task information of the scheduling task in the task interface on the task scheduling module and the instance bean class encapsulating the task processing logic of the scheduling task in the task scheduling interface, and registering the scheduling task in the task processing unit based on the task information and the bean class.
[0061] In one embodiment, optionally, the method further includes: sending the generated task processing data to a statistical analysis module, so that the statistical analysis module performs asynchronous statistical analysis on the task processing data received from each task scheduling module, and outputs the generated statistical analysis result.
[0062] In one embodiment, optionally, the task processing logic includes a call operation for calling the data reporting logic. Correspondingly, sending the generated task processing data to the statistical analysis module includes: during the process of the task processing unit executing the task processing operation, when it is detected that the data reporting logic is called by the task processing logic, sending the generated task processing data corresponding to the data reporting logic 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.
[0063] The technical solution of this embodiment provides a preset task trigger scheduling logic to the service side, and adds a new scheduling task when it is detected that the service side calls the preset task trigger scheduling logic, which solves the problem that the service side needs to perform code development and trigger configuration separately at the service side and the scheduling center system side during the development of scheduling tasks, and reduces the workload and development difficulty of developers. Further, the embodiment of the present invention completes the scheduling work of scheduling tasks based on a database, so that the service code and operation configuration are centrally managed, solves the problem of many external dependency factors in the scheduling center system of the distributed task scheduling system, and improves the portability of the task scheduling system.
[0064] Embodiment 4
[0065] Figure 5 FIG. is a schematic structural diagram of an electronic device provided in Embodiment 4 of the present invention. The embodiment of the present invention provides services for implementing the task scheduling method of the above embodiments of the present invention, and can configure the task scheduling system in the above embodiments. Figure 5 FIG. shows a block diagram of an exemplary device 12 suitable for implementing the embodiments of the present invention. Figure 5 The shown device 12 is merely an example and should not impose any limitation on the functions and scope of use of the embodiments of the present invention.
[0066] As Figure 5 shown, the device 12 is presented in the form of a general-purpose computing device. The components of the 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 connecting different system components (including the system memory 28 and the processing unit 16).
[0067] Bus 18 represents one or more of several types of bus architectures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of the various bus architectures. By way of example, these architectures include, but are not limited to, 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.
[0068] Device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by device 12, including volatile and nonvolatile media, removable and non-removable media.
[0069] System memory 28 can 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 can further include other removable / non-removable, volatile / nonvolatile computer system storage media. By way of example only, storage system 34 can be used for reading and writing on non-removable, nonvolatile magnetic media ( Figure 5 not shown, typically referred to as a "hard disk drive"). Although Figure 5 not shown in the figure, a disk drive for reading and writing on removable nonvolatile disks (such as a "floppy disk"), and an optical disk drive for reading and writing on removable nonvolatile optical disks (such as a CD-ROM, DVD-ROM, or other optical media) can be provided. In these cases, each drive can be connected to bus 18 through one or more data media interfaces. Memory 28 can include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the embodiments of the present invention.
[0070] A program / utility 40 having a set (at least one) of program modules 42 can be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods in the embodiments described in the present invention.
[0071] Device 12 can also communicate with one or more external devices 14 (such as a keyboard, a pointing device, a display 24, etc.), and can also communicate with one or more devices that enable a user to interact with the device 12, and / or communicate with any device that enables the device 12 to communicate with one or more other computing devices (such as a network card, a modem, etc.). Such communication can be carried out through an input / output (I / O) interface 22. Moreover, the device 12 can also 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) through a network adapter 20. As Figure 5 shown, the network adapter 20 communicates with other modules of the device 12 through a bus 18. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in combination with the device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0072] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the task scheduling method provided by the embodiments of the present invention.
[0073] Through the above-mentioned electronic device, the problem that the service side needs to execute separately at the service side and the scheduling center system side when developing scheduling tasks is solved, the workload and development difficulty of developers are reduced, and at the same time, the problem of many external dependence factors in the scheduling center system of the distributed task scheduling system is solved, and the portability of the task scheduling system is improved.
[0074] Embodiment Five
[0075] Embodiment Five of the present invention also provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute a task scheduling method when executed by a computer processor. The method includes:
[0076] When it is detected that a preset trigger logic is called by the service side, add the task information of the scheduling task sent by the service side received to a database; wherein, the preset trigger logic is used to trigger the addition operation of the task information of the scheduling task;
[0077] Send the task information of the scheduling task read from the database to a task processing unit, so that the task processing unit performs task processing operations based on task processing logic and outputs the generated task processing data.
[0078] The computer storage medium of the embodiments of the present invention may adopt any combination of one or more computer-readable media. The computer-readable media may be computer-readable signal media or computer-readable storage media. The computer-readable storage media may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage media may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
[0079] The computer-readable signal media may include data signals propagated in a baseband or as part of a carrier wave, which carry computer-readable program codes. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal media may also be any computer-readable media other than the computer-readable storage media, and the computer-readable media may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device.
[0080] The program codes contained on the computer-readable media may be transmitted by any appropriate media, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0081] The computer program codes for performing the operations of the present invention may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program codes may be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).
[0082] Of course, for a storage medium containing computer-executable instructions provided by an embodiment of the present invention, the computer-executable instructions are not limited to the above method operations, and can also execute relevant operations in the task scheduling method provided by any embodiment of the present invention.
[0083] Note that the above are only the preferred embodiments of the present invention and the technical principles applied. Those skilled in the art will understand that the present invention is not limited to the specific embodiments here, and various obvious changes, re-adjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, more other equivalent embodiments can be included, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A task scheduling system, characterized in that, Including: 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 includes a task scheduling module; Among them, at least one task processing unit for a 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, when detecting that a preset trigger logic is called by a service end, add the task information of the scheduling task sent by the service end received to the database; and, send the task information of the scheduling task read from the database to the task processing unit, so that the task processing unit performs a task processing operation based on the task processing logic and outputs the generated task processing data; among them, the preset trigger logic is used to trigger the addition operation of the task information of the scheduling task.
2. The system according to claim 1, wherein The task scheduling module is specifically used for: Based on a preset time interval, read the task information of the scheduling task in the database through a single-thread executor service, encapsulate the task information of the scheduling task into a runnable object and then submit it to a multi-thread executor service; Based on the exclusive mechanism of the database, send the runnable object to the task processing unit through a multi-thread executor service; among them, the exclusive mechanism of the database is used to control the sending operation of the runnable object by the only multi-thread executor service among multiple task scheduling modules that read the task information of the scheduling task.
3. The system according to claim 2, wherein The task scheduling module is further used for: After reading the task information of the scheduling task in the database, match the task information of the scheduling task with the task information in the task processing unit registered in the task scheduling module, and use the task information of the scheduling task with a successful match as the task information that can be encapsulated into a runnable object.
4. The system according to claim 1, wherein The task scheduling module is further used for: When detecting the startup of a task subsystem, obtain the task information of the scheduling task in the task interface on the task scheduling module and the instance bean class encapsulating the task processing logic of the scheduling task in the task scheduling interface, and register the scheduling task in the task processing unit based on the task information and the bean class.
5. The system according to claim 4, wherein The task subsystem further includes a statistical analysis module. Correspondingly, the task scheduling module is further used for: sending 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 task scheduling module and output the generated statistical analysis results.
6. The system according to claim 5, characterized in that, The task processing logic includes a call operation for calling the data reporting logic. Correspondingly, the task scheduling module is specifically used for: During the process of the task processing unit performing a task processing operation, when detecting that the data reporting logic is called by the task processing logic, send the generated task processing data corresponding to the data reporting logic to the statistical analysis module; among them, 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. The system according to claim 5, wherein The bean class also encapsulates the data statistics logic of the scheduling task. Correspondingly, the statistical analysis module is further configured to: Based on the bean class, register the data statistics logic of the scheduling task in the statistical analysis module, so that the statistical analysis module performs statistical analysis processing on the received task processing data based on the data statistics logic, and outputs the generated statistical analysis results.
8. The system according to claim 7, wherein The statistical analysis results include task overview data and / or verification success information. Correspondingly, the statistical analysis module is specifically configured to: When the data statistics logic includes the statistical logic based on the time window, generate task overview data based on the time window dimension based on the obtained task processing data corresponding to the time window, and output the task overview data; and / or When the data statistics logic includes the statistical logic based on the task dimension, obtain the processing status data in the task processing data corresponding to the scheduling task, and match the processing status data with the status verification standard corresponding to the scheduling task. If the match is successful, generate the verification success information of the scheduling task, and output the verification success information.
9. The system according to claim 4, wherein The task subsystem is built based on the springboot-starter mechanism.
10. A task scheduling method, characterized in that, Applied to the task scheduling system according to any one of claims 1-9, the method includes: When it is detected that the preset trigger logic is called by the service end, add the task information of the scheduling task sent by the service end received to the database; wherein, the preset trigger logic is used to trigger the addition operation of the task information of the scheduling task; Send the task information of the scheduling task read from the database to the task processing unit, so that the task processing unit performs task processing operations based on the task processing logic, and outputs the generated task processing data.
11. An electronic device, characterized in that, The electronic device includes: One or more processors; A memory for storing one or more programs; 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. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions are used to execute the task scheduling method as claimed in claim 10 when executed by a computer processor.
Citation Information
Patent Citations
Task scheduling method and system
CN108984290A