Task scheduling method and device based on ElasticJob framework, equipment and storage medium
Through the ElasticJob framework, the batch tasks are annotated and grouped to build a task tree, which solves the problem of low task processing efficiency in the existing technology and realizes efficient task scheduling.
Patent Information
- Application Number
- CN202311840754.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2025-07-01
AI Technical Summary
In the prior art, stand-alone deployment and distributed scheduling frameworks cannot efficiently process batch tasks, resulting in low task processing efficiency.
The ElasticJob framework is used to annotate batch candidate tasks, generate batch target tasks, and build a task tree through scene identification grouping, and use the ElasticJob framework to execute the task tree for scheduling.
This greatly reduces the amount of data in the task scheduling process, improves the scheduling efficiency of batch target tasks, and realizes the rapid identification and efficient processing of tasks in the same scenario.
Smart Images

Figure CN120234102A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a task scheduling method, device, equipment and storage medium based on an ElasticJob framework. Background Art
[0002] With the rapid development of computer technology, the amount of tasks that servers need to handle is gradually increasing. In order to process all tasks efficiently, staff often use some task scheduling systems to handle complex tasks.
[0003] At present, the task scheduling on the market specifically includes the following two types of implementation methods: the first is for light users, directly using the conventional scheduling framework based on Quartz, and deploying on a single machine. The second is to introduce an external task scheduling platform, deploy on multiple machines, and complete complex scheduling requirements. For the first implementation method, its limitations are very obvious. It is only suitable for situations where the amount of tasks is very small. Once the amount of tasks is too large, the stability of the server cannot be guaranteed. Due to the lack of consistency guarantee, it can only be deployed on a single machine. If a single machine fails, it will directly cause the service to be offline and unavailable. In addition, due to the limitations of single-machine performance, as the number of tasks increases, the machine performance bottleneck will soon be reached, and the lack of horizontal expansion capabilities will eventually lead to unstable services. The second implementation method is a distributed, microservice architecture. At present, there are many conventional distributed scheduling frameworks, each with different focuses, and the needs of different departments are also different. Each scheduling framework can only handle tasks of the corresponding type. For departments with large task volumes, their corresponding scheduling frameworks will be congested, making it impossible to process tasks on time.
[0004] There is currently no effective solution to the technical problem that both the existing single-machine deployment and distributed scheduling frameworks cannot efficiently handle batch tasks, resulting in low task processing efficiency. Summary of the invention
[0005] The purpose of the present invention is to provide a task scheduling method, device, equipment and storage medium based on the ElasticJob framework, which can solve the problem that both the single-machine deployment and distributed scheduling framework in the prior art cannot efficiently process batch tasks, resulting in low task processing efficiency.
[0006] One aspect of the present invention provides a task scheduling method based on the ElasticJob framework. The method includes: obtaining a batch of candidate tasks for processing by the ElasticJob framework; annotating the batch of candidate tasks to generate a batch of target tasks; parsing to obtain the scenario identifiers of the batch of target tasks, grouping the batch of target tasks by the scenario identifiers, and respectively constructing the grouped tasks into multiple task trees, where a task tree is a tree-like structure formed by each target task as a node; and executing the task trees based on the ElasticJob framework to achieve the scheduling of the batch of target tasks.
[0007] Optionally, annotating the batch of candidate tasks to generate a batch of target tasks includes: in response to the user's click operation on the target task, obtaining the target task parameters input by the user from the display page; matching the target task parameters with the batch of candidate tasks, and extracting the candidate tasks with successful matching from the batch of candidate tasks; obtaining a preset annotation identifier, and adding the annotation identifier to the candidate tasks with successful matching to generate a batch of target tasks.
[0008] Optionally, grouping the batch of target tasks by the scenario identifiers includes: obtaining a preset scenario relationship table from the database, where the preset scenario relationship table includes multiple types of scenario identifiers and the hierarchical numbers corresponding to the scenario identifiers; matching the scenario identifiers of the batch of target tasks with the preset scenario relationship table to determine the primary identifier and the secondary identifier in the scenario identifier of the target task, where the secondary identifier is a subset of the primary identifier; respectively dividing the target tasks corresponding to the primary identifier into a group; matching the primary identifier and the secondary label to determine the primary identifier to which the secondary identifier belongs; and dividing the target tasks corresponding to the secondary identifier into the task group of the target tasks corresponding to the belonging primary identifier.
[0009] Optionally, respectively constructing the grouped tasks into multiple task trees includes: sequentially extracting a task group as the target task group, and determining the target task corresponding to the primary identifier in the target task group as the root node; determining the target task corresponding to the secondary identifier in the target task group as the child node of the root node, and constructing the task tree corresponding to the target task group; and so on until the task trees corresponding to other task groups are created.
[0010] Optionally, executing the task trees based on the ElasticJob framework to achieve the scheduling of the batch of target tasks includes: determining the arrangement order of the child nodes in the belonging task tree; inputting the task tree into the ElasticJob framework, and executing the target task corresponding to the root node of the task tree through the ElasticJob framework; and after the execution of the target task corresponding to the root node ends, sequentially executing the target tasks corresponding to the child nodes in the ElasticJob framework according to the arrangement order.
[0011] Optionally, after executing a task tree based on the ElasticJob framework to implement scheduling of a batch of target tasks, the method further includes: in response to a user's operation of adjusting task parameters, obtaining a target task to be corrected and adjustment parameters of the target task; determining status information of the target task, and adjusting the target task based on the status information; if the status information of the target task is not executed, replacing the original parameters of the target task with the adjustment parameters of the target task; if the status information of the target task is being executed, stopping the execution of the target task, determining that the target task is the last task to be executed in the task tree to which it belongs, replacing the original parameters of the target task with the adjustment parameters of the target task, and executing the next target task adjacent to the target task through the ElasticJob framework.
[0012] Optionally, executing a task tree based on the ElasticJob framework to implement scheduling of a batch of target tasks further includes: when monitoring and obtaining execution exception information of a target task, alarming the target task; judging the alarm method and alarm type of the target task, and sending the execution exception information of the target task to a corresponding port for processing according to the alarm type of the target task.
[0013] Another aspect of the present invention provides a task scheduling device based on the ElasticJob framework. The device includes: an acquisition module, configured to acquire a batch of candidate tasks for processing by the ElasticJob framework; an annotation module, configured to annotate the batch of candidate tasks to generate a batch of target tasks; a grouping module, configured to parse and obtain a scenario identifier of the batch of target tasks, group the batch of target tasks according to the scenario identifier, and respectively construct the grouped tasks into a plurality of task trees, where a task tree is a tree-like structure formed by each task as a node; a scheduling module, configured to execute the task tree based on the ElasticJob framework to implement scheduling of the batch of target tasks.
[0014] Another aspect of the present invention provides a computer device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the computer program, it implements the task scheduling method based on the ElasticJob framework in any of the above embodiments.
[0015] Another aspect of the present invention provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the task scheduling method based on the ElasticJob framework in any of the above embodiments. Further, the computer-readable storage medium mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function, etc.; the data storage area can store data created according to the use of blockchain nodes, etc.
[0016] By annotating a batch of candidate tasks, the present invention generates a batch of target tasks, greatly reducing the amount of data in the task scheduling process; grouping the batch of target tasks and constructing and generating multiple task trees facilitate the quick identification of tasks in the same scenario by the ElasticJob framework, improving the scheduling efficiency of the batch of target tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of illustrating the preferred embodiments and are not considered to be a limitation of the present invention. Moreover, throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0018] Figure 1 An alternative flowchart of a task scheduling method based on the ElasticJob framework provided in Embodiment 1 of the present invention is shown;
[0019] Figure 2 A structural block diagram of a task scheduling device based on the ElasticJob framework provided in Embodiment 2 of the present invention is shown; and
[0020] Figure 3 A block diagram of a computer device suitable for implementing the task scheduling method based on the ElasticJob framework provided in Embodiment 3 of the present invention is shown. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0022] It should be noted that, in this article, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.
[0023] Embodiment 1
[0024] This embodiment provides a task scheduling method based on the ElasticJob framework,Figure 1 The flowchart of the task scheduling method based on the ElasticJob framework is shown. As Figure 1 shown, the task scheduling method based on the ElasticJob framework may include steps S101 to S104, where:
[0025] Step S101: Obtain a batch of candidate tasks for processing by the ElasticJob framework;
[0026] The batch of candidate tasks can be dependency packages of multiple type system platforms, used to represent the functional requirements of the corresponding scenarios.
[0027] Step S102: Annotate the batch of candidate tasks to generate a batch of target tasks;
[0028] Since the code in a candidate task is complex and not all code needs to be executed, if all the batch of candidate tasks are uniformly input into the ElasticJob framework for data processing, it will waste the processing resources of the system. By annotating the batch of candidate tasks to screen out the batch of target tasks that need to be executed, the ElasticJob framework only needs to execute the batch of target tasks, which can avoid wasting system resources and greatly improve the efficiency of task scheduling at the same time.
[0029] Preferably, step S102 may include steps S1021 to S1023, where:
[0030] Step S1021: In response to the user's click operation on the target task, obtain the target task parameters input by the user from the display page;
[0031] The target task parameters can be code keywords, and the code keywords are set according to actual requirements and are not limited here.
[0032] Step S1022: Match the target task parameters with the batch of candidate tasks, and extract the candidate tasks with successful matches from the batch of candidate tasks;
[0033] When matching the target task parameters with the batch of candidate tasks, if the candidate task contains the target task parameters, it indicates a successful match.
[0034] Step S1023: Obtain a preset annotation identifier, and add the annotation identifier to the candidate tasks with successful matches to generate a batch of target tasks.
[0035] The preset annotation identifier can be @ScheduledJob, or other annotation identifiers with distinguishable functions, which are not limited here. Add the annotation identifier to the front end of the code of the candidate tasks with successful matches to generate a batch of target tasks in this way.
[0036] Step S103: Parse to obtain the scenario identifiers of a batch of target tasks, group the batch of target tasks by the scenario identifiers, and respectively construct the grouped tasks into multiple task trees, where a task tree is a tree structure formed by each target task as a node;
[0037] The code types of target tasks in the same scenario have common features, while the code types of target tasks in different scenarios do not have common features. Dividing the target tasks in the same scenario into a group and constructing them into corresponding task trees can unify the data in the same scenario and facilitate the rapid scheduling of the ElasticJob framework.
[0038] Specifically, the scenario identifier can be the task name.
[0039] Preferably, step S103 may include steps S1031 to S1035, where:
[0040] Step S1031: Obtain a preset scenario relationship table from the database, where the preset scenario relationship table includes multiple types of scenario identifiers and the level numbers corresponding to the scenario identifiers;
[0041] The preset scenario relationship table is obtained by summarizing historical records. The preset scenario relationship table contains multi-level scenario identifiers of different types. For example, the types can be scenarios such as registration, shopping, and appeal. Among them, the execution steps in the registration scenario are divided into A1 to A6, the execution steps in the shopping scenario are divided into B1 to B4, and the execution steps in the appeal scenario are divided into C1 to C5. Registration, shopping, and appeal are all first-level identifiers, and A1 to A6, B1 to B4, and C1 to C5 are all second-level identifiers. In the preset scenario relationship table, the second-level identifiers are subsets of the first-level identifiers. That is, the target tasks corresponding to the first-level identifiers are all code segments for implementing the corresponding scenarios, and the target tasks corresponding to the second-level identifiers are only part of the code segments of the target tasks corresponding to the first-level identifiers. It should be particularly noted that the preset scenario relationship table may also include third-level identifiers, fourth-level identifiers... Correspondingly, the third-level identifiers are subsets of the second-level identifiers, and the fourth-level identifiers are subsets of the third-level identifiers. There is no limitation here.
[0042] Step S1032: Match the scenario identifiers of the batch of target tasks with the preset scenario relationship table to determine the first-level and second-level identifiers in the scenario identifiers of the target tasks, where the second-level identifiers are subsets of the first-level identifiers;
[0043] By determining the levels of the scenario identifiers of the target tasks, it is convenient to group the target tasks, which is beneficial to the rapid scheduling of tasks by the ElasticJob framework.
[0044] Step S1033: Divide the target tasks corresponding to the first-level identifiers into groups respectively;
[0045] Since the first-level identification represents the general term for tasks of the corresponding type of scenario, and the requirements of different types of scenarios vary greatly, the first-level identification can be used to quickly group target tasks and locate basic scenarios, which is conducive to improving the efficiency of the subsequent division of target tasks.
[0046] Step S1034, matching the primary identifier and the secondary tag to determine the primary identifier to which the secondary identifier belongs;
[0047] After the level of the scene identification of the target task is determined, the primary identification and the secondary identification of the target task are matched based on the preset scene relationship table to determine the primary identification to which each secondary identification belongs.
[0048] Step S1035 , classifying the target task corresponding to the secondary identifier into the task group of the target task corresponding to the primary identifier.
[0049] Since the target tasks have been grouped for the first time based on the first-level identifier, the target tasks corresponding to the second-level identifier are then divided into the task group of the target tasks corresponding to the first-level identifier, that is, the target tasks of the same type of scenario are divided into one group, and the tasks of the same scenario have commonality in execution code. The target tasks in the same task group are input into the ElasticJob framework for processing, which greatly improves the task scheduling efficiency of the ElasticJob framework.
[0050] Preferably, step S103 may further include steps S1031' to S1033', wherein:
[0051] Step S1031', extracting one task group in turn as a target task group, and determining a target task corresponding to a primary identifier in the target task group as a root node;
[0052] Step S1032', determining the target task corresponding to the secondary identifier in the target task group as a child node of the root node, and constructing a task tree corresponding to the target task group;
[0053] Step S1033', and so on, until the task trees corresponding to other task groups are created.
[0054] The target tasks in each task group are constructed in the form of a task tree, making the relationship between the target tasks more intuitive and facilitating the ElasticJob framework to quickly identify the target tasks, thereby improving the scheduling efficiency of the target tasks.
[0055] Step S104, executing the task tree based on the ElasticJob framework to implement the scheduling of batch target tasks.
[0056] Input the task tree into the ElasticJob framework. The ElasticJob framework can process target tasks in an orderly manner based on nodes at different levels, greatly improving the scheduling efficiency of batch target tasks.
[0057] Preferably, step S104 may include steps S1041 to S1043, where:
[0058] Step S1041, determine the arrangement order of the child nodes in the task tree to which they belong;
[0059] Specifically, the arrangement order of the child nodes in the task tree to which they belong may be the order of the acquisition time nodes of the target tasks corresponding to the child nodes, or other forms of order (such as alphabetical order), which is not limited here.
[0060] Step S1042, input the task tree into the ElasticJob framework, and execute the target task corresponding to the root node of the task tree through the ElasticJob framework;
[0061] In the ElasticJob framework, the target task corresponding to the root node of the task tree is preferentially executed. Since the target task corresponding to the root node is a first-level identifier, and the target task of the first-level identifier represents the code segments of all execution steps for implementing a certain scenario, preferentially executing this type of target task is beneficial for the ElasticJob framework to remember the data types of this type of scenario, thereby improving the scheduling efficiency of other data in this type of scenario.
[0062] Step S1043, after the execution of the target task corresponding to the root node ends, sequentially execute the target tasks corresponding to the child nodes in the ElasticJob framework according to the arrangement order.
[0063] After the execution of the target task corresponding to the root node ends, the ElasticJob framework has remembered the scenario data of this target task. Therefore, when executing the target tasks corresponding to the child nodes, the ElasticJob framework can process them quickly.
[0064] It should be noted that the operation of the ElasticJob framework to process target tasks is a conventional means and is not limited here.
[0065] Preferably, after executing the task tree based on the ElasticJob framework to implement the scheduling of batch target tasks, the method further includes steps A1 to A4, where:
[0066] Step A1, in response to the user's adjustment operation on task parameters, obtain the target task to be corrected and the adjustment parameters of the target task;
[0067] The original parameters of the target task are pre-set and cannot adapt to the real-time needs of users. By providing an operation to adjust the task parameters, the target task can be adjusted in a timely manner, greatly improving the user experience.
[0068] Step A2, determine the status information of the target task, and adjust the target task based on the status information;
[0069] The status information may include not executed and being executed. The adjustment methods for target tasks with different status information are different.
[0070] Step A3, if the status information of the target task is not executed, replace the original parameters of the target task with the adjusted parameters of the target task;
[0071] When the status information of the target task is not executed, at this time, the target task has not yet interacted substantially with the ElasticJob framework processor, and the parameters of the target task can be directly adjusted, that is, replace the original parameters of the target task with the adjusted parameters of the target task.
[0072] Step A4, if the status information of the target task is being executed, stop executing the target task, determine that the target task is the last executed task of the task tree to which it belongs, replace the original parameters of the target task with the adjusted parameters of the target task, and execute the next target task adjacent to the target task through the ElasticJob framework.
[0073] When the status information of the target task is being executed, at this time, the target task has interacted substantially with the processor of the ElasticJob framework. If the parameters of the target task are directly modified, it will cause processing exceptions in the ElasticJob framework and reduce the scheduling efficiency of batch target tasks. In this embodiment, by stopping the execution of the target task, setting the target task as the last executed task of the task tree to which it belongs, and replacing the original parameters of the target task with the adjusted parameters of the target task, at the same time, determining the next target task adjacent to the target task as the task to be executed by the current ElasticJob framework, ensuring the uninterrupted operation of the ElasticJob framework, thereby realizing the effective scheduling of batch target tasks and greatly improving the scheduling efficiency of batch target tasks.
[0074] Preferably, step S104 may include steps S1041' to S1042', where:
[0075] Step S1041', when monitoring and obtaining the execution exception information of the target task, alarm the target task;
[0076] Step S1042’, determine the alarm method and alarm type of the target task, and send the execution exception information of the target task to the corresponding port for processing according to the alarm type of the target task.
[0077] Specifically, the alarm methods may include DingTalk / Lark alarm, email alarm, and SMS alarm, and the alarm types may include system alarm, business alarm, etc. By setting the alarm method and alarm type as different parameters, different types of alarms can be split in a fine-grained manner and notified to different personnel.
[0078] In addition, this embodiment also sets up task logs. The logs generated during the task running process record log information such as the start, running, exception, end, and status change of the task, which is convenient for users to trace the task scheduling process information.
[0079] In this embodiment, by annotating a batch of candidate tasks to generate a batch of target tasks, the data volume in the task scheduling process is greatly reduced; the batch of target tasks are grouped, and multiple task trees are constructed and generated, which is convenient for the ElasticJob framework to quickly identify tasks in the same scenario and improves the scheduling efficiency of the batch of target tasks.
[0080] Embodiment 2
[0081] Embodiment 2 of the present invention also provides a task scheduling device based on the ElasticJob framework. This task scheduling device based on the ElasticJob framework corresponds to the task scheduling method based on the ElasticJob framework provided in the above Embodiment 1. The corresponding technical features and technical effects are not described in detail in this embodiment, and the relevant parts can refer to the above Embodiment 1. Specifically, Figure 2 shows the structural block diagram of this task scheduling device based on the ElasticJob framework. As Figure 2 shown, this task scheduling device 200 based on the ElasticJob framework includes an acquisition module 201, an annotation module 202, a grouping module 203, and a scheduling module 204, where:
[0082] The acquisition module 201 is used to acquire a batch of candidate tasks for processing by the ElasticJob framework;
[0083] The annotation module 202 is connected to the acquisition module 201 and is used to annotate the batch of candidate tasks to generate a batch of target tasks;
[0084] The grouping module 203 is connected to the annotation module 202 and is used to parse and obtain the scenario identifier of the batch of target tasks, group the batch of target tasks according to the scenario identifier, and respectively construct the grouped tasks into multiple task trees, where the task tree is a tree-like structure formed by each task as a node;
[0085] A scheduling module 204, connected to the grouping module 203, is used to execute a task tree based on the ElasticJob framework to implement the scheduling of a batch of target tasks.
[0086] Optionally, the annotation module is specifically used for: in response to a user's click operation on a target task, obtaining the target task parameters input by the user from the display page; matching the target task parameters with a batch of candidate tasks, and extracting the candidate tasks with successful matches from the batch of candidate tasks; obtaining a preset annotation identifier, and adding the annotation identifier to the candidate tasks with successful matches to generate a batch of target tasks.
[0087] Optionally, the grouping module is specifically used for: obtaining a preset scenario relationship table from a database, where the preset scenario relationship table includes multiple types of scenario identifiers and the hierarchical numbers corresponding to the scenario identifiers; matching the scenario identifier of the batch of target tasks with the preset scenario relationship table to determine the first-level identifier and the second-level identifier in the scenario identifier of the target task, where the second-level identifier is a subset of the first-level identifier; dividing the target tasks corresponding to the first-level identifier into one group respectively; matching the first-level identifier and the second-level mark to determine the first-level identifier to which the second-level identifier belongs; and dividing the target tasks corresponding to the second-level identifier into the task group corresponding to the target tasks corresponding to the first-level identifier to which it belongs.
[0088] Optionally, the grouping module is further used for: sequentially extracting one task group as the target task group, and determining the target task corresponding to the first-level identifier in the target task group as the root node; determining the target task corresponding to the second-level identifier in the target task group as the child node of the root node, and constructing a task tree corresponding to the target task group; and so on until the task trees corresponding to other task groups are created.
[0089] Optionally, the scheduling module is specifically used for: determining the arrangement order of the child nodes in the task tree to which they belong; inputting the task tree into the ElasticJob framework, and executing the target task corresponding to the root node of the task tree through the ElasticJob framework; and after the execution of the target task corresponding to the root node ends, sequentially executing the target tasks corresponding to the child nodes in the ElasticJob framework according to the arrangement order.
[0090] Optionally, the device further includes an adjustment module, configured to: in response to a user's adjustment operation on task parameters, obtain a target task to be corrected and adjustment parameters of the target task; determine status information of the target task, and adjust the target task based on the status information; if the status information of the target task is not executed, replace the original parameters of the target task with the adjustment parameters of the target task; if the status information of the target task is being executed, stop executing the target task, determine that the target task is the last task to be executed in the task tree to which it belongs, replace the original parameters of the target task with the adjustment parameters of the target task, and execute the next target task adjacent to the target task through the ElasticJob framework.
[0091] Optionally, the scheduling module is further configured to: when monitoring and obtaining execution exception information of a target task, alarm the target task; determine the alarm method and alarm type of the target task, and send the execution exception information of the target task to the corresponding port for processing according to the alarm type of the target task.
[0092] Embodiment III
[0093] Figure 3 FIG. shows a block diagram of a computer device suitable for implementing a task scheduling method based on the ElasticJob framework according to Embodiment III of the present invention. In this embodiment, the computer device 300 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers) that executes a program. As Figure 3 shown, the computer device 300 of this embodiment at least includes, but is not limited to: a memory 301, a processor 302, and a network interface 303 that can communicate with each other through a system bus. It should be noted that Figure 3 only the computer device 300 with components 301-303 is shown, but it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented.
[0094] In this embodiment, the memory 303 includes at least one type of computer-readable storage medium. The readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 301 may be an internal storage unit of the computer device 300, such as the hard disk or memory of the computer device 300. In other embodiments, the memory 301 may also be an external storage device of the computer device 300, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. equipped on the computer device 300. Of course, the memory 301 may also include both the internal storage unit and the external storage device of the computer device 300. In this embodiment, the memory 301 is generally used to store the operating system installed on the computer device 300 and various application software, such as the program code of the task scheduling method based on the ElasticJob framework.
[0095] In some embodiments, the processor 302 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 302 is generally used to control the overall operation of the computer device 300. For example, it performs control and processing related to data interaction or communication with the computer device 300. In this embodiment, the processor 302 is used to run the program code of the steps of the task scheduling method based on the ElasticJob framework stored in the memory 301.
[0096] In this embodiment, the task scheduling method based on the ElasticJob framework stored in the memory 301 may also be divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 302) to complete the present invention.
[0097] The network interface 303 may include a wireless network interface or a wired network interface, which is generally used to establish a communication link between the computer device 300 and other computer devices. For example, the network interface 303 is used to connect the computer device 300 to an external terminal through a network, and establish a data transmission channel and a communication link between the computer device 300 and the external terminal. The network may be a wireless or wired network such as an enterprise intranet (Intranet), the Internet, the Global System of Mobile communication (abbreviated as GSM), Wideband Code Division Multiple Access (abbreviated as WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0098] Embodiment 4
[0099] This embodiment also provides a computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, server, App application mall, etc., on which a computer program is stored, and when the computer program is executed by a processor, the steps of the task scheduling method based on the ElasticJob framework are implemented.
[0100] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the embodiments of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order from here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. Thus, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0101] It should be noted that the serial numbers of the embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments.
[0102] Through the description of the above embodiments, those skilled in the art can clearly understand that the above method of the embodiment can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0103] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.
Claims
1. A task scheduling method based on the ElasticJob framework, characterized in that, The method comprises: Get a batch of candidate tasks for processing by the ElasticJob framework; Annotating the batch of candidate tasks to generate batch of target tasks; Parsing and obtaining the scenario identifiers of the batch target tasks, grouping the batch target tasks according to the scenario identifiers, and constructing the grouped tasks into a plurality of task trees, wherein the task tree is a tree structure consisting of each target task as a node; The task tree is executed based on the ElasticJob framework to implement the scheduling of the batch target tasks.
2. The method according to claim 1, wherein The step of annotating the batch of candidate tasks to generate the batch of target tasks includes: In response to a user's clicking operation on a target task, obtaining target task parameters input by the user from a display page; Matching the target task parameters with the batch of candidate tasks, and extracting successfully matched candidate tasks from the batch of candidate tasks; A preset annotation identifier is obtained, and the annotation identifier is added to the successfully matched candidate tasks to generate batch target tasks.
3. The method according to claim 1, characterized in that, The grouping the batch target tasks according to the scenario identifier includes: Acquire a preset scene relationship table from a database, wherein the preset scene relationship table includes multiple types of scene identifiers and level numbers corresponding to the scene identifiers; Matching the scene identifiers of the batch target tasks with the preset scene relationship table to determine the primary identifier and the secondary identifier in the scene identifier of the target task, wherein the secondary identifier is a subset of the primary identifier; Divide the target tasks corresponding to the first-level identification into a group respectively; Matching the primary identifier and the secondary tag to determine the primary identifier to which the secondary identifier belongs; The target task corresponding to the secondary identification is divided into the task group of the target task corresponding to the primary identification.
4. The method according to claim 1, characterized in that The grouped tasks are constructed into multiple task trees, including: Extracting one task group in turn as a target task group, and determining a target task corresponding to a primary identifier in the target task group as a root node; Determine the target task corresponding to the secondary identifier in the target task group as a child node of the root node, and construct a task tree corresponding to the target task group; And so on, until the task trees corresponding to other task groups are created.
5. The method according to claim 4, wherein The executing the task tree based on the ElasticJob framework to implement the scheduling of the batch target tasks includes: Determine the order of arrangement of the sub-nodes in the corresponding task tree; Input the task tree into the ElasticJob framework, and execute the target task corresponding to the root node of the task tree through the ElasticJob framework; After the target task corresponding to the root node is executed, the target tasks corresponding to the child nodes are executed in sequence in the ElasticJob framework according to the arrangement order.
6. The method according to claim 4, wherein After executing the task tree based on the ElasticJob framework to implement scheduling of the batch target tasks, the method further includes: In response to a user's adjustment operation on a task parameter, obtaining a target task to be corrected and an adjustment parameter of the target task; Determine the status information of the target task, and adjust the target task according to the status information; If the status information of the target task is not executed, replace the original parameters of the target task with the adjusted parameters of the target task; If the status information of the target task is being executed, stop executing the target task, determine that the target task is the last executed task of the task tree to which it belongs, replace the original parameters of the target task with the adjusted parameters of the target task, and execute the next target task adjacent to the target task through the ElasticJob framework.
7. The method according to any one of claims 1-6, characterized in that The execution of the task tree based on the ElasticJob framework to achieve the scheduling of the batch target tasks further includes: When the execution exception information of the target task is monitored and obtained, alarm the target task; Judge the alarm method and alarm type of the target task, and send the execution exception information of the target task to the corresponding port for processing according to the alarm type of the target task.
8. A task scheduling device based on the ElasticJob framework, characterized in that The device includes: An acquisition module, configured to acquire a batch of candidate tasks for processing by the ElasticJob framework; An annotation module, configured to annotate the batch of candidate tasks to generate a batch of target tasks; A grouping module, configured to parse and obtain the scenario identifier of the batch of target tasks, group the batch of target tasks according to the scenario identifier, and respectively construct the grouped tasks into multiple task trees, where the task tree is a tree structure formed by each task as a node; A scheduling module, configured to execute the task tree based on the ElasticJob framework to achieve the scheduling of the batch of target tasks.
9. A computer device, the computer device comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program, when executed by the processor, implements the method according to any one of claims 1 to 7.