CN115454599A - Task processing method, system, device, storage medium and electronic equipment - Google Patents
Task processing method, system, device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN115454599A CN115454599A CN202211110617.XA CN202211110617A CN115454599A CN 115454599 A CN115454599 A CN 115454599A CN 202211110617 A CN202211110617 A CN 202211110617A CN 115454599 A CN115454599 A CN 115454599A
- Authority
- CN
- China
- Prior art keywords
- execution
- task
- target event
- node
- termination identifier
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0706—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
- G06F11/0715—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a system implementing multitasking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0793—Remedial or corrective actions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/481—Exception handling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/483—Multiproc
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Software Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a task processing method, a system, a device, a storage medium and electronic equipment, and relates to the field of big data. The method comprises the following steps: the method comprises the steps that a main node receives a task acquisition instruction of a target event sent by an execution node; under the condition that the task of the target event exists in the main node and the main node does not store the termination identifier, any task is sent to the execution node; and sending the termination identifier to the execution node under the condition that the task does not exist in the main node or the termination identifier is stored in the main node, and determining the execution result of the target event according to the target number of the tasks which are not executed of the target event and the execution duration of the target event. By the method and the device, the problems that in the related technology, the execution flow of the batch transaction tasks is long in time consumption, and abnormal conditions generated during the execution of the tasks cannot be fed back in time are solved.
Description
Technical Field
The present application relates to the field of big data, and in particular, to a task processing method, system, apparatus, storage medium, and electronic device.
Background
Before the financial institution carries out the money transaction task, the transaction task needs to be checked and verified, and the transaction is carried out after the fact that no abnormity exists. When the transaction task is checked, in order to ensure the accuracy of the checking, the background server generally performs serial transaction-by-transaction processing on each detail in the transaction task, and then processes summary information and other information, thereby determining whether the transaction task is accurate.
However, because the existing inspection method adopts a serial inspection mode and generates inspection results uniformly after the inspection is finished, when an exception exists in the transaction task inspection process, the results can be obtained only after all execution is finished, and meanwhile, because the detailed items in part of transaction tasks are numerous, the inspection flow time is long, thereby influencing the progress of the inspection work.
Aiming at the problems that the execution flow of the batch transaction tasks in the related technology is long in time consumption and abnormal conditions generated during the execution of the tasks cannot be fed back in time, an effective solution is not provided at present.
Disclosure of Invention
The application provides a task processing method, a system, a device, a storage medium and electronic equipment, which are used for solving the problems that in the related art, the execution flow of batch transaction tasks is long in time consumption, and abnormal conditions generated in the execution of the tasks cannot be fed back in time.
According to one aspect of the present application, a task processing method is provided. The method comprises the following steps: the method comprises the steps that a main node receives a task obtaining instruction of a target event sent by an execution node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the tasks; under the condition that the task of the target event exists in the main node and the main node does not store a termination identifier, any task is sent to the execution node, wherein the termination identifier indicates the execution operation of the unexecuted task of the target event to be terminated; and sending the termination identifier to the execution node under the condition that no task exists in the main node or the termination identifier is stored in the main node, and determining the execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution duration of the target event, wherein the execution duration is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received.
Optionally, after sending any one of the tasks to the execution node, the method further includes: receiving a sub-execution result returned by the execution node, wherein the sub-execution result is an execution result obtained after the execution node executes the task; judging whether the sub-execution result carries a termination identifier or not; and under the condition that the sub-execution result carries the termination identifier, the main node terminates the execution operation of the unexecuted task of the target event according to the termination identifier and stores the termination identifier.
Optionally, when there is no task in the master node or the master node stores a termination identifier, sending the termination identifier to the execution node includes: under the condition that the main node stores the termination identifier, sending the stored termination identifier to the execution node; and under the condition that the task does not exist in the main node, the main node generates a termination identifier and sends the termination identifier to the execution node.
Optionally, determining an execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution duration of the target event includes: judging whether the target quantity is greater than a preset quantity or not; when the target number is larger than the preset number, determining that the target event is abnormal to be executed, and sending first alarm information, wherein the first alarm information represents that the target event is failed to be executed; and under the condition that the target number is less than or equal to the preset number, determining the execution result of the target event according to the execution time length and the event execution time length threshold.
Optionally, the event execution duration threshold includes a first preset duration and a second preset duration, the second preset duration is longer than the first preset duration, and determining the execution result of the target event according to the execution duration includes: judging whether the execution time length is less than or equal to a first preset time length or not; determining that the target event is abnormal in execution under the condition that the execution time length is less than or equal to a first preset time length, and sending second alarm information, wherein the second alarm information represents that an unexecuted task exists in the target event; when the execution time is longer than a first preset time, judging whether the execution time is longer than or equal to a second preset time, wherein the second preset time is longer than the first preset time; when the execution time length is greater than or equal to a second preset time length, determining that the target event is abnormal in execution, and sending third alarm information, wherein the third alarm information represents that the target event is overtime in execution; and under the condition that the execution time length is less than a second preset time length, determining that the target event is normally executed.
Optionally, before sending any one of the tasks to the execution node, the method further includes: judging whether the execution time of each task is greater than or equal to a third preset time, wherein the execution time of each task is the execution time of each task at an execution node; when the execution time of at least one task is greater than or equal to a third preset time, determining that the target event is abnormal in execution, and sending third alarm information, wherein the third alarm information represents that the target event is overtime in execution; and under the condition that the execution time length of all the tasks is less than a third preset time length, executing the step of sending any one task to the execution node.
Optionally, the master node communicates with a plurality of execution nodes, which execute a plurality of tasks in the target event in parallel.
According to one aspect of the present application, a task processing method is provided. The method comprises the following steps: under the condition that an execution node is in an idle state, sending a task acquisition instruction of a target event to a main node, and receiving return information of the main node, wherein the target event comprises a plurality of tasks, the task acquisition instruction is used for acquiring any one of the plurality of tasks, the return information is a task or a termination identifier, and the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated; under the condition that the returned information is a task, the execution node executes the task to obtain a sub-execution result, and sends the sub-execution result to the main node; and in the case that the return information is the termination identifier, the execution node keeps an idle state.
Optionally, the executing node executes the task, and obtaining the sub-execution result includes: and adding a termination identifier for the sub-execution result under the condition that the sub-execution result is abnormal.
According to another aspect of the present application, a task processing system is provided. The system comprises: the main node is connected with the execution node and used for receiving a task acquisition instruction of a target event sent by the execution node, sending return information to the execution node according to whether the task of the target event exists in the main node or the termination identifier, and determining an execution result of the target event according to the target number of the tasks which are not executed of the target event and the execution duration of the target event under the condition that the return information is the termination identifier, wherein the execution duration is the time difference between the time when the main node starts executing the target event and the time when the termination identifier is received, the termination identifier indicates that the execution operation of the tasks which are not executed of the target event is terminated, the target event comprises a plurality of tasks, the task acquisition instruction is used for acquiring any one of the tasks, and the return information is the task or the termination identifier; and each execution node sends a task acquisition instruction of the target event to the main node in an idle state, receives return information returned by the main node, executes the task to obtain a sub-execution result under the condition that the return information is the task, and sends the sub-execution result to the main node, and keeps the idle state under the condition that the return information is a termination identifier, wherein the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated.
According to another aspect of the present application, there is provided a task processing device. The device includes: the first receiving unit is used for receiving a task obtaining instruction of a target event sent by an execution node by a main node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the plurality of tasks; the system comprises a first sending unit, a second sending unit and a third sending unit, wherein the first sending unit is used for sending any one task to an execution node under the condition that the task of a target event exists in a main node and the main node does not store a termination identifier, and the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated; and the second sending unit is used for sending the termination identifier to the execution node under the condition that the task does not exist in the main node or the termination identifier is stored in the main node, and determining the execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution time length of the target event, wherein the execution time length is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received.
According to another aspect of the present application, there is provided a task processing device. The device includes: the second receiving unit is used for sending a task obtaining instruction of a target event to the main node and receiving return information of the main node under the condition that the execution node is in an idle state, wherein the target event comprises a plurality of tasks, the task obtaining instruction is used for obtaining any one of the plurality of tasks, the return information is a task or a termination identifier, and the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated; the first execution unit is used for executing the node to execute the task under the condition that the returned information is the task, obtaining a sub-execution result and sending the sub-execution result to the main node; and the second execution unit is used for keeping the execution node in an idle state under the condition that the return information is the termination identifier.
According to another aspect of the embodiments of the present invention, a computer storage medium is further provided, where the computer storage medium is used to store a program, and when the program runs, the apparatus on which the computer storage medium is located is controlled to execute a task processing method.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors and a memory; the memory has stored therein computer readable instructions, and the processor is configured to execute the computer readable instructions, wherein the computer readable instructions when executed perform a method of task processing.
By the application, the following steps are adopted: the method comprises the steps that a main node receives a task obtaining instruction of a target event sent by an execution node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the tasks; under the condition that the tasks of the target event exist in the main node and the main node does not store a termination identifier, any task is sent to the execution node, wherein the termination identifier indicates the execution operation of the unexecuted task of the target event; and under the condition that no task exists in the main node or the main node stores a termination identifier, sending the termination identifier to the execution node, and determining an execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution time length of the target event, wherein the execution time length is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received. The problem of in the correlation technique batch transaction task's execution flow consume long time to can't in time feed back the abnormal conditions that the task execution produced is solved. The main node distributes a plurality of tasks in the target event to the plurality of execution nodes, so that the target event is executed in parallel through the plurality of execution nodes, and the task execution of all the execution nodes is immediately stopped under the condition that the termination identifier exists in the main node, thereby timely determining the reason for generating the abnormity and solving the abnormal task, further achieving the effects of shortening the checking time of the target event and timely determining the abnormal task.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
fig. 1 is a flowchart of a task processing method provided according to an embodiment of the present application;
FIG. 2 is a flow chart of another task processing method provided according to an embodiment of the application;
FIG. 3 is a schematic diagram of a task processing system provided in accordance with an embodiment of the present application;
FIG. 4 is a flow chart of an alternative task processing method provided in accordance with an embodiment of the present application;
FIG. 5 is a schematic diagram of a task processing device provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of another task processing device provided in accordance with an embodiment of the present application;
fig. 7 is a schematic diagram of an electronic device provided according to an embodiment of the present application.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions of the present application better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in the present disclosure are information and data authorized by the user or sufficiently authorized by each party. For example, an interface is provided between the system and the relevant user or organization, before obtaining the relevant information, an obtaining request needs to be sent to the user or organization through the interface, and after receiving the consent information fed back by the user or organization, the relevant information is obtained.
It should be noted that the task processing method, system, apparatus, storage medium, and electronic device determined in the present disclosure may be used in the field of big data, and may also be used in any field other than the field of big data.
According to an embodiment of the present application, a task processing method is provided.
Fig. 1 is a flowchart of a task processing method according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S101, a main node receives a task obtaining instruction of a target event sent by an execution node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the plurality of tasks.
Specifically, the master node may store a target event to be executed, where the target event may be an inspection event, that is, an inspection progress or completion condition of a certain project, where the target event may be split into multiple tasks in the master node, and each task may also include one or more subtasks.
When the target event to be executed is stored in the master node, a plurality of execution nodes connected with the master node can send task acquisition instructions to the master node sequentially or simultaneously, at the moment, the master node can send tasks to each execution node sequentially, and the tasks received by each execution node are different. By means of the mode that the main node sends the tasks to the execution nodes, the execution nodes can execute the tasks in the target event together, accordingly, execution speed of the target event is improved, and accuracy of task execution is guaranteed.
For example, the target event may be a transfer of a user from institution a to institution B, where there may be ten thousand users, and the master node may split the transfer to the ten thousand users into 100 tasks, where there are 100 transfer operations per task. In the case where there are 20 execution nodes, 1-20 tasks may be sent to the execution nodes, thereby causing the multiple execution nodes to execute the target event in parallel.
Step S102, when the task of the target event exists in the main node and the main node does not store the termination identifier, any task is sent to the execution node, wherein the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated.
Specifically, after receiving the task obtaining instruction, it is necessary to determine whether a termination identifier exists in the master node or whether an unprocessed task of the target event still exists in the master node, and if the task of the target event exists and the termination identifier does not exist, it indicates that the target event still needs to be executed continuously, so that the master node sends the task that has not been executed in the target event to the execution node that sends the task obtaining instruction to execute the task.
And step S103, under the condition that no task exists in the main node or the main node stores the termination identifier, sending the termination identifier to the execution node, and determining the execution result of the target event according to the target number of the tasks which are not executed of the target event and the execution time length of the target event, wherein the execution time length is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received.
Specifically, when there is no task in the master node or the master node stores the termination identifier, all tasks in the representation target event are completed, or one or some execution nodes are in an abnormal execution state, at this time, execution of the target event needs to be terminated, and therefore, the termination identifier needs to be sent to the execution nodes, so that the execution nodes are informed that execution operations may not be performed, and after all the execution nodes receive the termination identifier, the tasks corresponding to the target event are terminated.
Further, after the target event is executed, the execution result of the target event can be determined according to the target number of the tasks of the target event which are not executed and the execution duration of the target event, whether the execution is completed together is determined according to the execution result, the target event can be normally executed when the execution is completed successfully, and the data of the target event can be modified according to the task corresponding to the termination identifier when the execution is not completed successfully, so that the data in each task of the target event are normal.
According to the task processing method provided by the embodiment of the application, a task obtaining instruction of a target event sent by an execution node is received through a main node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the plurality of tasks; under the condition that the task of the target event exists in the main node and the main node does not store a termination identifier, any task is sent to the execution node, wherein the termination identifier indicates the execution operation of the unexecuted task of the target event to be terminated; and under the condition that no task exists in the main node or the main node stores a termination identifier, sending the termination identifier to the execution node, and determining an execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution time length of the target event, wherein the execution time length is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received. The problem of in the correlation technique batch transaction task's execution flow consume long time to can't in time feed back the abnormal conditions that the task execution produced is solved. The master node distributes a plurality of tasks in the target event to the plurality of execution nodes, so that the target event is executed in parallel by the plurality of execution nodes, and the task execution of all the execution nodes is immediately stopped under the condition that the termination identifier exists in the master node, thereby timely determining the cause of the abnormal occurrence and solving the abnormal task, further shortening the checking time of the target event and simultaneously timely determining the effect of the abnormal task.
Optionally, in the task processing method provided in the embodiment of the present application, after sending any one task to the execution node, the method further includes: receiving a sub-execution result returned by the execution node, wherein the sub-execution result is an execution result obtained after the execution node executes the task; judging whether the sub-execution result carries a termination identifier or not; and under the condition that the sub-execution result carries the termination identifier, the main node terminates the execution operation of the unexecuted task of the target event according to the termination identifier and stores the termination identifier.
Specifically, after a task is sent to an execution node, a sub-execution result returned by the execution node is received, where the sub-execution result may include a termination identifier or a target identifier, where the target identifier represents that the task corresponding to the sub-execution result is successfully executed, and the termination identifier represents that the sub-execution result is abnormal in the execution process, and the execution of a target event needs to be terminated, so as to timely handle the abnormality.
It should be noted that, after receiving the termination identifier, the master node stores the termination identifier, and when the execution node acquires a task later, sends the termination identifier to the execution node, so as to notify the execution node of terminating the execution of the target event, and thus, the execution node is in an idle state.
Optionally, in the task processing method provided in the embodiment of the present application, sending the termination identifier to the execution node when the task does not exist in the master node or the termination identifier is stored in the master node includes: under the condition that the main node stores the termination identifier, sending the stored termination identifier to the execution node; and under the condition that no task exists in the main node, the main node generates a termination identifier and sends the termination identifier to the execution node.
Specifically, after the host node receives the task obtaining instruction, it needs to determine whether a termination identifier exists in the host node or whether a task of an unprocessed target event still exists in the host node. Under the condition that the main node has the termination identifier, the termination identifier is sent to the execution node no matter whether the main node has the task which is not executed by the target event or not, so that the execution node is informed to terminate the execution of the target event, and the main node is in an idle state. And under the condition that the execution node does not exist in the main node and the unexecuted task of the target event does not exist, the representation target event is completed, so that a termination identifier is generated in the main node and is sent to the execution node, and the execution node is informed of terminating the execution of the target event, so that the main node is in an idle state. The embodiment sends the termination identifier to the executing node, so as to inform the executing node that the target event is terminated, thereby ensuring that the executing node stops acquiring the task.
Optionally, in the task processing method provided in the embodiment of the present application, determining the execution result of the target event according to the target number of unexecuted tasks of the target event and the execution duration of the target event includes: judging whether the target number is larger than a preset number or not; when the target number is larger than the preset number, determining that the target event is abnormal to be executed, and sending first alarm information, wherein the first alarm information represents that the target event is failed to be executed; and under the condition that the target number is less than or equal to the preset number, determining an execution result of the target event according to the execution time length and the event execution time length threshold.
Specifically, when no task exists in the master node or the master node stores the termination identifier, the execution result of the target event may be determined according to the target number of unexecuted tasks of the target event. And under the condition that the target number is greater than the preset number, representing that the number of the residual unexecuted tasks is large, so that the target event execution failure is determined, and a worker is required to determine the reason of the task failure. And under the condition that the target number is less than or equal to the preset number, further judging the execution result by combining the execution duration of the target event.
For example, the preset number may be 0, and in a case that the target number is greater than the preset number, that is, in a case that there is an unexecuted task, it indicates that the termination identifier in the master node is sent by the execution node, so that it can be proved that an exception occurs when a certain execution node executes a certain task, and therefore, the exception task needs to be confirmed.
Optionally, in the task processing method provided in this embodiment of the present application, the event execution duration threshold includes a first preset duration and a second preset duration, where the second preset duration is greater than the first preset duration, and determining the execution result of the target event according to the execution duration includes: judging whether the execution time length is less than or equal to a first preset time length or not; when the execution time is less than or equal to a first preset time, determining that the target event is abnormal in execution, and sending second alarm information, wherein the second alarm information represents that an unexecuted task exists in the target event; under the condition that the execution time length is longer than a first preset time length, judging whether the execution time length is longer than or equal to a second preset time length, wherein the second preset time length is longer than the first preset time length; when the execution time length is greater than or equal to a second preset time length, determining that the target event is abnormal in execution, and sending third alarm information, wherein the third alarm information represents that the target event is overtime in execution; and under the condition that the execution time length is less than a second preset time length, determining that the target event is normally executed.
It should be noted that, since the time for executing the target event can be estimated according to the task amount in the target time, the execution duration of the target event can be determined according to the estimated execution duration, so as to determine the execution result of the target event.
Specifically, the estimated execution duration of the target event may be between event execution duration thresholds, that is, the execution duration of the target event is normally executed between a first preset duration and a second preset duration. When the master node has no task, the master node generates a termination identifier, and at this time, the start time of executing the target event and the time of generating the termination identifier may be determined, so as to obtain a difference value between the two times, that is, the execution duration. After the execution time length is obtained, whether the execution time length is smaller than a first preset time length needs to be determined, and when the execution time length is smaller than the first preset time length, the speed of executing the target event by the multiple execution nodes is represented to be too fast, but no exception occurs, the execution exception may occur but no termination identifier is generated, or the execution nodes are abnormal in the process of executing the task, so that a sub-execution result is generated if the execution is not completely executed, and the execution time length is too short.
Further, when the execution time exceeds the second preset time, the speed of the multiple execution nodes executing the target event is too slow, but no abnormality occurs, and a situation that the execution time of the execution nodes executing the task is too long may occur, that is, although the tasks of the target event are all executed, the execution time exceeds the preset time, and there may be an abnormality in the execution nodes, the execution nodes need to be checked, the reason for timeout is determined, and the target event is re-executed after the execution node checks, so that the accuracy of executing the target event is ensured.
Optionally, in the task processing method provided in the embodiment of the present application, before sending any one task to the execution node, the method further includes: judging whether the execution time of each task is greater than or equal to a third preset time, wherein the execution time of each task is the execution time of each task at an execution node; when the execution time of at least one task is greater than or equal to a third preset time, determining that the target event is abnormal in execution, and sending third alarm information, wherein the third alarm information represents that the target event is overtime in execution; and under the condition that the execution time length of all the tasks is less than a third preset time length, executing the step of sending any one task to the execution node.
Specifically, when a certain execution node acquires a task from the master node, it indicates that a sub-execution result returned by the execution node has been acquired, at this time, it may be determined whether the task execution time is greater than or equal to a third preset time according to the sub-execution result, where the third preset time is a preset maximum task execution time, and when the task execution time is greater than or equal to the third preset time, it indicates that the task is completed overtime, and therefore a third warning message needs to be sent, so that a worker may check the execution node corresponding to the task, thereby ensuring the accuracy of the sub-task execution result.
Optionally, in the task processing method provided in the embodiment of the present application, the main node communicates with multiple execution nodes, and the multiple execution nodes execute multiple tasks in the target event in parallel.
Specifically, a plurality of execution nodes corresponding to the main node may execute in parallel, that is, a plurality of execution nodes may execute the task in each execution node at the same time, thereby increasing the execution speed of the target event.
According to an embodiment of the present application, a task processing method is provided.
Fig. 2 is a flowchart of another task processing method provided according to an embodiment of the present application. As shown in fig. 2, the method comprises the steps of:
step S201, sending a task obtaining instruction of a target event to the host node when the execution node is in an idle state, and receiving return information of the host node, where the target event includes multiple tasks, the task obtaining instruction is used to obtain any one of the multiple tasks, the return information is a task or a termination identifier, and the termination identifier indicates to terminate an execution operation of an unexecuted task of the target event.
Specifically, the execution node first determines its own state, does not acquire a task when it is executing the task, and sends a task acquisition instruction of a target event to the master node when the execution node has no task, so that the task can be acquired from the master node.
And step S202, under the condition that the return information is a task, executing the task by the execution node to obtain a sub-execution result, and sending the sub-execution result to the main node.
Specifically, when the return result returned by the master node is a task, the execution node executes the task, and generates a sub-execution result after the execution of the task is completed, where the sub-execution result is successful execution or abnormal execution, and sends the sub-execution result to the master node, thereby completing an execution cycle of the task.
In step S203, the executing node maintains the idle state in the case that the return information is the termination identifier.
Specifically, when the return result returned by the master node is the termination identifier, it is characterized that no task exists in the master node, or a certain task execution exception occurs, which results in that the target event needs to be terminated. At this time, the execution node may remain in the idle state after receiving the termination task.
According to the task processing method provided by the embodiment of the application, under the condition that an execution node is in an idle state, a task acquisition instruction of a target event is sent to a main node, and return information of the main node is received, wherein the target event comprises a plurality of tasks, the task acquisition instruction is used for acquiring any one of the plurality of tasks, the return information is a task or a termination identifier, and the termination identifier indicates that execution operation of an unexecuted task of the target event is terminated; under the condition that the returned information is a task, the execution node executes the task to obtain a sub-execution result and sends the sub-execution result to the main node; and in the case that the return information is the termination identifier, the execution node keeps an idle state. The problem of in the correlation technique batch transaction task's execution flow consume long time to can't in time feed back the abnormal conditions that the task execution produced is solved. The main node distributes a plurality of tasks in the target event to the plurality of execution nodes, so that the target event is executed in parallel through the plurality of execution nodes, and the task execution of all the execution nodes is immediately stopped under the condition that the termination identifier exists in the main node, thereby timely determining the reason for generating the abnormity and solving the abnormal task, further achieving the effects of shortening the checking time of the target event and timely determining the abnormal task.
Optionally, in the task processing method provided in the embodiment of the present application, the executing node executes the task, and obtaining the sub-execution result includes: and adding a termination identifier for the sub-execution result under the condition that the sub-execution result is abnormal.
Specifically, when an exception occurs in the process of executing a task by an execution node, for example, data of a certain subtask in the task is missing or a data format is abnormal, and the task cannot be normally executed, the task fails to be executed, the execution node generates a termination identifier, and determines the termination identifier as a sub-execution result and sends the result to the master node.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than here.
The embodiment of the present application further provides a task processing system, and it should be noted that the task processing system according to the embodiment of the present application can be used to execute the method for processing the task provided in the embodiment of the present application. The following describes a task processing system provided in an embodiment of the present application.
Fig. 3 is a schematic diagram of a task processing system provided according to an embodiment of the present application. As shown in fig. 3, the system includes:
the master node 301 is connected to the execution node 302, and is configured to receive a task obtaining instruction of a target event sent by the execution node 302, send return information to the execution node 302 according to whether a task of the target event or a termination identifier exists in the master node 301, and determine an execution result of the target event according to a target number of unexecuted tasks of the target event and an execution duration of the target event when the return information is the termination identifier, where the execution duration is a time difference between a time when the master node 301 starts executing the target event and a time when the termination identifier is received, the termination identifier indicates that an execution operation of the unexecuted task of the target event is terminated, the target event includes a plurality of tasks, the task obtaining instruction is used to obtain any one task of the plurality of tasks, and the return information is the task or the termination identifier.
Specifically, the main node 301 may store a target event to be executed, where the target event may be split into a plurality of tasks in the main node 301, and each task may also include one or more subtasks. When the target event to be executed is stored in the master node 301, the multiple execution nodes 302 connected to the master node 301 may send a task acquisition instruction to the master node 301 sequentially or simultaneously, and at this time, the master node 301 may send a task to each execution node 302 sequentially, where the tasks received by each execution node 302 are different. By means of the manner that the master node 301 sends the tasks to the multiple execution nodes 302, the multiple execution nodes 302 can execute multiple tasks in the target event together, so that the execution speed of the target event is increased, and meanwhile, the accuracy of task execution is not reduced.
After receiving the task acquisition instruction, the master node 301 determines whether a termination identifier exists in the master node 301, determines whether an unexecuted task exists, and sends a return message to the execution node 302 according to a determination result. In the case where the termination flag exists in the master node 301, the termination flag is transmitted to the execution node 302, in the case where the termination flag does not exist in the master node 301 and there is an unexecuted task, the task is transmitted to the execution node 302, and in the case where the termination flag does not exist in the master node 301 and there is no unexecuted task, the master node 301 generates the termination flag and transmits the termination flag to the execution node 302.
After the master node 301 sends the termination identifier to the execution node 302, the execution result of the target event may be determined according to the target number of the unexecuted tasks of the target event and the execution duration of the target event.
Each execution node 302 sends a task acquisition instruction of a target event to the master node 301 in an idle state, receives return information returned by the master node 301, executes the task to obtain a sub-execution result if the return information is the task, and sends the sub-execution result to the master node 301, and the execution nodes 302 keep the idle state if the return information is a termination identifier, wherein the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated.
Specifically, the execution node 302 first determines its own state, and does not acquire a task while it is executing a task, and sends a task acquisition instruction of a target event to the master node 301 when the execution node 302 has no task, so that a task can be acquired from the master node 301. When the return result returned by the master node 301 is a task, the execution node 302 executes the task, and generates a sub-execution result after the execution of the task is completed, where the sub-execution result is successful execution or abnormal execution, and sends the sub-execution result to the master node 301, thereby completing an execution cycle of a task. When the return result returned by the master node 301 is the termination identifier, it is characterized that no task exists in the master node 301, or a certain task execution exception occurs, which results in that the target event needs to be terminated. At this time, the executing node 302 may remain in the idle state after receiving the termination task.
It should be noted that, when the execution result of the execution node 302 executing the task is abnormal, the execution node 302 generates the termination flag and determines the termination flag as the sub-execution result.
The task processing system provided in the embodiment of the application is connected to the execution node 302 through the master node 301, and is configured to receive a task obtaining instruction of a target event sent by the execution node 302, send return information to the execution node 302 according to whether a task of the target event exists in the master node 301 or a termination identifier, and determine an execution result of the target event according to a target number of unexecuted tasks of the target event and an execution duration of the target event when the return information is the termination identifier, where the execution duration is a time difference between a time when the master node 301 starts executing the target event and a time when the termination identifier is received, the termination identifier indicates to terminate an execution operation of the unexecuted task of the target event, the target event includes a plurality of tasks, the task obtaining instruction is used to obtain any one task of the plurality of tasks, and the return information is the task or the termination identifier; each execution node 302 sends a task acquisition instruction of a target event to the master node 301 in an idle state, receives return information returned by the master node 301, executes the task to obtain a sub-execution result if the return information is the task, and sends the sub-execution result to the master node 301, and the execution nodes 302 keep the idle state if the return information is a termination identifier, wherein the termination identifier indicates that execution operation of an unexecuted task of the target event is terminated. The problem of in the correlation technique batch transaction task's execution flow consume long time to can't in time feed back the abnormal conditions that the task execution produced is solved. The main node 301 distributes a plurality of tasks in the target event to the plurality of execution nodes 302, so that the target event is executed in parallel by the plurality of execution nodes 302, and the execution of all the tasks of the execution nodes 302 is immediately terminated under the condition that the termination identifier exists in the main node 301, thereby timely determining the cause of the abnormal event and solving the abnormal task, further shortening the checking time of the target event, and simultaneously, timely determining the effect of the abnormal task.
Fig. 4 is a flowchart of an alternative task processing method provided according to an embodiment of the present application, and the task processing method may be used in the task processing system. As shown in fig. 4, the method includes:
the cooperative node sends a task acquisition instruction to the main node, after receiving the task acquisition instruction, the main node determines whether a termination identifier exists in the main node or whether an incomplete task exists, sends the termination identifier to the execution node under the condition that the termination identifier exists, and the execution node enters an idle state and sends the task to the execution node under the condition that the termination identifier does not exist but the task is not executed.
And after the execution node receives the task, executing the task and feeding back a sub-execution result, judging whether a termination identifier exists in the sub-execution result by the main node, and under the condition that the termination identifier exists, determining the execution result of the target event according to the target number of the tasks which are not executed of the target event and the execution duration of the target event, thereby obtaining the execution result. The master node distributes a plurality of tasks in the target event to the plurality of execution nodes, so that the target event is executed in parallel by the plurality of execution nodes, and the task execution of all the execution nodes is immediately stopped under the condition that the termination identifier exists in the master node, thereby timely determining the cause of the abnormal occurrence and solving the abnormal task, further shortening the checking time of the target event and simultaneously timely determining the effect of the abnormal task. The problem of in the correlation technique batch transaction task's execution flow consume long time to can't in time feed back the abnormal conditions that the task execution produced is solved.
The embodiment of the present application further provides a task processing device, and it should be noted that the task processing device according to the embodiment of the present application may be used to execute the method for processing the task provided in the embodiment of the present application. The following describes a task processing device provided in an embodiment of the present application.
Fig. 5 is a schematic diagram of a task processing device according to an embodiment of the present application. As shown in fig. 5, the apparatus includes: a first receiving unit 51, a first transmitting unit 52, and a second transmitting unit 53.
The first receiving unit 51 is configured to receive, by the master node, a task obtaining instruction of a target event sent by an executing node, where the target event includes multiple tasks, and the task obtaining instruction is used to obtain any one of the multiple tasks.
A first sending unit 52, configured to send any one of the tasks to the executing node when the task of the target event exists in the master node and the master node does not store a termination flag, where the termination flag indicates that an execution operation of an unexecuted task of the target event is terminated.
The second sending unit 53 is configured to send the termination identifier to the execution node when no task exists in the master node or the termination identifier is stored in the master node, and determine an execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution duration of the target event, where the execution duration is a time difference between a time when the master node starts executing the target event and a time when the termination identifier is received.
In the task processing apparatus provided in the embodiment of the present application, a master node receives, by a first receiving unit 51, a task obtaining instruction of a target event sent by an execution node, where the target event includes multiple tasks, and the task obtaining instruction is used to obtain any one task of the multiple tasks. The first transmission unit 52 transmits any one of the tasks to the execution node in a case where the task of the target event exists in the master node and the master node does not store the termination flag indicating the execution operation of the unexecuted task of the termination target event. The second sending unit 53 sends the termination identifier to the execution node when no task exists in the master node or the termination identifier is stored in the master node, and determines the execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution duration of the target event, wherein the execution duration is the time difference between the time when the master node starts executing the target event and the time when the termination identifier is received. The problem of in the correlation technique batch transaction task's execution flow consume long time to can't in time feed back the abnormal conditions that the task execution produced is solved. The main node distributes a plurality of tasks in the target event to the plurality of execution nodes, so that the target event is executed in parallel through the plurality of execution nodes, and the task execution of all the execution nodes is immediately stopped under the condition that the termination identifier exists in the main node, thereby timely determining the reason for generating the abnormity and solving the abnormal task, further achieving the effects of shortening the checking time of the target event and timely determining the abnormal task.
Optionally, in the task processing device provided in the embodiment of the present application, the device further includes: the third receiving unit is used for receiving a sub-execution result returned by the execution node, wherein the sub-execution result is an execution result obtained after the execution node executes the task; the first judging unit is used for judging whether the sub-execution result carries the termination identifier or not; and the third execution unit is used for terminating the execution operation of the unexecuted task of the target event according to the termination identifier by the main node under the condition that the sub-execution result carries the termination identifier, and storing the termination identifier.
Optionally, in the task processing device provided in the embodiment of the present application, the second sending unit 53 includes: the first sending module is used for sending the stored termination identifier to the execution node under the condition that the termination identifier is stored in the main node; and the second sending module is used for generating a termination identifier by the main node and sending the termination identifier to the execution node under the condition that no task exists in the main node.
Optionally, in the task processing device provided in the embodiment of the present application, the second sending unit 53 includes: the judging module is used for judging whether the target number is larger than the preset number or not; the first determining module is used for determining that the target event is abnormal in execution and sending first alarm information when the target number is larger than the preset number, wherein the first alarm information represents that the target event is failed in execution; and the second determining module is used for determining the execution result of the target event according to the execution time length and the event execution time length threshold under the condition that the target number is less than or equal to the preset number.
Optionally, in the task processing apparatus provided in this embodiment of the present application, the event execution duration threshold includes a first preset duration and a second preset duration, where the second preset duration is greater than the first preset duration, and the second determining module includes: the first judgment sub-module is used for judging whether the execution time length is less than or equal to a first preset time length; the first determining submodule is used for determining that the target event is abnormal in execution and sending out second alarm information under the condition that the execution time length is less than or equal to a first preset time length, wherein the second alarm information represents that an unexecuted task exists in the target event; the second judgment sub-module is used for judging whether the execution time length is greater than or equal to a second preset time length or not under the condition that the execution time length is greater than the first preset time length, wherein the second preset time length is greater than the first preset time length; the second determining submodule is used for determining that the target event is abnormal in execution and sending third alarm information under the condition that the execution time length is greater than or equal to a second preset time length, wherein the third alarm information represents that the target event is overtime in execution; and the third determining submodule is used for determining that the target event is normally executed under the condition that the execution time length is less than the second preset time length.
Optionally, in the task processing device provided in the embodiment of the present application, the device further includes: the second judging unit is used for judging whether the execution time of each task is greater than or equal to a third preset time, wherein the execution time of each task is the execution time of each task at an execution node; the determining unit is used for determining that the target event is abnormal to be executed and sending third alarm information when the execution time of at least one task is greater than or equal to a third preset time, wherein the third alarm information represents that the target event is overtime to be executed; and the fourth execution unit is used for executing the step of sending any one task to the execution node under the condition that the execution time length of all the tasks is less than the third preset time length.
Optionally, in the task processing apparatus provided in this embodiment of the present application, the master node communicates with multiple execution nodes, and the multiple execution nodes execute multiple tasks in the target event in parallel.
Fig. 6 is a schematic diagram of another task processing device provided according to an embodiment of the present application. As shown in fig. 6, the apparatus includes: a second receiving unit 61, a first executing unit 62 and a second executing unit 63.
The second receiving unit 61 is configured to send a task obtaining instruction of a target event to the master node and receive return information of the master node when the execution node is in an idle state, where the target event includes multiple tasks, the task obtaining instruction is used to obtain any one of the multiple tasks, the return information is a task or a termination identifier, and the termination identifier indicates that an execution operation of an unexecuted task of the target event is terminated.
And the first execution unit 62 is configured to, in a case that the return information is a task, execute the task by the execution node, obtain a sub-execution result, and send the sub-execution result to the master node.
And a second execution unit 63, configured to, in a case that the return information is the termination identifier, maintain the execution node in an idle state.
In the task processing device provided in the embodiment of the present application, when the execution node is in an idle state, the second receiving unit 61 sends a task obtaining instruction of a target event to the master node, and receives return information of the master node, where the target event includes multiple tasks, the task obtaining instruction is used to obtain any one task of the multiple tasks, the return information is a task or a termination identifier, and the termination identifier indicates that execution operations of an unexecuted task of the target event are terminated. When the return information is a task, the first execution unit 62 executes the task by the execution node, obtains a sub-execution result, and sends the sub-execution result to the master node. The second execution unit 63 keeps the execution node in the idle state in the case that the return information is the termination flag. The problem of in the correlation technique batch transaction task's execution procedure consume long time to can't feed back in time the unusual condition that produces when the task was executed is solved. The main node distributes a plurality of tasks in the target event to the plurality of execution nodes, so that the target event is executed in parallel through the plurality of execution nodes, and the task execution of all the execution nodes is immediately stopped under the condition that the termination identifier exists in the main node, thereby timely determining the reason for generating the abnormity and solving the abnormal task, further achieving the effects of shortening the checking time of the target event and timely determining the abnormal task.
Optionally, in the task processing device provided in the embodiment of the present application, the first execution unit 62 includes: and the adding module is used for adding a termination identifier for the sub-execution result under the condition that the sub-execution result is abnormal.
The task processing device comprises a processor and a memory, wherein the first receiving unit 51, the first transmitting unit 52, the second transmitting unit 53, the second receiving unit 61, the first executing unit 62, the second executing unit 63 and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. One or more kernels can be set, and the problems that the execution flow of batch transaction tasks in the related technology consumes long time and abnormal conditions generated during the execution of the tasks cannot be fed back in time are solved by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a computer-readable storage medium on which a program is stored, the program implementing the task processing method when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the task processing method is executed when the program runs.
As shown in fig. 7, an embodiment of the present invention provides an electronic device, where the electronic device 70 includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor executes the program to implement the following steps: the method comprises the steps that a main node receives a task obtaining instruction of a target event sent by an execution node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the tasks; under the condition that the task of the target event exists in the main node and the main node does not store a termination identifier, any task is sent to the execution node, wherein the termination identifier indicates the execution operation of the unexecuted task of the target event to be terminated; and sending the termination identifier to the execution node under the condition that no task exists in the main node or the termination identifier is stored in the main node, and determining the execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution duration of the target event, wherein the execution duration is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: the method comprises the steps that a main node receives a task obtaining instruction of a target event sent by an execution node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the tasks; under the condition that the tasks of the target event exist in the main node and the main node does not store a termination identifier, any task is sent to the execution node, wherein the termination identifier indicates the execution operation of the unexecuted task of the target event; and sending the termination identifier to the execution node under the condition that no task exists in the main node or the termination identifier is stored in the main node, and determining the execution result of the target event according to the target number of the unexecuted tasks of the target event and the execution duration of the target event, wherein the execution duration is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art to which the present application pertains. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (14)
1. A method for processing a task, comprising:
the method comprises the steps that a main node receives a task obtaining instruction of a target event sent by an execution node, wherein the target event comprises a plurality of tasks, and the task obtaining instruction is used for obtaining any one of the tasks;
under the condition that the task of the target event exists in the main node and the main node does not store a termination identifier, any task is sent to the execution node, wherein the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated;
and under the condition that the tasks do not exist in the main node or the termination identifier is stored in the main node, sending the termination identifier to the execution node, and determining an execution result of the target event according to the target number of the tasks of the target event which are not executed and the execution time of the target event, wherein the execution time is the time difference between the time when the main node starts to execute the target event and the time when the termination identifier is received.
2. The method of claim 1, wherein after sending any one task to the executing node, the method further comprises:
receiving a sub-execution result returned by the execution node, wherein the sub-execution result is an execution result obtained after the execution node executes the task;
judging whether the sub-execution result carries the termination identifier or not;
and under the condition that the sub-execution result carries the termination identifier, the main node terminates the execution operation of the unexecuted task of the target event according to the termination identifier and stores the termination identifier.
3. The method of claim 1, wherein sending the termination identifier to the executing node in the absence of the task in the master node or in the presence of the termination identifier stored in the master node comprises:
under the condition that the termination identifier is stored in the main node, sending the stored termination identifier to the execution node;
and under the condition that the task does not exist in the main node, the main node generates the termination identifier and sends the termination identifier to the execution node.
4. The method of claim 1, wherein determining the execution result of the target event according to the target number of unexecuted tasks of the target event and the execution duration of the target event comprises:
judging whether the target number is larger than a preset number or not;
when the target number is larger than the preset number, determining that the target event is abnormal in execution, and sending first alarm information, wherein the first alarm information represents that the target event fails in execution;
and under the condition that the target number is less than or equal to the preset number, determining the execution result of the target event according to the execution duration and an event execution duration threshold.
5. The method of claim 4, wherein the event execution duration threshold comprises a first preset duration and a second preset duration, the second preset duration is longer than the first preset duration, and determining the execution result of the target event according to the execution duration comprises:
judging whether the execution time length is less than or equal to the first preset time length or not;
determining that the target event is abnormal in execution under the condition that the execution duration is less than or equal to the first preset duration, and sending second alarm information, wherein the second alarm information represents that an unexecuted task exists in the target event;
under the condition that the execution time length is longer than the first preset time length, judging whether the execution time length is longer than or equal to a second preset time length, wherein the second preset time length is longer than the first preset time length;
when the execution time length is greater than or equal to the second preset time length, determining that the target event is abnormal in execution, and sending third alarm information, wherein the third alarm information represents that the target event is overtime in execution;
and determining that the target event is normally executed under the condition that the execution duration is less than the second preset duration.
6. The method of claim 1, wherein prior to sending any one task to the executing node, the method further comprises:
judging whether the execution time of each task is greater than or equal to a third preset time, wherein the execution time of each task is the execution time of each task at an execution node;
when the execution time of at least one task is longer than or equal to the third preset time, determining that the target event is abnormal in execution, and sending third alarm information, wherein the third alarm information represents that the target event is overtime in execution;
and under the condition that the execution time of all tasks is less than the third preset time, executing the step of sending any one task to the execution node.
7. The method of claim 1, wherein the master node communicates with a plurality of execution nodes that execute a plurality of tasks in the target event in parallel.
8. A task processing method, comprising:
under the condition that an execution node is in an idle state, sending a task obtaining instruction of a target event to a main node, and receiving return information of the main node, wherein the target event comprises a plurality of tasks, the task obtaining instruction is used for obtaining any one of the tasks, the return information is a task or a termination identifier, and the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated;
under the condition that the return information is a task, the execution node executes the task to obtain a sub-execution result, and sends the sub-execution result to the main node;
and under the condition that the return information is the termination identifier, the execution node keeps the idle state.
9. The method of claim 8, wherein the executing node executes the task and obtaining a sub-execution result comprises:
and under the condition that the sub-execution result is abnormal, adding the termination identifier for the sub-execution result.
10. A task processing system, comprising:
the main node is connected with the execution node and used for receiving a task acquisition instruction of a target event sent by the execution node, sending return information to the execution node according to whether the task of the target event or a termination identifier exists in the main node, and determining an execution result of the target event according to the target number of unexecuted tasks of the target event and the execution duration of the target event under the condition that the return information is the termination identifier, wherein the execution duration is the time difference between the moment when the main node starts to execute the target event and the moment when the termination identifier is received, the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated, the target event comprises a plurality of tasks, the task acquisition instruction is used for acquiring any one task of the plurality of tasks, and the return information is the task or the termination identifier;
each execution node sends a task obtaining instruction of a target event to a main node in an idle state, receives return information returned by the main node, executes the task to obtain a sub-execution result under the condition that the return information is the task, and sends the sub-execution result to the main node, and under the condition that the return information is a termination identifier, the execution nodes keep the idle state, wherein the termination identifier indicates that the execution operation of the unexecuted task of the target event is terminated.
11. A task processing apparatus, comprising:
a first receiving unit, configured to receive, by a master node, a task obtaining instruction of a target event sent by an execution node, where the target event includes multiple tasks, and the task obtaining instruction is used to obtain any one task of the multiple tasks;
a first sending unit, configured to send any one task to the execution node when the task of the target event exists in the master node and the master node does not store a termination identifier, where the termination identifier indicates that an execution operation of an unexecuted task of the target event is terminated;
a second sending unit, configured to send the termination identifier to the execution node when the task does not exist in the master node or the termination identifier is stored in the master node, and determine an execution result of the target event according to a target number of unexecuted tasks of the target event and an execution duration of the target event, where the execution duration is a time difference between a time when the master node starts executing the target event and a time when the termination identifier is received.
12. A task processing apparatus, comprising:
a second receiving unit, configured to send a task obtaining instruction of a target event to a master node and receive return information of the master node when an execution node is in an idle state, where the target event includes multiple tasks, the task obtaining instruction is used to obtain any one of the multiple tasks, the return information is a task or a termination identifier, and the termination identifier indicates to terminate an execution operation of an unexecuted task of the target event;
the first execution unit is used for executing the task by the execution node under the condition that the return information is the task to obtain a sub-execution result and sending the sub-execution result to the main node;
a second execution unit, configured to, in a case that the return information is the termination identifier, maintain the idle state by the execution node.
13. A computer storage medium for storing a program, wherein the program controls a device on which the computer storage medium is located to execute the task processing method according to any one of claims 1 to 9 when the program runs.
14. An electronic device comprising one or more processors and memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the task processing method of any of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211110617.XA CN115454599A (en) | 2022-09-13 | 2022-09-13 | Task processing method, system, device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211110617.XA CN115454599A (en) | 2022-09-13 | 2022-09-13 | Task processing method, system, device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115454599A true CN115454599A (en) | 2022-12-09 |
Family
ID=84302349
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211110617.XA Pending CN115454599A (en) | 2022-09-13 | 2022-09-13 | Task processing method, system, device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115454599A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118041975A (en) * | 2024-04-11 | 2024-05-14 | 杭州海浔科技有限公司 | Command processing transfer method, system and storage medium of concentrator device |
-
2022
- 2022-09-13 CN CN202211110617.XA patent/CN115454599A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118041975A (en) * | 2024-04-11 | 2024-05-14 | 杭州海浔科技有限公司 | Command processing transfer method, system and storage medium of concentrator device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8954579B2 (en) | Transaction-level health monitoring of online services | |
US9535754B1 (en) | Dynamic provisioning of computing resources | |
CN111782360A (en) | Distributed task scheduling method and device | |
CN106713388B (en) | Burst service processing method and device | |
CN110099108B (en) | Block chain event duplicate removal method and device, computer equipment and storage medium | |
CN107179982B (en) | Cross-process debugging method and device | |
CN111538585B (en) | Js-based server process scheduling method, system and device | |
CN115454599A (en) | Task processing method, system, device, storage medium and electronic equipment | |
CN108897646A (en) | A kind of switching method and baseboard management controller of BIOS chip | |
CN111309548A (en) | Timeout monitoring method and device and computer readable storage medium | |
CN112711462A (en) | Cloud platform virtual CPU hot binding method and device and computer readable storage medium | |
CN105824622B (en) | Data processing method and electronic equipment | |
CN112416534A (en) | Agent-based task management method and device | |
CN116361031A (en) | Message transmission method, system, device, processor and electronic equipment | |
CN111124631A (en) | Task processing method and device based on block chain network | |
CN116244062A (en) | Data processing method and device, electronic equipment and storage medium | |
CN114691241B (en) | Task execution method, device, electronic equipment and storage medium | |
CN105790975A (en) | Service processing operation execution method and device | |
US20160004576A1 (en) | Apparatus for managing application program and method therefor | |
CN115499493A (en) | Asynchronous transaction processing method and device, storage medium and computer equipment | |
CN109189615A (en) | A kind of delay machine treating method and apparatus | |
CN113900856A (en) | Data processing method and related equipment | |
CN114816662A (en) | Container arrangement method and system applied to Kubernetes | |
CN111090627B (en) | Log storage method and device based on pooling, computer equipment and storage medium | |
CN112673354B (en) | System state detection method, system state device and terminal equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |