A method and apparatus for handling task exceptions
By leveraging data interaction between the task execution thread and the exception handling thread, and utilizing exception handling pipelines and strategies to handle exceptions in the batch processing task flow, this solves the problems of low flexibility and efficiency in task node exception handling in existing technologies, and achieves efficient and reliable exception handling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies cannot effectively handle task node anomalies in batch processing workflows, resulting in poor flexibility and low efficiency in task processing, and the inability to preserve the anomaly context increases the complexity of the scheduling process.
Through data interaction between the task execution thread and the exception handling thread, the exception handling pipeline is used to transmit task exception data, and the exception handling strategy is used to handle task exceptions, including building the exception handling pipeline and receiving the exception handling strategy.
It improves the flexibility and efficiency of task exception handling, reduces control complexity, achieves reliability and real-time performance in exception handling, and automatically records the exception scene.
Smart Images

Figure CN120371589B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of task processing technology, and in particular to a method and apparatus for handling task anomalies. Background Technology
[0002] In application business processing systems, batch processing task flows can be used to improve business processing efficiency. In executing batch processing task flows, it is usually necessary to schedule different task flows and task nodes in the task flows.
[0003] When anomalies occur in task nodes during batch processing, existing methods typically record the abnormal state, send the abnormal state information to operations and maintenance personnel, and wait for the personnel to handle the abnormality before triggering the subsequent task process. However, existing methods have the problems of not being able to preserve the abnormal state and needing to handle the task blocking logic in the waiting state separately. With the increasing performance requirements of application services, especially for financial services, existing methods suffer from poor flexibility and low efficiency in handling tasks. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method and apparatus for handling task exceptions, capable of executing one or more task nodes using a task execution thread; when an exception is detected in the currently executing task node, the task exception data corresponding to the task node is sent to an exception handling thread; the exception handling thread binds the task exception data to an exception handling pipeline, and returns the receiving end of the exception handling pipeline to the task execution thread; the task execution thread receives an exception handling strategy for the task exception data via the receiving end of the exception handling pipeline, and handles the task exception based on the exception handling strategy. Embodiments of the present invention complete exception handling through data interaction between the task execution thread and the exception handling thread, improving the flexibility and efficiency of handling task exceptions, and enhancing the reliability of task exception handling.
[0005] To achieve the above objectives, according to one aspect of the present invention, a method for handling task exceptions is provided, characterized by comprising: executing one or more task nodes using a task running thread; when an exception is detected in the currently executing task node, sending task exception data corresponding to the task node to an exception handling thread; binding the task exception data to an exception handling pipeline corresponding to the task node using the exception handling thread, and returning the receiving end of the exception handling pipeline to the task running thread; and receiving an exception handling strategy for the task exception data via the receiving end of the exception handling pipeline using the task running thread, and handling the task exception based on the exception handling strategy.
[0006] Optionally, before binding the task exception data to the exception handling pipeline corresponding to the task node using the exception handling thread, the method further includes: receiving the task exception data using the exception handling thread, obtaining the task node exception feature value contained in the task exception data, and constructing the corresponding exception handling pipeline for the task node based on the task node exception feature value.
[0007] Optionally, if an anomaly is detected in the currently executing task node, the method further includes: writing the task anomaly data corresponding to the task node to the task log data source; so as to obtain the task anomaly data from the task log data source using the anomaly handling module, and send the anomaly handling strategy corresponding to the task anomaly data to the anomaly handling thread.
[0008] Optionally, the method for handling exceptions further includes: using an exception handling thread to receive an exception handling strategy for task exception data sent by an exception handling module; and sending the received exception handling strategy to the task running thread.
[0009] Optionally, receiving the exception handling strategy for the task exception data sent by the exception handling module using the exception handling thread further includes: obtaining the task node exception feature value contained in the task exception data; finding the target exception handling pipeline bound to the task node exception feature value from multiple exception handling pipelines; and sending the exception handling strategy to the task running thread, including: sending the exception handling strategy to the task running thread using the sending end of the target exception handling pipeline.
[0010] Optionally, the method for handling exceptions further includes: setting up an exception handling service port; sending the task exception data corresponding to the task node to the exception handling thread, including: using the task running thread to connect to the exception handling service port, and sending the task exception data corresponding to the task node to the exception handling thread through the exception recording service provided by the exception handling service port.
[0011] Optionally, the method for handling exceptions further includes: setting up an exception handling service port; after obtaining task exception data from the task log data source using the exception handling module and sending the exception handling strategy corresponding to the task exception data to the exception handling thread, it further includes: connecting to the exception handling service port using the exception handling module and sending the exception handling strategy for the task node to the exception handling thread through the exception handling service provided by the exception handling service port.
[0012] To achieve the above objectives, according to a second aspect of the present invention, an apparatus for handling task exceptions is provided, characterized in that it includes: an exception detection module, a pipeline binding module, and an exception handling module; wherein,
[0013] The exception detection module is used to execute one or more task nodes using the task execution thread; if an exception is detected in the currently executing task node, the task exception data corresponding to the task node is sent to the exception handling thread.
[0014] The binding pipeline module is used to bind task exception data to the exception handling pipeline corresponding to the task node using the exception handling thread, and return the receiving end of the exception handling pipeline to the task running thread.
[0015] The exception handling module is used to receive exception handling strategies for task exception data through the receiver of the exception handling pipeline by the task running thread, and to handle task exceptions based on the exception handling strategies.
[0016] Optionally, the apparatus for handling task exceptions is further configured to: after receiving the task exception data, use the exception handling thread to obtain the task node exception feature value contained in the task exception data; and construct a corresponding exception handling pipeline for the task node based on the task node exception feature value.
[0017] Optionally, the apparatus for handling task exceptions is further configured to, upon detecting an exception in a currently executing task node, include: writing the task exception data corresponding to the task node to a task log data source; so as to obtain the task exception data from the task log data source using an exception handling module.
[0018] Optionally, the apparatus for handling task exceptions is further configured to receive, via an exception handling thread, an exception handling strategy for task exception data sent by an exception handling module; and to send the received exception handling strategy to the task running thread.
[0019] Optionally, the apparatus for handling task exceptions, used to receive an exception handling strategy for task exception data sent by an exception handling module using an exception handling thread, further includes: obtaining task node exception feature values contained in the task exception data; searching for a target exception handling pipeline bound to the task node exception feature value from multiple exception handling pipelines; and sending the exception handling strategy to the task running thread, including: sending the exception handling strategy to the task running thread using the sending end of the target exception handling pipeline.
[0020] Optionally, the apparatus for handling exceptions is further configured to have an exception handling service port; sending the task exception data corresponding to the task node to the exception handling thread includes: using the task running thread to connect to the exception handling service port, and sending the task exception data corresponding to the task node to the exception handling thread through the exception recording service provided by the exception handling service port.
[0021] Optionally, the apparatus for handling exceptions is further configured to have an exception handling service port; when obtaining task exception data from the task log data source using the exception handling module, it further includes: connecting to the exception handling service port using the exception handling module, and sending an exception handling strategy for the task node to the exception handling thread through the exception handling service provided by the exception handling service port.
[0022] To achieve the above objectives, according to a third aspect of the present invention, an electronic device for handling task exceptions is provided, characterized in that it includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform any of the methods described above for handling task exceptions.
[0023] To achieve the above objectives, according to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, characterized in that, when the program is executed by a processor, it implements any of the methods described above for handling task exceptions.
[0024] To achieve the above objectives, according to a fifth aspect of the present invention, a computer program product is provided, comprising a computer program, characterized in that, when executed by a processor, the computer program implements any of the methods described above for handling task exceptions.
[0025] One embodiment of the above invention has the following advantages or beneficial effects: it can utilize a task execution thread to execute one or more task nodes; when an anomaly is detected in the currently executing task node, the task anomaly data corresponding to the task node is sent to the anomaly handling thread; the anomaly handling thread binds the task anomaly data to the anomaly handling pipeline, and returns the receiving end of the anomaly handling pipeline to the task execution thread; the task execution thread receives the anomaly handling strategy for the task anomaly data via the receiving end of the anomaly handling pipeline, and handles the task anomaly based on the anomaly handling strategy. This embodiment of the invention completes anomaly handling through data interaction between the task execution thread, the anomaly handling thread, and the anomaly handling module, improving the flexibility, efficiency, and reliability of anomaly handling.
[0026] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0027] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0028] Figure 1 This is a flowchart illustrating a method for handling task exceptions according to an embodiment of the present invention;
[0029] Figure 2 This is a schematic diagram of an interactive process for handling task exceptions provided in one embodiment of the present invention;
[0030] Figure 3 This is a flowchart illustrating another method for handling task exceptions provided in one embodiment of the present invention;
[0031] Figure 4 This is a schematic diagram of the structure of a device for handling task exceptions according to an embodiment of the present invention;
[0032] Figure 5 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0033] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0034] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0035] In various types of application software systems, batch processing systems are often included in business processing systems. For business systems with complex operations and high performance requirements, such as financial business systems, settlement business systems, and e-commerce business systems, the batch processing systems they use usually require an independent batch processing scheduling system to flexibly configure batch processing task flows and monitor the operation of batch processing task flows in real time.
[0036] In a batch processing task flow, there are usually multiple task nodes, and each task node corresponds to a business function. When there are business dependencies between business functions, multiple task nodes have an execution order when they are scheduled to be executed, and there may be one or more preceding or succeeding task nodes for a task node. When there are no business dependencies between multiple business functions, multiple task nodes can be executed in parallel.
[0037] During the execution and scheduling of batch processing tasks, when any task node encounters an anomaly in its business execution (e.g., network connection failure, interface call failure, memory resource failure, CPU resource failure, etc.), existing methods typically employ the following methods to handle the anomaly: A. The batch processing scheduling system continues to execute subsequent task processes according to pre-set rules (automatic retry or execution of the erroneous branch); B. The batch processing scheduling system records the status of the erroneous task node, awaiting manual intervention to trigger or skip the task node.
[0038] Method A suffers from poor flexibility and versatility due to the limitations of pre-defined rules. Method B has the problems of not being able to preserve the error context, requiring the batch processing scheduling system to consider how to block subsequent task flows when a task node fails, which increases the complexity of scheduling process control, and requiring the task node scheduling thread to be restarted or the erroneous task node to be reassigned when handling exceptions.
[0039] In view of this, such as Figure 1 As shown, this embodiment of the invention provides a method for handling task exceptions, which may include the following steps:
[0040] Step S101: Execute one or more task nodes using the task execution thread; if an anomaly is detected in the currently executing task node, send the task anomaly data corresponding to the task node to the anomaly handling thread.
[0041] Specifically, in the embodiments of the present invention, a task execution thread and an exception handling thread are set up and run in the batch processing scheduling system. The task execution thread is used to execute one or more task nodes. When an exception is detected in the currently executing task node, the task exception data corresponding to the task node is obtained and sent to the exception handling thread. When the task execution thread is used to execute one or more task nodes, a synchronous serial execution method can be adopted.
[0042] There are several types of exceptions that can occur at task nodes, such as: Connection and communication errors: When a task node experiences network connection problems during runtime, it may experience high data latency or packet loss because the task node needs to obtain data or interact with other systems via the network. Alternatively, when a task node depends on interfaces of other systems or services, network connection issues may cause interface call failures. For example, if a task node calls a third-party payment interface for financial transactions, incorrect interface parameters will lead to transaction failure. Data-related exceptions: For example, missing data, incorrect formatting, or inconsistent data can cause task node malfunctions. Resource-related exceptions in the task node's runtime environment: For example, insufficient memory: Task nodes may require a large amount of memory to process data or perform operations; if the system allocates insufficient memory to the task node, the task will fail. Insufficient CPU resources: When the computational load of a task node is large, but the system's CPU resources are limited, the task may execute slowly or even fail to complete. Storage resource issues: Task nodes may need to read and write to storage devices such as disks. If the storage device malfunctions, has insufficient space, or has read / write permission issues, it may cause task errors. This invention does not limit the specific business logic and exception types of task nodes.
[0043] Furthermore, when an anomaly is detected in a task node, the corresponding task anomaly data is obtained and sent to the anomaly handling thread. Specifically, the task anomaly data may include the unique identifier of the task node, the timestamp of the anomaly occurrence, and the specific information of the anomaly. The unique identifier of the task node and the timestamp of the anomaly occurrence can be combined to form the anomaly characteristic value of that task node in a particular anomaly (i.e., the task node anomaly characteristic value). It is understood that for the same task node, multiple anomalies may occur at different timestamps; by combining the unique identifier of the task node and the timestamp of the anomaly occurrence, each anomaly of the task node can be uniquely identified. The specific information of the anomaly may include various detailed information such as the anomaly type, the anomaly code, and the anomaly text description.
[0044] Step S102: Use the exception handling thread to bind the task exception data to the exception handling pipeline corresponding to the task node, and return the receiving end of the exception handling pipeline to the task running thread.
[0045] Specifically, in an embodiment of the present invention, an exception handling thread is set up and run in the batch processing scheduling system; wherein, the exception handling thread receives task exception data sent by the task running thread.
[0046] Furthermore, upon receiving task exception data from the task execution thread, the exception handling thread extracts the task node exception characteristic value from the task exception data and constructs a new exception handling pipeline corresponding to the task node exception characteristic value; that is, an exception handling pipeline is bound to the exception data of a task node. Specifically, before binding the task exception data to the exception handling pipeline corresponding to the task node using the exception handling thread, the process further includes: after receiving the task exception data, the exception handling thread extracts the task node exception characteristic value contained in the task exception data; and constructs a corresponding exception handling pipeline for the task node based on the task node exception characteristic value. The exception handling pipeline (PIPE) is a mechanism for full-duplex, point-to-point data transmission and communication between different threads (task execution thread and exception handling thread). One thread can put data into one end of the pipeline (e.g., the sending end), while another thread can obtain data from the other end of the pipeline (e.g., the receiving end), thereby realizing data interaction between threads.
[0047] Furthermore, the exception handling thread uses the constructed exception handling pipeline to return the receiving end to the task execution thread.
[0048] Step S103: The task running thread receives the exception handling strategy for the task exception data through the receiver of the exception handling pipeline, and handles the task exception based on the exception handling strategy.
[0049] Specifically, in the embodiments of the present invention, an exception handling module is used to determine the corresponding exception handling strategy for the abnormal data of the task; wherein, the exception handling module (external program) can be a separate application independent of the batch processing scheduling system.
[0050] In this embodiment of the invention, one or more task nodes are executed using a task running thread. If an anomaly is detected in the executing task node, the method further includes: writing the task anomaly data corresponding to the task node into a task log data source; and using an anomaly handling module to obtain the task anomaly data from the task log data source, that is, using the anomaly handling module to monitor log changes in the task log data source and obtain and process the task anomaly data from the task log data source in real time.
[0051] Furthermore, the exception handling module retrieves task exception data from the task log data source and sends the corresponding exception handling strategy to the exception handling thread. The exception handling strategy is determined based on the characteristics of the task exception data. This determination can be made by operations and maintenance personnel or by using pre-configured rules based on the characteristics of the task exception data.
[0052] Furthermore, exception handling strategies include, for example, retry, go, and ignore. Before determining the exception handling strategy as retry, it is necessary to attempt to correct the exception of the task node (e.g., attempt to restore network connectivity, release resources, etc.). If the exception handling strategy is go, the program can be terminated directly by executing `final`. If the exception handling strategy is ignore, the next one or more task nodes can be determined through configuration information, and the exception of that task node can be ignored to continue executing subsequent nodes.
[0053] Furthermore, task execution threads handle task exceptions based on the received exception handling strategy. For example, for the task node that currently experiences an exception, exception handling strategies such as retry, continue, or ignore are executed.
[0054] Through data interaction between the exception handling thread, the task execution thread, and the exception handling module in steps S101 to S103, the operation of suspending and handling the abnormal task node can be performed when an exception occurs at the task node. This improves the real-time performance and efficiency of handling task node exceptions, as well as the reliability of handling task node exceptions. It can automatically record the context of the exception and use the batch processing scheduling system to control the task flow, reducing the complexity of control. It does not require additional logic to block the subsequent task flow when an exception occurs at the task node. Furthermore, it does not require restarting the task execution thread when handling exceptions, thus improving response efficiency.
[0055] like Figure 2 As shown, this embodiment of the invention provides an interactive process for handling task exceptions, which may include the following steps:
[0056] Specifically, steps S201 to S206 are executed using a task execution thread:
[0057] Step S201: An anomaly was detected in the currently executing task node.
[0058] Step S202: Write the task exception data corresponding to the task node into the task log data source.
[0059] Step S203: Send the task exception data corresponding to the task node to the exception handling thread.
[0060] Step S204: Obtain the receiver of the exception handling pipe sent by the exception handling thread.
[0061] Step S205: Wait at the receiving end of the exception handling pipeline to receive the exception handling strategy (sent via the sending end of the target exception handling pipeline by the exception handling thread).
[0062] Step S206: Handle task exceptions based on exception handling strategies.
[0063] Specifically, steps S207 to S212 are executed using an exception handling thread:
[0064] Step S207: Receive task exception data from the task node and build a corresponding exception handling pipeline for the task node.
[0065] Step S208: Bind the task exception data to the exception handling pipeline.
[0066] Step S209: Send the receiver of the exception handling pipeline to the task running thread.
[0067] Step S210: Receive the exception handling strategy for the task exception data sent by the exception handling module, and obtain the task node feature values contained in the task exception data.
[0068] Step S211: Locate the target exception handling pipeline that is bound to the task node feature value.
[0069] Step S212: Send the exception handling strategy to the task running thread using the sender of the target exception handling pipeline.
[0070] Specifically, the exception handling thread can build and maintain multiple exception handling pipelines. These pipelines are distinguished by task node feature values. It's understood that a single task node may experience multiple exceptions, thus each task node can correspond to multiple exception handling pipelines (each pipeline is distinguished by a task node identifier combined with an exception occurrence timestamp). When the exception handling thread receives an exception handling strategy for task exception data from the exception handling module, it first searches for a matching target exception handling pipeline using the task node feature values contained in the exception data. Further, it uses the sending end of the target exception handling pipeline to send the exception handling strategy to the task execution thread. That is, before binding the task exception data to the exception handling pipeline corresponding to the task node using the exception handling thread, the process further includes: after receiving the task exception data, the exception handling thread obtains the task node exception feature values contained in the task exception data; and constructs a corresponding exception handling pipeline for the task node based on these task node exception feature values.
[0071] Further, steps S213 to S214 are executed using the exception handling module:
[0072] Step S213: Obtain task exception data of task nodes from the task log data source.
[0073] Step S214: Send the exception handling strategy for the abnormal data of the task.
[0074] Steps S201 to S214 describe the timing and content of the interaction between the task execution thread, the exception handling thread, and the exception handling module. Specifically, the task execution thread executes one or more task nodes; when an exception is detected in the currently executing task node, the task exception data corresponding to the task node is sent to the exception handling thread; the exception handling thread binds the task exception data to the exception handling pipeline corresponding to the task node and returns the receiving end of the exception handling pipeline to the task execution thread; the task execution thread receives the exception handling strategy for the task exception data through the receiving end of the exception handling pipeline; and the task execution thread handles the task exception based on the exception handling strategy.
[0075] Furthermore, after receiving task exception data, the exception handling thread obtains the task node exception feature value contained in the task exception data; and constructs the corresponding exception handling pipeline for the task node based on the task node exception feature value.
[0076] The task execution thread writes the task exception data corresponding to the task node to the task log data source.
[0077] The exception handling module is used to obtain task exception data from the task log data source, and an exception handling strategy is determined for the task node based on the task exception data.
[0078] like Figure 3 As shown, this embodiment of the invention provides a method for handling task exceptions, which may include the following steps:
[0079] Step S301: Execute one or more task nodes using the task execution thread; if an anomaly is detected in the currently executing task node, connect to the exception handling service port using the task execution thread, and send the task exception data corresponding to the task node to the exception handling thread through the exception recording service provided by the exception handling service port.
[0080] Step S302: Use the exception handling thread to bind the task exception data to the exception handling pipeline corresponding to the task node, and return the receiving end of the exception handling pipeline to the task running thread.
[0081] Step S303: The task running thread receives the exception handling strategy for the task exception data through the receiver of the exception handling pipeline; wherein, the exception handling module connects to the exception handling service port, and sends the exception handling strategy for the task node to the exception handling thread through the exception handling service provided by the exception handling service port.
[0082] Step S304: Handle task exceptions using the task execution thread based on the exception handling strategy.
[0083] In this embodiment of the invention, an exception handling service port is provided, which provides different service types (such as exception recording service, exception handling service, etc.). The task running thread sends the task exception data corresponding to the task node to the exception handling thread through the exception recording service of the exception service port. The exception handling module sends the exception handling strategy for the task node to the exception handling thread through the exception handling service provided by the exception handling service port.
[0084] That is, an exception handling service port is set up; the task exception data corresponding to the task node is sent to the exception handling thread, including: using the task running thread to connect to the exception handling service port, and sending the task exception data corresponding to the task node to the exception handling thread through the exception recording service provided by the exception handling service port.
[0085] After obtaining task exception data from the task log data source using the exception handling module and determining the exception handling strategy for the task node based on the task exception data, the process further includes: connecting to the exception handling service port using the exception handling module, and sending the exception handling strategy for the task node to the exception handling thread through the exception handling service provided by the exception handling service port.
[0086] By setting up an exception handling service port and using different service types on the exception handling service port to transmit different data between the task execution thread and the exception handling thread, and between the exception handling thread and the exception handling module, the efficiency and reliability of handling task exceptions are further improved.
[0087] In embodiments of the present invention, exception handling threads and task execution threads can belong to a batch processing scheduling system. For example, the exception handling thread is started through the batch processing scheduling system and listens to the exception handling service port to receive exception data of task nodes sent by the task execution thread through the exception handling service port. The batch processing scheduling system also starts several task execution threads according to a pre-set batch processing task flow to execute one or more task nodes (i.e., call the application).
[0088] like Figure 4 As shown, this embodiment of the invention provides a device 400 for handling task anomalies, including: an anomaly detection module 401, a pipeline binding module 402, and an anomaly handling module 403; wherein,
[0089] The exception detection module 401 is used to execute one or more task nodes using the task execution thread; if an exception is detected in the currently executing task node, the task exception data corresponding to the task node is sent to the exception handling thread.
[0090] The binding pipe module 402 is used to bind task exception data to the exception handling pipe corresponding to the task node using the exception handling thread, and return the receiving end of the exception handling pipe to the task running thread.
[0091] The exception handling module 403 is used to receive exception handling strategies for task exception data through the receiver of the exception handling pipeline by the task running thread, and to handle task exceptions based on the exception handling strategies.
[0092] This invention also provides an electronic device for handling task exceptions, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.
[0093] This invention also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in any of the above embodiments.
[0094] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the methods described above for handling task exceptions.
[0095] Figure 5 An exemplary system architecture 500 is shown, in which the method or apparatus for handling task exceptions according to embodiments of the present invention can be applied.
[0096] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, and 503, a network 504, and a server 505. Network 504 serves as the medium for providing communication links between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0097] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various client applications can be installed on terminal devices 501, 502, and 503, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, and email clients.
[0098] Terminal devices 501, 502, and 503 can be various electronic devices with displays and supporting various client applications, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0099] Server 505 can be a server that provides various services, such as a background management server that supports client applications used by users through terminal devices 501, 502, and 503. The background management server can process received requests for monitoring task node execution data and feed back the monitoring results of the task node execution data to the terminal devices.
[0100] It should be noted that the method for handling task exceptions provided in this embodiment of the invention is generally executed by server 505, and correspondingly, the device for handling task exceptions is generally located in server 505.
[0101] It should be understood that Figure 5 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0102] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing a terminal device of the present invention. Figure 6 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0103] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0104] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.
[0105] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.
[0106] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0107] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0108] The modules and / or units described in the embodiments of the present invention can be implemented in software or hardware. The described modules and / or units can also be located in a processor; for example, a processor can be described as including an exception detection module, a pipe binding module, and an exception handling module. The names of these modules do not necessarily limit the module itself; for example, the exception detection module can also be described as "a module that uses a task execution thread to detect the running status of one or more task nodes in a task flow."
[0109] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: the ability to send task exception data corresponding to a task node to the task execution thread when an exception is detected by the task execution thread; the ability to bind the task exception data to an exception handling pipeline using an exception handling thread, and return the receiving end of the exception handling pipeline to the task execution thread; and the ability for the task execution thread to receive an exception handling strategy for the task exception data via the receiving end of the exception handling pipeline, and to handle the task exception based on the exception handling strategy. The embodiments of the present invention complete exception handling through data interaction between the task execution thread, the exception handling thread, and the exception handling module, improving the flexibility, efficiency, and reliability of exception handling.
[0110] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for processing task exceptions, applied to a batch processing scheduling system, comprising: The method comprises: executing one or more task nodes by using a task running thread; in a case where it is detected that a task node currently being executed has an exception, sending task exception data corresponding to the task node to an exception handling thread; receiving the task exception data by using the exception handling thread, and obtaining a task node exception feature value contained in the task exception data; constructing a corresponding exception handling pipeline for the task node based on the task node exception feature value; wherein the task node exception feature value is a combination of a unique identifier of the task node and an exception occurrence timestamp of a certain exception; binding the task exception data to the exception handling pipeline corresponding to the task node by using the exception handling thread, and returning a receiving end of the exception handling pipeline to the task running thread; receiving an exception handling strategy for the task exception data via the receiving end of the exception handling pipeline by using the task running thread, and processing the task exception based on the exception handling strategy; wherein the exception handling strategy is used to control a task flow in a batch processing scheduling system, so that in a case where the task node has an exception, additional logic for blocking a subsequent task flow when the task node has an exception does not need to be considered, thereby controlling the execution of a subsequent task without terminating the batch processing task flow; and in the process of processing the task exception based on the exception handling strategy, the task running thread does not need to be restarted, thereby reducing the complexity of batch processing scheduling flow control when a task node has an error.
2. The method of claim 1, wherein in a case where it is detected that a task node currently being executed has an exception, further comprising: writing the task exception data corresponding to the task node into a task log data source; obtaining the task exception data from the task log data source by using an exception handling module.
3. The method of claim 1, wherein, Further comprising: receiving an exception handling strategy for the task exception data sent by the exception handling module by using the exception handling thread; sending the received exception handling strategy to the task running thread.
4. The method of claim 3, wherein receiving an exception handling strategy for the task exception data sent by the exception handling module by using the exception handling thread further comprises: obtaining a task node exception feature value contained in the task exception data; from a plurality of exception handling pipelines, finding a target exception handling pipeline bound with the task node exception feature value; sending the received exception handling strategy to the task running thread comprises: sending the exception handling strategy to the task running thread by using a sending end of the target exception handling pipeline.
5. The method of claim 1, wherein, Further comprising: setting an exception handling service port; sending the task exception data corresponding to the task node to the exception handling thread comprises: The task running thread is connected to the exception handling service port, and the task exception data corresponding to the task node is sent to the exception handling thread through an exception record service provided by the exception handling service port.
6. The method of claim 2, wherein, Further comprising: An exception handling service port is provided; After the task exception data is acquired from the task log data source by the exception handling module, further comprising: The exception handling module is connected to the exception handling service port, and an exception handling strategy for the task node is sent to the exception handling thread through an exception handling service provided by the exception handling service port.
7. An apparatus for handling task exceptions, applied to a batch processing scheduling system, comprising: Comprising: A detection exception module, a binding pipeline module and a processing exception module; wherein, The detection exception module is configured to execute one or more task nodes by a task running thread; the task running thread sends task exception data corresponding to a task node to an exception handling thread when detecting that the task node currently being executed has an exception; The binding pipeline module is configured to receive the task exception data by the exception handling thread, and acquire a task node exception feature value contained in the task exception data; an exception handling pipeline corresponding to the task node is constructed based on the task node exception feature value; wherein, the task node exception feature value is a combination of a unique identifier of the task node and an exception occurrence timestamp of an exception; the task exception data is bound to the exception handling pipeline corresponding to the task node by the exception handling thread, and a receiving end of the exception handling pipeline is returned to the task running thread; The processing exception module is configured to receive an exception handling strategy for the task exception data by the task running thread via the receiving end of the exception handling pipeline, and process the task exception based on the exception handling strategy; wherein, the exception handling strategy is used to control a task flow in a batch processing scheduling system, so that when the task node has an exception, the logic of additionally considering blocking the subsequent task flow when the task node has an exception is not needed, thereby controlling the execution of the subsequent task without terminating the batch processing task flow; and during the process of processing the task exception based on the exception handling strategy, the task running thread does not need to be restarted, so as to reduce the complexity of batch processing scheduling flow control when the task node has an error.
8. An electronic device, comprising: Comprising: One or more processors; A storage device configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-6.
9. A computer readable medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the method of any one of claims 1-6.
10. A computer program product comprising a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Structured exception handling for application-managed thread units
CN101251792A
Process data processing method, terminal equipment and storage medium
CN116204289A