A method, device, storage medium and electronic device for processing timing tasks

By determining target scheduled tasks and generating task policies based on the task management table, the problems of task backlog and policy errors in scheduled task processing are solved, and automatic and timely scheduled task distribution and execution are achieved.

CN114942839BActive Publication Date: 2025-12-19PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210694993.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-20
Publication Date
2025-12-19
Estimated Expiration
2042-06-20

AI Technical Summary

Technical Problem

Existing scheduled task processing methods are prone to task backlog and processing strategy errors, especially when the number of scheduled tasks increases and processing strategies become more diversified.

Method used

The target scheduled task is determined in real time based on the task management table, and the task strategy is verified and generated. The strategy is then sent to the target execution server for execution. The target execution server automatically distributes the scheduled task. When generating the task strategy, configuration information such as the number of executions, fragmentation information and interruption location are taken into account.

Benefits of technology

It enables automatic and timely distribution of scheduled tasks, ensuring the accuracy and reliability of task strategies, avoiding errors caused by task backlog and manual processing, and guaranteeing the correctness of task execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114942839B_ABST
    Figure CN114942839B_ABST
Patent Text Reader

Abstract

The application discloses a method, device, storage medium and electronic equipment for processing a timing task, wherein the method comprises the following steps: determining a target timing task to be processed based on a task management table; checking the target timing task to obtain a checking result of the target timing task; generating a target task strategy corresponding to the target timing task based on the target timing task in the case that the checking result of the target task is passed; and sending the target timing task and the target task strategy to a target execution server, so that the target execution server executes the target timing task according to the target task strategy. In the application, the timing task can be processed in time and accurately, and the problems that the current timing task processing method is prone to cause the accumulation of timing tasks and the processing strategy is prone to errors are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a method and device for processing timing task, storage medium and electronic equipment. BACKGROUND

[0002] With the continuous development of Internet technology and the continuous increase of application services, the timing tasks in the computer system are increasing, and the processing strategies of the timing tasks are gradually becoming diverse.

[0003] The existing processing method of the timing task is to monitor and control the execution of the timing task by artificial. In the early stage of the business, when the number of timing tasks is small and the processing strategy is relatively single, the above-mentioned artificial processing of simple task attributes can basically meet the business requirements. However, with the continuous development of the business, the number of timing tasks in the system increases, and the processing strategy of the timing task becomes diverse, it is difficult to realize the compatibility of multiple business requirements by artificial processing, which can easily cause the accumulation of timing tasks, and the problem of easy error of artificial determination of timing task processing strategy. SUMMARY

[0004] Therefore, the present application provides a method and device for processing timing task, storage medium and electronic equipment, which mainly aims to solve the problem that the current timing task processing method is easy to cause the accumulation of timing tasks and the error of processing strategy.

[0005] To solve the above problems, the present application provides a method for processing timing task, comprising:

[0006] determining a target timing task to be processed based on a task management table in real time;

[0007] verifying the target timing task to obtain a verification result of the target timing task;

[0008] generating a target task strategy corresponding to the target timing task based on the target timing task, in the case that the verification result of the target timing task is verified;

[0009] sending the target timing task and the target task strategy to a target execution server, so that the target execution server executes the target timing task according to the target task strategy.

[0010] Optionally, the target timing task to be processed is determined based on the task management table, specifically comprising:

[0011] obtaining the task state of each timing task based on the task management table;

[0012] The timing task whose task state is determined as the initialization state is the target timing task; or, the timing task whose task state is determined as the interruption state is the target timing task, or the timing task whose task state is determined as the execution failure state is the target timing task.

[0013] Optionally, after determining the target timing task to be processed based on the task management table, the method further comprises: updating a state of the target timing task to an execution state, and storing the updated execution state of the target timing task into the task management table.

[0014] The checking of the target timing task to obtain a checking result of the target timing task specifically comprises:

[0015] The target timing task is checked based on the task distribution module at least according to a task type of the target timing task to obtain a checking result.

[0016] Optionally, in a case where the checking result of the target timing task is a checking pass, the method further comprises: obtaining configuration information of the target timing task.

[0017] The generating of the target task strategy corresponding to the target timing task based on the target timing task specifically comprises:

[0018] The target task strategy corresponding to the target timing task is generated based at least on the configuration information of the target timing task.

[0019] Optionally, the configuration information comprises any one or more of the following: an execution frequency, sharding information, and an interruption position.

[0020] In a case where the configuration information comprises the execution frequency, the generating of the target task strategy corresponding to the target timing task based at least on the configuration information of the target timing task specifically comprises: determining a target execution frequency of the target timing task based on the execution frequency to generate the target task strategy.

