Task processing method and device, electronic equipment and storage medium
By using blocking queues and Redis caches in the processing nodes of the task processing system, the task acquisition and execution process is decoupled, and the problem of low processing efficiency when the task is large is solved, and efficient task processing and state management are achieved.
Patent Information
- Application Number
- CN202411086005.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-22
AI Technical Summary
In the case of a large number of tasks, how to improve the overall processing efficiency of the task processing system for tasks.
By using a local blocking queue in the processing node of the task processing system, putting the tasks to be executed in the Redis cache into the blocking queue, and obtaining the target task execution from the header when the blocking queue is not empty, avoiding frequent access to the Redis cache, and realizing Decoupling of task processing and update execution status at the end of the task.
It improves the overall processing efficiency of the task processing system, reduces network delay, improves the success rate of task execution, and supports parallel processing of multiple processing nodes to facilitate unified management of task status.
Smart Images

Figure CN119003120A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of task scheduling and computer technology, and in particular to a task processing method, device, electronic device and storage medium. Background Art
[0002] Related technologies usually use a task processing system to process tasks issued by task issuers. Taking the banking business field as an example, the tasks issued by task issuers include tasks of creating, maintaining and managing various bank accounts such as savings accounts and credit card accounts generated in the banking business system, tasks of processing various transaction requests such as deposits and transfers initiated by customers, and tasks of credit status assessment.
[0003] When the number of tasks is large, how to improve the overall processing efficiency of the task processing system is a problem that needs to be solved. Summary of the invention
[0004] The present application provides a task processing method, device, electronic device and storage medium to solve the technical problem in the related art of how to improve the overall processing efficiency of tasks by the task processing system when the task volume is large.
[0005] In the first aspect, the present application provides a task processing method, which is applied to any processing node of at least one processing node included in a task processing system, and the arbitrary processing node includes a local blocking queue; the method includes: when the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is placed into the blocking queue from the tail of the blocking queue, wherein the Redis cache includes tasks issued by at least one task publisher, and the at least one task to be executed includes at least one of the following tasks: tasks with an execution status of unexecuted and tasks that need to be re-executed based on the execution status among the tasks issued by the at least one task publisher; when the blocking queue is not empty, the target task is obtained from the head of the blocking queue, and the target task is executed according to the preset task execution method; when the target task ends execution, the execution status of the target task is updated to the Redis cache.
[0006] In the second aspect, the present application provides a task processing device, which is applied to any processing node of at least one processing node included in the task processing system, and the arbitrary processing node includes a local blocking queue; the device includes: a task acquisition module, which is used to put at least one task to be executed in the Redis cache into the blocking queue from the tail of the blocking queue when the capacity of the blocking queue does not reach the preset capacity, wherein the Redis cache includes tasks issued by at least one task publisher, and the at least one task to be executed includes at least one of the following tasks: tasks with an execution status of unexecuted and tasks that need to be re-executed based on the execution status among the tasks issued by the at least one task publisher; a task processing module, which is used to obtain a target task from the head of the blocking queue when the blocking queue is not empty, and execute the target task according to a preset task execution method; an update module, which is used to update the execution status of the target task to the Redis cache when the execution of the target task is completed.
[0007] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect.
[0008] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
[0009] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0010] The technical solution provided by the embodiment of the present application can quickly obtain the tasks to be executed from the Redis cache by storing the tasks issued by the task publisher in a memory-based Redis cache, and when the capacity of the local blocking queue of any processing node does not reach the preset capacity, at least one task to be executed in the Redis cache is placed in the blocking queue from the tail of the local blocking queue, and when the blocking queue is not empty, the target task is obtained from the head of the blocking queue for execution, which can achieve the decoupling of the process of obtaining tasks from the Redis cache and executing tasks by any processing node, so that the process of obtaining tasks from the Redis cache does not have to wait for the previous task to be completed, and any processing node only needs to execute the tasks in the local blocking queue, avoiding the network delay that may occur in the process of frequently accessing the Redis cache during the execution of the task, thereby improving the overall processing efficiency of the task processing system for the task. By updating the execution status of the target task to the Redis cache when the target task ends execution, it is possible to determine the task that needs to be re-executed and re-execute the task according to the execution status of the target task, thereby improving the success rate of task execution. In addition, the number of processing nodes can be multiple, and multiple processing nodes can process tasks in the Redis cache in parallel, which can further improve the overall processing efficiency of tasks. And by updating the execution status of the target task to the Redis cache, the Redis cache can store the execution status of each task, which facilitates the unified management of tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0012] Figure 1 The process of the task processing method provided in the embodiment of the present application Figure 1 ;
[0013] Figure 2 The process of the task processing method provided in the embodiment of the present application Figure 2 ;
[0014] Figure 3 An example diagram of the task processing process provided in the embodiment of the present application;
[0015] Figure 4 A schematic diagram of the structure of a task processing device provided in an embodiment of the present application;
[0016] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0017] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0018] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0019] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties. The acquisition, transmission, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant laws and regulations of the relevant regions.
[0020] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0021] In order to improve the overall processing efficiency of the task processing system for tasks when the amount of tasks is large, the embodiment of the present application proposes the following concept: the task processing system includes at least one processing node, and the tasks issued by at least one task publisher are stored in the Redis cache, and the tasks in the Redis cache are processed by any processing node, wherein any processing node includes a local blocking queue, and when the capacity of the local blocking queue does not reach the preset capacity, any processing node puts at least one task to be executed in the Redis cache from the tail of the blocking queue into the blocking queue, and when the blocking queue is not empty, obtains the target task from the head of the blocking queue, executes the target task according to the preset task execution method, obtains the execution status of the target task, and updates the execution status of the target task to the Redis cache. Among them, the at least one task to be executed includes at least one of the following tasks: tasks with an execution status of unexecuted among the tasks issued by at least one task publisher and tasks that need to be re-executed based on the execution status.
[0022] Thus, by storing the tasks issued by the task publisher in a memory-based Redis cache, the tasks to be executed can be quickly obtained from the Redis cache, and when the capacity of the local blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is placed in the blocking queue from the tail of the local blocking queue by any processing node, and when the blocking queue is not empty, the target task is obtained from the head of the blocking queue to execute, and the process of obtaining tasks from the Redis cache and executing tasks by any processing node can be decoupled, so that the process of obtaining tasks from the Redis cache does not have to wait for the previous task to be completed, and any processing node only needs to execute the tasks in the local blocking queue, avoiding the network delay that may occur in the frequent access to the Redis cache during the execution of the task, thereby improving the overall processing efficiency of the task processing system for the task. By updating the execution status of the target task to the Redis cache when the target task ends execution, it can be realized according to the execution status of the target task, determining the task that needs to be re-executed and re-executing the task, and improving the success rate of task execution. In addition, the number of processing nodes can be multiple, and the tasks in the Redis cache are processed in parallel by multiple processing nodes, which can further improve the overall processing efficiency of the task. And by updating the execution status of the target task to the Redis cache, the execution status of each task can be stored in the Redis cache, which facilitates the unified management of tasks.
[0023] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0024] First combine Figure 1 , the task processing method provided in the embodiment of the present application is described. Figure 1 The process of the task processing method provided in the embodiment of the present application Figure 1 .
[0025] It should be noted that the task processing method provided in the embodiment of the present application can be executed by a task processing device, wherein the task processing device can be an electronic device or can be configured in an electronic device, and the present application does not limit this.
[0026] Among them, the electronic device can be any device with computing capabilities, such as a personal computer, a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.
[0027] The task processing method can be applied to any processing node in at least one processing node included in the task processing system. The processing node can be an electronic device. For example, the task processing system can include multiple electronic devices, each of which can be configured with a task processing device, and each task processing device can execute the task processing method provided in the embodiment of the present application.
[0028] like Figure 1 As shown, the task processing method includes the following steps:
[0029] S101. When the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is placed into the blocking queue from the tail of the blocking queue, wherein the Redis cache includes at least one task issued by a task publisher, and the at least one task to be executed includes at least one of the following tasks: a task with an execution status of not executed among the tasks issued by at least one task publisher and a task that needs to be re-executed based on the execution status.
[0030] Among them, Redis (Remote Dictionary Server) is a high-performance key-value storage system written in the open source ANSI C language. It is a network-supported, memory-based, and persistent log-type, Key-Value database. It provides multiple language APIs and can be used as a database, cache, and message middleware.
[0031] In an embodiment of the present application, at least one task publisher can publish a task, wherein, when there are multiple task publishers, multiple task publishers can publish tasks at the same time. After at least one task publisher successfully publishes a task, it can store the relevant data of the task in the Redis cache, waiting for execution by any processing node. Any processing node can put at least one task to be executed in the Redis cache into the blocking queue from the tail of the blocking queue when the capacity of the local blocking queue does not reach the preset capacity. Among them, the at least one task to be executed includes at least one of the following tasks: tasks with an execution status of unexecuted among the tasks published by at least one task publisher and tasks that need to be re-executed based on the execution status.
[0032] The task-related data may include, for example, the task name, description, priority, maximum execution time, maximum execution times, and any other data related to the task.
[0033] Among them, the blocking queue, namely the Blocking Queue, can ensure the first-in-first-out and last-in-last-out order of data.
[0034] The preset capacity can be determined based on factors such as the machine performance of any processing node. For example, when a processing node has more processing resources, the preset capacity of the blocking queue of the processing node can be set to be larger, and when a processing node has less processing resources, the preset capacity of the blocking queue of the processing node can be set to be smaller, so that the processing resources of each processing node can be fully utilized and the task overload of each processing node can be avoided.
[0035] The execution status of any task may indicate at least one of information such as whether the task has been executed, whether it has been successfully executed within a preset time, and the current number of executions.
[0036] For example, for any task, the execution status can be unexecuted, that is, the task has not been executed, or successfully executed within the preset duration, or unsuccessfully executed within the preset duration and the current execution count does not exceed the preset count, or unsuccessfully executed within the preset duration and the current execution count exceeds the preset count, etc. The preset duration is the maximum execution duration pre-set for the task. The preset count is the maximum execution count pre-set for the task.
[0037] In order to re-execute tasks that have not been successfully executed within the preset time, improve the success rate of tasks, and avoid repeated execution of tasks too many times, the tasks that need to be re-executed based on the execution status may include, for example, tasks that have not been successfully executed within the preset time and whose current execution times do not exceed the preset times. Among them, tasks that have not been successfully executed within the preset time may include tasks that have not been completed within the preset time, that is, tasks that have timed out, and tasks that have failed to execute within the preset time.
[0038] As an example, the Redis cache may include a first Redis list for storing tasks whose execution status is unexecuted and tasks in the first execution status, a second Redis list for storing tasks in the second execution status, and a third Redis list for storing tasks in the third execution status; wherein the first execution status includes: the execution was not successful within the preset time length and the current execution times did not exceed the preset times; the second execution status includes: the execution was successful within the preset time length; the third execution status includes: the execution was not successful within the preset time length and the current execution times exceeded the preset times. The tasks stored in the first Redis list are tasks to be executed, so that any processing node can read the tasks in the first Redis list and put at least one task in the first Redis list into the blocking queue from the tail of the local blocking queue.
[0039] The number of tasks that any processing node puts into the blocking queue each time can be set as needed.
[0040] As an example, the task processing system can provide a standardized task publishing interface. Any task publisher can define the task publishing interface according to business needs and in accordance with the specifications, and then publish the tasks to be executed through the pre-defined task publishing interface. Among them, any task publisher can call the task publishing interface and send the corresponding field values to the task publishing interface according to the fields specified in the interface definition to publish the tasks to be executed. Among them, the fields can include, for example, the name, description, priority, etc. of the task.
[0041] That is, any task in the Redis cache can be published by the corresponding task publisher through a predefined task publishing interface. Therefore, the task processing system can provide a task publishing interface, allowing the task publisher to customize the task publishing interface as needed, and publish tasks through the task publishing interface, which has high adaptability.
[0042] S102: When the blocking queue is not empty, obtain the target task from the head of the blocking queue, and execute the target task according to a preset task execution method.
[0043] The number of target tasks may be one or more, and this application does not impose any limitation on this.
[0044] As an example, the task processing system can provide a set of standardized task implementation interfaces, which can specify in detail the input parameters, output results and other information required for task execution. Any task publisher can follow these specifications according to business needs to implement the specific logic of the interface, that is, set the task execution method corresponding to the task.
[0045] That is, the task execution mode corresponding to any task in the Redis cache can be set by the corresponding task publisher through a standardized task implementation interface.
[0046] Therefore, any processing node can obtain the preset task execution mode corresponding to the target task by calling the task implementation interface, and then execute the target task according to the preset task execution mode.
[0047] Therefore, the task processing system can provide a task implementation interface, allowing the task publisher to customize the task implementation interface as needed, so as to set the task execution mode as needed, with high adaptability.
[0048] S103: When the target task is finished executing, the execution status of the target task is updated to the Redis cache.
[0049] It is understandable that any processing node can obtain the execution status of the target task in real time or at a certain time interval during the execution of the target task, and update the final execution status of the target task to the Redis cache when the target task is finished.
[0050] As an example, the target task can be terminated after being successfully executed within a preset time, and accordingly, the execution status of the target task may include: the target task is successfully executed within the preset time; or the target task can be terminated after being failed to execute within the preset time, and accordingly, the execution status of the target task may include: the target task is not successfully executed within the preset time; or the target task can be terminated when the execution time exceeds the preset time, and accordingly, the execution status of the target task may include: the target task is not successfully executed within the preset time. In addition, the execution status of the target task may also include whether the current execution times of the target task exceed the preset times.
[0051] As an example, the Redis cache may include different Redis lists for storing tasks in different execution states, which may include a first Redis list, wherein the first Redis list is used to store tasks whose execution state is not executed and tasks in a first execution state, and the first execution state includes: not successfully executed within a preset time length and the current number of executions does not exceed the preset number of times. Among them, the tasks stored in the first Redis list may be tasks to be executed, and any processing node may take out at least one task to be executed from the first Redis list and put it into the blocking queue from the tail of the local blocking queue.
[0052] Correspondingly, updating the execution status of the target task to the Redis cache in S103 may include: according to the execution status of the target task, putting the target task into the Redis cache for storing a Redis list of tasks with corresponding execution statuses.
[0053] For example, the Redis cache may include the above-mentioned first Redis list, as well as the second Redis list and the third Redis list, wherein the second Redis list is used to store tasks in the second execution state, and the third Redis list is used to store tasks in the third execution state; wherein the second execution state includes: successful execution within a preset time length; the third execution state includes: unsuccessful execution within a preset time length and the current number of executions exceeds a preset number. According to the execution state of the target task, the target task is placed in the Redis cache for storing the Redis list of tasks with the corresponding execution state, which may include: when the execution state of the target task is the first execution state, the target task is placed in the first Redis list; when the execution state of the target task is the second execution state, the target task is placed in the second Redis list; when the execution state of the target task is the third execution state, the target task is placed in the third Redis list.
[0054] Thus, tasks in different execution states can be stored through different Redis lists in the Redis cache, so that any processing node can directly quickly obtain the task to be executed from the first Redis list, and by putting the executed target task into the Redis list corresponding to its execution state, the execution state of the target task in the Redis cache can be quickly updated. And for any task to be executed in the first Redis list, by taking out the task and putting it into the blocking queue, it can be avoided that the task is executed by other processing nodes while being executed by any processing node. By putting the task back into the first Redis list when the task is not successfully executed within the preset duration and the current execution number does not exceed the preset number, it is possible to re-execute the task and improve the success rate of task execution. By putting the task into the second Redis list when the task is successfully executed within the preset duration, and putting the task into the third Redis list when the task is not successfully executed within the preset duration and the current execution number exceeds the preset number, it is possible to store the task that is successfully executed within the preset duration separately from the task that is not successfully executed within the preset duration and the current execution number exceeds the preset number, which is convenient for task management.
[0055] As an example, for any task to be executed in the first Redis list, any processing node can also put the task into a local blocking queue while keeping the task in the first Redis list, and modify the execution status of the task in the first Redis list to executing, so as to avoid the task being executed by other processing nodes at the same time as being executed by the processing node, and when the task is completed, the task will be deleted from the first Redis list, and according to the execution status of the task, the task will be placed in the Redis list corresponding to its execution status, so as to quickly update the execution status of the target task in the Redis cache.
[0056] The task processing method provided by the embodiment of the present application can quickly obtain the tasks to be executed from the Redis cache by storing the tasks issued by the task publisher in a memory-based Redis cache, and when the capacity of the local blocking queue of any processing node does not reach the preset capacity, at least one task to be executed in the Redis cache is placed in the blocking queue from the tail of the local blocking queue, and when the blocking queue is not empty, the target task is obtained from the head of the blocking queue for execution, which can realize the decoupling of the process of obtaining tasks from the Redis cache and executing tasks by any processing node, so that the process of obtaining tasks from the Redis cache does not have to wait for the previous task to be completed, and any processing node only needs to execute the tasks in the local blocking queue, avoiding the network delay that may occur in the process of frequently accessing the Redis cache during the execution of the task, thereby improving the overall processing efficiency of the task processing system for the task. By updating the execution status of the target task to the Redis cache when the target task ends execution, it is possible to determine the task that needs to be re-executed and re-execute the task according to the execution status of the target task, thereby improving the success rate of task execution. In addition, the number of processing nodes can be multiple, and multiple processing nodes can process tasks in the Redis cache in parallel, which can further improve the overall processing efficiency of tasks. And by updating the execution status of the target task to the Redis cache, the Redis cache can store the execution status of each task, which facilitates the unified management of tasks.
[0057] Combine the following Figure 2 , the manner in which any processing node implements the above-mentioned task processing in the task processing method provided in the embodiment of the present application is further described. It should be noted that at least one task daemon process and a monitoring process are started in the any processing node.
[0058] Figure 2 The process of the task processing method provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, the task processing method includes the following steps:
[0059] S201. Scan the Redis cache at a pre-configured time interval through a listening process started in any processing node.
[0060] The Redis cache includes at least one task published by a task publisher.
[0061] As an example, any processing node can obtain a configuration file, in which the time interval for the listening process to scan the Redis cache is configured, so that the any processing node can scan the Redis cache at a pre-configured time interval through the listening process started therein to obtain at least one task to be executed from the Redis cache.
[0062] S202: When the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the monitoring process.
[0063] The at least one task to be executed includes at least one of the following tasks: a task whose execution status is unexecuted among the tasks issued by at least one task issuer and a task that needs to be re-executed based on the execution status.
[0064] As an example, when the capacity of the local blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache can be taken out through the monitoring process and put into the blocking queue from the tail of the local blocking queue.
[0065] It should be noted that when the capacity of the blocking queue reaches the preset capacity, the listening process can be blocked and wait for the next scan of the Redis cache.
[0066] As an example, when there are multiple processing nodes, before scanning the Redis cache in S201, it also includes: setting a pessimistic lock for the Redis cache through a monitoring process, and determining that the pessimistic lock is set successfully; after S202, it also includes: releasing the pessimistic lock through the monitoring process.
[0067] Among them, the listening process started in any processing node can set the pessimistic lock of the Redis cache through the setting command of the pessimistic lock in Redis before scanning the Redis cache each time. Among them, if the setting is successful, it means that the listening process started in the processing node has obtained the pessimistic lock of the Redis cache, and can scan the Redis cache and put at least one task to be executed in it into the local blocking queue. If the setting is not successful, it means that the listening process started in the processing node has not obtained the pessimistic lock of the Redis cache, and cannot scan the Redis cache and put at least one task to be executed in it into the local blocking queue.
[0068] Through the listening process started in any processing node, before scanning the Redis cache, the pessimistic lock of the Redis cache is set first, and the Redis cache is scanned after the pessimistic lock is successfully set. This can achieve that only one listening process started in a processing node can scan the Redis cache at the same time and obtain at least one task to be executed from the Redis cache, avoiding multiple processing nodes from scanning the Redis cache at the same time and obtaining tasks from it, which causes data confusion in Redis. Through the listening process started in any processing node, after putting at least one task to be executed in the Redis cache from the tail of the blocking queue into the blocking queue, the pessimistic lock that has been set is released, allowing other processing nodes to operate on the data in the Redis cache.
[0069] As an example, in order to ensure that the pessimistic lock set by the listening process in each processing node can only be released by itself, before releasing the pessimistic lock through the listening process, it can also be determined that the current pessimistic lock of the Redis cache is set by the listening process.
[0070] Among them, the pessimistic lock includes key and value. The key represents the identifier of the pessimistic lock, and the key of the pessimistic lock set by the listening process in each processing node is the same. The value is used to identify the owner of the pessimistic lock. Therefore, the listening process can determine whether the current pessimistic lock of the Redis cache is set by itself by judging whether the value of the pessimistic lock matches itself.
[0071] S203: When the blocking queue is not empty, obtain the target task from the head of the blocking queue through each task daemon process in at least one task daemon process.
[0072] In the case where multiple task daemons are started in the same processing node, the multiple task daemons are independent of each other and do not affect each other. The multiple task daemons can sequentially obtain the target task from the head of the blocking queue.
[0073] As an example, when the local blocking queue is empty, each task daemon process may be blocked, and when a new task enters the local blocking queue, each task daemon process may be reactivated.
[0074] This can avoid the situation where each task daemon process constantly polls the blocking queue when the local blocking queue is empty, thereby wasting resources.
[0075] S204: Create a corresponding subprocess through each task daemon process, and execute the target task obtained by the corresponding task daemon process according to a preset task execution method through the subprocess.
[0076] As an example, the task execution mode corresponding to any task in the Redis cache is set by the corresponding task publisher through a standardized task implementation interface. For each task in the local blocking queue, the task daemon that obtains the task can call the task implementation interface to obtain the task execution mode corresponding to the task, and can create a corresponding child process. Through the child process, the task obtained by the task daemon is executed according to the task execution mode.
[0077] S205. Obtain the execution status of the corresponding target task through each task daemon process, and update the execution status of the target task to the Redis cache when the target task finishes execution.
[0078] As an example, each task daemon process can detect in real time or at a certain time interval whether the target task is successfully executed within a preset time duration during the process of its created subprocess executing the target task, and detect whether the execution time of the target task exceeds the preset time duration.
[0079] When a task daemon detects that a target task fails to execute within a preset time or the execution time of the target task exceeds the preset time, the task daemon can end the child process it created to end the execution of the target task, and detect whether the current number of executions of the target task exceeds the preset number, and obtain the execution status of the target task, where the execution status can be that the target task has not been successfully executed within the preset time and the current number of executions exceeds the preset number, or that the target task has not been successfully executed within the preset time and the current number of executions does not exceed the preset number, and the execution status is updated to the Redis cache.
[0080] When a task daemon detects that a task is successfully executed within a preset time, the task daemon can end the child process it created to end the execution of the target task, and update the execution status of the target task to the Redis cache, where the execution status can be that the target task is successfully executed within the preset time.
[0081] Among them, the Redis cache may include a Redis list for storing tasks in different execution states. The task daemon process can put the target task into the Redis cache for storing the Redis list of tasks with corresponding execution states according to the execution state of the target task, so as to update the execution state of the target task to the Redis cache.
[0082] It should be noted that before each task daemon updates the execution status of the target task it has acquired to the Redis cache, it can first set a pessimistic lock for the Redis cache. If the pessimistic lock is set successfully, it will then update the execution status of the target task it has acquired to the Redis cache, and after the update is completed, it will release the pessimistic lock it has set.
[0083] The task processing method provided in the embodiment of the present application scans the Redis cache through a listening process started in any processing node. When the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the listening process, and when the blocking queue is not empty, each task daemon process in at least one task daemon process obtains the target task from the head of the blocking queue, creates a corresponding child process through each task daemon process, and executes the target task obtained by the corresponding task daemon process according to the preset task execution method through the child process, and updates the execution status of the corresponding target task to the Redis cache through the task daemon process. It can be achieved by starting different processes in any processing node to decouple the process of obtaining tasks from the Redis cache and executing tasks, so that the process of obtaining tasks from the Redis cache does not have to wait for the previous task to be completed, and the task daemon process only needs to execute the tasks in the local blocking queue, thereby avoiding network delays that may occur due to frequent access to the Redis cache during task execution, thereby improving the overall processing efficiency of the task processing system for tasks. And when there are multiple task daemons started in any processing node, multiple tasks in the local blocking queue can be executed in parallel, further improving the overall processing efficiency of the task. In addition, each task daemon can update the execution status of the corresponding target task to the Redis cache, so that the execution status of each task can be stored in the Redis cache, which is convenient for unified management of tasks.
[0084] Combine the following Figure 3 , taking the task processing system processing the tasks issued by task issuer A and task issuer B as an example, the task processing method provided in the embodiment of the present application is exemplarily described. Among them, the task processing system may include multiple processing nodes, Figure 3 Only one processing node a is shown in FIG.
[0085] refer to Figure 3, task publisher A and task publisher B can define the task publishing interface provided by the task processing system according to business needs, and when tasks need to be executed, they can call their defined task publishing interfaces and send corresponding field values to the corresponding task publishing interfaces according to the fields specified in the interface definition to publish multiple tasks that need to be executed. After multiple tasks are successfully published, the relevant data of multiple tasks can be stored in the Redis cache.
[0086] The relevant data of each task may include, for example, the name, description, priority, maximum execution time, maximum execution times, and any other data related to the task.
[0087] Among them, the Redis cache may include a first Redis list for storing tasks with an execution status of unexecuted and tasks in a first execution state, a second Redis list for storing tasks in a second execution state, and a third Redis list for storing tasks in a third execution state. Among them, the first execution state includes: the first execution state includes: the execution is not successful within the preset time and the current execution number does not exceed the preset number; the second execution state includes: the execution is successful within the preset time; the third execution state includes: the execution is not successful within the preset time and the current execution number exceeds the preset number. Among them, the preset number is the maximum number of executions set in advance for the task. The preset duration is the maximum execution duration set in advance for the task. After multiple tasks are successfully published, the relevant data of the multiple tasks can be stored in the first Redis list first.
[0088] In addition, the task processing system can provide a task implementation interface, and task publisher A and task publisher B can respectively implement the specific logic of the task implementation interface according to business needs, that is, set the task execution mode corresponding to each task.
[0089] Taking processing node a as an example, a monitoring process and a preset number of task daemons can be started in processing node a. Figure 3 Take the preset number of 3 as an example. Processing node a can scan the Redis cache at a pre-configured time interval through a monitoring process, and before each scan of the Redis cache, a pessimistic lock of the Redis cache can be set through the monitoring process, and after determining that the pessimistic lock is set successfully, if the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the first Redis list is put into the blocking queue from the tail of the blocking queue through the monitoring process, and then the set pessimistic lock is released through the monitoring process.
[0090] In addition, each processing node can obtain the target task from the local blocking queue through a preset number of task daemons therein to execute the target task. Taking processing node a as an example, processing node a can obtain a target task from the head of the blocking queue through each of task daemons 1, task daemons 2 and task daemons 3, when the blocking queue is not empty, and call the task implementation interface to obtain the task execution method of the target task, and can create a corresponding child process, and execute the target task through the child process according to the task execution method corresponding to the target task.
[0091] Each task daemon process can detect in real time or at a certain time interval whether the target task is successfully executed within a preset time length during the process of the child process it creates executing the target task, and detect whether the execution time of the target task exceeds the preset time length.
[0092] When a task daemon detects that a target task fails to execute within a preset time, it can terminate the subprocess it created to terminate the execution of the target task and detect whether the current execution times of the target task exceed the preset times. If not, the task daemon can put the target task into the first Redis list, and accordingly, the execution status of the target task is updated to the first execution status, so that the task can be re-executed through a processing node; if exceeded, the task daemon can put the target task into the third Redis list, and accordingly, the execution status of the target task is updated to the third execution status.
[0093] When a task daemon detects that a target task is successfully executed within a preset time, it can terminate the child process it created to end the execution of the target task and put the target task into the second Redis list. Accordingly, the execution status of the target task is updated to the second execution status.
[0094] When a task daemon detects that the execution time of a target task exceeds a preset time, it can terminate the subprocess it created to terminate the execution of the target task, and detect whether the current execution times of the target task exceed the preset times. If not, the task daemon can put the target task into the first Redis list, and accordingly, the execution status of the target task is updated to the first execution status, so that the task can be re-executed through a processing node; if it exceeds, the task daemon can put the target task into the third Redis list, and accordingly, the execution status of the target task is updated to the third execution status.
[0095] After each task daemon process ends the subprocess it created to end the execution of the current target task, if the local blocking queue is not empty, it can re-obtain the next target task from the head of the local blocking queue and re-create the subprocess to execute the next target task in the above manner. If the local blocking queue is empty, each task daemon process is blocked to wait for a new task to enter the local blocking queue.
[0096] The task processing method provided in the embodiment of the present application can quickly obtain the tasks to be executed from the Redis cache by storing the tasks issued by the task publisher in a memory-based Redis cache, scan the Redis cache through a listening process started in any processing node, and when the capacity of the blocking queue does not reach the preset capacity, put at least one task to be executed in the Redis cache from the tail of the blocking queue into the blocking queue through the listening process, and when the blocking queue is not empty, obtain the target task from the head of the blocking queue through each task daemon process in at least one task daemon process, create a corresponding child process through each task daemon process, and execute the target task obtained by the corresponding task daemon process according to the preset task execution method through the child process, and update the execution status of the corresponding target task to the Redis cache through the task daemon process, so that the process of obtaining tasks from the Redis cache and executing tasks can be decoupled through different processes started in any processing node, so that the process of obtaining tasks from the Redis cache does not have to wait for the previous task to be completed, and the task daemon process only needs to execute the tasks in the local blocking queue, avoiding network delays that may occur due to frequent access to the Redis cache during task execution, thereby improving the overall processing efficiency of the task processing system for tasks. By updating the execution status of the target task to the Redis cache when the target task is finished, it is possible to determine the task that needs to be re-executed and re-execute the task according to the execution status of the target task, thereby improving the success rate of task execution. In addition, the number of processing nodes can be multiple, and the number of task daemons started in any processing node can also be multiple. The tasks to be executed are obtained from the Redis cache in parallel through the listening processes in multiple processing nodes, and the tasks are obtained and executed from the local blocking queue in parallel through the multiple task daemons in each processing node, which can improve the throughput of the task and improve the overall processing efficiency of the task. And each task daemon can update the execution status of the corresponding target task to the Redis cache, so that the execution status of each task can be stored in the Redis cache, which is convenient for unified management of tasks. In addition, parameters such as the preset number of times, preset duration, time interval, etc. can be set or modified at any time as needed, which improves the flexibility of task processing. The task implementation interface and the task publishing interface allow the task publisher to customize the implementation as needed, with high adaptability. In addition, the task processing method provided in the embodiment of the present application can be packaged as an executable jar package as a whole, and can run by relying on the JDK (Java Development Kit, a software development kit for the Java language) environment and Redis. The operating environment is simple, has no external dependencies, and can achieve portable deployment.
[0097] Figure 4A schematic diagram of the structure of a task processing device provided in an embodiment of the present application, wherein the task processing device is applied to any processing node in at least one processing node included in a task processing system, and any processing node includes a local blocking queue.
[0098] like Figure 4 As shown, the task processing device 400 includes: a task acquisition module 410 , a task processing module 420 and an update module 430 .
[0099] The task acquisition module 410 is used to put at least one task to be executed in the Redis cache into the blocking queue from the tail of the blocking queue when the capacity of the blocking queue does not reach the preset capacity, wherein the Redis cache includes at least one task issued by a task publisher, and the at least one task to be executed includes at least one of the following tasks: a task with an execution status of unexecuted among the tasks issued by at least one task publisher and a task that needs to be re-executed based on the execution status;
[0100] The task processing module 420 is used to obtain the target task from the head of the blocking queue when the blocking queue is not empty, and execute the target task according to the preset task execution mode;
[0101] The update module 430 is used to update the execution status of the target task to the Redis cache when the target task is finished executing.
[0102] It should be noted that the task processing device 400 provided in the embodiment of the present application can execute the task processing method in the above embodiment. The task processing device can be an electronic device or can be configured in an electronic device.
[0103] Among them, the electronic device can be any device with computing capabilities, such as a personal computer, a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.
[0104] In some embodiments, at least one task daemon process is started in any processing node; the task processing module 420 is used to:
[0105] Obtaining, by each of the at least one task daemon process, a target task from a head of the blocking queue;
[0106] Through each task daemon process, a corresponding subprocess is created, and through the subprocess, the target task obtained by the corresponding task daemon process is executed according to the preset task execution method.
[0107] In some embodiments, the update module 430 is configured to:
[0108] Through each task daemon, the execution status of the corresponding target task is obtained, and when the target task is completed, the execution status is updated to the Redis cache.
[0109] In some embodiments, the task processing module 420 is further configured to:
[0110] When the local blocking queue is empty, block each task daemon process.
[0111] In some embodiments, the task acquisition module 410 is used to:
[0112] Scan the Redis cache at pre-configured time intervals through the listening process started in any processing node;
[0113] When the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the monitoring process.
[0114] In some embodiments, the number of processing nodes is multiple; the task acquisition module 410 is also used to:
[0115] Before scanning the Redis cache, set the pessimistic lock of the Redis cache through the monitoring process and make sure that the pessimistic lock is set successfully;
[0116] After at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the listening process, the pessimistic lock is released through the listening process.
[0117] In some embodiments, the task acquisition module 410 is further used to:
[0118] Determines the current pessimistic lock of the Redis cache that is set by the listening process.
[0119] In some embodiments, the Redis cache includes different Redis lists for storing tasks in different execution states, and the different Redis lists include a first Redis list, wherein the first Redis list is used to store tasks whose execution state is not executed and tasks in a first execution state, and the first execution state includes: not successfully executed within a preset time and the current execution number does not exceed a preset number;
[0120] The task acquisition module 410 is used to:
[0121] Take out at least one task to be executed from the first Redis list, and put it into the blocking queue from the tail of the blocking queue;
[0122] The updating module 430 is used to:
[0123] According to the execution status of the target task, the target task is placed in the Redis cache to store the Redis list of tasks with the corresponding execution status.
[0124] In some embodiments, the Redis cache further includes a second Redis list and a third Redis list, wherein the second Redis list is used to store tasks in a second execution state, and the third Redis list is used to store tasks in a third execution state; wherein the second execution state includes: successful execution within a preset time length; the third execution state includes: unsuccessful execution within a preset time length and the current execution count exceeds a preset count;
[0125] The updating module 430 is used to:
[0126] When the execution status of the target task is the first execution status, the target task is put into the first Redis list;
[0127] When the execution state of the target task is the second execution state, the target task is put into the second Redis list;
[0128] When the execution status of the target task is the third execution status, the target task is put into the third Redis list.
[0129] In some embodiments, any task in the Redis cache is published by the corresponding task publisher through a predefined task publishing interface, and the task execution method corresponding to any task is set by the corresponding task publisher through a standardized task implementation interface.
[0130] The task processing device provided in the embodiment of the present application can be used to execute the technical solution of the task processing method in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0131] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the task processing module 420 can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above task processing module 420. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0132] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device may include: a transceiver 121 , a processor 122 , and a memory 123 .
[0133] The processor 122 executes the computer execution instructions stored in the memory, so that the processor 122 executes the scheme in the above embodiment. The processor 122 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0134] The memory 123 is connected to the processor 122 via a system bus and completes communication between them. The memory 123 is used to store computer program instructions.
[0135] The transceiver 121 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.
[0136] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.
[0137] An embodiment of the present application also provides a chip for executing instructions, which is used to execute the technical solution of the task processing method in the above embodiment.
[0138] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the task processing method of the above embodiment.
[0139] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the task processing method in the above embodiment can be implemented.
[0140] The electronic device, chip, computer-readable storage medium, and computer program product provided in the embodiments of the present application can be used to execute the technical solutions of the task processing methods in the above embodiments. Their implementation principles and technical effects are similar and will not be repeated here.
[0141] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0142] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A task processing method, characterized in that: The method is applied to any processing node of at least one processing node included in the task processing system, wherein the any processing node includes a local blocking queue; the method includes: In the case that the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue, wherein the Redis cache includes at least one task issued by a task publisher, and the at least one task to be executed includes at least one of the following tasks: a task whose execution status is unexecuted among the tasks issued by the at least one task publisher and a task that needs to be re-executed based on the execution status; When the blocking queue is not empty, obtaining the target task from the head of the blocking queue, and executing the target task according to a preset task execution mode; When the target task is finished executing, the execution status of the target task is updated to the Redis cache.
2. The method according to claim 1, characterized in that At least one task daemon process is started in any processing node; obtaining a target task from the head of the blocking queue and executing the target task according to a preset task execution method includes: Obtaining the target task from the head of the blocking queue through each of the at least one task daemon process; A corresponding subprocess is created through each of the task daemon processes, and the target task acquired by the corresponding task daemon process is executed through the subprocess according to the preset task execution mode.
3. The method according to claim 2, characterized in that When the target task is finished executing, updating the execution status of the target task to the Redis cache includes: The execution status of the corresponding target task is obtained through each task daemon process, and when the target task is finished executing, the execution status is updated to the Redis cache.
4. The method according to claim 2, characterized in that: The method further comprises: When the local blocking queue is empty, each task daemon process is blocked.
5. The method according to claim 1, characterized in that When the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue, including: Scanning the Redis cache at a pre-configured time interval by a listening process started in any processing node; When the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the monitoring process.
6. The method according to claim 5, characterized in that The number of the processing nodes is multiple; before scanning the Redis cache, it also includes: Setting a pessimistic lock for the Redis cache through the monitoring process, and determining that the pessimistic lock is set successfully; After the at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the monitoring process, the method further includes: The pessimistic lock is released by the monitoring process.
7. The method according to claim 6, characterized in that Before releasing the pessimistic lock, the method further includes: Determine that the current pessimistic lock of the Redis cache is set by the listening process.
8. The method according to any one of claims 1 to 7, characterized in that The Redis cache includes different Redis lists for storing tasks in different execution states, wherein the different Redis lists include a first Redis list, wherein the first Redis list is used to store tasks whose execution state is not executed and tasks in a first execution state, wherein the first execution state includes: not being successfully executed within a preset time and the current execution count not exceeding a preset count; The step of placing at least one task to be executed in the Redis cache into the blocking queue from the tail of the blocking queue comprises: Taking out the at least one task to be executed from the first Redis list, and putting it into the blocking queue from the tail of the blocking queue; The updating the execution status of the target task to the Redis cache includes: According to the execution status of the target task, the target task is placed in the Redis cache for storing a Redis list of tasks with corresponding execution status.
9. The method according to claim 8, characterized in that The Redis cache also includes a second Redis list and a third Redis list, wherein the second Redis list is used to store tasks in a second execution state, and the third Redis list is used to store tasks in a third execution state; wherein the second execution state includes: successful execution within a preset time length; the third execution state includes: unsuccessful execution within the preset time length and the current execution count exceeds the preset count; The step of placing the target task into the Redis cache according to the execution status of the target task for storing a Redis list of tasks with corresponding execution statuses includes: When the execution status of the target task is the first execution status, putting the target task into the first Redis list; When the execution state of the target task is the second execution state, putting the target task into the second Redis list; When the execution state of the target task is the third execution state, the target task is put into the third Redis list.
10. The method according to any one of claims 1 to 7, characterized in that Any task in the Redis cache is published by the corresponding task publisher through a predefined task publishing interface, and the task execution mode corresponding to the arbitrary task is set by the corresponding task publisher through a standardized task implementation interface.
11. A task processing device, characterized in that: The device is applied to any processing node of at least one processing node included in a task processing system, and the any processing node includes a local blocking queue; the device includes: A task acquisition module, used for, when the capacity of the blocking queue does not reach the preset capacity, putting at least one task to be executed in the Redis cache into the blocking queue from the tail of the blocking queue, wherein the Redis cache includes at least one task issued by a task publisher, and the at least one task to be executed includes at least one of the following tasks: a task whose execution status is unexecuted among the tasks issued by the at least one task publisher and a task that needs to be re-executed based on the execution status; A task processing module, used for obtaining a target task from the head of the blocking queue when the blocking queue is not empty, and executing the target task according to a preset task execution mode; An update module is used to update the execution status of the target task to the Redis cache when the target task is finished executing.
12. The device according to claim 11, characterized in that At least one task daemon process is started in any processing node; the task processing module is used to: Obtaining the target task from the head of the blocking queue through each of the at least one task daemon process; A corresponding subprocess is created through each of the task daemon processes, and the target task acquired by the corresponding task daemon process is executed through the subprocess according to the preset task execution mode.
13. The device according to claim 12, characterized in that The update module is used to: The execution status of the corresponding target task is obtained through each task daemon process, and when the target task is finished executing, the execution status is updated to the Redis cache.
14. The device according to claim 12, characterized in that The task processing module is further used for: When the local blocking queue is empty, each task daemon process is blocked.
15. The device according to claim 11, characterized in that The task acquisition module is used to: Scanning the Redis cache at a pre-configured time interval by a listening process started in any processing node; When the capacity of the blocking queue does not reach the preset capacity, at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the monitoring process.
16. The device according to claim 15, characterized in that The number of the processing nodes is multiple; the task acquisition module is also used to: Before scanning the Redis cache, a pessimistic lock of the Redis cache is set through the monitoring process, and it is determined that the pessimistic lock is set successfully; After at least one task to be executed in the Redis cache is put into the blocking queue from the tail of the blocking queue through the listening process, the pessimistic lock is released through the listening process.
17. The device according to claim 16, characterized in that The task acquisition module is also used for: Determine that the current pessimistic lock of the Redis cache is set by the listening process.
18. The device according to any one of claims 11 to 17, characterized in that The Redis cache includes different Redis lists for storing tasks in different execution states, wherein the different Redis lists include a first Redis list, wherein the first Redis list is used to store tasks whose execution state is not executed and tasks in a first execution state, wherein the first execution state includes: not being successfully executed within a preset time and the current execution count not exceeding a preset count; The task acquisition module is used to: Taking out the at least one task to be executed from the first Redis list, and putting it into the blocking queue from the tail of the blocking queue; The update module is used to: According to the execution status of the target task, the target task is placed in the Redis cache for storing a Redis list of tasks with corresponding execution status.
19. The device according to claim 18, characterized in that The Redis cache also includes a second Redis list and a third Redis list, wherein the second Redis list is used to store tasks in a second execution state, and the third Redis list is used to store tasks in a third execution state; wherein the second execution state includes: successful execution within a preset time length; the third execution state includes: unsuccessful execution within the preset time length and the current execution count exceeds the preset count; The update module is used to: When the execution status of the target task is the first execution status, putting the target task into the first Redis list; When the execution state of the target task is the second execution state, putting the target task into the second Redis list; When the execution state of the target task is the third execution state, the target task is put into the third Redis list.
20. The device according to any one of claims 11 to 17, characterized in that Any task in the Redis cache is published by the corresponding task publisher through a predefined task publishing interface, and the task execution mode corresponding to the arbitrary task is set by the corresponding task publisher through a standardized task implementation interface.
21. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 10 when executed by a processor.
23. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 10 when being executed by a processor.
