Task processing method and device, electronic equipment and computer readable medium
By dynamically generating distributed query statements and submitting them to distributed batch processing clusters, and using the distributed batch processing framework to perform task processing, we solve the problems of difficult task processing, high risk, and low efficiency in the existing technology, and achieve a more efficient Task processing.
Patent Information
- Application Number
- CN202410846846.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-06
AI Technical Summary
Existing task processing methods are difficult, risky, and inefficient when using lightweight batch processing frameworks. Especially when processing large transactions on multiple distributed servers, there are problems of difficulty and high risk in task processing.
By obtaining the database identifier and task identifier, calling the persistence layer framework interface to obtain configuration data, dynamically generating distributed query statements and submitting them to the distributed batch processing cluster, using the distributed batch processing framework to perform computing tasks, and finally dividing the result data into batches Write to database.
It reduces the difficulty and risk of task processing, improves the efficiency of task processing, and effectively solves the problems caused by the splitting of large tasks through distributed processing capabilities.
Smart Images

Figure CN118606031A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a task processing method, device, electronic device and computer-readable medium. Background Art
[0002] At present, batch processing is performed by using a lightweight and complete batch processing framework (SpringBatch), deploying multiple distributed servers, and splitting the original large transaction into many small transactions for parallel processing. This makes task processing difficult, risky, and inefficient. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a task processing method, device, electronic device and computer-readable medium, which can solve the problems of high difficulty, high risk and low efficiency in existing task processing.
[0004] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present application, a task processing method is provided, including: in response to a task processing request, obtaining a corresponding database identifier and a task identifier, and then obtaining a corresponding batch processing task based on the task identifier; calling a persistence layer framework interface to obtain configuration data, and then dynamically generating a distributed query statement corresponding to the batch processing task based on the configuration data; submitting the distributed query statement and the preset maximum computing resources to a distributed batch processing cluster, and then obtaining a batch processing computing task generated by the distributed batch processing cluster; obtaining the data to be analyzed from the database corresponding to the database identifier, calling the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtaining the task execution result data; and writing the task execution result data into the database in batches.
[0005] Optionally, based on the configuration data, dynamically generating a distributed query statement corresponding to the batch processing task includes: determining a query statement record identifier and dynamic parameters based on the configuration data; and dynamically generating a corresponding distributed query statement according to the query statement record identifier and dynamic parameters.
[0006] Optionally, dynamically generating a corresponding distributed query statement includes: querying and obtaining a corresponding query statement record according to a query statement record identifier; and modifying a query statement corresponding to the query statement record based on a dynamic parameter to dynamically generate a corresponding distributed query statement.
[0007] Optionally, submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster includes: submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster through a uniformly encapsulated distributed executor requester.
[0008] Optionally, the batch computing task is generated based on the distributed query statement and preset maximum computing resources.
[0009] Optionally, writing the task execution result data into the database in batches includes: splitting the task execution result data based on the batch computing task to obtain each batch of data; accessing the target database based on the target database connection, and writing each batch of data into the target database in parallel.
[0010] In addition, the present application also provides a task processing device, including: an acquisition unit, configured to obtain a corresponding database identifier and a task identifier in response to a task processing request, and then obtain a corresponding batch processing task based on the task identifier; a distributed query statement generation unit, configured to call a persistence layer framework interface to obtain configuration data, and then dynamically generate a distributed query statement corresponding to the batch processing task based on the configuration data; a submission unit, configured to submit a distributed query statement and a preset maximum computing resource to a distributed batch processing cluster, and then obtain a batch processing computing task generated by the distributed batch processing cluster; a task execution unit, configured to obtain data to be analyzed from a database corresponding to the database identifier, call a distributed batch processing framework to execute a batch processing computing task based on the data to be analyzed, and obtain task execution result data; a batch writing unit, configured to write the task execution result data into the database in batches.
[0011] Optionally, the distributed query statement generation unit is further configured to: determine the query statement record identifier and dynamic parameters based on the configuration data; and dynamically generate a corresponding distributed query statement according to the query statement record identifier and the dynamic parameters.
[0012] Optionally, the distributed query statement generation unit is further configured to: query and obtain a corresponding query statement record according to the query statement record identifier; and modify the query statement corresponding to the query statement record based on a dynamic parameter to dynamically generate a corresponding distributed query statement.
[0013] Optionally, the submission unit is further configured to: submit the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster through a uniformly encapsulated distributed executor requester.
[0014] Optionally, the batch computing task is generated based on the distributed query statement and preset maximum computing resources.
[0015] Optionally, the batch writing unit is further configured to: split the task execution result data based on the batch computing task to obtain each batch of data; access the target database based on the target database connection, and write each batch of data into the target database in parallel.
[0016] In addition, the present application also provides a task processing electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the one or more processors implement the task processing method as described above.
[0017] In addition, the present application also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the task processing method as described above is implemented.
[0018] To achieve the above objective, according to another aspect of the embodiments of the present application, a computer program product is provided.
[0019] A computer program product according to an embodiment of the present application includes a computer program, and when the program is executed by a processor, the task processing method provided by the embodiment of the present application is implemented.
[0020] One embodiment of the above invention has the following advantages or beneficial effects: the application obtains the corresponding database identifier and task identifier by responding to the task processing request, and then obtains the corresponding batch processing task based on the task identifier; calls the persistence layer framework interface to obtain the configuration data, and then dynamically generates the distributed query statement corresponding to the batch processing task based on the configuration data; submits the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtains the batch processing computing task generated by the distributed batch processing cluster; obtains the data to be analyzed from the database corresponding to the database identifier, calls the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtains the task execution result data; writes the task execution result data into the database in batches. Thereby reducing the difficulty and risk of task processing and improving the efficiency of task processing.
[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present application and do not constitute an improper limitation on the present application. Figure 1 is a schematic diagram of the main process of a task processing method according to an embodiment of the present application; Figure 2 is a schematic diagram of the main process of a task processing method according to an embodiment of the present application; Figure 3 It is a main flow chart of a task processing method according to an embodiment of the present application; Figure 4 It is a schematic diagram of the main process of Spark processing tasks according to a task processing method of an embodiment of the present application; Figure 5is a schematic diagram of main units of a task processing device according to an embodiment of the present application; Figure 6 is an exemplary system architecture diagram to which the embodiments of the present application can be applied; Figure 7 It is a structural diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following is a description of the exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of known functions and structures is omitted in the following description. It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of the present application are in compliance with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of the present application, certain software, components, models, and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or must have used the solution. In the technical solution of the present application, the collection, analysis, use, transmission, storage, and other aspects of the user's personal information involved are in compliance with the provisions of relevant laws and regulations, and are used for legal and reasonable purposes, and are not shared, leaked, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities. Take necessary measures to prevent illegal access to such personal information, ensure that persons with access to personal information comply with relevant laws and regulations, and ensure the security of personal information. Once such personal information is no longer needed, risks should be minimized by limiting or even prohibiting data collection and / or deleting data.
[0024] When used, including in certain related applications, user privacy is protected by de-identifying data, such as by removing specific identifiers when used, controlling the amount or specificity of data stored, controlling how data is stored, and / or other methods of de-identification.
[0025] Figure 1 is a schematic diagram of the main process of a task processing method according to an embodiment of the present application, such as Figure 1 As shown, the task processing method mainly includes the following steps S101 to S105.
[0026] Step S101 , in response to a task processing request, obtaining a corresponding database identifier and a task identifier, and then obtaining a corresponding batch processing task based on the task identifier.
[0027] In this embodiment, the execution subject of the task processing method (for example, a server) can receive the task processing request through a wired connection or a wireless connection. After receiving the task processing request, the execution subject can obtain the database identifier and the task identifier carried in the request. According to the task identifier, the corresponding batch processing task is determined and obtained. The database identifier is used to represent the name or number of the database where the data to be analyzed is located.
[0028] Step S102, calling the persistence layer framework interface to obtain configuration data, and then dynamically generating a distributed query statement corresponding to the batch processing task based on the configuration data.
[0029] The execution subject can call the persistence layer framework interface to obtain the configuration data corresponding to the batch task. The configuration data may include a query statement record identifier (i.e., sqlId) and dynamic parameters. For example, the query statement record identifier is used to characterize the type of distributed query statement to be generated, and the dynamic parameters may include the real-time query condition, termination query condition, and query start time of the distributed query statement. The dynamic parameters can be modified by the user in real time, and the embodiments of the present application do not specifically limit the dynamic parameters. This allows the distributed query statements corresponding to the batch task to be flexibly generated.
[0030] After obtaining the configuration data, the execution subject can dynamically generate a distributed query statement, namely Spark sql, according to the query statement record identifier and dynamic parameters in the configuration data.
[0031] Step S103 , submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtaining the batch processing computing tasks generated by the distributed batch processing cluster.
[0032] The preset maximum computing resource can be the maximum computing resource owned by the distributed batch processing cluster. The execution subject can submit the dynamically generated distributed query statement and the preset maximum computing resource to the distributed batch processing cluster. The distributed batch processing cluster generates each batch computing task based on the distributed query statement and the preset maximum computing resource. With the help of distributed big data batch processing capabilities, the difficulty and risk brought by the splitting of large distributed tasks can be solved.
[0033] Specifically, submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster includes: submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster through a uniformly packaged distributed executor request end.
[0034] Through the uniformly encapsulated distributed executor request end, namely the Spark driver request end, the distributed query statements and the preset maximum computing resources are submitted to the distributed batch processing cluster to accurately and quickly split the tasks.
[0035] Specifically, batch computing tasks are generated based on distributed query statements and preset maximum computing resources.
[0036] Within the preset maximum computing resource setting range, batch computing tasks are generated based on distributed query statements to rationally utilize computing resources.
[0037] Step S104, obtaining the data to be analyzed from the database corresponding to the database identifier, calling the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtaining the task execution result data.
[0038] The batch computing task is executed on the acquired data to be analyzed through the distributed batch processing framework to accurately and quickly obtain the task execution result data. For example, the task execution result data can be calculation result data, query result data, etc., which can be determined according to the type of batch computing task.
[0039] Step S105, writing the task execution result data into the database in batches.
[0040] Specifically, the task execution result data is written into the database in batches, including: splitting the task execution result data based on the batch computing task to obtain each batch of data; accessing the target database based on the target database connection, and writing each batch of data into the target database in parallel.
[0041] The task execution result data is split based on the dimension of the batch computing task to obtain the split task execution result data corresponding to each batch computing task. Each split task execution result data is taken as a batch, and the task execution result data of each batch is written in parallel to the target database corresponding to the target database connection.
[0042] This embodiment obtains the corresponding database identifier and task identifier in response to the task processing request, and then obtains the corresponding batch processing task based on the task identifier; calls the persistence layer framework interface to obtain configuration data, and then dynamically generates the distributed query statement corresponding to the batch processing task based on the configuration data; submits the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtains the batch processing computing task generated by the distributed batch processing cluster; obtains the data to be analyzed from the database corresponding to the database identifier, calls the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtains the task execution result data; and writes the task execution result data into the database in batches. This reduces the difficulty and risk of task processing and improves the efficiency of task processing.
[0043] Figure 2 is a main flow chart of a task processing method according to an embodiment of the present application, such as Figure 2 As shown, the task processing method mainly includes the following steps S201 to S207.
[0044] Step S201 , in response to a task processing request, obtaining a corresponding database identifier and a task identifier, and then obtaining a corresponding batch processing task based on the task identifier.
[0045] After receiving the task processing request, the execution subject can obtain the database identifier and task identifier carried in the request. According to the task identifier, the corresponding batch processing task is determined and obtained. The database identifier is used to represent the name or number of the database where the data to be analyzed is located.
[0046] Step S202: calling the persistence layer framework interface to obtain configuration data.
[0047] The configuration data may include a query statement record identifier (i.e., sqlId), the number of distributed query statements recommended to be generated, and dynamic parameters. For example, the query statement record identifier is used to characterize the type of distributed query statements to be generated, and the dynamic parameters may include the real-time query conditions, termination query conditions, and query start time of the distributed query statements. The dynamic parameters can be modified by the user in real time, and the embodiments of the present application do not specifically limit the dynamic parameters. This allows for flexible generation of distributed query statements corresponding to batch processing tasks.
[0048] Step S203: determining the query statement record identifier and dynamic parameters based on the configuration data.
[0049] The execution subject can obtain the query statement record identifier and dynamic parameters in the configuration data. For example, the query statement record identifier can be used to represent the record location of the distributed query statement to be generated, or can be used to represent the record form of the distributed query statement to be generated (such as a snapshot record or a text record). The embodiment of the present application does not specifically limit the definition of the query statement record identifier. The dynamic parameters may include symbols or judgment conditions that must be included in the distributed query statement to be generated. The embodiment of the present application does not specifically limit the dynamic parameters.
[0050] Step S204: dynamically generate a corresponding distributed query statement according to the query statement record identifier and dynamic parameters.
[0051] Specifically, dynamically generating a corresponding distributed query statement includes: querying and obtaining a corresponding query statement record according to a query statement record identifier; and modifying a query statement corresponding to the query statement record based on a dynamic parameter to dynamically generate a corresponding distributed query statement.
[0052] The query statement record corresponding to the query statement record identifier may be a record corresponding to the initial query statement generation template. The query statement corresponding to the query statement record may be the initial query statement generation template. By modifying the initial query statement generation template based on dynamic parameters, the final distributed query statement may be obtained.
[0053] Step S205 , submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtaining the batch processing computing tasks generated by the distributed batch processing cluster.
[0054] Through the uniformly encapsulated distributed executor request end, namely the Spark driver request end, the distributed query statements and the preset maximum computing resources are submitted to the distributed batch processing cluster to accurately and quickly split the tasks.
[0055] Step S206, obtaining the data to be analyzed from the database corresponding to the database identifier, calling the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtaining the task execution result data.
[0056] The batch computing task is executed on the acquired data to be analyzed through the distributed batch processing framework to accurately and quickly obtain the task execution result data. For example, the task execution result data can be calculation result data, query result data, modification result data, marking result data, etc., which can be determined according to the type of batch computing task.
[0057] Step S207, writing the task execution result data into the database in batches.
[0058] The execution entity can continue to process the task execution result data in batches according to the batch dimensions set by the user, so as to write the batched task execution result data to the database in batches in parallel, so as to speed up the data writing speed and improve the task processing efficiency.
[0059] Figure 3 FIG. 1 is a schematic diagram of the main flow of a task processing method according to an embodiment of the present application. Figure 3 As shown, the first step is to configure the dynamic sql (Structured Query Language, SQL for short, is a special-purpose programming language, a database query and programming language used to access data and query, update and manage relational database systems) script of the batch task Job through the mybatis framework (similar to the original oracle writing method, the original sql can be migrated at a low cost), and configure the dynamic sql to the xml file of mybatis. When executing batch processing, first call the interface api of the mybatis framework, and obtain the Spark sql (i.e. distributed query statement) to be executed after program analysis and processing based on sqlId and dynamic parameters, so that the batch sql in the oracle all-in-one machine can be implemented with very small changes, basically maintaining logical consistency. The second step is Manager: According to the Spark sql generated in the first step, the Spark sql operation task and the preset maximum computing resources are submitted to the Spark batch cluster through the uniformly encapsulated Spark driver request end. The Spark batch processing cluster parses Spark SQL through multiple Workers (threads), generates batch computing tasks, obtains the original data to be analyzed from the database, and uses the powerful computing power of the Spark distributed batch processing framework to calculate the data. The Spark processing task process is as follows: Figure 4 As shown: Sparksql task submission - Spark sql syntax analysis - calculation of operation scale pre-allocation of operation resources - access to database to obtain operation data - data analysis distributed computing. Step 3: After the Spark distributed batch processing framework operation is completed, the operation results need to be collected for persistence. Here, the ability of Spark task splitting is also used to write the result set into a batch of 1,000 data in parallel batches to the domestic database for persistence through jdbc.
[0060] The embodiment of the present application adopts a unified framework to migrate the large transaction batch processing function of the Oracle all-in-one machine with very small changes. With the help of Spark's big data batch processing capabilities, the difficulties and risks brought by the splitting of large distributed tasks are solved. The solution is highly reusable and suitable for most batch processing scenarios of accounting engines. It is independent of the database and can adapt to different database solutions.
[0061] The embodiment of the present application adopts a unified framework, using mybatis and Spark frameworks, and can achieve the same business functions with minimal modifications. Use the mybatis framework to dynamically parse SQL statements, and transform the mybatis framework. The original mybatis framework is used to parse SQL statements, and then access the database through jdbc (Java Database Connectivity, Java Database Connection) is an application program interface used in the Java language to standardize how client programs access databases, and provides methods such as querying and updating data in the database). The embodiment of the present application only uses the SQL statement parsing function of the mybatis framework, and through transformation, it can dynamically generate spark SQL statements. Encapsulate the Spark batch processing framework so that it receives Spark SQL statement input to obtain domestic database data, and writes the results back to the database after parallel batch processing.
[0062] Figure 5 Schematic diagram of the main units of the task processing device according to an embodiment of the present application. Figure 5 As shown, the task processing device 500 includes an acquisition unit 501 , a distributed query statement generation unit 502 , a submission unit 503 , a task execution unit 504 and a batch writing unit 505 .
[0063] The acquisition unit 501 is configured to acquire the corresponding database identifier and task identifier in response to the task processing request, and then acquire the corresponding batch processing task based on the task identifier.
[0064] The distributed query statement generating unit 502 is configured to call the persistence layer framework interface to obtain configuration data, and then dynamically generate a distributed query statement corresponding to the batch processing task based on the configuration data.
[0065] The submitting unit 503 is configured to submit the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtain the batch processing computing tasks generated by the distributed batch processing cluster.
[0066] The task execution unit 504 is configured to obtain the data to be analyzed from the database corresponding to the database identifier, call the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtain the task execution result data.
[0067] The batch writing unit 505 is configured to write the task execution result data into the database in batches.
[0068] In some embodiments, the distributed query statement generation unit 502 is further configured to: determine the query statement record identifier and dynamic parameters based on the configuration data; and dynamically generate a corresponding distributed query statement according to the query statement record identifier and dynamic parameters.
[0069] In some embodiments, the distributed query statement generation unit 502 is further configured to: query and obtain a corresponding query statement record according to a query statement record identifier; and modify a query statement corresponding to the query statement record based on a dynamic parameter to dynamically generate a corresponding distributed query statement.
[0070] In some embodiments, the submitting unit 503 is further configured to submit the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster through a uniformly packaged distributed executor requester.
[0071] In some embodiments, the batch computing task is generated based on the distributed query statement and the preset maximum computing resources.
[0072] In some embodiments, the batch writing unit 505 is further configured to: split the task execution result data based on the batch computing task to obtain each batch of data; access the target database based on the target database connection, and write each batch of data into the target database in parallel.
[0073] It should be noted that the task processing method and the task processing device of the present application have a corresponding relationship in terms of specific implementation contents, so the repeated contents will not be described again.
[0074] Figure 6 An exemplary system architecture 600 to which the task processing method or task processing device according to the embodiment of the present application can be applied is shown.
[0075] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0076] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0077] The terminal devices 601 , 602 , and 603 may be various electronic devices having a task processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0078] Server 605 can be a server that provides various services, such as a background management server that provides support for task processing requests submitted by users using terminal devices 601, 602, and 603 (only as an example). The background management server can respond to the task processing request, obtain the corresponding database identifier and task identifier, and then obtain the corresponding batch processing task based on the task identifier; call the persistence layer framework interface to obtain configuration data, and then dynamically generate a distributed query statement corresponding to the batch processing task based on the configuration data; submit the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtain the batch processing computing task generated by the distributed batch processing cluster; obtain the data to be analyzed from the database corresponding to the database identifier, call the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtain the task execution result data; write the task execution result data into the database in batches. This reduces the difficulty and risk of task processing and improves the efficiency of task processing.
[0079] It should be noted that the task processing method provided in the embodiment of the present application is generally executed by the server 605 , and accordingly, the task processing device is generally set in the server 605 .
[0080] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0081] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present application. Figure 7 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0082] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 to a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the computer system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0083] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.
[0084] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present application are executed.
[0085] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. Computer-readable storage media may include, for example, but are not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0086] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0087] The units involved in the embodiments described in the present application may be implemented by software or by hardware. The units described may also be provided in a processor, for example, may be described as: a processor including an acquisition unit, a distributed query statement generation unit, a submission unit, a task execution unit, and a batch writing unit. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0088] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device responds to the task processing request, obtains the corresponding database identifier and task identifier, and then obtains the corresponding batch processing task based on the task identifier; calls the persistence layer framework interface to obtain configuration data, and then dynamically generates a distributed query statement corresponding to the batch processing task based on the configuration data; submits the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtains the batch processing computing task generated by the distributed batch processing cluster; obtains the data to be analyzed from the database corresponding to the database identifier, calls the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtains the task execution result data; writes the task execution result data into the database in batches.
[0089] The computer program product of the present application includes a computer program, and when the computer program is executed by a processor, the task processing method in the embodiment of the present application is implemented.
[0090] According to the technical solution of the embodiment of the present application, the difficulty and risk of task processing can be reduced and the efficiency of task processing can be improved.
[0091] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A task processing method, characterized in that: include: In response to the task processing request, obtaining a corresponding database identifier and a task identifier, and then obtaining a corresponding batch processing task based on the task identifier; Calling the persistence layer framework interface to obtain configuration data, and then dynamically generating a distributed query statement corresponding to the batch processing task based on the configuration data; Submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtaining the batch computing tasks generated by the distributed batch processing cluster; Acquire the data to be analyzed from the database corresponding to the database identifier, call the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtain task execution result data; The task execution result data is written into the database in batches.
2. The method according to claim 1, characterized in that The dynamically generating a distributed query statement corresponding to the batch processing task based on the configuration data includes: Based on the configuration data, determining a query statement record identifier and dynamic parameters; A corresponding distributed query statement is dynamically generated according to the query statement record identifier and the dynamic parameter.
3. The method according to claim 2, characterized in that The dynamically generated corresponding distributed query statement includes: According to the query statement record identifier, query and obtain the corresponding query statement record; The query statement corresponding to the query statement record is modified based on the dynamic parameter to dynamically generate a corresponding distributed query statement.
4. The method according to claim 1, characterized in that: Submitting the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster includes: The distributed query statement and the preset maximum computing resources are submitted to the distributed batch processing cluster through the uniformly encapsulated distributed executor requester.
5. The method according to claim 1, characterized in that The batch computing task is generated based on the distributed query statement and the preset maximum computing resources.
6. The method according to claim 1, characterized in that Writing the task execution result data into the database in batches includes: Splitting the task execution result data based on the batch computing task to obtain each batch of data; Based on the target database connection, the target database is accessed, and the batches of data are written into the target database in parallel.
7. A task processing device, characterized in that: include: An acquisition unit is configured to acquire a corresponding database identifier and a task identifier in response to a task processing request, and then acquire a corresponding batch processing task based on the task identifier; A distributed query statement generating unit is configured to call a persistence layer framework interface to obtain configuration data, and then dynamically generate a distributed query statement corresponding to the batch processing task based on the configuration data; A submitting unit, configured to submit the distributed query statement and the preset maximum computing resources to the distributed batch processing cluster, and then obtain the batch processing computing tasks generated by the distributed batch processing cluster; A task execution unit is configured to obtain the data to be analyzed from the database corresponding to the database identifier, call the distributed batch processing framework to execute the batch processing computing task based on the data to be analyzed, and obtain task execution result data; The batch writing unit is configured to write the task execution result data into the database in batches.
8. The device according to claim 7, characterized in that The distributed query statement generating unit is further configured to: Based on the configuration data, determining a query statement record identifier and dynamic parameters; A corresponding distributed query statement is dynamically generated according to the query statement record identifier and the dynamic parameter.
9. The device according to claim 8, characterized in that The distributed query statement generating unit is further configured to: According to the query statement record identifier, query and obtain the corresponding query statement record; The query statement corresponding to the query statement record is modified based on the dynamic parameter to dynamically generate a corresponding distributed query statement.
10. The device according to claim 7, characterized in that The submitting unit is further configured to: The distributed query statement and the preset maximum computing resources are submitted to the distributed batch processing cluster through the uniformly encapsulated distributed executor requester.
11. The device according to claim 7, characterized in that The batch computing task is generated based on the distributed query statement and the preset maximum computing resources.
12. The device according to claim 7, characterized in that The batch writing unit is further configured to: Splitting the task execution result data based on the batch computing task to obtain each batch of data; Based on the target database connection, the target database is accessed, and the batches of data are written into the target database in parallel.
13. A task processing electronic device, characterized in that: include: one or more processors; a storage device for storing 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 according to any one of claims 1 to 6.
14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Data batch insertion method and device, computer equipment and storage medium
CN121455965A