[0021] In a case where the configuration information comprises the interruption position, the generating of the target task strategy corresponding to the target timing task based at least on the configuration information of the target timing task specifically comprises: determining a starting execution position based on the interruption position to generate the target task strategy.

[0022] In a case where the configuration information comprises shard information, the at least one configuration information of the target timing task is used to generate a target task strategy corresponding to the target timing task, specifically comprising: determining a plurality of sub-timing tasks corresponding to the target timing task based on a shard quantity in the shard information, and determining a target execution server corresponding to each of the sub-timing tasks based on a shard strategy in the shard information, so as to generate the target task strategy.

[0023] Optionally, the target execution server corresponding to each of the sub-timing tasks is determined based on the shard strategy in the shard information, specifically comprising:

[0024] based on an average allocation method, an execution server with a current task quantity less than an average task quantity is determined as the target execution server;

[0025] Alternatively, based on a hash value of the target timing task, a hash round robin allocation method is used to determine a starting execution server corresponding to the target timing task, and each of the target execution servers is determined based on the starting execution server;

[0026] Alternatively, based on a hash value of the target timing task, a hash round robin allocation method is used to determine a starting execution server corresponding to the target timing task, and each of the target execution servers is determined based on the starting execution server.

[0027] Optionally, the method for processing timing tasks further comprises:

[0028] receiving, in real time, execution information of the target timing task sent by the target execution server;

[0029] storing the execution information and a corresponding relationship between the execution information and the target timing task into the task management table.

[0030] To solve the above problems, the present application provides a device for processing timing tasks,

[0031] a determination module configured to determine a target timing task to be processed based on a task management table;

[0032] a verification module configured to verify the target timing task to obtain a verification result of the target timing task;

[0033] a generation module configured to, in a case where the verification result of the target task is a verification pass, generate a target task strategy corresponding to the target timing task based on the target timing task;

[0034] The sending module is configured to send the target timing task and the target task policy to a target execution server, so that the target execution server executes the target timing task according to the target task policy.

[0035] To solve the above problems, the present application provides a storage medium, which stores a computer program, and the computer program implements the steps of the processing timing task method according to any one of the above when executed by a processor.

[0036] To solve the above problems, the present application provides an electronic device, which at least includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the processing timing task method according to any one of the above when executing the computer program stored on the memory.

[0037] The method, device, storage medium and electronic device for processing timing tasks in the present application can automatically generate a task policy according to a target timing task, and send the target timing task to a target execution server, so that the target execution server can execute the target timing task, realize automatic and timely distribution of the timing task, solve the problem of accumulation of timing tasks due to manual monitoring and distribution of the timing task, generate a corresponding task policy according to the timing task, make the generation of the task policy more accurate and reliable, and solve the problem of errors in manual determination of the task policy. Before generating the task policy, the target task is verified to ensure the correctness of subsequent task execution, and provide a guarantee for timely and accurate execution of the timing task.

[0038] The above description is only a summary of the technical solutions of the present application. In order to more clearly understand the technical means of the present application, the content of the specification can be implemented, and in order to make the above and other purposes, characteristics and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application are described below. BRIEF DESCRIPTION OF DRAWINGS

[0039] By reading the detailed description of the preferred embodiments below, 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 as limiting the present application. Moreover, the same reference symbols are used to represent the same components throughout the drawings. In the drawings:

[0040] Figure 1 Flowchart of a method for processing timing tasks according to an embodiment of the present application;

[0041] Figure 2 Flowchart of a method for processing timing tasks according to another embodiment of the present application;

[0042] Figure 3A flow chart of a method of processing a timing task according to another embodiment of the application;

[0043] Figure 4 A block diagram of an apparatus for processing a timing task according to yet another embodiment of the application;

[0044] Figure 5 A block diagram of an electronic device according to an embodiment of the application. DETAILED DESCRIPTION

[0045] Various aspects and features of the present application are described herein with reference to the drawings.

[0046] It is to be understood that various modifications can be made to the embodiments described herein. Thus, the description is not to be considered as limiting, but merely as a description of exemplary embodiments. Other modifications of the application will occur to those skilled in the art upon reading the description of the application.

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the application and, together with the general description of the application given above, and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0048] These and other characteristics of the present application will become apparent from the following description of the preferred forms thereof given with reference to the accompanying drawings.

[0049] It should also be understood that, although the present application has been described with reference to certain specific embodiments thereof, many other embodiments will be apparent to those of ordinary skill in the art in view of the above teachings.

