Batch task execution method and apparatus
By generating target control numbers and adding new control records, batch tasks in the concurrent control table are automatically matched, solving the problem of manual intervention after batch server crashes and realizing the orderly execution and efficient operation of batch tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BANK OF CHINA
- Filing Date
- 2022-06-30
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, after a batch of servers crash, manual intervention is required to activate cold backup servers, resulting in low operating efficiency, high failure rate, and wasted human resources.
By generating target control numbers and adding new control records, the system automatically matches batch tasks in the concurrent control table, performs timeout checks and preempts execution rights, and ensures that batch tasks are executed in an orderly manner.
It reduces manual intervention, improves the efficiency and success rate of batch tasks, and saves labor costs.
Smart Images

Figure CN115167998B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, particularly to the field of artificial intelligence technology, and especially to a method and apparatus for batch task execution. Background Technology
[0002] Servers deployed for batch service programs should possess multi-active and high-availability characteristics. In related technologies, cold backup is often used for multiple batch servers. This means that only one batch server is running at a time. If this server fails, it affects the overall operation of the batch service program, causing it to fail and requiring manual intervention. This involves using scripts to restart the cold-backed batch server to restore the program's operation, which is wasteful of manpower, has a high failure rate, and low efficiency. Summary of the Invention
[0003] One object of the present invention is to provide a batch task execution method that enables the orderly execution of batch tasks, reduces manual intervention, saves labor costs, and improves operational efficiency and success rate. Another object of the present invention is to provide a batch task execution device. A further object of the present invention is to provide a computer-readable medium. A still other object of the present invention is to provide a computer device.
[0004] To achieve the above objectives, this invention discloses a batch task execution method, comprising:
[0005] If the acquired batch tasks to be processed fail to match the batch tasks in the set concurrency control table, a first new control record is generated based on the generated target control number and the batch tasks to be processed.
[0006] Add the first new control record to the concurrent control table and execute the pending batch tasks.
[0007] Preferably, the concurrency control list includes multiple batch tasks and the task name for each batch task;
[0008] If the acquired batch tasks to be processed fail to match the batch tasks in the set concurrent control table, before generating the first new control record based on the generated target control number and the batch tasks to be processed, the process further includes:
[0009] Determine whether the task name of the batch task to be processed is included in the task name of the batch task to be processed;
[0010] If so, then the batch tasks to be processed have successfully matched the batch tasks in the concurrency control table;
[0011] If not, the batch tasks to be processed will fail to match the batch tasks in the concurrency control table.
[0012] Preferably, after the batch tasks to be processed successfully match the batch tasks in the concurrency control table, the process further includes:
[0013] Perform timeout checks on batch tasks to be processed;
[0014] If the pending batch tasks time out, update the concurrency control table according to the generated target control number and the pending batch tasks, and then execute the pending batch tasks.
[0015] Preferably, the concurrency control table includes multiple batch tasks and the execution time of each batch task;
[0016] Timeout detection is performed for batch tasks, including:
[0017] Based on the concurrency control table, query the execution time of the batch tasks corresponding to the batch tasks to be processed;
[0018] Calculate the execution duration based on the execution time and the current time obtained;
[0019] If the execution time exceeds the set timeout threshold, the batch tasks to be processed will time out.
[0020] If the execution time is less than or equal to the timeout threshold, then the batch tasks to be processed have not timed out.
[0021] Preferably, the concurrency control table is updated based on the generated target control number and the batch tasks to be processed, including:
[0022] Delete the target control record from the concurrency control list. The target control record is the control record containing the batch task that matches the batch task to be processed.
[0023] Based on the generated target control number and the batch tasks to be processed, a second new control record is generated.
[0024] Preferably, before executing the batch tasks to be processed, the following steps are also included:
[0025] Based on the task name of the batch tasks to be processed, retrieve the corresponding concurrency control number from the concurrency control table;
[0026] If the concurrent control number is the same as the target control number, execute the batch tasks to be processed.
[0027] The present invention also discloses a batch task execution device, comprising:
[0028] The generation unit is used to generate a first new control record based on the generated target control number and the batch tasks to be processed if the acquired batch tasks to be processed fail to match the batch tasks in the set concurrent control table.
[0029] The addition unit is used to add the first newly added control record to the concurrent control table and execute the batch tasks to be processed.
[0030] Preferably, the concurrency control list includes multiple batch tasks and the task name for each batch task;
[0031] The device also includes:
[0032] The first judgment unit is used to determine whether the task name of the batch task to be processed is included in the task name of the batch task to be processed; if yes, the batch task to be processed is successfully matched with the batch task in the concurrency control table; if no, the batch task to be processed is not matched with the batch task in the concurrency control table.
[0033] Preferably, the device further includes:
[0034] The timeout detection unit is used to detect timeouts for batch tasks to be processed.
[0035] The update unit is used to update the concurrency control table based on the generated target control number and the batch tasks to be processed if the batch tasks to be processed time out, and then execute the batch tasks to be processed.
[0036] Preferably, the concurrency control table includes multiple batch tasks and the execution time of each batch task;
[0037] The timeout determination unit is specifically used to query the execution time of the batch tasks corresponding to the batch tasks to be processed according to the concurrency control table; calculate the execution duration based on the execution time and the current time obtained; if the execution duration is greater than the set timeout threshold, the batch tasks to be processed have timed out; if the execution duration is less than or equal to the timeout threshold, the batch tasks to be processed have not timed out.
[0038] Preferably, the update unit is specifically used to delete the target control record from the concurrency control table, where the target control record is the control record of the batch task that matches the batch task to be processed; and to generate a second new control record based on the generated target control number and the batch task to be processed.
[0039] Preferably, the device further includes:
[0040] The query unit is used to retrieve the corresponding concurrency control number from the concurrency control table based on the task name of the batch tasks to be processed.
[0041] The second judgment unit is used to execute the batch tasks to be processed if the concurrent control number is the same as the target control number.
[0042] The present invention also discloses a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0043] The present invention also discloses a computer device, including a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions, wherein the processor executes the program to implement the method described above.
[0044] The present invention also discloses a computer program product, including a computer program / instructions that, when executed by a processor, implement the method described above.
[0045] If the batch tasks to be processed obtained by this invention fail to match the batch tasks in the set concurrent control table, a first new control record is generated based on the generated target control number and the batch tasks to be processed. The first new control record is added to the concurrent control table, and the batch tasks to be processed are executed. This enables the batch tasks to be executed in an orderly manner, reduces manual intervention, saves labor costs, and improves operating efficiency and success rate. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 A flowchart of a batch task execution method provided in an embodiment of the present invention;
[0048] Figure 2 A flowchart illustrating yet another batch task execution method provided in this embodiment of the invention;
[0049] Figure 3 A flowchart of a method for determining timeout of batch tasks to be processed, provided by an embodiment of the present invention;
[0050] Figure 4 This is a schematic diagram of the structure of a batch task execution device provided in an embodiment of the present invention;
[0051] Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] It should be noted that the batch task execution method and apparatus disclosed in this application can be used in the field of artificial intelligence technology, or in any field other than artificial intelligence technology. The application field of the batch task execution method and apparatus disclosed in this application is not limited.
[0054] The following uses a batch task execution device as an example to illustrate the implementation process of the batch task execution method provided in this embodiment of the invention. It is understood that the execution subject of the batch task execution method provided in this embodiment of the invention includes, but is not limited to, a batch task execution device.
[0055] Figure 1 A flowchart of a batch task execution method provided in an embodiment of the present invention is shown below. Figure 1 As shown, the method includes:
[0056] Step 101: If the acquired batch tasks to be processed fail to match the batch tasks in the set concurrent control table, generate the first new control record based on the generated target control number and the batch tasks to be processed.
[0057] Step 102: Add the first newly added control record to the concurrent control table and execute the batch tasks to be processed.
[0058] In the technical solution provided by the embodiments of the present invention, if the acquired batch tasks to be processed fail to match the batch tasks in the set concurrent control table, a first new control record is generated according to the generated target control number and the batch tasks to be processed; the first new control record is added to the concurrent control table, and the batch tasks to be processed are executed, which enables the batch tasks to be executed in an orderly manner, reduces manual intervention, saves labor costs, and improves operating efficiency and success rate.
[0059] Figure 2 A flowchart of another batch task execution method provided in an embodiment of the present invention is shown below. Figure 2 As shown, the method includes:
[0060] Step 201: Determine whether the task names of multiple batch tasks include the task name of the batch task to be processed. If yes, proceed to step 204; otherwise, proceed to step 202.
[0061] In this embodiment of the invention, each step is executed by a batch task execution device.
[0062] In this embodiment of the invention, a concurrency control table is pre-set, which stores multiple batch tasks currently being executed. The concurrency control table includes multiple concurrency control records, including but not limited to the task name, concurrency control number, and execution time of each batch task. The task name is the primary key of the concurrency control table.
[0063] In this embodiment of the invention, the batch tasks to be processed can be initiated by a third party.
[0064] Specifically, if the names of multiple batch tasks include the name of the batch task to be processed, it indicates that the batch task to be processed is being executed and the batch task to be processed has successfully matched with the batch task in the concurrency control table, so continue to execute step 204; if the names of multiple batch tasks do not include the name of the batch task to be processed, it indicates that the batch task to be processed has not yet been executed and the batch task to be processed has failed to match with the batch task in the concurrency control table, so continue to execute step 202.
[0065] Step 202: Generate the first new control record based on the generated target control number and the batch tasks to be processed.
[0066] In this embodiment of the invention, the target control number is randomly generated and uniquely identifies each control record. At any given time, no two batch servers will generate the same control number.
[0067] Step 203: Add the first newly added control record to the concurrent control table, and continue to step 206.
[0068] In this embodiment of the invention, inserting a first new control record into the concurrency control table indicates that the batch task is being executed, and the batch server that inserted the first new control record has preempted the execution right of the batch task.
[0069] Step 204: Check the timeout for the batch tasks to be processed. If a timeout occurs, proceed to step 205; otherwise, the process ends.
[0070] In this embodiment of the invention, the concurrency control table stores multiple batch tasks that are currently being executed. The concurrency control table includes multiple concurrency control records, including but not limited to the task name, concurrency control number, and execution time of each batch task.
[0071] Figure 3 A flowchart of a method for determining timeout of batch tasks to be processed, provided by an embodiment of the present invention, is shown below. Figure 3 As shown, the method includes:
[0072] Step 2041: Based on the concurrency control table, query the execution time of the batch tasks corresponding to the batch tasks to be processed.
[0073] In this embodiment of the invention, the execution time of the batch tasks is queried for subsequent calculation of the execution duration.
[0074] Step 2042: Calculate the execution duration based on the execution time and the current time obtained.
[0075] Specifically, subtract the execution time from the current time to obtain the execution duration of the batch tasks.
[0076] Step 2043: Determine whether the execution time is greater than the set timeout threshold. If yes, proceed to step 2044; otherwise, proceed to step 2045.
[0077] In this embodiment of the invention, the timeout threshold is preset according to the actual situation, and the specific value of the timeout threshold is not limited in this embodiment of the invention.
[0078] Specifically, if the execution time exceeds the set timeout threshold, the batch task to be processed will time out, and step 2044 will continue; if the execution time is less than or equal to the timeout threshold, the batch task to be processed will not time out, and step 2045 will continue.
[0079] Step 2044: The batch task to be processed has timed out. Continue to step 205.
[0080] Specifically, if the pending batch task times out, it means that after the batch task was initiated and executed by another server, the server executing the batch task crashed, causing the batch task to not be completed. Continue to execute step 205.
[0081] Step 2045: The batch of tasks to be processed has not timed out, and the process ends.
[0082] Specifically, if the pending batch tasks have not timed out, it indicates that the batch tasks are being executed and the process has ended.
[0083] Step 205: Update the concurrency control table based on the generated target control number and the batch tasks to be processed.
[0084] Specifically, if a batch task to be processed times out, the target control record where it is located becomes invalid. The target control record is then deleted from the concurrency control table. The target control record is the control record where the batch task matching the batch task to be processed is located.
[0085] Specifically, a second new control record is generated based on the generated target control number and the batch tasks to be processed. The target control number is randomly generated and uniquely identifies each control record. No two batch servers will generate the same control number at the same time.
[0086] In this embodiment of the invention, inserting a second newly added control record into the concurrency control table indicates that the batch task is being executed, and the batch server that inserted the second newly added control record has preempted the execution right of the batch task.
[0087] Step 206: Based on the task name of the batch tasks to be processed, retrieve the corresponding concurrency control number from the concurrency control table.
[0088] In this embodiment of the invention, the task name is the primary key of the concurrency control table, and the concurrency control number of the batch tasks to be processed in the concurrency control table is retrieved based on the task name.
[0089] Step 207: Determine if the concurrent control number is the same as the target control number. If yes, proceed to step 208; otherwise, the process ends.
[0090] In this embodiment of the invention, if the concurrency control number is the same as the target control number, it indicates that the concurrency control record was inserted by the current batch server, and the current batch server has preempted the execution right of the batch task, and continues to execute step 208; if the concurrency control number is different from the target control number, it indicates that the concurrency control record was not inserted by the current batch server, the current batch server does not have the execution right of the batch task, and the process ends.
[0091] In this embodiment of the invention, the concurrency control number is confirmed again before executing the batch tasks to be processed, so as to ensure the accuracy of the batch server executing the batch tasks and avoid the same batch task running on multiple batch servers at the same time.
[0092] Step 208: Execute the batch tasks to be processed.
[0093] In this embodiment of the invention, the batch server that preempts the execution right executes the tasks according to the actual task requirements of the batch tasks to be processed.
[0094] In the technical solution of the batch task execution method provided in the embodiments of the present invention, if the obtained batch task to be processed fails to match the batch task in the set concurrency control table, a first new control record is generated according to the generated target control number and the batch task to be processed; the first new control record is added to the concurrency control table, and the batch task to be processed is executed, which enables the batch task to be executed in an orderly manner, reduces manual intervention, saves labor costs, and improves operating efficiency and success rate.
[0095] Figure 4 This is a schematic diagram of a batch task execution device provided in an embodiment of the present invention. This device is used to execute the aforementioned batch task execution method, such as... Figure 4 As shown, the device includes: a generation unit 11 and an increasing unit 12.
[0096] If the acquired batch tasks to be processed fail to match the batch tasks in the set concurrent control table, the generation unit 11 generates a first new control record based on the generated target control number and the batch tasks to be processed.
[0097] The addition unit 12 is used to add the first newly added control record to the concurrent control table and execute the batch tasks to be processed.
[0098] In this embodiment of the invention, the concurrency control table includes multiple batch tasks and the task name of each batch task; the device also includes: a first judgment unit 13.
[0099] The first judgment unit 13 is used to determine whether the task name of the batch task to be processed is included in the task name of the batch task to be processed; if yes, the batch task to be processed is successfully matched with the batch task in the concurrency control table; if no, the batch task to be processed is not matched with the batch task in the concurrency control table.
[0100] In this embodiment of the invention, the device further includes: a timeout determination unit 14 and an update unit 15.
[0101] The timeout detection unit 14 is used to detect timeouts for batch tasks to be processed.
[0102] The update unit 15 is used to update the concurrency control table according to the generated target control number and the batch tasks to be processed if the batch tasks to be processed time out, and then execute the batch tasks to be processed.
[0103] In this embodiment of the invention, the concurrency control table includes multiple batch tasks and the execution time of each batch task; the timeout discrimination unit 14 is specifically used to query the execution time of the batch task corresponding to the batch task to be processed according to the concurrency control table; calculate the execution duration according to the execution time and the current time obtained; if the execution duration is greater than the set timeout threshold, the batch task to be processed has timed out; if the execution duration is less than or equal to the timeout threshold, the batch task to be processed has not timed out.
[0104] In this embodiment of the invention, the update unit 15 is specifically used to delete the target control record from the concurrency control table. The target control record is the control record where the batch task matching the batch task to be processed is located. Based on the generated target control number and the batch task to be processed, a second new control record is generated.
[0105] In this embodiment of the invention, the device further includes: a query unit 16 and a second judgment unit 17.
[0106] The query unit 16 is used to query the corresponding concurrency control number from the concurrency control table based on the task name of the batch tasks to be processed.
[0107] The second judgment unit 17 is used to execute the batch tasks to be processed if the concurrent control number is the same as the target control number.
[0108] In the solution of this embodiment of the invention, if the acquired batch tasks to be processed fail to match the batch tasks in the set concurrent control table, a first new control record is generated according to the generated target control number and the batch tasks to be processed; the first new control record is added to the concurrent control table, and the batch tasks to be processed are executed, which enables the batch tasks to be executed in an orderly manner, reduces manual intervention, saves labor costs, and improves operating efficiency and success rate.
[0109] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer device, specifically, a computer device can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0110] This invention provides a computer device including a memory and a processor. The memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, they implement the steps of the above-described batch task execution method. For a detailed description, please refer to the above-described batch task execution method embodiments.
[0111] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer device 600 suitable for implementing the embodiments of this application.
[0112] like Figure 5 As shown, the computer device 600 includes a central processing unit (CPU) 601, which can perform various appropriate tasks 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 computer device 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.
[0113] 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 feedback (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 in storage section 608 as needed.
[0114] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program including 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.
[0115] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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 technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0116] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0117] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0118] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0119] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0120] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0121] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.
[0122] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can 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, etc.) containing computer-usable program code.
[0123] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0124] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0125] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for executing batch tasks, characterized in that, The method includes: If the acquired batch task to be processed fails to match the batch task in the set concurrency control table, a first new control record is generated based on the generated target control number and the batch task to be processed. The target control number is randomly generated and uniquely identifies a control record. The concurrency control table includes multiple batch tasks and the task name of each batch task. The task name is the primary key of the concurrency control table. Add the first newly added control record to the concurrent control table and execute the batch task to be processed; The concurrency control table includes multiple batch tasks and the execution time of each batch task; If the batch tasks to be processed successfully match the batch tasks in the concurrency control table, a timeout determination is performed on the batch tasks to be processed, specifically including: Based on the concurrency control table, the execution time of the batch tasks corresponding to the batch tasks to be processed is retrieved; The execution duration is calculated based on the execution time and the current time obtained. If the execution time exceeds the set timeout threshold, the batch tasks to be processed will time out. If the pending batch tasks time out, update the concurrency control table according to the generated target control number and the pending batch tasks, and execute the pending batch tasks.
2. The batch task execution method according to claim 1, characterized in that, Before generating the first new control record based on the generated target control number and the batch tasks to be processed, if the acquired batch tasks fail to match the batch tasks in the set concurrency control table, the process further includes: Determine whether the task name of the batch task to be processed is included in the task name of the batch task among the multiple batch tasks. If so, the batch tasks to be processed have successfully matched the batch tasks in the concurrency control table; If not, the batch tasks to be processed fail to match the batch tasks in the concurrency control table.
3. The batch task execution method according to claim 1, characterized in that, The timeout determination for the batch of tasks to be processed includes: If the execution time is less than or equal to the timeout threshold, then the batch tasks to be processed have not timed out.
4. The batch task execution method according to claim 1, characterized in that, The step of updating the concurrency control table based on the generated target control number and the batch tasks to be processed includes: Delete the target control record from the concurrency control table. The target control record is the control record of the batch task that matches the batch task to be processed. Based on the generated target control number and the batch tasks to be processed, a second new control record is generated.
5. The batch task execution method according to claim 1, characterized in that, Before executing the batch tasks to be processed, the following is also included: Based on the task name of the batch tasks to be processed, the corresponding concurrency control number is retrieved from the concurrency control table; If the concurrent control number is the same as the target control number, execute the batch task to be processed.
6. A batch task execution device, characterized in that, The device includes: The generation unit is used to generate a first new control record based on the generated target control number and the batch task to be processed if the acquired batch task to be processed fails to match the batch task in the set concurrency control table. The target control number is randomly generated and uniquely identifies a control record. The concurrency control table includes multiple batch tasks and the task name of each batch task. The task name is the primary key of the concurrency control table. An addition unit is used to add the first newly added control record to the concurrent control table and execute the batch task to be processed; The concurrency control table includes multiple batch tasks and the execution time of each batch task; If the batch tasks to be processed successfully match the batch tasks in the concurrency control table, the device further includes: The timeout detection unit is used to detect timeouts in the batch of tasks to be processed. An update unit is used to update the concurrency control table according to the generated target control number and the batch tasks to be processed if the batch tasks to be processed time out, and then execute the batch tasks to be processed. The timeout determination unit is specifically used to query the execution time of the batch tasks corresponding to the batch tasks to be processed according to the concurrency control table; calculate the execution duration according to the execution time and the current time; and if the execution duration is greater than the set timeout threshold, the batch tasks to be processed time out.
7. The batch task execution device according to claim 6, characterized in that, The device further includes: The first judgment unit is used to determine whether the task name of the batch task to be processed is included in the task name of the batch task to be processed among the multiple batch tasks; if yes, the batch task to be processed is successfully matched with the batch task in the concurrency control table; if no, the batch task to be processed fails to match the batch task in the concurrency control table.
8. The batch task execution device according to claim 6, characterized in that, The timeout determination unit is specifically used to determine that if the execution time is less than or equal to the timeout threshold, then the batch tasks to be processed have not timed out.
9. The batch task execution device according to claim 6, characterized in that, The update unit is specifically used to delete the target control record from the concurrency control table, where the target control record is the control record of the batch task that matches the batch task to be processed; and to generate a second new control record based on the generated target control number and the batch task to be processed.
10. The batch task execution device according to claim 6, characterized in that, The device further includes: The query unit is used to query the corresponding concurrency control number from the concurrency control table based on the task name of the batch tasks to be processed; The second judgment unit is used to execute the batch task to be processed if the concurrent control number is the same as the target control number.
11. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the batch task execution method as described in any one of claims 1 to 5.
12. A computer device comprising a memory and a processor, the memory for storing information including program instructions, and the processor for controlling the execution of the program instructions, characterized in that, When the program instructions are loaded and executed by the processor, they implement the batch task execution method according to any one of claims 1 to 5.
13. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the batch task execution method according to any one of claims 1 to 5.