A parallel logic optimization method, device and medium based on low-code configuration

The parallel logic optimization method of low-code configuration simplifies the code optimization process, reduces user professional requirements, shortens the problem repair and development cycle, and improves the running speed.

CN118113266BActive Publication Date: 2025-09-09INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410108587.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-25
Publication Date
2025-09-09
Estimated Expiration
2044-01-25

AI Technical Summary

Technical Problem

When running the same code on multiple computing nodes or multiple servers, using fixed parallel logic to run the code requires a high level of professionalism from the user and results in a long problem-solving cycle.

Method used

Through low-code configuration, the current task execution node is used to obtain function configuration information, assign operation object list parameters, generate node configuration information for each task execution node, execute functions through these nodes, store the results in the execution result collector, and poll the results at time intervals to determine the function execution results.

Benefits of technology

It simplifies the code optimization process, reduces user expertise requirements, shortens problem fixing and development cycles, and improves running speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118113266B_ABST
    Figure CN118113266B_ABST
Patent Text Reader

Abstract

The embodiments of this specification disclose a parallel logic optimization method, device and medium based on low-code configuration, which relate to the field of low-code development technology. The method includes: obtaining function configuration information corresponding to the current execution function through the current task execution node, allocating operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the current execution function, generating node configuration information of each other task execution node, sending the node configuration information of each other task execution node to other task execution nodes to determine the task execution result of each other task execution node, and storing it in a pre-built execution result collector; polling the execution result collector through the current task execution node according to a preset time interval to obtain the task execution result of each other task execution node, and determining the function execution result of the current execution function based on each task execution result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of low-code development technology, and in particular to a parallel logic optimization method, device and medium based on low-code configuration. Background Art

[0002] In a section of code logic that needs to traverse a long list for execution, the same logic needs to be repeated a lot, such as Excel import and export in ERP systems, batch approval of documents, etc. This type of logic entry often needs to accept a list description operation object and some optional parameters to describe the operations to be completed based on the list description operation object. Taking batch approval of documents as an example, the list description operation object can be considered as a document list, and the optional parameters can be considered as approval. In order to improve the execution efficiency of this type of code and make full use of server computing resources, developers are generally required to perform special multi-process / multi-thread / coroutine coding for each scenario. Taking inSuite as an example, multi-threading and coroutine technology are used when submitting a list of documents for approval in batches.

[0003] Developers coding for multiple processes, threads, and coroutines is cumbersome and complex, with high barriers to entry and long development cycles. This significantly relies on specialized skills, and the time it takes for developers to resolve performance issues, from the moment they are discovered during software implementation, can often take days. Because concurrent / parallel logic is fixed in the code and inaccessible to implementers, this leads to long problem-solving cycles. When running the same code on multiple compute nodes or servers, using fixed parallel logic requires a high level of expertise and results in long problem-solving cycles. Summary of the Invention

[0004] One or more embodiments of this specification provide a parallel logic optimization method, device, and medium based on low-code configuration, which are used to solve the following technical problems: when running the same code on multiple computing nodes or multiple servers, the method of using fixed parallel logic to run the code requires high professionalism from the user and has a long problem-solving cycle.

[0005] One or more embodiments of this specification adopt the following technical solutions:

[0006] One or more embodiments of the present specification provide a parallel logic optimization method based on low-code configuration, the method comprising: obtaining function configuration information corresponding to a currently executed function through a current task execution node, wherein the function configuration information comprises node protocol types, operation object list parameters and operation object list parameter allocation strategies of multiple other task execution nodes, the current task execution node being the first of multiple task execution nodes to receive an execution task corresponding to the currently executed function; allocating the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, and generating node configuration information for each of the other task execution nodes, wherein the node configuration information comprises Node execution requirement information, node execution identification information, node function allocation execution identification and node execution status information; through the current task execution node, the node configuration information of each of the other task execution nodes is sent to the other task execution nodes, so that the other task execution nodes can execute functions according to the node configuration information, determine the task execution results of each of the other task execution nodes, and store them in a pre-built execution result collector; according to a preset time interval, the execution result collector is polled by the current task execution node to obtain the task execution results of each of the other task execution nodes, and based on each of the task execution results, determine the function execution result of the current execution function.

[0007] Furthermore, before obtaining the function configuration information corresponding to the currently executed function through the current task execution node, the method also includes: receiving the currently executed function through the current task execution node to determine whether there is a function allocation execution identifier of the currently executed function based on the current execution function; if not, obtaining the function configuration information corresponding to the currently executed function through the current task execution node.