[0050] The above and other aspects, features, and advantages of the present application will become apparent from the following detailed description, which is to be read in connection with the accompanying drawings.

[0051] Specific embodiments of the present application are described hereinbelow, with reference to the drawings; however, it will be understood that the described embodiments are merely examples of the present application, which can be embodied in many different forms. Well-known and / or redundant functions and structures have not been described in detail in order to not obscure the present application unnecessarily. Accordingly, the detailed description of the specific structural and functional details set forth herein were provided as examples only so as to provide a thorough understanding thereof. The described embodiments are merely examples of the present application, which can be embodied in various forms.

[0052] The specification can use phrases such as "in one embodiment", "in another embodiment", "in yet another embodiment", or "in other embodiments", which can refer to one or more of the same or different embodiments of the application.

[0053] The embodiment of the present application provides a method for processing a timing task, which can be applied to electronic devices such as terminals and servers. Figure 1 As shown in the figure, the method in the embodiment includes the following steps:

[0054] In step S101, a target timing task to be processed is determined based on a task management table.

[0055] In the embodiment, the task management table can be created in advance, and the task management table is used to count and manage the timing tasks. The task management table stores the names of the timing tasks and the current task states of the timing tasks. The task states include an initialization state, a processing state, an interruption state, an execution failure state, and the like. In the step of determining the target timing task, the timing tasks in the task management table can be scanned in a timing manner, and the timing tasks satisfying the predetermined task state are determined as the target timing tasks according to the task states of the timing tasks.

[0056] In step S102, the target timing task is checked to obtain a checking result of the target timing task.

[0057] In the embodiment, the target timing task can be distributed to a task distribution factory, that is, a task distribution module, and then the target timing task to be processed is checked by the task distribution factory / task distribution module to determine the executability of the task and ensure the correctness of subsequent task execution, by checking whether the target timing task exists, whether the state is in processing, and whether the target timing task is a supported task type.

[0058] In step S103, a target task strategy corresponding to the target timing task is generated based on the target timing task, when the checking result of the target task is a checking pass.

[0059] In the embodiment, the target task strategy can be generated according to configuration information associated with the target timing task, and the configuration information can include the number of executions, fragmentation information, and an interruption position. The number of executions refers to whether the target timing task is single execution, or repeated cyclic execution, or a predetermined number of repeated executions. The fragmentation information refers to whether the target timing task supports being split into multiple subtasks and the number of subtasks. The target timing task can be split into multiple subtasks, and the subtasks can be processed by different execution servers, so that the processing speed of the timing task can be improved. The interruption position refers to the end point of the last execution, and the start point of the next batch can be determined by using the interruption position.

[0060] Step S104, sending the target timing task and the target task policy to a target execution server, so that the target execution server executes the target timing task according to the target task policy.

[0061] In this step, after the target task policy is generated, the target task policy and the target task can be sent to the corresponding execution server to realize the execution operation of the target task. Specifically, the target task policy and the target timing task can be sent to any execution server in a random manner, or the target task policy and the target task can be sent to the corresponding execution server according to the identifier of the execution server in the target task policy.

[0062] By automatically generating the task policy according to the target timing task and sending the target timing task to the target execution server, the target timing task can be executed by the target execution server, the automatic and timely distribution of the timing task is realized, the problem of timing task accumulation caused by manual monitoring and distribution of the timing task is solved, the generation of the task policy is more accurate and reliable by generating the corresponding task policy according to the timing task, and the problem of easy error of manual determination of the task policy is solved. Before the task policy is generated, the correctness of subsequent task execution is ensured by verifying the target task, which provides a guarantee for timely and accurate execution of the timing task.

[0063] Another embodiment of the present application provides a method for processing a timing task, comprising the following steps:

[0064] Step S201, obtaining the task state of each timing task based on a task management table; determining the timing task with the task state as an initialization state as the target timing task; or, determining the timing task with the task state as an interruption state as the target timing task, or determining the timing task with the task state as an execution failure state as the target timing task;

[0065] In the specific implementation process of this step, the target task state can be preset, then each timing task in the task management table is traversed to obtain the state of each timing task, and then the timing task with the task state as the target task state is determined as the target timing task. The target task state can be any one or several of the initialization state, the interruption state and the failure state.

[0066] Step S202, updating the state of the target timing task to an execution state, and storing the updated execution state of the target timing task in the task management table;

[0067] In the specific implementation process, after the target timing task is determined, the task state of the target timing task can be modified to an executing state, i.e., the current task state of the target timing task is in processing, and the current task state is stored to prevent the target timing task from being determined as a task to be processed again when each timing task is traversed.

