Task execution methods, devices, equipment, media and products
By pre-creating multiple partitions in the data table and obtaining unoccupied partitions, the problems of long execution time and high resource consumption in multi-task scenarios are solved, and the efficiency and resource utilization of computing tasks are improved.
Patent Information
- Application Number
- CN202210530118.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-16
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-05-16
AI Technical Summary
In a multi-task scenario, in the prior art, the computing task needs to determine the database or data table corresponding to the computing task in all databases or all data tables, resulting in a long time executing the computing task and increasing the cost of metadata management and databases Connection pool resource consumption.
By creating multiple partitions in the data table in advance, each partition stores the same source data set, and obtaining partitions that have not been occupied by the executed calculation task in response to the target calculation task, thereby obtaining the corresponding source data set and performing the calculation task. Avoid access to metadata.
It reduces the cost of metadata management and database connection pool resource consumption, improves the efficiency of obtaining the source data set of computing tasks and the efficiency of executing computing tasks, and realizes the isolation of each computing task source data set.
Smart Images

Figure CN114860352B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data processing technology, and in particular to a task execution method, device, equipment, medium and product. Background Art
[0002] With the development of mobile Internet technology and artificial intelligence technology, multiple computing tasks are required to complete a complete service, such as supply chain service. These multiple computing tasks constitute a multi-task scenario.
[0003] In a multi-task scenario, computing tasks may rely on the same source data set to be executed. It is necessary to isolate the source data sets used by each computing task from each other so that the source data sets used by each computing task do not affect each other. This avoids the user's personalized modification of the source data set based on the target computing task, which may affect the source data sets obtained by other computing tasks and ultimately affect the execution results of other computing tasks.
[0004] In the prior art, a separate database or a separate data table is established for each computing task to achieve mutual isolation of the source data sets that each computing task depends on. However, when a computing task is executed based on the source data set, it is necessary to determine the database or data table corresponding to the computing task in all databases or all data tables, which results in a long time to execute the computing task, and leads to high metadata management costs and database connection pool resource consumption. Summary of the invention
[0005] The present application provides a task execution method, apparatus, equipment, medium and product, which are used to solve the technical problems in the prior art of determining the database or data table corresponding to the computing task among all databases or all data tables, resulting in a long time consumed in executing the computing task, and causing high metadata management costs and database connection pool resource consumption.
[0006] In a first aspect, the present application provides a task execution method, comprising:
[0007] In response to the triggered target computing task, a partition in the corresponding data table of the database that is not occupied by the executed computing task is obtained; the target computing task is any computing task in a multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; a plurality of partitions are pre-created in the data table, and the same source data set is pre-stored in each partition;
[0008] Obtain the corresponding source data set from the partition that is not occupied by the executed computing task;
[0009] The target computing task is executed according to the source data set to obtain execution result data.
[0010] In a second aspect, the present application provides a task execution device, comprising:
[0011] A first acquisition module is used to obtain, in response to a triggered target computing task, a partition in a data table corresponding to the database that is not occupied by an executed computing task; the target computing task is any computing task in a multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; a plurality of partitions are pre-created in the data table, and the same source data set is pre-stored in each partition;
[0012] A second acquisition module is used to acquire the corresponding source data set from the partition not occupied by the executed computing task;
[0013] An execution module is used to execute the target computing task according to the source data set to obtain execution result data.
[0014] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory and a transceiver communicatively connected to the processor;
[0015] The memory stores computer-executable instructions; the transceiver is used to send and receive data;
[0016] The processor executes the computer-executable instructions stored in the memory to implement the method according to the first aspect.
[0017] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
[0018] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0019] The present application provides a task execution method, device, equipment, medium and product. In response to a triggered target computing task, a partition in a corresponding data table of a database that is not occupied by an executed computing task is obtained; the target computing task is any computing task in a multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; multiple partitions are pre-created in the data table, and the same source data set is pre-stored in each partition; the corresponding source data set is obtained from the partition that is not occupied by the executed computing task; the target computing task is executed according to the source data set to obtain execution result data. The same source data set used by the computing task is stored in the same data table in the form of partitions. After the target computing task is obtained, the source data set in the unoccupied partition is obtained from the same data table as the source data set corresponding to the target computing task. The corresponding source data set can be obtained without accessing metadata, so the metadata management cost and database connection pool resource consumption can be reduced; and the partition method can be used to isolate the source data sets that each computing task depends on from each other, thereby improving the efficiency of obtaining the source data set corresponding to the computing task, and further improving the efficiency of executing the computing task. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0021] Figure 1 A schematic diagram of a network architecture of this application;
[0022] Figure 2 A flowchart of a task execution method provided in an embodiment of the present application;
[0023] Figure 3 A flowchart of a task execution method provided in Example 2 of the present application;
[0024] Figure 4 A flowchart of a task execution method provided in Example 4 of the present application;
[0025] Figure 5 A schematic diagram of a method for determining data screening parameters provided in this application;
[0026] Figure 6 A schematic diagram of another method for determining data screening parameters provided in this application;
[0027] Figure 7 A flowchart of a task execution method provided in Example 5 of the present application;
[0028] Figure 8 A schematic diagram of the structure of a task execution device provided in Example 6 of the present application;
[0029] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in Example 7 of the present application.
[0030] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0031] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.
[0032] The terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following embodiments, "multiple" means more than two, unless otherwise clearly and specifically defined.
[0033] In order to clearly understand the technical solution of the present application, the solution of the prior art is first introduced in detail.
[0034] The present application can be applied to multi-task scenarios that rely on the same source data set. For example, in the process of supply chain management, when performing various intelligent process optimization computing tasks, it is necessary to perform calculations based on the same set of data sets from multiple systems, and the data set may be obtained from customer systems, order systems, warehousing systems, logistics systems, warehouse systems and other systems.
[0035] Although different computing tasks have different requirements for data sets, for example, when performing inventory optimization computing tasks, the inventory data entity, sales data entity, and supply planning data entity in the data set need to be used, while when performing store group optimization computing tasks, the marketing data entity and sales data entity in the data set need to be used; however, the associations between all data entities in the data set must be solidified to ensure data consistency. For example, when performing store group optimization computing tasks, the inventory data entity is not used, but when the sales data changes, the corresponding inventory data should also change at the same time, so different computing tasks need to rely on the same source data set with solidified associations.
[0036] In addition, when executing a computing task, the data entities in the data set may be derived and changed for the computing task, such as adjusting the value of inventory, but this adjustment should not affect the source data set that other computing tasks depend on, and ultimately affect the execution results of other computing tasks. Therefore, it is necessary to isolate the source data sets that each computing task depends on from each other.
[0037] In the prior art, the source data set is usually copied to a separate database or a separate data table, and the database or data table is assigned to different computing tasks. The computing tasks perform calculations based on the source data set in the database or data table they occupy, thereby achieving mutual isolation of the source data sets that each computing task depends on when multiple computing tasks depend on the same source data set.
[0038] Since the source data sets used by computing tasks in multi-task scenarios are stored in multiple databases or multiple data tables, when a computing task executes a computing task based on the source data set, it is necessary to determine the database or data table corresponding to the computing task in all databases or all data tables, resulting in a long time for executing the computing task, and a high metadata management cost and database connection pool resource consumption. Therefore, in order to improve the efficiency of executing computing tasks, when storing the source data set, the same source data set used by the computing task can be stored in the same data table, and specifically, multiple identical source data sets can be partitioned and stored in the data table. Then, when obtaining the source data set corresponding to the computing task, it is only necessary to obtain the corresponding source data set from the partition of the data table that is not occupied by the executed computing task, and the corresponding source data set can be obtained without accessing the metadata, so the metadata management cost and database connection pool resource consumption can be reduced. And the use of partitions can achieve mutual isolation of the source data sets that each computing task depends on, thereby improving the efficiency of obtaining the source data set corresponding to the computing task, and further improving the efficiency of executing the computing task.
[0039] Figure 1 A schematic diagram of a network architecture of this application is shown in FIG. Figure 1 As shown, it includes an electronic device 1 and a database 2; wherein a first partition and a plurality of second partitions are pre-created in the database 2, such as Figure 1As shown, it may include: a first partition, a second partition 1, a second partition 2, and a second partition 3, each of which pre-stores the same source data set and partition key, and the partition identification code used as the partition key in the same partition is the same, and the partition key can be used as an isolation field for data. After the user triggers the target computing task in the electronic device 1, illustratively, the partition in the source data set that is not occupied by the executed computing task is the second partition 2, then the electronic device 1 can obtain the second partition 2 that is not occupied by the executed computing task from the database 2, determine the second partition 2 as the partition corresponding to the target computing task, and obtain the source data set therefrom; execute the target computing task according to the source data set, and obtain the execution result data of the target computing task.
[0040] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0041] Embodiment 1
[0042] Figure 2 A flow chart of a task execution method provided in an embodiment of the present application, the embodiment of the present application provides a task execution method to solve the problem that in the prior art, the database or data table corresponding to the computing task is determined in all databases or all data tables, resulting in a long time consumed in executing the computing task, and resulting in high metadata management costs and database connection pool resource consumption. The execution subject of the task execution method provided in the embodiment of the present application can be a task execution device. In practical applications, the task execution device can be implemented by a computer program, such as application software, etc., or by a medium storing relevant computer programs, such as a USB flash drive, a CD, etc., or it can also be implemented by a physical device integrated or installed with relevant computer programs, such as a chip, a board, etc.
[0043] In addition, the task execution device may be located in an electronic device, which may be a digital computer in various forms, such as a cellular phone, a smart phone, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers.
[0044] like Figure 2 As shown, the task execution method provided in the embodiment of the present application includes the following steps:
[0045] Step S101: In response to a triggered target computing task, a partition in a corresponding data table of a database that is not occupied by an executed computing task is obtained.
[0046] The target computing task is any computing task in a multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; multiple partitions are pre-created in the data table, and the same source data set is pre-stored in each partition.
[0047] Specifically, the task execution device can first respond to the triggered target computing task, obtain the partition in the corresponding data table of the database that is not occupied by the executed computing task, and determine the partition that is not occupied by the executed computing task as the partition corresponding to the target computing task. The embodiment of the present application does not limit the method of triggering the target computing task. For example, it can be actively triggered by the user or automatically triggered according to the system setting.
[0048] In an embodiment of the present application, the source data set pre-stored in the partition may have a corresponding partition key, and the partition identification code used as the partition key in the same partition is the same. Optionally, the partition identification code corresponding to the partition not occupied by the executed computing task may be first determined, and the partition not occupied by the executed computing task in the corresponding data table of the database may be determined according to the partition identification code. The partition identification code corresponding to the partition not occupied by the executed computing task may be pre-stored in the message queue.
[0049] It is understandable that the method for obtaining the partition in the corresponding data table of the database that is not occupied by the executed computing task can also be other methods. For example, after the partition is occupied by the executed computing task, the corresponding partition identification code can be stored in a certain storage space, and it is determined whether the partition is occupied by the executed computing task by judging whether the partition identification code corresponding to the partition exists in the storage space, and the partition in the corresponding data table of the database that is not occupied by the executed computing task is obtained by obtaining the partition corresponding to the partition identification code that is not found in the storage space.
[0050] In the embodiment of the present application, after the partition not occupied by the executed computing task is determined as the partition corresponding to the target computing task, the partition is the partition already occupied by the executed computing task. Exemplarily, the partitions not occupied by the executed computing task in the corresponding data table of the database include: partition a and partition b; after partition a is determined as the partition corresponding to the target computing task, the partitions not occupied by the executed computing task will not include partition a.
[0051] Step S102: Obtain a corresponding source data set from a partition that is not occupied by the executed computing task.
[0052] In the embodiment of the present application, after the partition not occupied by the executed computing task is determined as the partition corresponding to the target computing task, the corresponding source data set can be obtained from the partition. The source data set is a set of data that all computing tasks in a multi-task scenario rely on.
[0053] Specifically, after obtaining the partition in the corresponding data table of the database that is not occupied by the executed computing tasks, the partition is determined as the partition corresponding to the target computing task. The partition identification code corresponding to the partition can be determined. The partition identification code can be used to directly search and obtain the source data set corresponding to the target computing task in each partition of the data table.
[0054] Optionally, the source data set pre-stored in the partition may have a corresponding partition key. If the partition identification code serving as the partition key in the same partition is the same, then the method for obtaining the corresponding source data set from the partition that has not been occupied by the executed computing task may be: obtaining the partition key corresponding to the partition identification code from the data table; determining the corresponding second partition according to the corresponding partition key; determining the corresponding second partition as the partition that has not been occupied by the executed computing task; and obtaining the corresponding source data set from the partition that has not been occupied by the executed computing task.
[0055] Step S103: Execute the target computing task according to the source data set to obtain execution result data.
[0056] The execution result data is the result data obtained by executing the target computing task according to the source data set.
[0057] Specifically, after obtaining the corresponding source data set, the target computing task can be executed according to the data required to execute the target computing task in the source data set, and the execution result data obtained by executing the target computing task can be obtained. The data required for the target computing task can be all the data under the field required by the target computing task; or it can be part of the data under the field required by the target computing task. For example, when the target computing task is a store group optimization computing task, the data required for the target computing task can be all the data in the sales field, or it can be the data in the sales field within a certain time range.
[0058] The target calculation task can be a pre-set calculation task, and a corresponding calculation formula is set for the pre-set calculation task. The user can trigger the target calculation task by selecting the target calculation task from the pre-set calculation tasks. For example, a sales forecast calculation task can be pre-set, and a sales forecast calculation formula can be set. On this basis, the method of executing the target calculation task according to the source data set can be: after obtaining the source data set corresponding to the target calculation task, the fields required to execute the target calculation task in the source data set can be determined according to the calculation formula corresponding to the target calculation task, and the target calculation task can be executed according to all the data under the required fields required to execute the target calculation task.
[0059] If the data required for the target computing task is partial data under the required field, the method for executing the target computing task based on the source data set can be: determining data filtering parameters for at least one field in the filtering data set; determining partial data under the required field based on the data filtering parameters, and executing the target computing task based on the partial data under the field required to execute the target computing task.
[0060] The task execution method provided in the embodiment of the present application, in response to the triggered target computing task, obtains the partition in the corresponding data table of the database that is not occupied by the executed computing task; the target computing task is any computing task in the multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; multiple partitions are pre-created in the data table, and the same source data set is pre-stored in each partition; the corresponding source data set is obtained from the partition that is not occupied by the executed computing task; the target computing task is executed according to the source data set to obtain the execution result data. The same source data set used by the computing task is stored in the same data table in the form of partitions. After the target computing task is obtained, the source data set in the unoccupied partition is obtained from the same data table as the source data set corresponding to the target computing task. The corresponding source data set can be obtained without accessing metadata, so the metadata management cost and database connection pool resource consumption can be reduced; and the partitioning method can be used to achieve the mutual isolation of the source data sets that each computing task depends on, thereby improving the efficiency of obtaining the source data set corresponding to the computing task, and further improving the efficiency of executing the computing task.
[0061] Embodiment 2
[0062] Figure 3 A flowchart of a task execution method provided in the second embodiment of the present application, based on any of the above embodiments, the embodiment of the present application involves a process of partitioning the data table before obtaining the partitions in the corresponding data table of the database that are not occupied by the executed computing tasks in step S101 in response to the triggered target computing task. Figure 3 The task execution method provided in the embodiment of the present application includes the following steps:
[0063] Step S201: Store the source data set into the first partition in the data table.
[0064] Specifically, a source data set is obtained, a data table is created according to the source data set, and the source data set is stored in the first partition of the data table. The data structure of the data table is based on the data structure of the source data set and a partition key column is added, and the partition key serves as an isolation field of the data.
[0065] In an embodiment of the present application, the first partition is a partition for storing source data sets that are not occupied by any target computing task; only query operations and synchronization operations can be performed on the source data sets in the first partition, and editing operations such as deletion and modification of the source data sets in the first partition are restricted.
[0066] Step S202: Generate a corresponding partition identification code for at least one second partition in the data table.
[0067] In an embodiment of the present application, the second partition is a partition for storing source data sets that can be occupied by the target computing task. The source data sets in the second partition can be read, deleted, modified, and edited.
[0068] The embodiment of the present application does not specifically limit the method for generating the partition identification code corresponding to the second partition. Exemplarily, the partition identification code can be generated in the form of a hash code.
[0069] In the embodiment of the present application, the partition identification code corresponding to each generated second partition is different.
[0070] Step S203: Control the database to copy the source data sets to the corresponding second partitions respectively according to the partition identification code of at least one second partition, and add the partition identification code as a partition key to the corresponding second partition.
[0071] In the embodiment of the present application, the source data sets are copied to the corresponding second partitions respectively, so that each second partition stores a copy of the source data set. The partition identification code is added to the corresponding second partition as a partition key to serve as an isolation field for data.
[0072] Step S204: store the partition identification code of at least one second partition in the message queue.
[0073] The message queue is used to store the partition identification codes of the partitions that are not occupied by the executed computing tasks.
[0074] Specifically, the corresponding partition identification codes are stored in the message queue in the order of copying the source data set to the second partition, so that when obtaining the partitions in the corresponding data table of the database that are not occupied by the executed computing tasks, the partition identification codes of the partitions that are not occupied by the executed computing tasks can be obtained from the message queue.
[0075] In the embodiment of the present application, the time for storing the partition identification code in the message queue is not specifically limited. For example, the corresponding partition identification code can be stored in the message queue while the source data set is copied to the second partition; or the corresponding partition identification code can be stored in the message queue after the source data set is copied to the second partition.
[0076] The task execution method provided by the embodiment of the present application stores the source data set in the first partition of the data table; generates corresponding partition identification codes for at least one second partition in the data table; controls the database to copy the source data set to the corresponding second partitions according to the partition identification code of at least one second partition, and adds the partition identification code as a partition key to the corresponding second partition; stores the partition identification code of at least one second partition in the message queue, so as to realize pre-creation of multiple partitions in the data table, pre-storing the same source data set in each partition, and eliminating the need to prepare the corresponding source data set after triggering the target computing task. The source data set can be directly obtained from the corresponding partition, and the target computing task can be executed according to the source data set, thereby improving the execution efficiency of the target computing task.
[0077] Embodiment 3
[0078] Based on any of the above embodiments, obtaining the partitions in the corresponding data table of the database that are not occupied by the executed computing tasks in step S101 specifically includes the following steps:
[0079] Step S301: read a partition identification code of a second partition from a message queue according to the first-in-first-out principle.
[0080] Step S302: determine the second partition corresponding to the read partition identification code as a partition not occupied by the executed computing task.
[0081] In an embodiment of the present application, the partition identification codes of the second partition are stored in the message queue in sequence. After the target computing task is triggered, the partition identification code first stored in the message queue is read from the message queue according to the first-in-first-out principle; the partition corresponding to the partition identification code is determined as a partition not occupied by the executed computing task, and the partition identification code is determined as the partition identification code corresponding to the partition occupied by the target computing task.
[0082] Exemplarily, partition identification code 1, partition identification code 2, and partition identification code 3 are sequentially stored in the message queue. After the target computing task is triggered, partition identification code 1 is determined as a partition not occupied by the executed computing task, and the partition corresponding to partition identification code 1 is determined as a partition occupied by the target computing task.
[0083] After determining that the second partition corresponding to the read partition identification code is a partition not occupied by the executed computing task, the partition identification code is deleted from the message queue to ensure that the partition identification codes stored in the message queue are all partition identification codes of partitions not occupied by the executed computing tasks.
[0084] The task execution method provided in the embodiment of the present application reads a partition identification code of a second partition from the message queue according to the first-in-first-out principle; and determines the second partition corresponding to the read partition identification code as a partition not occupied by the executed computing task. The partition identification code corresponding to the partition not occupied by the executed computing task can be directly obtained from the message queue, and the partition corresponding to the partition identification code is determined as the partition occupied by the target computing task, which can speed up the acquisition of the partition not occupied by the executed computing task in the corresponding data table of the database. At the same time, the partition identification code of the second partition is read from the message queue according to the first-in-first-out principle. Since the partition identification code read is the partition identification code stored first, the source data set is first copied to the second partition corresponding to the partition identification code, so it can be ensured that when the partition identification code is read, the source data set has been stored in the corresponding second partition.
[0085] Optionally, after reading a partition identification code of a second partition from the message queue according to the first-in-first-out principle in step S301, the following steps may also be included:
[0086] Step S401: Generate a new partition identification code, and control the database to create a corresponding new second partition in the data table according to the new partition identification code.
[0087] In an embodiment of the present application, after a partition identification code of a second partition is read from a message queue, the partition corresponding to the partition identification code is occupied by a target computing task, so a new partition identification code is generated, and a new second partition corresponding to the new partition identification code is created to ensure that the number of partitions not occupied by executed computing tasks is maintained at a certain value.
[0088] The embodiments of the present application do not limit the specific time for generating a new partition identification code and executing subsequent steps. For example, a new partition identification code can be generated and subsequent steps can be executed immediately after reading a partition identification code of a second partition from a message queue. Alternatively, a new partition identification code can be generated and the database can be controlled to copy the source data set in the first partition to the new second partition when no computing task is executed.
[0089] Step S402: Control the database to copy the source data set in the first partition to the new second partition.
[0090] In the embodiment of the present application, the control database copies the source data set in the first partition to the new second partition, so that a computing task triggered later can obtain the source data set from the new second partition.
[0091] Step S403: store the partition identification code corresponding to the new partition in the message queue.
[0092] In an embodiment of the present application, the partition identification code corresponding to the new partition is stored in a message queue, so that a computing task triggered later can obtain the partition identification code corresponding to the new partition from the message queue, thereby determining that the partition identification code is a partition not occupied by an executed computing task.
[0093] The task execution method provided in the embodiment of the present application generates a new partition identification code, and controls the database to create a corresponding new second partition in the data table according to the new partition identification code; controls the database to copy the source data set in the first partition to the new second partition; and stores the partition identification code corresponding to the new partition in the message queue. After the partition not occupied by the executed computing task is occupied by the target computing task, a new partition identification code can be generated, and a new second partition corresponding to the new partition identification code can be created to ensure that the number of partitions not occupied by the executed computing task is maintained at a certain value, and to ensure that the partitions not occupied by the executed computing task in the corresponding data table of the database can be obtained after the new computing task is triggered.
[0094] Embodiment 4
[0095] Figure 4 A flowchart of a task execution method provided in the fourth embodiment of the present application is provided. Based on any of the above embodiments, the present embodiment of the present application involves a refinement of an implementation method of executing the target computing task according to the source data set in step S103 to obtain the execution result data. Figure 4 As shown, the task execution method provided in the embodiment of the present application includes the following steps:
[0096] Step S501: Determine data screening parameters corresponding to the computing task.
[0097] The data screening parameters are parameters for screening the fields in the source data set that the target computing task depends on, and the screening result data are the data in the source data set after being screened according to the data screening parameters.
[0098] In practical applications, since the source data set contains too much data, the data in the source data set can be filtered, and the execution result data can be obtained according to the filtered result data, which can reduce the amount of data calculated, thereby improving the calculation speed. Specifically, the data filtering parameters corresponding to the calculation task can be determined by the user's selection or input of the data filtering parameters.
[0099] In an optional embodiment, determining the data filtering parameters corresponding to the computing task includes: displaying a parameter configuration interface in response to the computing task triggered by the user; and determining the data filtering parameters corresponding to the computing task in response to the user's configuration operation of the data filtering parameters in the parameter configuration interface.
[0100] Specifically, Figure 5A schematic diagram of a method for determining data screening parameters provided in this application can pre-set multiple calculation tasks and set corresponding calculation formulas for the pre-set calculation tasks, such as Figure 5 As shown in the upper left figure, you can pre-set calculation task 1, calculation task 2, and calculation task 3. Click calculation task 1 to trigger the target calculation task corresponding to calculation task 1. After the target calculation task is triggered, the parameter configuration interface can be displayed. In the parameter configuration interface, at least one filterable field name can be displayed, such as Figure 5 As shown in the upper right figure, the filter date can be displayed, where the filter date means filtering the time field in the source data set; in the parameter configuration interface, the filter control can also be displayed. For example, the component can be displayed as a drop-down arrow and an input box. Figure 5 As shown in the lower right figure, after clicking the filter control, the parameter selection box will be displayed. You can select the data filter parameter by clicking the date in the parameter selection box. In addition, you can also directly enter the data filter parameter in the input box. Figure 5 As shown in the lower left figure, after the user selects the data filtering parameters, the user can click the OK button to allow the task execution device to determine the data filtering parameters corresponding to the calculation task.
[0101] In another optional implementation, determining data screening parameters corresponding to a computing task includes: displaying a source data set display interface in response to a computing task triggered by a user; and determining data screening parameters corresponding to the computing task in response to a user's selection operation on source data in the source data set display interface.
[0102] Specifically, Figure 6 A schematic diagram of another method for determining data screening parameters provided in this application, such as Figure 6 As shown in the figure on the left in the upper middle part, a calculation task creation component may be provided. For example, the component may be a calculation task creation button. By clicking the calculation task creation button, a calculation task may be triggered. After the calculation task is triggered, a source data set display interface may be displayed. In the source data set display interface, at least one filterable field name may be displayed, such as Figure 6 As shown in the figure on the right in the upper middle, the warehouse name, such as the warehouse location and warehouse inventory in the source data set, can be displayed. Figure 6 As shown in the figure on the right in the lower middle, after clicking the drop-down arrow corresponding to the warehouse location, the data corresponding to the warehouse location can be displayed, including: Region A, Region B, and Region C. The user can select data filtering parameters in the displayed data, and can click the OK button to allow the task execution device to determine the data filtering parameters corresponding to the calculation task, such as Figure 5As shown in the lower left figure, region A can be selected as a data screening parameter, so that the task execution device screens the data corresponding to region A in the source data set, and determines the data corresponding to region A as the screening result data.
[0103] Step S502: Filter data from the corresponding source data set according to the data filtering parameters to obtain filtering result data.
[0104] Step S503: Execute the target computing task according to the screening result data to obtain execution result data.
[0105] Exemplarily, the source data set may include a time field, and the time range of the source data set that the target computing task depends on may be set by determining data screening parameters. For example, the target computing task may predict sales for the data in the source data set in the past four months, and the time range of the source data set that the target computing task depends on may be determined to be the past four months by determining the data screening parameters corresponding to the computing task, obtaining the data in the source data set in the past four months, and predicting sales based on the data in the past four months.
[0106] The task execution method provided in the embodiment of the present application determines the data screening parameters corresponding to the computing task; screens the data from the corresponding source data set according to the data screening parameters to obtain the screening result data; and executes the target computing task according to the screening result data to obtain the execution result data. The data in the source data set can be screened by the data screening parameters, the target computing task can be executed according to the screening result data, and the execution result data calculated according to the screening result data can be obtained, which can reduce the amount of data calculated, thereby improving the calculation speed.
[0107] Optionally, based on the above implementation, before executing the target computing task according to the source data set in step S103 to obtain the execution result data, the following steps may also be included: adjusting the value of the filtering result data; synchronizing the adjusted value of the filtering result data to the source data set of the corresponding partition to form a destination data set.
[0108] The destination data set is a data set obtained by adjusting the values of the data in the source data set.
[0109] In the embodiment of the present application, the value of the data in the second partition occupied by the target computing task can be adjusted to form a target data set; the target computing task is executed according to the target data set to obtain execution result data.
[0110] In practical applications, it may be necessary to adjust the data in the source dataset to perform target computing tasks under special hypothetical scenarios.
[0111] Exemplarily, storage planning can be performed to determine whether the supply that can be provided by the warehouse inventory adjusted according to the storage plan can match the predicted sales. Specifically, the fields in the source data set can include warehouse inventory and warehouse location. The warehouse inventory of warehouses in region A can be obtained by determining that the data screening parameter is that the warehouse location is region A; the warehouse inventory of a warehouse in region A can be adjusted according to the storage plan and synchronized to the source data set of the corresponding partition; the supply can be calculated based on the adjusted warehouse inventory to determine whether the supply can match the predicted sales.
[0112] The task execution method provided in the embodiment of the present application adjusts the value of the filtering result data; synchronizes the adjusted value of the filtering result data to the source data set of the corresponding partition to form a target data set, which can meet the demand of the target computing task under special hypothetical scenarios for adjusting the data in the source data set.
[0113] Embodiment 5
[0114] Figure 7 This is a flowchart of a task execution method provided in Embodiment 5 of the present application. Based on any of the above embodiments, this embodiment of the present application involves a process of storing result data. Figure 7 As shown, the task execution method provided in the embodiment of the present application includes the following steps:
[0115] Step S601: Control the database to create a result table for storing execution result data, and create partitions in the result table according to the partition identification code.
[0116] Specifically, after the control database creates the result table, it obtains the partition identification code, and creates a corresponding partition in the result table for each obtained partition identification code. The result table is used to store the execution result data.
[0117] In an optional implementation, a partition may be created in a result table according to a partition identification code as follows: in response to a triggered target computing task, after obtaining a partition in a corresponding data table of the database that is not occupied by an executed computing task, the partition identification code corresponding to the partition may be determined, and a corresponding partition may be created in the result table for the partition identification code corresponding to the partition.
[0118] In another optional implementation, a partition is created in the result table according to the partition identification code by reading the partition identification code of the second partition from the message queue, and creating a corresponding partition for the partition identification code of the second partition in the message queue.
[0119] Step S602: Add the partition identification code as a partition key to the partition corresponding to the result table.
[0120] Specifically, after creating a partition in the result table according to the partition identification code, the partition identification code is added as a partition key to the partition corresponding to the result table, so that after the execution result data is obtained, the execution result data is associated with the partition identification code and stored.
[0121] Step S603: Execute the computing task according to the screening result data to obtain execution result data.
[0122] Step S604: Store the execution result data in the partition corresponding to the result table according to the partition key.
[0123] Specifically, the execution result data with the same partition key is stored in the partition corresponding to the same result table.
[0124] Step S605: Display the execution result data on the result display interface.
[0125] Specifically, the partition identification code corresponding to the target computing task is obtained, the execution result data corresponding to the target computing task is obtained from the result table according to the partition identification code, and the execution result data is displayed in the result display interface.
[0126] The task execution method provided in the embodiment of the present application controls the database to create a result table for storing the execution result data, and creates partitions in the result table according to the partition identification code; adds the partition identification code as a partition key to the execution result data; stores the execution result data in the partition corresponding to the result table according to the partition key; and displays the execution result data in the result display interface. The execution result data can be stored in the partitions of the result table according to the partition key, which can improve the speed of obtaining the execution result data corresponding to the computing task, and reduce the metadata management cost of the execution result data and the resource consumption of the database connection pool.
[0127] Optionally, based on any of the above embodiments, the following steps may also be included:
[0128] Step S701: In response to a data query request triggered by a user, a partition identification code and data query parameters in the data query request are obtained.
[0129] In the embodiment of the present application, the user can input the partition identification code and the data query parameter in the query interface to trigger the data query request, wherein the data query parameter is a parameter for filtering the data set.
[0130] Step S702: Acquire a corresponding data set from the partition corresponding to the partition identification code, and acquire a data query result matching the data query parameter in the data set.
[0131] Step S703: display the data query result.
[0132] The acquired data set is a data set stored in the partition corresponding to the partition identification code, and may be a source data set or a destination data set obtained by adjusting the source data set.
[0133] Specifically, after the corresponding data set is acquired, the data query results are filtered out from the data set according to the data query parameters, and the data query results are displayed.
[0134] Optionally, if step S604 has been executed to store the execution result data in the partition corresponding to the result table according to the partition key, then in response to the data query request triggered by the user and after obtaining the partition identification code in the data query request, the execution result data in the partition corresponding to the partition identification code can also be obtained from the result table and displayed.
[0135] The task execution method provided in the embodiment of the present application responds to a data query request triggered by a user, obtains a partition identification code and data query parameters in the data query request; obtains a corresponding data set from the partition corresponding to the partition identification code, and obtains a data query result matching the data query parameters in the data set; displays the data query result; can query the data set that the executed computing task depends on, so that the user can know the source data set that the executed computing task depends on; can also query the execution result data that the executed computing task depends on, so that the user can know the execution result data that the executed computing task depends on, and can compare the data sets and execution result data of multiple computing tasks in a multi-task scenario.
[0136] Embodiment 6
[0137] Figure 8 This is a schematic diagram of the structure of the task execution device provided in Example 6 of the present application, such as Figure 8 As shown, the task execution device 80 provided in the sixth embodiment of the present application includes: a first acquisition module 801 , a second acquisition module 802 and an execution module 803 .
[0138] Specifically, the first acquisition module 801 is used to obtain the partition in the data table corresponding to the database that is not occupied by the executed computing task in response to the triggered target computing task; the target computing task is any computing task in the multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; multiple partitions are pre-created in the data table, and the same source data set is pre-stored in each partition;
[0139] A second acquisition module 802 is used to acquire a corresponding source data set from a partition not occupied by the executed computing task;
[0140] The execution module 803 is used to execute the target computing task according to the source data set to obtain execution result data.
[0141] Optionally, the task execution device 80 also includes: a storage module; the storage module is used to store the source data set in the first partition of the data table; generate corresponding partition identification codes for at least one second partition in the data table; control the database to copy the source data set to the corresponding second partitions according to the partition identification code of at least one second partition, and add the partition identification code as a partition key to the corresponding second partition; store the partition identification code of at least one second partition in the message queue.
[0142] Optionally, the first acquisition module 801 is specifically used to: read a partition identification code of a second partition from the message queue according to the first-in-first-out principle; and determine the second partition corresponding to the read partition identification code as a partition not occupied by the executed computing task.
[0143] Optionally, the task execution device 80 further includes: a creation module; the creation module is used to generate a new partition identification code, and control the database to create a corresponding new second partition in the data table according to the new partition identification code. The storage module is also used to: control the database to copy the source data set in the first partition to the new second partition; and store the partition identification code corresponding to the new partition in the message queue.
[0144] Optionally, the execution module 803 is specifically used to determine data screening parameters corresponding to the computing task; filter data from the corresponding source data set according to the data screening parameters to obtain screening result data; execute the target computing task according to the screening result data to obtain execution result data.
[0145] Optionally, the task execution device 80 also includes: a parameter configuration module; the parameter configuration module is used to: display a parameter configuration interface in response to a computing task triggered by a user; and determine the data filtering parameters corresponding to the computing task in response to the user's configuration operation of the data filtering parameters in the parameter configuration interface.
[0146] Optionally, the task execution device 80 also includes: a parameter selection module; the parameter selection module is used to: display a source data set display interface in response to a computing task triggered by a user; and determine data screening parameters corresponding to the computing task in response to a user's selection operation on source data in the source data set display interface.
[0147] Optionally, the creation module is further used to: control the database to create a result table for storing the execution result data, and create partitions in the result table according to the partition identification code; add the partition identification code as a partition key to the partition corresponding to the result table. The storage module is also used to: store the execution result data in the partition corresponding to the result table according to the partition key; and display the execution result data on the result display interface.
[0148] Optionally, the task execution device 80 further includes: a parameter adjustment module; the parameter adjustment module is used to: adjust the value of the screening result data; synchronize the adjusted value of the screening result data to the source data set of the corresponding partition to form a destination data set.
[0149] Optionally, the task execution device 80 also includes: a data query module; the data query module is used to: respond to a data query request triggered by a user, obtain a partition identification code and data query parameters in the data query request; obtain a corresponding data set from the partition corresponding to the partition identification code, and obtain a data query result that matches the data query parameters in the data set; and display the data query result.
[0150] It should be noted that the technical solutions and effects performed by the task execution device provided in the embodiment of the present application can be found in the relevant contents of the aforementioned method embodiment and will not be repeated here.
[0151] Embodiment 7
[0152] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 7 of the present application, such as Fig. 9 As shown, the present application also provides an electronic device 90 , including: a memory 901 , a processor 902 , and a transceiver 903 .
[0153] The memory 901 is used to store programs, and the transceiver 903 is used to send and receive data. Specifically, the program may include program code, and the program code includes computer execution instructions. The memory 901 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0154] The processor 902 is used to execute the program stored in the memory 901 .
[0155] The computer program is stored in the memory 901 and is configured to be executed by the processor 902 to implement the task execution method provided in any embodiment of the present application. The relevant description can be understood by referring to the relevant descriptions and effects corresponding to the steps in the accompanying drawings, and no further details are given here.
[0156] In the embodiment of the present application, the memory 901 and the processor 902 are connected via a bus. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0157] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the task execution method provided in any embodiment of the present application.
[0158] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements a task execution method provided in any embodiment of the present application.
[0159] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0160] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0161] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0162] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable task execution device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0163] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0164] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the application. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.
[0165] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0166] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A task execution method, characterized in that: include: In response to the triggered target computing task, obtaining the partitions in the corresponding data table of the database that are not occupied by the executed computing task; The target computing task is any computing task in a multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; a plurality of partitions are pre-created in the data table, and the same source data set is pre-stored in each partition; Obtain the corresponding source data set from the partition that is not occupied by the executed computing task; Execute the target computing task according to the source data set to obtain execution result data; Before obtaining the partitions in the corresponding data table of the database that are not occupied by the executed computing tasks, the method further includes: Store the source data set into the first partition of the data table; Generate a corresponding partition identification code for at least one second partition in the data table, and add the partition identification code as a partition key to the corresponding second partition; The step of obtaining the partitions in the corresponding data table of the database that are not occupied by the executed computing tasks includes: According to the first-in-first-out principle, a partition identification code of a second partition is read from the message queue, wherein the message queue stores at least one partition identification code of the second partition; The second partition corresponding to the read partition identification code is determined as a partition not occupied by the executed computing task.
2. The method according to claim 1, characterized in that Before adding the partition identification code as a partition key to the corresponding second partition, the method further includes: According to the partition identification code of at least one second partition, the database is controlled to copy the source data sets to the corresponding second partitions respectively.
3. The method according to claim 1, characterized in that After reading a partition identification code of a second partition from the message queue according to the first-in-first-out principle, the method further includes: Generate a new partition identification code, and control the database to create a corresponding new second partition in the data table according to the new partition identification code; The control database copies the source data set in the first partition to the new second partition; The partition identification code corresponding to the new partition is stored in the message queue.
4. The method according to claim 2, characterized in that: The executing the target computing task according to the source data set to obtain execution result data includes: Determining data screening parameters corresponding to the computing task; Filter the data from the corresponding source data set according to the data filtering parameters to obtain filtering result data; The target computing task is executed according to the screening result data to obtain execution result data.
5. The method according to claim 4, characterized in that The determining of the data screening parameters corresponding to the computing task includes: In response to a computing task triggered by a user, a parameter configuration interface is displayed; In response to the configuration operation of the data screening parameter performed by the user on the parameter configuration interface, the data screening parameter corresponding to the computing task is determined.
6. The method according to claim 4, characterized in that The determining of the data screening parameters corresponding to the computing task includes: In response to a computing task triggered by a user, a source data set display interface is displayed; In response to a user's selection operation on source data in a source data set display interface, a data screening parameter corresponding to the computing task is determined.
7. The method according to claim 4, characterized in that Before executing the computing task according to the screening result to obtain the execution result data, the method further includes: Controlling the database to create a result table for storing the execution result data, and creating partitions in the result table according to the partition identification code; Add the partition identification code as a partition key to the partition corresponding to the result table; After executing the computing task according to the screening result data to obtain the execution result data, the method further includes: Store the execution result data into the partition corresponding to the result table according to the partition key; The execution result data is displayed on the result display interface.
8. The method according to any one of claims 4 to 6, characterized in that: Before executing the computing task according to the screening result data to obtain the execution result data, the method further includes: Adjusting the value of the screening result data; The adjusted values of the screening result data are synchronized to the source data set of the corresponding partition to form the destination data set.
9. The method according to claim 7, characterized in that: Also includes: In response to a data query request triggered by a user, obtaining a partition identification code and data query parameters in the data query request; Acquire a corresponding data set from the partition corresponding to the partition identification code, and acquire a data query result matching the data query parameter in the data set; The data query result is displayed.
10. A task execution device, characterized in that: include: A first acquisition module is used to obtain, in response to a triggered target computing task, a partition in a corresponding data table of a database that is not occupied by an executed computing task; The target computing task is any computing task in a multi-task scenario, and each computing task in the multi-task scenario depends on the same source data set; a plurality of partitions are pre-created in the data table, and the same source data set is pre-stored in each partition; A second acquisition module is used to acquire the corresponding source data set from the partition not occupied by the executed computing task; An execution module, used for executing the target computing task according to the source data set to obtain execution result data; The task execution device also includes: a storage module; The storage module is used to store the source data set in the first partition of the data table; Generate a corresponding partition identification code for at least one second partition in the data table, and add the partition identification code as a partition key to the corresponding second partition; The first acquisition module is specifically used to: According to the first-in-first-out principle, a partition identification code of a second partition is read from a message queue, wherein the message queue stores at least one partition identification code of the second partition; The second partition corresponding to the read partition identification code is determined as a partition not occupied by the executed computing task.
11. An electronic device, characterized in that: include: A processor, and a memory and a transceiver communicatively connected to the processor; The memory stores computer-executable instructions; the transceiver is used to send and receive data; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.
13. 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 9 is implemented.
Citation Information
Patent Citations
Data statistics method and device and computer readable storage medium
CN113268487A
Data access method and data management service system
CN113343275A