[0008] Furthermore, the function configuration information corresponding to the currently executed function is obtained through the current task execution node, specifically including: obtaining the current function identifier corresponding to the currently executed function; based on the current function identifier, querying in a pre-built persistent database to determine whether there is function configuration information corresponding to the current function identifier in the persistent database; if so, obtaining the function configuration information corresponding to the currently executed function in the persistent database.

[0009] Furthermore, the operation object list parameters are allocated according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, and the node configuration information of each of the other task execution nodes is generated, specifically including: according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, the operation object list parameters are divided to obtain multiple segmentation parameters after segmentation; according to the preset allocation rules, the multiple segmentation parameters are allocated to determine the allocation result, wherein the allocation result includes the node task execution relationship between each of the segmentation parameters and the other task execution nodes; according to the multiple segmentation parameters and the allocation result, the node configuration information of each of the other task execution nodes is generated.

[0010] Furthermore, according to the multiple split parameters and the allocation results, node configuration information of each of the other task execution nodes is generated, specifically including: generating node execution requirement information corresponding to each other task execution node based on each of the split parameters and the function identifier corresponding to the current execution function obtained in advance; generating node execution identification information corresponding to each of the other task execution nodes according to the node task execution relationship between each of the split parameters in the allocation result and the other task execution nodes; generating a node function allocation execution identifier corresponding to the current execution function according to the multiple split parameters; setting progress saving logic for each of the other task execution nodes to determine the node execution status information of each of the other task execution nodes through the execution progress of the other task execution nodes; generating node configuration information for each of the other task execution nodes based on the node execution requirement information, the node execution identification information, the node function allocation execution identifier and the node execution status information.

[0011] Furthermore, through the other task execution nodes, the function is executed according to the node configuration information to determine the task execution result of each of the other task execution nodes, specifically including: obtaining the node execution requirement information, node execution identification information, node function allocation execution identification and node execution status information in the node configuration information; judging whether it is assigned for execution through the node function allocation execution identification, if not, obtaining the function object of the currently executing function according to the function identifier in the node execution requirement information; through the other task execution nodes, the function is executed based on the function object and the split parameters in the node configuration information to generate a task execution result, wherein the task execution result includes the function running result and the task execution progress.

[0012] Furthermore, the storage is in a pre-built execution result collector, specifically including: the result collector is a key-value pair structure, including a data key and a data value; the other node information corresponding to each of the other task execution nodes, the function information of the currently executed function and the split parameter information corresponding to the other task execution nodes are stored in the data key; the task execution result is stored in the data value, wherein the task execution progress in the task execution result includes any one of the current execution proportion and the current execution status.

[0013] Furthermore, based on each of the task execution results, the function execution result of the currently executing function is determined, specifically including: obtaining multiple task execution results in the execution result collector, wherein the task execution results include function execution results and task execution progress; when the task execution progress in each of the task execution results is in a completed state, obtaining the function execution results corresponding to multiple other task execution nodes; splicing the function execution results corresponding to each of the split parameters according to the parameter order of each split parameter in the operation object list parameter to determine the function execution result of the currently executing function.

[0014] One or more embodiments of this specification provide a parallel logic optimization device based on a low-code configuration, including:

[0015] at least one processor; and,

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the above method.

[0018] One or more embodiments of this specification provide a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to:

[0019] Acquiring function configuration information corresponding to a currently executed function through a current task execution node, wherein the function configuration information includes node protocol types, operation object list parameters, and operation object list parameter allocation strategies of multiple other task execution nodes, and the current task execution node is the first node among the multiple task execution nodes to receive an execution task corresponding to the currently executed function; allocating the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, and generating node configuration information for each of the other task execution nodes, wherein the node configuration information includes node execution requirement information, node execution identification information, node function allocation execution identification, and node execution status information; sending the node configuration information of each of the other task execution nodes to the other task execution nodes through the current task execution node, so that the other task execution nodes execute the function according to the node configuration information, determine the task execution result of each of the other task execution nodes, and store the result in a pre-built execution result collector; polling the execution result collector through the current task execution node according to a preset time interval to obtain the task execution result of each of the other task execution nodes, and determining the function execution result of the currently executed function based on each of the task execution results.

[0020] At least one of the above-mentioned technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects: through the above-mentioned technical solution, the function configuration information corresponding to the currently executed function is obtained through the current task execution node, and the code running mode is optimized through the function configuration information. The user can optimize the code execution mode through simple and easy-to-operate configuration items; the function configuration information is used to allocate the operation object list parameters, which are executed separately by multiple other task execution nodes. After the execution of multiple other task execution nodes is completed, the current task execution node obtains it and returns it to the data caller. From the perspective of code visualization and configuration, some easy-to-operate configuration items can be used to optimize the code running mode, effectively improve the running speed, reduce professional restrictions on users, and enable software implementers to optimize software logic to achieve the purpose of shortening the implementation cycle and quickly solving performance problems. It also reduces the development complexity of developers and shortens the development cycle and problem repair cycle. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some of the embodiments described in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without inventive work. In the drawings:

[0022] Figure 1 A flowchart of a parallel logic optimization method based on low-code configuration provided in an embodiment of this specification;

[0023] Figure 2 A schematic diagram of a parallel logic architecture of a parallel logic optimization method based on low-code configuration provided in an embodiment of this specification;

[0024] Figure 3 A flowchart of another parallel logic optimization method based on low-code configuration provided in an embodiment of this specification;

[0025] Figure 4 A schematic diagram of the structure of a parallel logic optimization device based on low-code configuration provided in an embodiment of this specification. DETAILED DESCRIPTION

[0026] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this specification without creative work should fall within the scope of protection of this specification.

[0027] In a section of code logic that needs to traverse a long list for execution, the same logic needs to be repeated a lot, such as Excel import and export in ERP systems, batch approval of documents, etc. This type of logic entry often needs to accept a list description operation object and some optional parameters to describe the operations to be completed based on the list description operation object. Taking batch approval of documents as an example, the list description operation object can be considered as a document list, and the optional parameters can be considered as approval. In order to improve the execution efficiency of this type of code and make full use of server computing resources, developers are generally required to perform special multi-process / multi-thread / coroutine coding for each scenario. Taking inSuite as an example, multi-threading and coroutine technology are used when submitting a list of documents for approval in batches.

[0028] Developers coding for multiple processes, threads, and coroutines is cumbersome and complex, with high barriers to entry and long development cycles. This significantly relies on specialized skills, and the time it takes for developers to resolve performance issues, from the moment they are discovered during software implementation, can often take days. Because concurrent / parallel logic is fixed in the code and inaccessible to implementers, this leads to long problem-solving cycles. When running the same code on multiple compute nodes or servers, using fixed parallel logic requires a high level of expertise and results in long problem-solving cycles.

[0029] The embodiments of this specification provide a parallel logic optimization method based on low-code configuration. It should be noted that the execution subject in the embodiments of this specification can be a server or any device with data processing capabilities. Figure 1 A flow chart of a parallel logic optimization method based on low-code configuration provided in an embodiment of this specification is shown as follows: Figure 1 As shown, it mainly includes the following steps:

[0030] Step S101: obtaining function configuration information corresponding to the currently executed function through the current task execution node.

[0031] Before obtaining the function configuration information corresponding to the currently executing function through the current task execution node, the method also includes: receiving the currently executing function through the current task execution node to determine whether there is a function allocation execution identifier for the currently executing function based on the current execution function; if not, obtaining the function configuration information corresponding to the currently executing function through the current task execution node.

[0032] In one embodiment of this specification, Figure 2 A schematic diagram of a parallel logic architecture of a parallel logic optimization method based on low-code configuration provided in an embodiment of this specification is shown as follows: Figure 2 As shown, the first node among multiple task execution nodes that first receives the execution task corresponding to the current execution function is called the current task execution node. Before the current task execution node executes the task, it is necessary to query the function configuration information, and the function information configuration query can be calculated in parallel. According to the current execution function received by the current task execution, it is determined in the result collector or other storage location whether there is a context that identifies the function allocation, that is, the function allocation execution identifier, which is used to identify whether this function has been allocated and run. Here, it can be determined in the result collector or other storage location according to the pre-set configuration storage location. If there is a function allocation execution identifier, it means that the allocation operation has been performed. If there is no function allocation execution, it means that the allocation operation has not been performed, and the function configuration information corresponding to the current execution function is obtained through the current task execution node.

[0033] Obtaining function configuration information corresponding to the currently executed function through the current task execution node, specifically including: obtaining the current function identifier corresponding to the currently executed function; based on the current function identifier, querying in a pre-built persistent database to determine whether function configuration information corresponding to the current function identifier exists in the persistent database; if so, obtaining the function configuration information corresponding to the currently executed function in the persistent database.

[0034] In one embodiment of the present specification, the current function identifier corresponding to the currently executed function is obtained, and the parallel computing function configuration information is queried based on the function identifier. The query is performed in a pre-built persistent database to determine whether the function configuration information corresponding to the current function identifier exists in the persistent database. Here, the judgment can be made in the persistent database or in a certain file. If so, the function configuration information corresponding to the currently executed function is obtained in the persistent database. The function configuration information here is the parallel computing function configuration information, including the node protocol type, operation object list parameters and operation object list parameter allocation strategy of multiple other task execution nodes. It should be noted that the function identifier is the complete call chain of the function, that is, the class information + function parameter information to which the function belongs, such as ClassA.ClassB.methodC + function parameter information. The function object can be obtained in reverse (reflection) through the function identifier. The node of the current query configuration, that is, the current task execution node, is regarded as the main node or Master, and the nodes of other task execution nodes recorded in the configuration, that is, other task execution nodes, are regarded as workers.