[0068] In step S203, the target timing task is verified based on the task distribution module according to at least the task type of the target timing task, and a verification result is obtained.

[0069] In the specific implementation process, the task type is the executability of the target timing task, which specifically includes an executable type and a non-executable type. In the specific implementation process, the executability of the target timing task can be verified according to the existence of the target timing task, the task state of the target task, and the task type supported by the target task. For example, when the target timing task does not exist, or the task state of the target timing task is execution success, or the task type of the target timing task is a type that cannot be run by the execution server, it can be determined that the task type of the target timing task is a non-executable type, otherwise, it can be determined that the task type of the target timing task is an executable type.

[0070] In step S204, the configuration information of the target timing task is obtained.

[0071] In the specific implementation process, the configuration information specifically includes any one or several of the following: the number of executions, the sharding information, and the interruption position. In the embodiment, the configuration information of each timing task can be stored in the task management table in advance, so that the configuration information of the corresponding timing task can be obtained by searching the task management table, thereby laying a foundation for accurately generating a task strategy based on the configuration information.

[0072] In step S205, when the configuration information includes the number of executions, the target execution number of the target timing task is determined based on the number of executions to generate the target task strategy; when the configuration information includes the interruption position, the starting execution position is determined based on the interruption position to generate the target task strategy; and when the configuration information includes the sharding information, a number of sub-timing tasks corresponding to the target timing task is determined based on the number of shards in the sharding information, and a target execution server corresponding to each of the sub-timing tasks is determined based on the sharding strategy in the sharding information to generate the target task strategy.

[0073] In the specific implementation process, the sharding strategy specifically includes any one of the following: an average allocation method, a hash polling allocation method, and a hash odd-even allocation method. In the specific implementation process of the embodiment, the target execution server corresponding to each of the sub-timing tasks can be determined in the following three ways:

[0074] The first mode is a sharding strategy based on an average allocation method, and an execution server with a task quantity less than an average task quantity is determined as a target execution server.

[0075] In this mode, the task quantity of each target timing task allocated to each execution server can be determined first, and then the average task quantity can be calculated based on the task quantity of each execution server. Thus, the execution server with a task quantity less than the average task quantity can be determined as the target execution server, and then each sub timing task can be allocated to the target execution server with a smaller task quantity, thereby avoiding the problem of unbalanced task quantity among the execution servers.

[0076] The second mode is a sharding strategy based on a hash value of a target timing task, and a hash round robin allocation method is used to determine a starting execution server corresponding to the target timing task, and each target execution server is determined based on the starting execution server.

[0077] In this mode, each server can be sorted according to the IP address of each execution server in advance, and then the hash value of the target timing task can be calculated based on the name of the target timing task. Then, the hash value of the target timing task is matched with the IP address of each execution server to determine the target IP address corresponding to the hash value, and then the execution server corresponding to the target IP address is determined as the starting server. Finally, each sub timing task can be allocated to the starting server and the execution server after the starting server according to the arrangement order of each execution server.

[0078] The third mode is a sharding strategy based on a hash value of a target timing task, and a hash odd-even allocation method is used to determine a starting execution server corresponding to the target timing task, and each target execution server is determined based on the starting execution server.

[0079] In this mode, the hash value of the target timing task can be calculated based on the name of the target timing task, and the target sorting mode can be determined based on the parity of the calculated hash value. For example, when the calculated hash value is even, the descending sorting mode can be determined as the target sorting mode; and when the calculated hash value is odd, the ascending sorting mode can be determined as the target sorting mode. After the target sorting mode is determined, each execution server can be sorted based on the target sorting mode and the IP address of each execution server, and the hash value of the target timing task is matched with the IP address of each execution server to determine the target IP address corresponding to the hash value. Then, the execution server corresponding to the target IP address is determined as the starting server. Finally, each sub timing task can be allocated to the starting server and the execution server after the starting server according to the arrangement order of each execution server.

[0080] Step S206, sending the target timing task and the target task policy to a randomly determined target execution server, or sending the target timing task and the target task policy to the target execution server based on the identification information of the target execution server in the target task policy, so that the target execution server executes the target timing task according to the target task policy;

[0081] In the specific implementation process of the present step, when the target task policy does not contain the identification information of the target execution server, the target task policy and the corresponding target timing task can be sent to any execution server in a random manner. When the target task policy contains the identification information of the target execution server, the target task policy and the target timing task can be sent to the target execution server based on the identification information of the target execution server.

[0082] Step S207, receiving execution information of the target timing task sent by the target execution server in real time;

