Task scheduling method and device
Through the configuration of data groups and business rules, data shard split data groups for distributed task calculations are solved, and the problem of high difficulty in adjusting the calculation logic of the insurance industry sales management platform is achieved, and rapid modification of business logic and improvement of computing efficiency is achieved.
Patent Information
- Application Number
- CN202311467024.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-06
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-11-06
AI Technical Summary
The commission and fee calculation of the insurance industry sales management platform is carried out on the database side to calculate the program code at a high degree of coupling, learning cost, modification and testing are difficult, and adjustment is difficult, which is prone to error calculations.
Through the configuration of data groups and business rules, the separation of business calculations and storage media is realized, and the data groups are split in the form of data sharding for distributed task calculations, and a calculation subtask is generated to calculate the target indicators.
It realizes rapid modification of business logic and improves computing efficiency, without the need to perform data calculations on the database side, reducing the difficulty and risk of modification.
Smart Images

Figure CN117573304B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a task scheduling method and device. Background Art
[0002] In related technologies, since the commission and expense calculations of insurance industry sales management platforms are mostly performed in batches in stored procedures on the database side, it is easy to lead to high coupling of program codes, high learning costs, and difficulty in modification and testing. At the same time, it also makes it difficult for insurance companies to modify the calculation logic according to market changes and adjustments to operating strategies, and the adjustment is difficult, the workload is large, the risk is high, and calculation errors are prone to occur. Summary of the Invention
[0003] The present invention aims to solve one of the technical problems in the related art at least to a certain extent.
[0004] To this end, the first purpose of the present invention is to propose a task scheduling method, which can realize the separation of business calculation and storage medium through the configuration of data groups and business rules, without the need for data calculation on the database side, and can realize the rapid modification of business logic, and through the configuration of data sharding, realize the splitting of data groups according to the sharding granularity in the data sharding information, perform distributed task calculation, and improve computing efficiency.
[0005] The second objective of the present invention is to provide a task scheduling device.
[0006] A third object of the present invention is to provide an electronic device.
[0007] A fourth object of the present invention is to provide a computer-readable storage medium.
[0008] A fifth object of the present invention is to provide a computer program product.
[0009] To achieve the above objectives, a first embodiment of the present invention provides a task scheduling method, comprising:
[0010] Obtaining task information and data sharding information of a computing task, wherein the computing task is used to calculate a target indicator, and the task information includes a configured data group and business rules;
[0011] Splitting the data group in the task information according to the sharding granularity in the data sharding information to obtain at least one sub-data group, wherein the at least one sub-data group corresponds to the sharding granularity;
[0012] Generate a corresponding computing subtask based on any of the sub-data groups and the business rules, wherein any of the computing subtasks is used to calculate the target indicator at the corresponding sharding granularity;
[0013] Execute each of the computing subtasks to obtain the target indicator at the corresponding sharding granularity.
[0014] To achieve the above-mentioned purpose, a second embodiment of the present invention provides a task scheduling device, comprising:
[0015] An acquisition module, configured to acquire task information and data sharding information of a computing task, wherein the computing task is used to calculate a target indicator, and the task information includes a configured data group and business rules;
[0016] a splitting module, configured to split the data group in the task information according to the sharding granularity in the data sharding information to obtain at least one sub-data group, wherein the at least one sub-data group corresponds to the sharding granularity;
[0017] A generation module, configured to generate a corresponding computing subtask based on any of the sub-data groups and the business rules, wherein any of the computing subtasks is used to calculate a target indicator at a corresponding sharding granularity;
[0018] The first execution module is used to execute each of the computing subtasks to obtain the target indicator at the corresponding sharding granularity.
[0019] To achieve the above-mentioned purpose, an embodiment of the third aspect of the present invention proposes an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the task scheduling method of the first aspect mentioned above.
[0020] In order to achieve the above-mentioned purpose, an embodiment of a fourth aspect of the present invention proposes a computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the task scheduling method of the first aspect.
[0021] In order to achieve the above-mentioned purpose, a fifth embodiment of the present invention proposes a computer program product, including a computer program, which implements the task scheduling method of the first aspect when executed by a processor.
[0022] The technical solution provided by the embodiment of the present invention has the following beneficial effects:
[0023] By obtaining the task information and data sharding information of the computing task, where the computing task is used to calculate the target indicator, and the task information includes the configured data group and business rules, the data group in the task information is split according to the sharding granularity in the data sharding information to obtain the data group at the corresponding sharding granularity, and then the corresponding computing subtask is generated according to the data group and business rules at any sharding granularity, and then each computing subtask is executed to obtain the target indicator at the corresponding sharding granularity. In this way, the separation of business computing and storage media can be achieved through the configuration of data groups and business rules, without the need for data calculation on the database side, which can achieve rapid modification of business logic, and the data sharding configuration can be used to split the data group according to the sharding granularity in the data sharding information, perform distributed task computing, and improve computing efficiency.
[0024] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0026] Figure 1 A flowchart of a task scheduling method provided by an embodiment of the present invention;
[0027] Figure 2 A flowchart of another task scheduling method provided by an embodiment of the present invention;
[0028] Figure 3 A schematic diagram of a DMN indicator adding page provided by an embodiment of the present invention;
[0029] Figure 4 A schematic diagram of a new employee allowance decision table provided in an embodiment of the present invention;
[0030] Figure 5 A schematic diagram of a DAG for indicating the association relationship between calculation indicators provided by an embodiment of the present invention;
[0031] Figure 6 A flowchart of another task scheduling method provided by an embodiment of the present invention;
[0032] Figure 7 A schematic diagram of the principle of a task scheduling method provided by an embodiment of the present invention;
[0033] Figure 8 A schematic diagram illustrating another method for scheduling tasks according to an embodiment of the present invention;
[0034] Figure 9 A schematic diagram of the structure of a task scheduling device provided by an embodiment of the present invention;
[0035] Figure 10 A schematic structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The following describes embodiments of the present invention in detail, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and are not to be construed as limiting the present invention.
[0037] The following describes a task scheduling method and apparatus according to an embodiment of the present invention with reference to the accompanying drawings.
[0038] Figure 1 A flowchart of a task scheduling method provided by an embodiment of the present invention.
[0039] like Figure 1 As shown, the task scheduling method includes the following steps:
[0040] Step 101: Obtain task information and data shard information of a computing task.
[0041] The calculation task is used to calculate the target indicator, and the task information includes the configured data group and business rules.
[0042] Optionally, when configuring a data group, you can configure the target indicators and the model wide tables involved in calculating the target indicators. When configuring the model wide tables involved in calculating the target indicators, you can configure the data source information, field information, etc. of the model wide tables.
[0043] It should be noted that at least one dependent indicator may be involved in the process of calculating the target indicator. That is, the calculation indicators involved in calculating the target indicator may include only the target indicator, or may include the target indicator and the dependent indicators involved in calculating the target indicator. Among them, the dependent indicators involved in calculating the target indicator include the dependent indicators of the target indicator and the dependent indicators of the dependent indicators. For example, assuming that the dependent indicators of target indicator A are B and C, this means that to calculate target indicator A, it is necessary to first calculate the dependent indicators of target indicator A, that is, it is necessary to first calculate dependent indicator B and dependent indicator C. Optionally, a dependent indicator may also have dependent indicators. For example, assuming that dependent indicator C has dependent indicator D, this means that to calculate dependent indicator C, it is necessary to first calculate the dependent indicators of dependent indicator C, that is, it is necessary to first calculate dependent indicator D.
[0044] Optionally, if at least one dependent indicator is involved in the process of calculating the target indicator, the dependent indicators involved in calculating the target indicator may be configured while configuring the target indicator when configuring the data group.
[0045] As a possible implementation method, when configuring data groups, at least one data group may be configured for the model wide table involved in calculating the target indicator, and one data group may be configured for the calculation indicator involved in calculating the target indicator.
[0046] Optionally, when configuring business rules, a business rule may be configured for each calculation indicator, with each business rule used to indicate how to calculate the corresponding calculation indicator. The calculation indicator may include only the target indicator, or may include the target indicator and the dependent indicators involved in calculating the target indicator.
[0047] Since data groups and business rules are manually configured, computing tasks can be configured, visualized, and modularized, and business computing and storage media can be separated. Data computing no longer requires reliance on databases, and business logic can be quickly modified and put online.
[0048] The data sharding information includes a preset sharding granularity. Optionally, the sharding granularity may be an organization dimension, a team dimension, etc., which is not limited in this embodiment.
[0049] In some embodiments, the task information and data slice information of the computing task can be obtained through various public, legal, and compliant methods. For example, the task information and data slice information of the computing task can be collected in real time, or the task information and data slice information of the computing task can be obtained from other devices that store the task information and data slice information of the computing task through network transmission or physical copying, or the task information and data slice information of the computing task can be obtained through other public, legal, and compliant methods, which are not limited in this embodiment.
[0050] Step 102: Split the data group in the task information according to the sharding granularity in the data sharding information to obtain at least one sub-data group.
[0051] At least one sub-data group corresponds to a sharding granularity, that is, any sharding granularity in the data sharding information corresponds to a sub-data group.
[0052] It should be noted that when configuring a data group, since the configuration of the model wide table involved in the calculation target indicator may involve multiple data sources, in the present invention, in order to improve the calculation efficiency, the data sharding can be configured to split the data group according to the sharding granularity in the data sharding information and perform distributed task calculations.
[0053] In some embodiments, the data group in the task information can be split according to the sharding granularity in the data sharding information to obtain sub-data groups at the corresponding sharding granularity. It should be noted that the split data group is at least one data group configured for the model wide table involved in the calculation of the target indicator, rather than the data group configured for the calculation indicator involved in the calculation of the target indicator.
[0054] Step 103: Generate a corresponding computing subtask according to any sub-data group and business rules.
[0055] It's understandable that, because business rules are configured for each calculation metric, even if a data group is split according to the sharding granularity in the data sharding information, the same business rules can be used to calculate the corresponding calculation metric for sub-data groups at different sharding granularities. However, the calculated calculation metric will only be the one at the corresponding sharding granularity.
[0056] In some embodiments, a corresponding computing subtask can be generated based on any sub-data group and business rules, wherein any computing subtask is used to calculate the target indicator at the corresponding sharding granularity.
[0057] Step 104: execute each computing subtask to obtain the target indicator at the corresponding sharding granularity.
[0058] In some embodiments, the target indicator at the corresponding sharding granularity can be obtained by executing each computing subtask. Optionally, each computing subtask can be performed in a distributed manner, thereby improving computing efficiency.
[0059] The task scheduling method provided in this embodiment obtains the task information and data sharding information of the computing task, wherein the computing task is used to calculate the target indicator, and the task information includes the configured data group and business rules, so as to split the data group in the task information according to the sharding granularity in the data sharding information to obtain the data group at the corresponding sharding granularity, thereby generating the corresponding computing subtasks according to the data group and business rules at any sharding granularity, and then executing each computing subtask to obtain the target indicator at the corresponding sharding granularity. Thus, the separation of business computing and storage media can be achieved through the configuration of data groups and business rules, without the need to perform data computing on the database side, and the rapid modification of business logic can be achieved. In addition, the data group can be split according to the sharding granularity in the data sharding information through the configuration of data sharding, and distributed task computing can be performed to improve computing efficiency.
[0060] In order to clearly illustrate the above embodiment, this embodiment provides another task scheduling method. Figure 2 A flowchart of another task scheduling method provided by an embodiment of the present invention.
[0061] like Figure 2 As shown, the task scheduling method may include the following steps:
[0062] Step 201: Obtain task information and data shard information of the computing task.
[0063] The calculation task is used to calculate the target indicator, and the task information includes the configured data group and business rules.
[0064] The data group includes a first data group and a second data, and the first data group is used to store the target field in the target data table for calculating the target indicator, and the second data group is used to store the calculated indicator, wherein the calculated indicator may only include the target indicator, or may include the target indicator and the dependent indicators involved in calculating the target indicator.
[0065] Optionally, the number of the first data group may be one or more, which is not limited in this embodiment. Similarly, the number of the second data group may be one or more, which is not limited in this embodiment.
[0066] The target data table may be a data table containing only the target fields used to calculate the target indicator, or a data table containing the target fields and other fields used to calculate the target indicator, and this embodiment does not impose any restrictions on this. Similarly, the number of target data tables may be one or more, and this embodiment does not impose any restrictions on this.
[0067] It should be noted that the target data table may involve multiple data sources, which is not limited in this embodiment.
[0068] As an example, assuming the target indicator is salary, the model wide tables involved in calculating salary include the basic information data table, the organizational information data table, the transaction information data table, the recommendation information data table, and the development information data table. The first data group can be the personal data wide table shown in Table 1:
[0069] Table 1 Personal data wide table
[0070]
[0071]
[0072] As shown in Table 1, the basic information data table, organizational information data table, transaction information data table, recommendation information data table, and cultivation information data table are target data tables. The first data group is used to store the target fields in the target data tables, such as the basic information data table, organizational information data table, transaction information data table, recommendation information data table, and cultivation information data table, for calculating target indicators.
[0073] It should be noted that target data tables such as basic information data table, organizational information data table, transaction information data table, recommendation information data table, and cultivation information data table may involve multiple data sources, for example, they may come from multiple institutions in different provinces.
[0074] Assuming that the dependent indicators involved in calculating the salary include the new employee allowance, the new employee recommendation bonus, and the new employee's direct recommender bonus, the second data group can be a wide table of personal indicators as shown in Table 2:
[0075] Table 2 Personal indicator width table
[0076]
[0077] As shown in Table 2, the second data group is only used to store calculation indicators, wherein the calculation indicators may only include target indicators, or may include target indicators and dependent indicators involved in calculating the target indicators.
[0078] Among them, the business rules correspond to the calculation indicators stored in the second data group, and any business rule is used to indicate the calculation field and calculation rule of the corresponding calculation indicator, wherein the calculation field is determined based on the first data group and the second data group and is used to calculate the corresponding calculation indicator, and the calculation rule is used to adopt at least one calculation mode to calculate the corresponding calculation indicator based on the calculation field.
[0079] Optionally, the calculation field may include an input field and an output field, the input field is determined based on the first data group, and the output field is determined based on the second data group.
[0080] Optionally, calculation modes include the DMN (Decision Model and Notation) calculation mode, the formula calculation mode, and the Java calculation mode, and corresponding indicator types include the DMN indicator type, the expression indicator type, and the Java indicator type. That is, the indicator type of a calculation indicator calculated using the DMN calculation mode is the DMN indicator type, the indicator type of a calculation indicator calculated using the formula calculation mode is the expression indicator type, and the indicator type of a calculation indicator calculated using the Java calculation mode is the Java indicator type.
[0081] As an example, when configuring business rules, you can configure input tables / fields, output tables / fields, and calculation rules. Optionally, when configuring input tables / fields, you can select the data wide tables and data fields that the indicator calculation depends on, as well as the calculation subject fields (primary keys or logical primary keys for indicator calculations), which are used to configure the input items when configuring business rules, and the data input and calculation subject when calculating indicators. When configuring output tables / fields, you can select the data wide tables and data fields for the output of indicator calculation results, as well as the output subject fields, which are used as the output basis for indicator calculations. When configuring calculation rules, the following three calculation models are supported:
[0082] DMN: Decision table configuration, which allows you to configure decision tables, expressions, and DRDs (Decision Requirements Diagrams). This calculation mode supports calculations on single-row data.
[0083] Simple formula calculation: supports sum, maximum, minimum, average, etc. This calculation mode supports calculation of multiple rows of data;
[0084] SDK (Software Development Kit): By developing a Java SDK, it provides unified data access, output standards, and development standards. This model supports complex scenarios and problems that cannot be solved by DMN and simple formula calculations.
[0085] Alternatively, one can use Figure 3 Configure DMN indicators on the Add DMN Indicator page shown in the figure. Figure 3 As shown in the figure, when configuring DMN indicators, you need to configure indicator information and rule configuration. The indicator information configuration includes the indicator name, dependent indicators, input table selection, and output selection.
[0086] It should be noted that Figure 3 The personal basic information table shown in the input table selection is a first data group, and the insurance policy table is a first data group. Figure 3 It can be seen from the personal basic information table / field 1, field 2, field 3 and the insurance policy width table / field 1, field 2, field 3 shown in the input table selection that when selecting the input table, one or more first data groups can be selected, and each first data group can select one or more data fields.
[0087] It should be noted that Figure 3 The personal indicator table shown in the output selection is a second data group. Since this is only used to configure the business rule for calculating a single indicator, you can only select one data field from a second data group when making an output selection.
[0088] It should be noted that when configuring rules, you can use multiple methods to configure, such as Figure 3 The DRD shown, Figure 4 The decision table, formula calculation, etc. shown in the figure are as follows. It can be understood that Figure 3 The DMN indicator used in the DRD indicator configuration is obtained by "summing" the integer attribute A, integer attribute B, Boolean attribute C, character attribute D, and date attribute E. The "sum" here refers to a logical sum relationship, not a mathematical sum calculation.
[0089] Figure 4 In the data, there are corresponding rules for calculating new employee allowances for different signing dates, different monthly FYCs, different new employee quality coefficients, and different institution types. For example, the new employee allowance calculation rule indicated by row number 1 states that as long as the signing date is greater than 12, the corresponding new employee allowance is 0 regardless of the monthly FYC, new employee quality coefficient, or institution type. The new employee allowance calculation rule indicated by row number 2 states that when the signing date is between [1..3], the monthly FYC is greater than or equal to 10800, the new employee quality coefficient is "Rookie Edition", and the institution type is "Urban", the corresponding new employee allowance is 4500; and so on. The relationship between signing date, monthly FYC, new employee quality coefficient, and institution type is an AND relationship.
[0090] It should be noted that the execution process of this step can specifically refer to step 101 in the previous embodiment, and the principles are the same, so it will not be repeated here.
[0091] Step 202: Split the first data group according to the fragmentation granularity in the data fragmentation information to obtain at least one first sub-data group.
[0092] The data in any first sub-data group is the data at the corresponding sharding granularity in the first data group.
[0093] Since the target data table may involve multiple data sources, the first data group may store a large amount of data even if it is only used to store the target fields in the target data table for calculating the target indicators. Therefore, in order to improve computing efficiency, in the present invention, data sharding can be configured to split the data group according to the sharding granularity in the data sharding information to perform distributed task calculations.
[0094] In some embodiments, the first data group may be split according to the sharding granularity in the data sharding information to obtain a first sub-data group at the corresponding sharding granularity.
[0095] It should be noted that since the second data group is only used to store calculation indicators and has no effect on calculation efficiency, in the present invention, the second data group can be split according to the sharding granularity in the data sharding information to obtain a second sub-data group at the corresponding sharding granularity, wherein any second sub-data group is used to store the calculation indicators at the corresponding sharding granularity, or the second data group can be left unsplit and one second data group can be used to store the calculation indicators at each sharding granularity. There is no restriction on this in this embodiment.
[0096] Step 2031, when the calculation indicators stored in the second data group only include the target indicator, generate a calculation subtask for calculating the target indicator at the corresponding shard granularity according to the business rules corresponding to any first sub-data group and the target indicator.
[0097] It is understandable that if the calculation indicators stored in the second data group only include the target indicators, it means that the process of calculating the target indicators does not involve dependent indicators, that is, the target indicators do not have dependent indicators, and the target indicators can be directly calculated based on the target fields stored in the first data group. At the same time, in order to improve calculation efficiency in step 202, the first data group is split to obtain the first sub-data groups at each shard granularity. Therefore, in some embodiments, when the calculation indicators stored in the second data group only include the target indicators, a calculation subtask for calculating the target indicator at the corresponding shard granularity can be generated directly based on the business rules corresponding to any first sub-data group and the target indicator.
[0098] Step 2032: For any calculation subtask, determine the target indicator at the corresponding sharding granularity according to the calculation fields and calculation rules indicated by the corresponding first sub-data group and the business rules corresponding to the target indicator.
[0099] Since the calculation indicators stored in the second data group only include the target indicators, the target indicators can be directly calculated based on the target fields stored in the first data group. In addition, in the above steps, the calculation subtasks for calculating the target indicators at the corresponding sharding granularity are generated based on the first sub-data group obtained by splitting the first data group and the business rules corresponding to the target indicators. Therefore, when executing the calculation subtasks, when the calculation indicators stored in the second data group only include the target indicators, for any calculation subtask, the target indicators at the corresponding sharding granularity can be determined based on the calculation fields and calculation rules indicated by the corresponding first sub-data group and the business rules corresponding to the target indicators.
[0100] Step 2041, when the calculation indicators stored in the second data group include the target indicators and the dependent indicators involved in calculating the target indicators, a calculation subtask for calculating the target indicators at the corresponding shard granularity is generated according to any first sub-data group, the business rules corresponding to the dependent indicators and the business rules corresponding to the target indicators.
[0101] It is understandable that if the calculation indicators stored in the second data group include the target indicators and the dependent indicators involved in calculating the target indicators, it means that the dependent indicators are involved in the process of calculating the target indicators, that is, the target indicators need to be calculated based on the target fields stored in the first data group and the dependent indicators involved in calculating the target indicators. At this time, there will also be corresponding business rules for the dependent indicators. In addition, in order to improve the calculation efficiency in step 202, the first data group is split to obtain the first sub-data groups at each shard granularity. Therefore, in some embodiments, when the calculation indicators stored in the second data group include the target indicators and the dependent indicators involved in calculating the target indicators, a calculation sub-task for calculating the target indicators at the corresponding shard granularity can be generated according to any first sub-data group, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators.
[0102] Step 2042: Generate a corresponding directed acyclic graph (DAG) based on the dependency relationship between the calculation indicators.
[0103] If the calculation indicators stored in the second data group include the target indicator and dependent indicators involved in calculating the target indicator, since the process of calculating the target indicator involves dependent indicators, it is necessary to first determine the association relationship between the calculation indicators. Optionally, when the calculation indicators stored in the second data group include the target indicator and dependent indicators involved in calculating the target indicator, a corresponding DAG (Directed Acyclic Graph) can be generated based on the dependency relationship between the calculation indicators, where the DAG is used to indicate the association relationship between the calculation indicators.
[0104] For example, for the second data set shown in Table 2, the following can be generated: Figure 5 As shown in the DAG. Figure 5 As shown, the indicator types of the newcomer allowance, the newcomer's direct referrer bonus, and the salary are DMN indicator types, the indicator type of the newcomer recommendation award is expression indicator type, and the newcomer's direct referrer bonus is a dependent indicator of the newcomer recommendation award, and the newcomer recommendation award and the newcomer allowance are dependent indicators of the salary.
[0105] Step 2043: For any computing subtask, determine the target indicator at the corresponding shard granularity based on the DAG, the corresponding first sub-data group, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators.
[0106] In some embodiments, after obtaining the DAG, for any computing subtask, the target indicator at the corresponding sharding granularity can be determined based on the DAG, the corresponding first sub-data group, the business rules corresponding to the dependency indicator, and the business rules corresponding to the target indicator.
[0107] Optionally, for any computing subtask, the computing subtask can be split according to the DAG to obtain at least one indicator computing subtask, wherein any indicator computing subtask is used to calculate the dependent indicator or to calculate the target indicator, so that when there are multiple dependent indicators, the execution order of multiple target indicator computing subtasks is determined according to the association relationship between the dependent indicators indicated by the DAG, wherein any target indicator computing subtask is used to calculate the corresponding dependent indicator, and according to the execution order of the multiple target indicator computing subtasks, the corresponding dependent indicator at the corresponding sharding granularity is determined in turn according to the corresponding first sub-data group and the business rules corresponding to the corresponding dependent indicator, or, when there is one dependent indicator, the dependent indicator at the corresponding sharding granularity is determined according to the corresponding first sub-data group and the business rules corresponding to the dependent indicator, and then the indicator computing subtask for calculating the target indicator is executed to determine the target indicator at the corresponding sharding granularity according to the corresponding first sub-data group, the calculated dependent indicator at the corresponding sharding granularity and the business rules corresponding to the target indicator. In this way, each computing subtask can be split into at least one indicator computing subtask based on the association between the computing indicators indicated by the DAG, so that the corresponding task computing nodes can be called to execute the tasks respectively, thereby improving computing efficiency.
[0108] Optionally, each indicator calculation subtask corresponds to a task calculation node, and each task calculation node integrates a calculation engine corresponding to at least one calculation mode, so that the corresponding calculation engine is used to calculate the dependent indicator or target indicator based on the indicator type of the dependent indicator or target indicator. For example, if the calculation modes include the DMN calculation mode, the formula calculation mode, and the Java calculation mode, and the corresponding indicator types include the DMN indicator type, the expression indicator type, and the Java indicator type, then each task calculation node can integrate the DMN calculation engine, the formula calculation engine, and the Java calculation engine.
[0109] It should be noted that steps 2031-2032 and steps 2041-2043 are parallel steps and have no order relationship.
[0110] The task scheduling method provided in this embodiment splits the first data group according to the sharding granularity in the data sharding information to obtain at least one first sub-data group. Thus, when the calculation indicators stored in the second data group only include the target indicator, a calculation sub-task for calculating the target indicator at the corresponding sharding granularity is generated according to any first sub-data group and the business rules corresponding to the target indicator. For any calculation sub-task, the target indicator at the corresponding sharding granularity is determined according to the calculation fields and calculation rules indicated by the corresponding first sub-data group and the business rules corresponding to the target indicator. Alternatively, when the calculation indicators stored in the second data group include the target indicator and the dependent indicators involved in calculating the target indicator, a calculation sub-task for calculating the target indicator at the corresponding sharding granularity is generated according to any first sub-data group, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators. Based on the dependency relationship between the calculation indicators, a corresponding directed acyclic graph (DAG) is generated. For any calculation sub-task, the target indicator at the corresponding sharding granularity is determined according to the DAG, the corresponding first sub-data group, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators. In this way, it is possible to generate corresponding computing subtasks for calculating the target indicators at the corresponding sharding granularity for different situations, and adopt different computing strategies to determine the target indicators at the corresponding sharding granularity.
[0111] It should be noted that, in the present invention, the status of the computing task can also be updated. Figure 6 , which explains this process.
[0112] Figure 6 A flowchart of another task scheduling method provided by an embodiment of the present invention.
[0113] like Figure 6 As shown, the task scheduling method includes the following steps:
[0114] Step 601: Obtain task information and data shard information of the computing task.
[0115] Step 602: Split the data group in the task information according to the sharding granularity in the data sharding information to obtain at least one sub-data group.
[0116] Step 603: Generate a corresponding computing subtask according to any sub-data group and business rules.
[0117] Step 604: execute each computing subtask to obtain the target indicator at the corresponding sharding granularity.
[0118] It should be noted that the execution process of steps 601-604 may specifically refer to steps 101-104 in the above embodiment, and the principles are the same, so they will not be repeated here.
[0119] Step 605: poll the computing task at a set frequency to obtain the execution status of the computing subtask corresponding to the computing task.
[0120] The execution status includes not executed, executing, and completed.
[0121] The present invention does not limit the setting of the set frequency. Optionally, the set frequency can be set based on manual experience, for example, the set frequency can be set to 5 minutes / time, or the set frequency can be dynamically adjusted according to actual application requirements, which is not limited in this embodiment.
[0122] In some embodiments, the computing task may be polled at a set frequency to obtain the execution status of the computing subtask corresponding to the computing task, so as to determine whether the computing task has been completed.
[0123] Step 606: When the execution status of the computing subtasks corresponding to the computing task are all completed, the status of the computing task is updated to executed.
[0124] In some embodiments, if all computing subtasks corresponding to the computing task are completed, the status of the computing task can be updated to executed.
[0125] The task scheduling method provided in this embodiment polls the computing task at a set frequency to obtain the execution status of the computing subtasks corresponding to the computing task. If the execution status of all the computing subtasks corresponding to the computing task is completed, the computing task status is updated to "executed." This allows timely determination of whether the computing task has been completed.
[0126] It should be noted that, in the present invention, a scheduler can also be integrated to implement the execution of computing tasks in at least one execution mode, where the execution modes include single execution, daily execution, monthly execution, and execution based on a configured expression. For example, by integrating Quartz, single execution, daily execution, monthly execution, and CROCK expression configuration of computing tasks can be supported.
[0127] In order to clearly illustrate the above embodiment, an example is now given for illustration.
[0128] Figure 7 A schematic diagram of the principle of a task scheduling method provided by an embodiment of the present invention.
[0129] like Figure 7 As shown, the task scheduling method includes three steps: 1. data group configuration; 2. business rule configuration; 3. indicator calculation, wherein the indicator calculation includes task scheduling components, data sharding components, task parsing components and task calculation nodes.
[0130] The following uses salary index calculation as an example to illustrate the above three steps:
[0131] 1. Data Group Configuration
[0132] In the data group configuration step / function, you can configure the model wide tables involved in the entrusted salary calculation indicators and assessment calculation indicators, as well as the wide table data source information and field information. This is used for data source preparation in the second business rule configuration and the third indicator calculation data sharding component.
[0133] For example, a personal data wide table as shown in Table 1 above and a personal indicator wide table as shown in Table 2 above can be configured, thereby configuring the individual's basic information, organizational relationship information, transaction information, recommendation information and training information in the personal data wide table, covering all the information elements required by the salesperson in the salary calculation indicators, and configuring the intermediate indicators and result indicators in the indicator calculation process in the personal indicator wide table.
[0134] 2. Business Rule Configuration
[0135] After sorting out the business rules, you can configure indicator items in the business rule configuration module. Indicator items can be configured with input tables / fields, output tables / fields, and calculation rule configurations:
[0136] Input Table / Field: You can select the data wide table and data fields that the indicator calculation depends on, as well as the calculation subject field (primary key / logical primary key for indicator calculation); used for input items when configuring business rules, and data input and calculation subject when calculating indicators;
[0137] Output table / field: You can select the data table and data field for output of indicator calculation results, as well as the output main field. It is used as the output basis for indicator calculation;
[0138] Calculation rule configuration: The current indicator configuration module supports three calculation modes, namely:
[0139] DMN: Decision table configuration, which can configure decision tables, expressions, and DRDs. This calculation mode supports calculations on single-row data.
[0140] Simple formula calculation: supports sum, maximum, minimum, average, etc. This calculation mode supports calculation of multiple rows of data;
[0141] SDK: By developing a Java SDK, we provide unified data access, output standards, and development standards. This model supports complex scenarios and problems that cannot be solved by DMN and simple formula calculations.
[0142] Indicator dependency configuration: Configurable indicator dependencies, supporting multi-indicator dependency configuration;
[0143] Computing task scheduling configuration: You can configure the scheduling method and scheduling time of computing tasks.
[0144] For example, you can use Figure 3 Configure DMN indicators on the Add DMN Indicator page shown in the figure. DMN indicator configuration example (newcomer allowance) is as follows Figure 4 shown.
[0145] After the indicator information is configured, you can generate Figure 5 The DAG shown in the figure is used to indicate the relationship between the calculation indicators. Figure 5 As shown in the figure, you can annotate the dependencies and types of the calculated indicators in the DAG.
[0146] 3. Indicator calculation
[0147] After completing the configuration of the calculation indicator, the indicator calculation component can complete the latest calculation of the indicator and output it through a series of tasks.
[0148] Task scheduling component: through the integration of Quartz, it supports single task execution, daily execution, monthly execution, and CROCK expression configuration;
[0149] Data sharding component: Through data sharding configuration, it can be configured at the organizational level (province, city, county) and team level (district, department, group). The smallest shard granularity is used as a data group for a computing task, which can realize distributed task computing and improve computing efficiency. Data can also be recalculated according to data sharding rules.
[0150] Task parsing component: Based on the indicator dependencies configured in the business rule configuration step, it parses the entire computing task into a directed acyclic graph (DAG) and generates an execution plan with a DAG structure to sequentially complete the calculation of the final indicator;
[0151] Task computing node: The task computing node integrates the DMN computing engine, simple formula computing engine, and JAVASDK engine, and performs data access and data output based on unified standards.
[0152] The following combination Figure 8 , explaining the background calculation process.
[0153] Figure 8 A schematic diagram of the principles of another task scheduling method provided by an embodiment of the present invention.
[0154] like Figure 8 As shown in the figure, the task scheduling method is divided into three parts: the scheduling main program, the distributed task executor, and the task status update component.
[0155] The main scheduling program is used to perform the following steps:
[0156] 1. Dynamically monitor database tasks by scheduling listeners (quartz)
[0157] 2. Read the task information of the computing task through the task ID
[0158] 3. Obtain data sharding information of computing tasks, such as organization and team, through task ID
[0159] 4. Generate corresponding computing subtasks according to the sharding granularity in the data sharding information and push them to MQ (Message Queue)
[0160] The distributed task executor is used to perform the following steps:
[0161] 1. The listener monitors MQ and obtains computing subtasks
[0162] 2. Read the data group and business rules corresponding to the calculation subtask
[0163] 3. Analyze the calculation subtasks and generate DAG
[0164] 4. The DAG task executor calculates the indicators of the indicator nodes. DMN, simple working hours, and SDK call different task executors to execute tasks.
[0165] 5. After all node tasks are completed, update the subtask status and output the results to the database
[0166] The task status updater performs the following steps:
[0167] 1. Poll the calculation task list at a set frequency to obtain unexecuted and / or incomplete calculation tasks. For example, poll the calculation task list at a frequency of 5 minutes / time.
[0168] 2. Query the completion status of the computing subtask corresponding to the computing task by computing the task ID
[0169] 3. If all calculation subtasks are completed, the calculation task status is updated
[0170] In summary, the business side can configure data groups and decision tables / calculation formulas to enter and orchestrate business logic, making it configurable and traceable. The backend uses microservices and containerized deployment for distributed computing, improving computing efficiency. Furthermore, it can separate business computing from storage media, eliminating reliance on databases for data calculations and enabling rapid modification and rollout of business logic.
[0171] In order to implement the above embodiment, the present invention also provides a task scheduling device.
[0172] Figure 9 A structural diagram of a task scheduling device provided by an embodiment of the present invention.
[0173] like Figure 9 As shown, the task scheduling device includes: an acquisition module 11, a splitting module 12, a generation module 13 and a first execution module 14.
[0174] An acquisition module 11 is configured to acquire task information and data sharding information of a computing task, wherein the computing task is used to calculate a target indicator, and the task information includes a configured data group and business rules;
[0175] a splitting module 12, configured to split the data group in the task information according to the sharding granularity in the data sharding information to obtain at least one sub-data group, wherein the at least one sub-data group corresponds to the sharding granularity;
[0176] A generation module 13 is configured to generate a corresponding computing subtask based on any of the sub-data groups and the business rules, wherein any of the computing subtasks is configured to calculate a target indicator at a corresponding sharding granularity;
[0177] The execution module 14 is used to execute each of the computing subtasks to obtain the target indicator at the corresponding sharding granularity.
[0178] Furthermore, in a possible implementation of the embodiment of the present invention, the data group includes a first data group, the first data group is used to store a target field in a target data table for calculating the target indicator, and the sub-data group includes a first sub-data group;
[0179] The splitting module 12 is specifically used for:
[0180] The first data group is split according to the sharding granularity in the data sharding information to obtain at least one first sub-data group, wherein the data in any first sub-data group is the data at the corresponding sharding granularity in the first data group.
[0181] Furthermore, in a possible implementation of the embodiment of the present invention, the data group further includes a second data group, and the second data group is used to store calculation indicators, wherein the calculation indicators include only the target indicator, or include the target indicator and dependent indicators involved in calculating the target indicator;
[0182] The business rules correspond to the calculation indicators stored in the second data group, and any of the business rules is used to indicate the calculation fields and calculation rules of the corresponding calculation indicators, wherein the calculation fields are determined based on the first data group and the second data group and are used to calculate the corresponding calculation indicators, and the calculation rules are used to calculate the corresponding calculation indicators based on the calculation fields using at least one calculation mode;
[0183] The generation module 13 is specifically used for:
[0184] In a case where the calculation indicators stored in the second data group only include the target indicator, generating a calculation subtask for calculating the target indicator at the corresponding shard granularity according to the business rules corresponding to any one of the first sub-data groups and the target indicator;
[0185] In the case where the calculation indicators stored in the second data group include the target indicator and the dependent indicators involved in calculating the target indicator, a calculation subtask for calculating the target indicator at the corresponding shard granularity is generated based on any of the first sub-data groups, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators.
[0186] Furthermore, in a possible implementation manner of the embodiment of the present invention, the calculation field includes an input field and an output field, the input field is determined based on the first data group, and the output field is determined based on the second data group.
[0187] Furthermore, in a possible implementation of the embodiment of the present invention, the first execution module 14 is specifically configured to:
[0188] When the calculation indicators stored in the second data group only include the target indicator, for any of the calculation subtasks, the target indicator at the corresponding sharding granularity is determined based on the calculation fields and calculation rules indicated by the corresponding first sub-data group and the business rules corresponding to the target indicator;
[0189] When the calculation indicators stored in the second data group include the target indicator and dependent indicators involved in calculating the target indicator, generating a corresponding directed acyclic graph (DAG) according to the dependency relationship between the calculation indicators, wherein the DAG is used to indicate the association relationship between the calculation indicators;
[0190] For any of the computing subtasks, the target indicator at the corresponding sharding granularity is determined according to the DAG, the corresponding first sub-data group, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators.
[0191] Furthermore, in a possible implementation of the embodiment of the present invention, the first execution module 14 determines the target indicator at the corresponding shard granularity based on the DAG, the corresponding first sub-data group, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators, including:
[0192] Splitting the calculation subtask according to the DAG to obtain at least one indicator calculation subtask, wherein any one of the indicator calculation subtasks is used to calculate the dependent indicator or the target indicator;
[0193] In the case where there are multiple dependent indicators, determining the execution order of multiple target indicator calculation subtasks according to the association relationship between the dependent indicators indicated by the DAG, wherein any target indicator calculation subtask is used to calculate the corresponding dependent indicator;
[0194] According to the execution order of multiple target indicator calculation subtasks, the corresponding dependent indicators at the corresponding sharding granularity are determined according to the corresponding first sub-data group and the business rules corresponding to the corresponding dependent indicators;
[0195] In the case where there is only one dependency indicator, determining the dependency indicator at the corresponding sharding granularity according to the corresponding first sub-data group and the business rule corresponding to the dependency indicator;
[0196] Execute the indicator calculation subtask for calculating the target indicator to determine the target indicator at the corresponding shard granularity based on the corresponding first sub-data group, the calculated dependent indicator at the corresponding shard granularity and the business rules corresponding to the target indicator.
[0197] Furthermore, in a possible implementation method of an embodiment of the present invention, any of the indicator calculation subtasks corresponds to a task calculation node, and any of the task calculation nodes is integrated with a calculation engine corresponding to at least one calculation mode, so as to calculate the dependent indicator or the target indicator using the corresponding calculation engine according to the indicator type of the dependent indicator or the target indicator.
[0198] Furthermore, in a possible implementation of the embodiment of the present invention, the apparatus further includes:
[0199] A polling module is used to poll the computing task at a set frequency to obtain the execution status of the computing subtask corresponding to the computing task, wherein the execution status includes not executed, executing, and completed;
[0200] The updating module is used to update the status of the computing task to "executed" when the execution status of the computing subtasks corresponding to the computing task are all completed.
[0201] Furthermore, in a possible implementation of the embodiment of the present invention, the apparatus further includes:
[0202] The second execution module is used to use a scheduler to execute the computing task in at least one execution mode, wherein the execution mode includes single execution, daily execution, monthly execution and configuration-based expression execution.
[0203] It should be noted that the above explanation of the embodiment of the task scheduling method is also applicable to the task scheduling device of this embodiment, and will not be repeated here.
[0204] The task scheduling device provided in this embodiment obtains the task information and data sharding information of the computing task, wherein the computing task is used to calculate the target indicator, and the task information includes the configured data group and business rules, so as to split the data group in the task information according to the sharding granularity in the data sharding information, and obtain the data group under the corresponding sharding granularity, thereby generating the corresponding computing subtask according to the data group and business rules under any sharding granularity, and then executing each computing subtask to obtain the target indicator under the corresponding sharding granularity. Thus, the separation of business computing and storage media can be achieved through the configuration of data groups and business rules, without the need to perform data computing on the database side, and the rapid modification of business logic can be achieved. In addition, the data group can be split according to the sharding granularity in the data sharding information through the configuration of data sharding, and distributed task computing can be performed to improve computing efficiency.
[0205] In order to implement the above embodiments, the present invention also proposes an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the task scheduling method proposed in any of the above embodiments of the present invention.
[0206] In order to implement the above embodiments, the present invention further proposes a computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the task scheduling method proposed in any of the above embodiments of the present invention.
[0207] In order to implement the above embodiments, the present invention further proposes a computer program product, including a computer program, which implements the task scheduling method proposed in any of the above embodiments of the present invention when executed by a processor.
[0208] Figure 10 A schematic structural diagram of an electronic device provided in an embodiment of the present invention.
[0209] It should be noted that Figure 10The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0210] like Figure 10 As shown, the electronic device includes:
[0211] A memory 21 , a processor 22 , and a computer program stored in the memory 21 and executable on the processor 22 .
[0212] When the processor 22 executes the program, the task scheduling method provided in any of the above embodiments is implemented.
[0213] Furthermore, the electronic device further includes:
[0214] The communication interface 23 is used for communication between the memory 21 and the processor 22 .
[0215] The memory 21 is used to store computer programs that can be run on the processor 22.
[0216] The memory 21 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0217] The processor 22 is configured to implement the task scheduling method described in any of the above embodiments when executing the program.
[0218] If the memory 21, the processor 22, and the communication interface 23 are implemented independently, the communication interface 23, the memory 21, and the processor 22 can be connected to each other via a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0219] Optionally, in a specific implementation, if the memory 21, the processor 22 and the communication interface 23 are integrated on a chip, the memory 21, the processor 22 and the communication interface 23 can communicate with each other through an internal interface.
[0220] The processor 22 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0221] In the description of this specification, the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0222] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.
[0223] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention pertain.
[0224] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.
[0225] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0226] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0227] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing module, or each unit may exist physically separately, or two or more units may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a computer-readable storage medium.
[0228] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and are not to be construed as limiting the present invention. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.
Claims
1. A task scheduling method, characterized in that: The method comprises: Dynamically monitor the database's computing tasks by scheduling listeners; Obtaining task information and data sharding information for the computing task based on the computing task ID, wherein the computing task is used to calculate a target indicator, and the task information includes a configured data group and business rules, wherein the data group is at least one data group configured for a model wide table involved in calculating the target indicator; According to the sharding granularity in the data sharding information, the data group in the task information is split to obtain at least one sub-data group, wherein the at least one sub-data group corresponds to the sharding granularity, and a corresponding computing subtask is generated and pushed to the message queue, wherein any of the computing subtasks is used to calculate the target indicator at the corresponding sharding granularity; The distributed task executor monitors the message queue to obtain each computing subtask, executes each computing subtask according to the sub-data group corresponding to each computing subtask and the business rules, so as to obtain the target indicator at the corresponding sharding granularity, and after all computing subtasks are executed, the distributed task executor updates the computing subtask status and outputs the results to the database; The task status update program queries the completion status of the computing subtasks corresponding to the computing task based on the computing task id. If all computing subtasks are completed, the computing task status is updated.
2. The method according to claim 1, characterized in that The data group includes a first data group, the first data group is used to store a target field in a target data table for calculating the target indicator, and the sub-data group includes a first sub-data group; The step of splitting the data group in the task information according to the sharding granularity in the data sharding information to obtain at least one sub-data group includes: The first data group is split according to the sharding granularity in the data sharding information to obtain at least one first sub-data group, wherein the data in any first sub-data group is the data at the corresponding sharding granularity in the first data group.
3. The method according to claim 2, characterized in that The data group further includes a second data group, the second data group being used to store calculation indicators, wherein the calculation indicators include only the target indicator, or include the target indicator and dependent indicators involved in calculating the target indicator; The business rules correspond to the calculation indicators stored in the second data group, and any of the business rules is used to indicate the calculation fields and calculation rules of the corresponding calculation indicators, wherein the calculation fields are determined based on the first data group and the second data group and are used to calculate the corresponding calculation indicators, and the calculation rules are used to calculate the corresponding calculation indicators based on the calculation fields using at least one calculation mode; Generating a corresponding computing subtask according to any of the sub-data groups and the business rules includes: In a case where the calculation indicators stored in the second data group only include the target indicator, generating a calculation subtask for calculating the target indicator at the corresponding shard granularity according to the business rules corresponding to any one of the first sub-data groups and the target indicator; In the case where the calculation indicators stored in the second data group include the target indicator and the dependent indicators involved in calculating the target indicator, a calculation subtask for calculating the target indicator at the corresponding shard granularity is generated based on any of the first sub-data groups, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators.
4. The method according to claim 3, characterized in that The calculation field includes an input field and an output field, the input field is determined based on the first data group, and the output field is determined based on the second data group.
5. The method according to claim 3, characterized in that The execution of each computing subtask to obtain the target indicator at the corresponding sharding granularity includes: When the calculation indicators stored in the second data group only include the target indicator, for any of the calculation subtasks, the target indicator at the corresponding sharding granularity is determined based on the calculation fields and calculation rules indicated by the corresponding first sub-data group and the business rules corresponding to the target indicator; When the calculation indicators stored in the second data group include the target indicator and dependent indicators involved in calculating the target indicator, generating a corresponding directed acyclic graph (DAG) according to the dependency relationship between the calculation indicators, wherein the DAG is used to indicate the association relationship between the calculation indicators; For any of the computing subtasks, the target indicator at the corresponding sharding granularity is determined according to the DAG, the corresponding first sub-data group, the business rules corresponding to the dependent indicators, and the business rules corresponding to the target indicators.
6. The method according to claim 5, characterized in that The calculating the target indicator at the corresponding sharding granularity according to the DAG, the corresponding first sub-data group, the business rules corresponding to the dependent indicator, and the business rules corresponding to the target indicator includes: Splitting the calculation subtask according to the DAG to obtain at least one indicator calculation subtask, wherein any one of the indicator calculation subtasks is used to calculate the dependent indicator or the target indicator; In the case where there are multiple dependent indicators, determining the execution order of multiple target indicator calculation subtasks according to the association relationship between the dependent indicators indicated by the DAG, wherein any target indicator calculation subtask is used to calculate the corresponding dependent indicator; According to the execution order of multiple target indicator calculation subtasks, the corresponding dependent indicators at the corresponding sharding granularity are determined according to the corresponding first sub-data group and the business rules corresponding to the corresponding dependent indicators; In the case where there is only one dependency indicator, determining the dependency indicator at the corresponding sharding granularity according to the corresponding first sub-data group and the business rule corresponding to the dependency indicator; Execute the indicator calculation subtask for calculating the target indicator to determine the target indicator at the corresponding shard granularity based on the corresponding first sub-data group, the calculated dependent indicator at the corresponding shard granularity and the business rules corresponding to the target indicator.
7. The method according to claim 6, characterized in that Any of the indicator calculation subtasks corresponds to a task calculation node, and any of the task calculation nodes is integrated with a calculation engine corresponding to at least one calculation mode, so as to calculate the dependent indicator or the target indicator using the corresponding calculation engine according to the indicator type of the dependent indicator or the target indicator.
8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: Polling the computing task at a set frequency to obtain the execution status of the computing subtask corresponding to the computing task, wherein the execution status includes not executed, executing, and completed; When the execution status of the computing subtasks corresponding to the computing task are all completed, the status of the computing task is updated to executed.
9. The method according to any one of claims 1 to 7, characterized in that The method further comprises: A scheduler is used to execute the computing task in at least one execution mode, wherein the execution mode includes single execution, daily execution, monthly execution, and configuration-based expression execution.
10. A task scheduling device, characterized in that: The device comprises: The monitoring module is used to dynamically monitor the computing tasks of the database by scheduling the monitor; an acquisition module, configured to acquire task information and data sharding information of a computing task based on the computing task ID, wherein the computing task is used to calculate a target indicator, the task information includes a configured data group and business rules, and the data group is at least one data group configured for a model wide table involved in calculating the target indicator; a splitting module, configured to split the data group in the task information according to the sharding granularity in the data sharding information to obtain at least one sub-data group, wherein the at least one sub-data group corresponds to the sharding granularity; A generation module is used to generate corresponding computing subtasks according to the sharding granularity in the data sharding information and push them to the message queue, wherein any of the computing subtasks is used to calculate the target indicator at the corresponding sharding granularity; A first execution module is configured to monitor the message queue to obtain each computing subtask, execute each computing subtask according to the sub-data group corresponding to each computing subtask and the business rules, so as to obtain the target indicator at the corresponding sharding granularity, and after all computing subtasks are executed, the distributed task executor updates the computing subtask status and outputs the result to the database; The task status update program in the device queries the completion status of the computing subtasks corresponding to the computing task according to the computing task ID, and updates the computing task status if all the computing subtasks are completed.
Citation Information
Patent Citations
Cross-database paging querying method for multi-database table
CN104572676A
Data fragmentation and database division method and device, computer equipment and storage medium
CN116719884A