[0035] In one embodiment of the present specification, each node is both a Master and a Worker. The first node to receive a task to execute a function is responsible for querying the function configuration information. If the function configuration information is found, it will also perform task distribution and task monitoring. If the function configuration information is not found, it will only execute the function task. After the function task is executed, the Master and other workers are in the same role again, waiting for new function tasks. The role allocation of the Master and the Worker is similar to the Master and the Worker in the Spark standalone mode. The main difference here is that the roles of the Master and the Worker can be converted to each other, which has the advantage of being able to be used in conjunction with server load balancing.

[0036] Step S102 : Allocate the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, and generate node configuration information of each other task execution node.

[0037] The node configuration information includes node execution requirement information, node execution identification information, node function allocation execution identification and node execution status information.

[0038] According to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, the operation object list parameters are allocated to generate the node configuration information of each other task execution node, specifically including: according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, the operation object list parameters are divided to obtain multiple segmentation parameters after segmentation; according to the preset allocation rules, the multiple segmentation parameters are allocated to determine the allocation result, wherein the allocation result includes the node task execution relationship between each segmentation parameter and the other task execution nodes; according to the multiple segmentation parameters and the allocation result, the node configuration information of each other task execution node is generated.

[0039] According to the multiple split parameters and the allocation result, the node configuration information of each other task execution node is generated, specifically including: based on each of the split parameters and the pre-acquired function identifier corresponding to the current execution function, the node execution requirement information corresponding to each other task execution node is generated; according to the node task execution relationship between each of the split parameters and the other task execution nodes in the allocation result, the node execution identification information corresponding to each other task execution node is generated; according to the multiple split parameters, the node function allocation execution identification corresponding to the current execution function is generated; the progress saving logic is set for each of the other task execution nodes to determine the node execution status information of each of the other task execution nodes through the execution progress of the other task execution node; based on the node execution requirement information, the node execution identification information, the node function allocation execution identification and the node execution status information, the node configuration information of each other task execution node is generated.

[0040] In one embodiment of the present specification, after querying and obtaining the function configuration information, the worker protocol type, the operation object list parameter name N and the strategy for allocating N (operation object list parameter allocation strategy) are obtained from the function configuration information. According to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, the Master splits the input parameters to obtain multiple segmentation parameters after segmentation. The parameter allocation strategy can be customized, for example, it can be based on the number of cores and load conditions of the worker. In addition, if the system-level information requires the Master node to have root authority, it can also be an average distribution strategy. The allocation method can be set according to demand, which is only shown here as an example. According to the preset allocation rules, multiple segmentation parameters are allocated to multiple other task execution nodes, that is, allocated to workers to determine the allocation results. The allocation results include the node task execution relationship between each of the segmentation parameters and other task execution nodes. According to the multiple segmentation parameters and the allocation results, the node configuration information of each of the other task execution nodes is generated. The Master will divide the input parameters into the operation object list according to the configured allocation strategy, record the action of the worker executing the function as task, and regard each parameter and function identifier after division as the information required for a task as taskInfo, that is, the node execution requirement information corresponding to each other task execution node. Create a globally unique identifier for the task, recorded as taskId, that is, the node execution identification information corresponding to other task execution nodes. The node execution identification information here is used to identify the execution relationship between this worker and each parameter. In addition, a context needs to be passed in, recorded as context, to identify whether the function is assigned for execution (that is, the node function assignment execution identifier) ​​and whether the function has progress saving logic (node ​​execution status information).

[0041] Step S103, sends the node configuration information of each other task execution node to other task execution nodes through the current task execution node, so that the function is executed according to the node configuration information through other task execution nodes, the task execution result of each other task execution node is determined, and stored in a pre-built execution result collector.

[0042] Through the other task execution node, the function is executed according to the node configuration information to determine the task execution result of each of the other task execution nodes, specifically including: obtaining the node execution requirement information, node execution identification information, node function allocation execution identification and node execution status information in the node configuration information; through the node function allocation execution identification, it is determined whether it is assigned for execution, and if not, according to the function identifier in the node execution requirement information, the function object of the currently executing function is obtained; through the other task execution node, the function is executed based on the function object and the split parameters in the node configuration information to generate a task execution result, wherein the task execution result includes the function running result and the task execution progress.