[0083] The execution information and the corresponding relationship between the execution information and the target timing task are stored in the task management table.

[0084] In the present step, the execution information specifically includes the current position of the target timing task execution, the current time corresponding to the current position, and the time length consumed, etc.

[0085] The method for processing timing tasks in the present embodiment can automatically generate a task policy according to a target timing task, and send the target timing task to a target execution server, so as to execute the target timing task by the target execution server, realize automatic and timely distribution of the timing task, solve the problem of timing task accumulation caused by manual monitoring and distribution of the timing task, generate a corresponding task policy according to the timing task, so that the generation of the task policy is more accurate and reliable, and solve the problem of easy error of manual determination of the task policy. Before generating the task policy, the target task is verified, so as to ensure the correctness of subsequent task execution, and provide protection for subsequent timely and accurate execution of the timing task.

[0086] In order to further explain the above embodiment, the following will be described in combination with a specific application scenario, as shown in Figure 2 The processing method of the timing task in the present embodiment is specifically used for processing batch timing tasks, that is, processing batch timing tasks. At this time, the execution process of the scheduling can directly view the execution of the task, and the end point of the previous batch can be obtained as the starting point of the next batch. The specific processing process includes:

[0087] I. Initial configuration of tasks.

[0088] In this step, the main task is to maintain and configure the tasks: different timing tasks are managed using a unified specification, the task management table of the timing task is pre-set and maintained. The task management table includes task name, task state (initial state, execution, execution success, execution failure, special state), job parameters (such as executing to a certain node, execution frequency), special configuration (whether to support sharding) and other information. When a new task is added, a timing task configuration is added in the timing task table, and the initial state of the task is set according to the business requirements.

[0089] II. Scanning of timing tasks.

[0090] After completing the initial configuration, the next step is to be able to execute these timing tasks. Specifically, a unified timing task can be added to find out the timing tasks with the target task state.

[0091] III. Obtain all tasks in the initial state, i.e., obtain the target timing task.

[0092] Use the unified timing task to find all timing tasks in the initial state to obtain the target timing task.

[0093] IV. Set the target timing task state to processing / execution and dispatch the target timing task to the downstream for processing.

[0094] In this step, before the target timing task is dispatched to the downstream application / module, the configuration information of the task, such as the cron expression, can be flexibly set. This makes the execution requirements of the task configurable and flexible.

[0095] V. Task distribution of the target timing task to distribute the target timing task to the distribution factory.

[0096] In this step, the distribution factory can be an application service or module set in the server, which is specifically used for checking the target timing task.

[0097] VI. Verification of timing tasks.

[0098] After the timing task is distributed, it is routed to the task distribution factory, which checks the task to be executed, such as whether the task exists, is in the processing state, and is a supported task type, to ensure the correctness of subsequent task execution.

[0099] VII. Generation of task strategy according to task type and task configuration.

[0100] In this step, after the verification is completed, the task strategy can be generated according to the task type and the task configuration, wherein the task configuration refers to the configuration information of the target timing task, and specifically can include: execution times, interruption positions, and the like.

[0101] Eight, execution of the timing task.

[0102] In this step, after the target task strategy is generated, the target task strategy can be sent to each target execution server, and the target timing task is executed by using the target execution server.

[0103] The logical execution of the timing task is started, and the execution process meets the business requirements at the same time. In order to meet the flexible business requirements, the timing task configuration and the job parameters set in advance can be used to achieve this.

[0104] In order to further explain the above embodiment, the following will be described in combination with another application scenario. The application scenario in this embodiment is a scenario of processing a timing task configured with shard information. According to the business requirements, if the processing of the task has strict sequence requirements, the serial execution is not performed and the shard is not performed, similar to the application scenario shown in Figure 2 If there is no sequence requirement, the number of shards, the shard strategy, and the personalized parameters can be pre-configured for the timing task. Then, during the execution, the timing task will be dispersed to different machines for execution according to the shard configuration, so as to improve the execution efficiency and reduce the impact of partial task failure on the whole. The specific processing process is as shown in Figure 3

[0105] One, initial configuration of the task.

[0106] In this step, the maintenance and configuration of the task are mainly performed: different timing tasks are managed by using a unified specification, the task management table of the timing task is pre-set and maintained. The task management table includes information such as task name, task state (initial state, execution, execution success, execution failure, special state), job parameters (for example, execution to a certain node, execution frequency), special configuration (whether to support shard), and the like. When a new task is added, the timing task configuration is added in the timing task table, and the initial state of the task is set according to the business requirements.

[0107] Two, scanning of the timing task.

[0108] After the initial configuration is completed, the next step is to be able to execute these timing tasks. Specifically, a unified timing task can be added, and the unified timing task is used to find out the timing tasks with the target task state.

[0109] Three, obtaining all the tasks in the initial state, that is, obtaining the target timing task.

[0110] ​All the timing tasks whose status is initialized are found out by the unified timing task to obtain the target timing task.

[0111] IV. The status of the target timing task is set to processing / execution, and the target timing task is dispatched to the downstream for processing.

[0112] In this step, the configuration information of the task, such as the cron expression, can be flexibly set before the target timing task is dispatched to the downstream application / module, so that the execution requirements of the task are configured and flexible.

[0113] V. The target timing task is dispatched to the dispatch factory.

[0114] In this step, the dispatch factory can be an application service or a module set in the server, which is specifically used for checking the target timing task.

[0115] VI. The timing task is checked.

[0116] After the timing task is dispatched, it is uniformly routed to the task dispatch factory, which checks the task to be executed, whether the task exists, the status is processing, and the task type is supported, etc., to ensure the correctness of subsequent task execution.

[0117] VII. The task strategy is generated according to the task type and the task configuration.

[0118] In this step, after the checking is completed, the task strategy can be generated according to the task type and the task configuration, wherein the task configuration refers to the configuration information of the target timing task, which can specifically include: the number of executions, the interruption position, etc.

[0119] VIII. The sharding configuration is selected.

[0120] In this step, if the processing of the timing task has strict sequence requirements, serial execution is set, that is, no sharding is performed; if the timing task has no sequence requirements, the number of sharding, sharding strategy, and individualized parameters can be configured in advance for the timing task. Then, after the task strategy is generated, the task strategy can be further improved according to the sharding information, that is, according to the sharding information to determine each sub-timing task and the target execution server for processing each sub-timing task, and then improve the task strategy based on the above information. In this embodiment, by dispersing each sub-timing task to different servers for execution according to the sharding information, the execution efficiency can be improved, and the influence of partial task failure on the whole can be reduced.

[0121] IX. The timing task is executed.

[0122] In this step, after the target task strategy is generated, the target task strategy can be sent to each target execution server, and the target execution server is used to execute the target timing task.

[0123] In this embodiment, when each target timing task is executed, execution information of the target timing task sent by each target execution server can be received in real time, and the execution information and a corresponding relationship between the execution information and the target timing task are stored in the task management table.

[0124] In this embodiment, different business requirements can be achieved according to flexible configuration of the timing task parameters. After final task execution is completed, final judgment is performed. Tasks meeting the conditions are set to the final state. The role of this step is to automatically set the tasks that can be set to the final state to the final state without manual operation, and to enable the tasks that cannot be set to the final state to continue to be executed.

[0125] Another embodiment of the present application provides a device for processing a timing task, as shown in Figure 4 The device 1 for processing a timing task comprises:

[0126] A determination module 11 is configured to determine a target timing task to be processed based on a task management table.

[0127] A verification module 12 is configured to verify the target timing task to obtain a verification result of the target timing task.

[0128] A generation module 13 is configured to generate a target task strategy corresponding to the target timing task based on the target timing task when the verification result of the target task is verification passed.

[0129] A sending module 14 is configured to send the target timing task and the target task strategy to a target execution server, so that the target execution server executes the target timing task according to the target task strategy.

[0130] In the specific implementation process of this embodiment, the determination module is specifically configured to obtain a task state of each timing task based on a task management table, determine a timing task with an initialization state as the target timing task, or determine a timing task with an interruption state or an execution failure state as the target timing task.

[0131] In the implementation process of the embodiment, the device for processing the timing task further comprises an updating module, which is specifically configured to: after determining the target timing task to be processed based on the task management table, update the state of the target timing task to an executing state, and store the executing state of the target timing task after the update into the task management table.

[0132] In the embodiment, the checking module is specifically configured to: check the target timing task based on the task distribution module and at least according to the task type of the target timing task, and obtain a checking result.

[0133] In the implementation process of the embodiment, the device for processing the timing task further comprises an obtaining module, which is configured to: in the case that the checking result of the target timing task is a checking pass, obtain configuration information of the target timing task; and the generating module is specifically configured to: generate a target task strategy corresponding to the target timing task based on at least the configuration information of the target timing task.