[0043] In one embodiment of the present specification, taskInfo, taskId and context are sent to the worker, where the worker address is obtained from the distributed computing resource configuration table, which is used to store the worker addresses of multiple workers and is information pre-set by the user. The node function in the context is assigned an execution identifier to determine whether it is assigned for execution. If not, the function object of the currently executing function is obtained based on the function identifier in the node execution requirement information. The function object can be obtained by querying the local cache. If the local cache is not used, the reflection feature provided by the programming language must be used to obtain the function object. Through the other task execution node, the function is executed based on the function object and the segmentation parameters in the node configuration information to generate a task execution result. The task execution result includes the function running result and the task execution progress.

[0044] Storing in a pre-built execution result collector, specifically including: the result collector is a key-value pair structure, including a data key and a data value; storing the other node information corresponding to each other task execution node, the function information of the currently executed function and the split parameter information corresponding to the other task execution node in the data key; storing the task execution result in the data value, wherein the task execution progress in the task execution result includes any one of the current execution proportion and the current execution status.

[0045] In one embodiment of the present specification, the result collector is implemented as a key-value pair structure, including a data key and a data value. The data key part is used to store other node information corresponding to other task execution nodes, function information of the currently executed function, and split parameter information corresponding to the other task execution nodes. The data value part is used to store the task execution results. The task execution results here include function execution results and task execution progress. The execution progress can be in the form of current execution proportion or current execution status. The current execution proportion refers to the running percentage, and the current execution status includes two types: running completed and running incomplete.

[0046] Step S104: polling the execution result collector through the current task execution node according to a preset time interval to obtain the task execution result of each other task execution node, and determining the function execution result of the currently executed function based on each task execution result.

[0047] In one embodiment of the present specification, the Master polls the result collector at a preset time interval to obtain the task execution result of each worker, where the task execution result includes the function running result and the worker's task execution progress.

[0048] Based on each task execution result, the function execution result of the currently executing function is determined, specifically including: obtaining multiple task execution results in the execution result collector, wherein the task execution result includes the function execution result and the task execution progress; when the task execution progress in each task execution result is in the completion state, obtaining the function execution results corresponding to multiple other task execution nodes; according to the parameter order of each split parameter in the operation object list parameter, the function execution results corresponding to each split parameter are spliced ​​to determine the function execution result of the currently executing function.

[0049] In one embodiment of this specification, the master polls the result collector at a preset time interval to obtain the task execution results of each worker. The task execution results here include the function execution results and the worker's task execution progress. It should be noted that the time interval here can be set according to the computing power of the worker.

[0050] In one embodiment of the present disclosure, when each worker's task execution progress is complete, the function execution results corresponding to the multiple workers are obtained. The function execution results corresponding to each split parameter are concatenated according to the parameter order of the split parameters in the operation object list parameter to determine the function execution result of the currently executing function. The current task execution node, i.e., the master, returns the execution result to the caller.

[0051] Through the above technical solution, the function configuration information corresponding to the currently executed function is obtained through the current task execution node, and the code running mode is optimized through the function configuration information. Users can optimize the code execution mode through simple and easy-to-operate configuration items; use the function configuration information to allocate the operation object list parameters, which are executed separately by multiple other task execution nodes. After the execution of multiple other task execution nodes is completed, the current task execution node obtains it and returns it to the data caller. From the perspective of code visualization and configuration, some easy-to-operate configuration items can be used to optimize the code running mode, effectively improving the running speed and reducing professional restrictions on users, so that software implementers can optimize the software logic, shorten the implementation cycle, and quickly solve performance problems. It also reduces the development complexity of developers and shortens the development cycle and problem repair cycle.

[0052] Figure 3 A flowchart of another parallel logic optimization method based on low-code configuration provided in the embodiment of this specification is as follows: Figure 3 As shown, first, step S00 is executed to determine whether there is a context that identifies the function allocation. If yes, step S06 is executed; otherwise, step S01 is executed. Step S01: Identify the current function identifier and function parameters, and query the parallelizable function configuration information based on the function identifier. The function identifier here is the complete call chain of the function, that is, the class information and function parameter information to which the function belongs, such as ClassA.ClassB.methodC + function parameter information. The function object can be obtained reversely (reflection) through the function identifier.

[0053] Optionally, the function identifier can be base64-encoded or hashed. In this case, the worker can decode the function identifier to obtain the original function information. In this case, the function identifier can be base64-encoded or hashed, and the function information can be stored in a third-party cache server or a local cache. Each worker has a cache, and because they run the same code, the contents of each cache are identical.