[0134] In the implementation process of the embodiment, the configuration information comprises any one or several of the following: execution times, sharding information, and interruption position; in the case that the configuration information comprises execution times, the generating module is specifically configured to: determine target execution times of the target timing task based on the execution times, so as to generate the target task strategy; in the case that the configuration information comprises interruption position, the generating module is specifically configured to: determine a starting execution position based on the interruption position, so as to generate the target task strategy; and in the case that the configuration information comprises sharding information, the generating module is specifically configured to: determine a plurality of sub-timing tasks corresponding to the target timing task based on a sharding number in the sharding information, and determine target execution servers corresponding to each of the sub-timing tasks based on a sharding strategy in the sharding information, so as to generate the target task strategy.

[0135] Specifically, the generating module is specifically configured to: determine an execution server with a current task quantity less than an average task quantity as a target execution server based on a sharding strategy of an average allocation method; or determine a starting execution server corresponding to the target timing task based on a hash value of the target timing task and a sharding strategy of a hash round robin allocation method, and determine each of the target execution servers based on the starting execution server; or determine a starting execution server corresponding to the target timing task based on a hash value of the target timing task and a sharding strategy of a hash odd-even allocation method, and determine each of the target execution servers based on the starting execution server.

[0136] The device for processing the timing task in the embodiment further comprises a recording module, configured to receive execution information of the target timing task sent by the target execution server in real time, and store the execution information and a corresponding relationship between the execution information and the target timing task into the task management table.

[0137] The device for processing the timing task in the application can generate a task strategy automatically according to the target timing task, and send the target timing task to the target execution server, so that the target execution server can execute the target timing task, the automatic and timely distribution of the timing task is realized, the problem of accumulation of the timing task caused by manual monitoring and distribution of the timing task is solved, the generation of the task strategy is more accurate and reliable by generating the corresponding task strategy according to the timing task, and the problem of easy error of the manual determination of the task strategy is solved. Before the generation of the task strategy, the correctness of the subsequent task execution is ensured by checking the target task, and the timely and accurate execution of the timing task is ensured.

[0138] Another embodiment of the application provides a storage medium storing a computer program, and the computer program is executed by a processor to implement the following method steps.

[0139] Step one, determining a target timing task to be processed in real time based on a task management table;

[0140] Step two, checking the target timing task to obtain a checking result of the target timing task;

[0141] Step three, generating a target task strategy corresponding to the target timing task based on the target timing task when the checking result of the target timing task is passed;

[0142] Step four, sending the target timing task and the target task strategy to a target execution server, so that the target execution server executes the target timing task according to the target task strategy.

[0143] The specific implementation process of the above method steps can be referred to the embodiments of any of the above methods for processing the timing task, which will not be repeated here.

[0144] In the application, the task strategy is automatically generated according to the target timing task, and the target timing task is sent to the target execution server, so that the target timing task can be executed by the target execution server, the automatic and timely distribution of the timing task is realized, the problem of timing task accumulation caused by manual monitoring and distribution of the timing task is solved, the generation of the task strategy is more accurate and reliable by generating the corresponding task strategy according to the timing task, the problem of easy error of manual determination of the task strategy is solved. And before generating the task strategy, the target task is verified, so as to ensure the correctness of subsequent task execution and provide guarantee for subsequent timely and accurate execution of the timing task.

[0145] Another embodiment of the application provides an electronic device, as shown in the accompanying drawings, comprising at least a memory 1 and a processor 2, the memory 1 stores a computer program, and the processor 2 implements the following method steps when executing the computer program on the memory 1. Figure 5

[0146] Step one, determining the target timing task to be processed in real time based on the task management table;

[0147] Step two, verifying the target timing task to obtain the verification result of the target timing task;

[0148] Step three, generating the target task strategy corresponding to the target timing task based on the target timing task when the verification result of the target timing task is verified;

[0149] Step four, sending the target timing task and the target task strategy to the target execution server, so that the target execution server executes the target timing task according to the target task strategy.

[0150] The specific implementation process of the above method steps can refer to the embodiments of any of the above processing timing task methods, which will not be repeated here.

[0151] In the application, the task strategy is automatically generated according to the target timing task, and the target timing task is sent to the target execution server, so that the target timing task can be executed by the target execution server, the automatic and timely distribution of the timing task is realized, the problem of timing task accumulation caused by manual monitoring and distribution of the timing task is solved, the generation of the task strategy is more accurate and reliable by generating the corresponding task strategy according to the timing task, the problem of easy error of manual determination of the task strategy is solved. And before generating the task strategy, the target task is verified, so as to ensure the correctness of subsequent task execution and provide guarantee for subsequent timely and accurate execution of the timing task.

[0152] ​The above examples are only exemplary embodiments of the present application, and are not intended to limit the present application, and the protection scope of the present application is defined by the claims. Those skilled in the art can make various modifications or equivalent replacements to the present application within the spirit and protection scope of the present application, and such modifications or equivalent replacements are also considered to fall within the protection scope of the present application.