[0054] The following is a function caching embodiment provided by the embodiments of this specification. When a function is loaded into memory, a global identifier is set for the function object. ClassA.ClassB.methodC + function parameter information can be base64 encoded or hashed, and {identifier: function object} is stored in the cache kv data structure. The kv data structure here can be a local dictionary or Redis. If it is in Redis, then v corresponds to the serialized information of the function object rather than the function object, which is easy to query. When the worker obtains the function object based on the identifier, it only needs to query the identifier once from the kv data structure to obtain the function object.

[0055] Step S02: Determine whether there is a configuration matching the identifier of the currently executed function in the persistent data (database or file). If yes, jump to step S03; otherwise, jump to step S06.

[0056] Step S03: The node of the current query configuration is regarded as the main node or Master, and the other nodes that execute tasks recorded in the configuration are regarded as workers. After querying the function configuration information, the worker protocol type, the operation object list parameter name N and the strategy for allocating N are obtained from the configuration. The parameter allocation strategy can be customized, for example, based on the number of cores of the worker, the load situation (if it is system-level information, the Master node needs to have root permissions), or an average distribution strategy. The simplest strategy is to distribute evenly to each worker. In addition, other strategies, such as distribution based on worker load, can poll the load situation of each worker through the protocol after querying the info and then distribute parameters according to the weight.

[0057] The master divides the input parameters into the operation object list parameter according to the configured allocation strategy, and the worker's execution of the function is called a task. The operation object list parameter is a string representing the name of the input parameter of the function func executed in the master. This parameter should be a list, which can be split into multiple sublists. Each sublist can be used as an input parameter of func again without affecting the execution of func.

[0058] Each split parameter and function identifier is treated as the information required for a task, recorded as taskInfo. A globally unique identifier is created for the task, recorded as taskId. In addition, a context is passed in to identify whether the function is assigned for execution and whether the function has progress saving logic. Then, taskInfo, taskId, and context are sent to the worker. The worker address here is obtained from the distributed computing resource configuration table. The worker address (addr) in the distributed computing resource configuration depends on the protocol type in the parallel computing function function information configuration (info). In the simplest case, the HTTP protocol can be used to develop a web interface to implement interaction between the Master and the worker. Other custom protocols can also be used.

[0059] After receiving the function identifier, the Worker can retrieve the function object based on the identifier (if not using the local cache in S01, it must use the reflection feature provided by the programming language to obtain the function object). It then uses the context to determine whether the function has been assigned for execution. If so, it does not further query the function configuration (avoiding recursive queries) and then executes the function based on the parameters. When executing the function, the Worker saves the function execution status to the execution result collector for the Master to obtain.

[0060] In one embodiment of this specification, the result collector is implemented as follows: the result collector is a key-value structure, where key represents worker information, function information, and parameter information, and v represents the execution status. The execution status can be represented by either execution progress or completion status. The execution progress can be calculated by dividing the number of list parameters processed by the total number of list parameters. During execution, the worker saves the execution progress to a database or cache database accessible by the master.

[0061] It's important to note that the execution result collector stores the parameters and execution status of the master and worker nodes for each request. When the execution status is complete, the worker node saves the execution results. It's important to note that a worker is another process that can execute the current function. It doesn't have to be another local processor core or another server, as long as it can interact with the master through the configured protocol.

[0062] Step S04: The Master polls the result collector at a certain time interval. When the result collector shows that all worker function executions have terminated, the execution results are spliced ​​in the order of the operation object list parameters.

[0063] Step S05: The Master returns the execution result to the caller.

[0064] Step S06: the original execution logic of the function.

[0065] Step S07: The function returns to its original logic.

[0066] In addition, it should be noted that when the first worker in the application server layer, the Master, receives a function execution request, it first processes it at the function aspect layer. It first determines whether there is a context identifying the function to be assigned for execution. If not, it queries the configuration and performs task distribution and status monitoring. The specific distribution and monitoring process is as follows: Figure 2 、 Figure 3 As shown, if an execution is assigned or the configuration cannot be found, the existing execution logic is used. When other workers receive the assigned function execution request, this function execution request is structured data, such as JSON, containing the function identifier, parameters, and context information. Similarly, the worker checks whether a context exists. If so, the worker bypasses the configuration query and retrieves the function object based on the function identifier. The parameters are passed to the function object, and the function begins execution. During the worker function execution, the worker saves the function execution progress (percentage, details) to the execution result collector.

[0067] Optionally, if the function itself does not implement the logic of saving the execution progress (this information is carried in the context), then this logic can be processed in the function aspect, dividing the operation object list into multiple small lists, passing a small list to the function object for execution each time, and after each small list is processed, the function aspect layer saves the progress (number of processed small lists / total number of small lists) to the execution result collector.