Claims

1. A method of processing timing tasks, characterized by, The method comprises the following steps: determining a target timing task to be processed in real time based on a task management table; verifying the target timing task to obtain a verification result of the target timing task; generating a target task strategy corresponding to the target timing task based on the target timing task in a case where the verification result of the target timing task is a verification pass; sending the target timing task and the target task strategy to a target execution server, so that the target execution server executes the target timing task according to the target task strategy; wherein the generating of the target task strategy corresponding to the target timing task based on the target timing task specifically comprises: generating the target task strategy corresponding to the target timing task based on at least configuration information of the target timing task; the configuration information comprises any one or several of the following: execution times, sharding information, and interruption position; the generating of the target task strategy corresponding to the target timing task based on at least the configuration information of the target timing task specifically comprises: in a case where the configuration information comprises execution times, determining a target execution times of the target timing task based on the execution times to generate the target task strategy; in a case where the configuration information comprises an interruption position, determining a starting execution position based on the interruption position to generate the target task strategy; in a case where the configuration information comprises sharding information, determining a plurality of sub-timing tasks corresponding to the target timing task based on a number of shards in the sharding information, and determining a target execution server corresponding to each of the sub-timing tasks based on a sharding strategy in the sharding information to generate the target task strategy.

2. The method of claim 1, wherein, The determining of the target timing task to be processed based on the task management table specifically comprises: obtaining task states of each timing task based on the task management table; determining a timing task with an initialization state as the target timing task, or determining a timing task with an interruption state as the target timing task, or determining a timing task with an execution failure state as the target timing task.

3. The method of claim 1, wherein, After determining the target timing task to be processed based on the task management table, the method further comprises updating a state of the target timing task to an execution-in-progress state, and storing the execution-in-progress state of the target timing task after the updating into the task management table. The verifying of the target timing task to obtain the verification result of the target timing task specifically comprises: verifying the target timing task based on at least a task type of the target timing task according to a task distribution module to obtain the verification result.

4. The method of claim 1, wherein, In a case where the verification result of the target timing task is a verification pass, the method further comprises obtaining configuration information of the target timing task.

5. The method of claim 1, wherein, The determining of the target execution server corresponding to each of the sub-timing tasks based on the sharding strategy in the sharding information specifically comprises: determining an execution server with a current task quantity less than an average task quantity as the target execution server based on a sharding strategy of an average allocation method; Alternatively, a hash polling distribution method is adopted based on a hash value of the target timing task to determine a starting execution server corresponding to the target timing task, and each target execution server is determined based on the starting execution server. Alternatively, a hash polling distribution method is adopted based on a hash value of the target timing task to determine a starting execution server corresponding to the target timing task, and each target execution server is determined based on the starting execution server.

6. The method of claim 1, wherein, The method further includes: receiving, in real time, execution information of the target timing task sent by the target execution server; storing the execution information and a corresponding relationship between the execution information and the target timing task into the task management table.

7. An apparatus for processing a timing task, comprising: a determination module configured to determine a target timing task to be processed based on a task management table; a verification module configured to verify the target timing task to obtain a verification result of the target timing task; a generation module configured to generate a target task strategy corresponding to the target timing task based on the target timing task if the verification result of the target timing task is verified to be passed; a sending module configured to send the target timing task and the target task strategy to a target execution server, so that the target execution server executes the target timing task according to the target task strategy; wherein the generation module is specifically configured to: generate the target task strategy corresponding to the target timing task based on at least configuration information of the target timing task; the configuration information includes any one or more of the following: execution times, distribution information, and interruption position; and the generation module is specifically configured to: if the configuration information includes the execution times, determine target execution times of the target timing task based on the execution times to generate the target task strategy; if the configuration information includes the interruption position, determine a starting execution position based on the interruption position to generate the target task strategy; if the configuration information includes the distribution information, determine a plurality of sub-timing tasks corresponding to the target timing task based on a number of distributions in the distribution information, and determine target execution servers corresponding to each of the sub-timing tasks based on a distribution strategy in the distribution information to generate the target task strategy.

8. A storage medium, characterized by The storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the method for processing a timing task according to any one of claims 1-6.

9. An electronic device, comprising: The apparatus at least includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method for processing a timing task according to any one of claims 1-6 when executing the computer program stored in the memory.

Citation Information

Patent Citations

  • Timing task processing method, device and equipment and computer readable storage medium

    CN110262878A

  • Task allocation method and device, server and storage medium

    CN113360269A