[0068] Worker functions may throw exceptions during execution. The function aspect layer captures these exceptions and updates the execution results to the execution result collector, with a percentage value of 100 and details as structured exception data, such as a JSON file. In extreme cases, the function aspect layer may also throw an exception, at which point the worker execution progress in the execution result collector stops updating (including situations where no progress is recorded).

[0069] The Master polls the result collector at regular intervals, querying worker information, function information, and parameter information. If any progress stops updating for a period exceeding the timeout configured in the function, the Master considers the worker to have terminated abnormally. At this point, if a compensatory execution count n is configured, the Master redistributes the task, repeating this logic up to n times. When the result collector indicates that all worker function executions have terminated (including timeouts), the Master concatenates the execution results into a list L, in the order of the operation object list parameters.

[0070] Optionally, if a return value concatenation component is configured in the function configuration, where the return value concatenation component is a function preset by the developer, the concatenated list L is passed as a parameter to the return value concatenation component function, which performs secondary processing on L to obtain the final return value R. Finally, the Master returns L or R to the caller.

[0071] The above technical solution is suitable for scenarios where multiple workers or servers are running the same code. By visualizing and configuring the code, it leverages easy-to-use configuration options to change the code's execution mode and improve its speed. For software implementers, this allows them to easily optimize software logic, shorten implementation cycles, and quickly resolve performance issues. For developers, this reduces development complexity and shortens development cycles.

[0072] The embodiment of this specification also provides a parallel logic optimization device based on low-code configuration, such as Figure 4 As shown, the device 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 to enable the at least one processor to perform the above method.

[0073] The embodiments of this specification also provide a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:

[0074] Acquire function configuration information corresponding to the currently executed function through the current task execution node, wherein the function configuration information includes node protocol types, operation object list parameters, and operation object list parameter allocation strategies of multiple other task execution nodes, and the current task execution node is the first node among the multiple task execution nodes to receive the execution task corresponding to the currently executed function; allocate the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, and generate node configuration information for each of the other task execution nodes, wherein the node configuration information includes node execution requirement information, node execution identification information, node function allocation execution identification, and node execution status information; send the node configuration information of each of the other task execution nodes to the other task execution nodes through the current task execution node, so that the function is executed according to the node configuration information through the other task execution nodes, determine the task execution result of each of the other task execution nodes, and store it in a pre-built execution result collector; poll the execution result collector through the current task execution node according to a preset time interval to obtain the task execution result of each of the other task execution nodes, and determine the function execution result of the currently executed function based on each of the task execution results.

[0075] The various embodiments in this specification are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the device, apparatus, and non-volatile computer storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simplified. For relevant details, refer to the descriptions of the method embodiments.

[0076] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0077] The devices and media provided in the embodiments of this specification correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects to their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0078] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0079] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0080] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0081] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0082] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0083] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0084] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0085] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0086] The foregoing description is merely one or more embodiments of this specification and is not intended to limit this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of one or more embodiments of this specification are intended to be within the scope of the claims of this specification.

Claims

1. A parallel logic optimization method based on low-code configuration, characterized in that: The method comprises: Obtaining function configuration information corresponding to the currently executed function through the current task execution node, wherein the function configuration information includes node protocol types, operation object list parameters, and operation object list parameter allocation strategies of multiple other task execution nodes, and the current task execution node is the first node among the multiple task execution nodes to receive the execution task corresponding to the currently executed function; Allocate the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, and generate node configuration information for each of the other task execution nodes, wherein the node configuration information includes node execution requirement information, node execution identification information, node function allocation execution identification, and node execution status information; Sending the node configuration information of each of the other task execution nodes to the other task execution nodes through the current task execution node, so as to execute a function according to the node configuration information through the other task execution nodes, determine the task execution result of each of the other task execution nodes, and store the result in a pre-built execution result collector; According to a preset time interval, the execution result collector is polled by the current task execution node to obtain the task execution result of each of the other task execution nodes, and the function execution result of the currently executed function is determined based on each of the task execution results.

2. A parallel logic optimization method based on low-code configuration according to claim 1, characterized in that: Before obtaining function configuration information corresponding to the currently executed function through the current task execution node, the method further includes: Receiving the currently executed function through the currently executed task execution node, and judging whether there is a function allocation execution identifier of the currently executed function according to the currently executed function; If not, the function configuration information corresponding to the currently executed function is obtained through the current task execution node.

3. A parallel logic optimization method based on low-code configuration according to claim 1, characterized in that: Get the function configuration information corresponding to the currently executed function through the current task execution node, including: Obtaining a current function identifier corresponding to the currently executed function; Based on the current function identifier, querying a pre-built persistent database to determine whether function configuration information corresponding to the current function identifier exists in the persistent database; If so, the function configuration information corresponding to the currently executed function is obtained from the persistent database.

4. A parallel logic optimization method based on low-code configuration according to claim 1, characterized in that: Allocating the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function to generate node configuration information for each of the other task execution nodes specifically includes: Segmenting the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function to obtain a plurality of segmented parameters; Allocating the plurality of segmentation parameters according to a preset allocation rule to determine an allocation result, wherein the allocation result includes a node task execution relationship between each segmentation parameter and other task execution nodes; Node configuration information of each of the other task execution nodes is generated according to the multiple segmentation parameters and the allocation result.

5. A parallel logic optimization method based on low-code configuration according to claim 4, characterized in that: Generating node configuration information of each of the other task execution nodes according to the multiple segmentation parameters and the allocation result, specifically including: Generate node execution requirement information corresponding to each other task execution node based on each of the segmentation parameters and the pre-acquired function identifier corresponding to the currently executed function; Generate node execution identification information corresponding to each of the other task execution nodes according to the node task execution relationship between each of the split parameters in the allocation result and the other task execution nodes; Generating a node function allocation execution identifier corresponding to the currently executed function according to the plurality of segmentation parameters; Setting a progress saving logic for each of the other task execution nodes to determine node execution status information of each of the other task execution nodes based on the execution progress of the other task execution nodes; Node configuration information of each of the other task execution nodes is generated based on the node execution requirement information, the node execution identification information, the node function allocation execution identification and the node execution state information.

6. A parallel logic optimization method based on low-code configuration according to claim 1, characterized in that: Executing a function according to the node configuration information by the other task execution nodes to determine the task execution result of each of the other task execution nodes specifically includes: Obtaining node execution requirement information, node execution identification information, node function allocation execution identification and node execution status information in the node configuration information; Determine whether the node function is assigned for execution by assigning an execution identifier to the node function; if not, obtain the function object of the currently executing function according to the function identifier in the node execution requirement information; The other task execution nodes execute a function based on the function object and the split parameters in the node configuration information to generate a task execution result, wherein the task execution result includes a function running result and a task execution progress.

7. A parallel logic optimization method based on low-code configuration according to claim 6, characterized in that: Stored in pre-built execution result collectors, including: The result collector is a key-value pair structure, including a data key and a data value; storing other node information corresponding to each of the other task execution nodes, function information of the currently executed function, and split parameter information corresponding to the other task execution nodes in the data key; The task execution result is stored in the data value, wherein the task execution progress in the task execution result includes any one of a current execution ratio and a current execution status.

8. A parallel logic optimization method based on low-code configuration according to claim 1, characterized in that: Determining the function execution result of the currently executed function based on each of the task execution results specifically includes: Obtaining a plurality of task execution results in the execution result collector, wherein the task execution results include function running results and task execution progress; When the task execution progress in each of the task execution results is in the completion state, obtaining the function execution results corresponding to the multiple other task execution nodes; According to the parameter order of each segmentation parameter in the operation object list parameter, the function execution results corresponding to each segmentation parameter are spliced ​​to determine the function execution result of the currently executed function.

9. A parallel logic optimization device based on low-code configuration, characterized in that: The device comprises: 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 to enable the at least one processor to perform the method according to any one of claims 1 to 8.

10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to: Obtaining function configuration information corresponding to the currently executed function through the current task execution node, wherein the function configuration information includes node protocol types, operation object list parameters, and operation object list parameter allocation strategies of multiple other task execution nodes, and the current task execution node is the first node among the multiple task execution nodes to receive the execution task corresponding to the currently executed function; Allocate the operation object list parameters according to the operation object list parameter allocation strategy in the function configuration information corresponding to the currently executed function, and generate node configuration information for each of the other task execution nodes, wherein the node configuration information includes node execution requirement information, node execution identification information, node function allocation execution identification, and node execution status information; Sending the node configuration information of each of the other task execution nodes to the other task execution nodes through the current task execution node, so as to execute a function according to the node configuration information through the other task execution nodes, determine the task execution result of each of the other task execution nodes, and store the result in a pre-built execution result collector; According to a preset time interval, the execution result collector is polled by the current task execution node to obtain the task execution result of each of the other task execution nodes, and the function execution result of the currently executed function is determined based on each of the task execution results.

Citation Information

Patent Citations

  • Big data task scheduling system and method

    CN106557363A

  • Task processing method, device and system

    CN116932156A