A method, apparatus, device and storage medium for running a node code

CN116860361BActive Publication Date: 2026-09-18GUANGZHOU ASENSING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310789776.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2026-09-18
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

[0005]本发明提供了一种节点代码的运行方法、装置、设备及存储介质,以解决现有技术中代码复用率不高、无法实现数据流自动处理、操作及管理复杂性高、不便于统一管理的技术问题

Benefits of technology

[0043]The technical solution of this invention creates new task execution objects and sub-threads. In the sub-threads, based on the information of the task execution object, the corresponding node code and its execution order are read. The sub-threads then execute the node code sequentially. After each node code is executed, the next node code to be executed is updated. The sub-threads determine whether the node code to be executed is a timer task, ensuring that the main thread executes timer tasks while the sub-threads uniformly execute node code. This avoids problems such as low code reuse and inability to automatically process data streams. Simultaneously, the main thread continues to refresh for newly created task execution objects and corresponding sub-threads. This achieves automatic construction of process-oriented projects without requiring administrators or developers to write the task code for each project sequentially.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116860361B_ABST
    Figure CN116860361B_ABST
Patent Text Reader

Abstract

The application discloses a node code running method and device, equipment and storage medium, including: new task execution object is built, and a subthread is built, thereby reading the node code and its execution order corresponding to the task execution object; according to the execution order, the subthread is called to execute the node code in turn, so that after executing a node code, the next node code to be executed is updated; if the node code to be executed is a timer task, the timer task is returned; if the node code to be executed is not a timer task, according to a preset time interval, whether there is a newly built task execution object is continued to be refreshed; until all node codes are executed and there is no newly built task execution object, the running of the node codes is completed. The application solves the technical problems that the code reuse rate is not high in the prior art, data stream automatic processing cannot be realized, operation and management complexity is high, and unified management is inconvenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of host computer technology, and in particular to a method, apparatus, device, and storage medium for running node code. Background Technology

[0002] A host computer typically refers to a higher-level computer device, usually a desktop computer, server, or embedded computer. These devices are responsible for controlling and managing the entire system, collecting and processing data, and executing complex algorithms and logical operations. Host computers usually run software programs written in high-level languages, providing a user-friendly graphical interface so that users can interact with the system.

[0003] Currently, each project has an independent host computer for control and management, ensuring stable and efficient operation without interference from external systems or devices. This means developers and administrators must write the host computer code for each project sequentially. While existing technologies encapsulate code into modules, simplifying coding, this is limited to projects with similar functions or structures. It cannot quickly build up a system for all workflow-based projects or tasks, resulting in low code reusability and hindering automated data processing. For administrators, multiple host computers for different projects increase management difficulty and complexity, hindering unified management. The need for individual project setup makes rapid deployment impossible in the short term, leading to longer development cycles, lower efficiency, and impeding rapid product iteration.

[0004] Therefore, there is an urgent need for a method that can improve code reusability, increase the efficiency of host computer development, and enable automated execution with configurable parameters. Summary of the Invention

[0005] This invention provides a method, apparatus, device, and storage medium for running node code, in order to solve the technical problems of low code reuse rate, inability to achieve automatic data flow processing, high complexity of operation and management, and inconvenience for unified management in the prior art.

[0006] To address the aforementioned technical problems, embodiments of the present invention provide a method for running node code, comprising:

[0007] A new task execution object is created, and a new sub-thread is created. In the sub-thread, the node code corresponding to the task execution object and its execution order are read according to the information of the task execution object. The task execution object includes multiple node codes.

[0008] According to the execution order, the child thread is called to execute the node code in sequence, so that after each node code is executed, the next node code to be executed is updated, and the child thread determines whether the node code to be executed is a timer task.

[0009] If the node code to be executed is a timer task, then the timer task is returned so that the main thread can execute the timer task;

[0010] If the node code to be executed is not a timer task, then according to the preset time interval, continue to refresh whether there is a newly created task execution object, and call the child thread to execute the updated node code;

[0011] The execution of the node code is complete once all node code has been executed and no new task execution objects have been created.

[0012] As a preferred embodiment, the step of creating a new task execution object and a new sub-thread, and then reading the node code corresponding to the task execution object and its execution order in the sub-thread according to the information of the task execution object, specifically:

[0013] In response to the task requirements input by the user, a new task execution object is created, and a child thread is created for the task execution object;

[0014] The sub-thread is invoked to parse the task execution object, so that the sub-thread can read the node code corresponding to the task requirement information and the execution order of each node code based on the task requirement information obtained from parsing the task execution object.

[0015] As a preferred embodiment, the step of calling the sub-threads to execute the node code sequentially according to the execution order specifically includes:

[0016] The child thread determines the node code that needs to be executed at the current time based on the execution order.

[0017] The child thread obtains the input and output instruction parameters when the current node code is executed, and determines the number of times the currently executing node code is executed in a loop based on the instruction parameters, so that the child thread executes the current node code in a loop;

[0018] After the loop finishes executing the current node code, the child thread, based on the instruction parameters obtained after each iteration of the current node code execution, waits for the response data to be returned after the loop finishes executing the current node code, once it has determined that the current node code is not a callback function.

[0019] When it is necessary to verify the response data, the response data is verified, and after the verification is successful, the process returns to the next node code to be executed.

[0020] When response data validation is not required, the system returns to the next node code to be executed, based on the information of the task execution object and the execution order of the node code.

[0021] As a preferred option, it also includes:

[0022] Based on the response data obtained after the current node code is terminated, the next node code to be executed is automatically matched;

[0023] Based on the log data, the response data is input into the node code to be executed after simulation for virtual simulation; or, the response data is directly input into the node code to be executed for actual test run.

[0024] Returns the data from the simulation of virtual or actual test runs of the node code to be executed to the current node code.

[0025] As a preferred option, it also includes:

[0026] Based on the information of the task execution object, the execution order of the node code, and the data after simulation virtual operation or actual test operation, the validity of the node code to be executed is verified.

[0027] If the code to be executed is invalid, the child thread is terminated.

[0028] If the node code to be executed is valid, then the process recursively moves to executing the next node code to be executed, thereby completing the update of the next node code to be executed.

[0029] As a preferred embodiment, the sub-thread determines whether the node code to be executed is a timer task, specifically as follows:

[0030] The child thread determines the timer task for the next node code to be executed based on the input and output instruction parameters during the execution of the current node code.

[0031] As a preferred embodiment, the step of continuously refreshing for newly created task execution objects according to a preset time interval specifically involves:

[0032] According to a preset time interval, the task request information input by the user is continuously parsed, and then refreshed to see if there is a newly created task execution object;

[0033] If a new task execution object exists, a new child thread is created for that new task execution object, and the new task execution object is processed by that child thread.

[0034] Accordingly, the present invention also provides a node code execution device, comprising: a task execution object module, a node code execution module, a first judgment module, a second judgment module, and a final execution module.

[0035] The task execution object module is used to create a new task execution object and a new sub-thread, so that the sub-thread can read the node code corresponding to the task execution object and its execution order according to the information of the task execution object; wherein, the task execution object includes multiple node codes.

[0036] The node code execution module is used to call the sub-thread to execute the node code sequentially according to the execution order, so that after each node code is executed, the next node code to be executed is updated, and the sub-thread determines whether the node code to be executed is a timer task.

[0037] The first judgment module is used to return the timer task if the node code to be executed is a timer task, so that the main thread executes the timer task.

[0038] The second judgment module is used to refresh whether a new task execution object has been created according to a preset time interval if the node code to be executed is not a timer task, and to call the sub-thread to execute the updated node code.

[0039] The final execution module is used to complete the execution of the node code after all node code has been executed and no new task execution object has been created.

[0040] Accordingly, the present invention also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the node code execution method as described in any of the preceding claims.

[0041] Accordingly, the present invention also provides a computer-readable storage medium comprising a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to execute the node code execution method as described in any of the preceding claims.

[0042] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0043] The technical solution of this invention creates new task execution objects and sub-threads. In the sub-threads, based on the information of the task execution object, the corresponding node code and its execution order are read. The sub-threads then execute the node code sequentially. After each node code is executed, the next node code to be executed is updated. The sub-threads determine whether the node code to be executed is a timer task, ensuring that the main thread executes timer tasks while the sub-threads uniformly execute node code. This avoids problems such as low code reuse and inability to automatically process data streams. Simultaneously, the main thread continues to refresh for newly created task execution objects and corresponding sub-threads. This achieves automatic construction of process-oriented projects without requiring administrators or developers to write the task code for each project sequentially. Attached Figure Description

[0044] Figure 1 : A flowchart illustrating the steps of a node code execution method provided in an embodiment of the present invention;

[0045] Figure 2 This is a flowchart of the execution of the main thread and child threads provided in an embodiment of the present invention;

[0046] Figure 3 : A flowchart illustrating the specific execution node code of a sub-thread provided in an embodiment of the present invention;

[0047] Figure 4 : A structural diagram of a node code execution device provided in an embodiment of the present invention. Detailed Implementation

[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0049] Example 1

[0050] Please refer to Figure 1 The present invention provides a method for running node code, comprising the following steps S101-S105:

[0051] Step S101: Create a new task execution object and a new sub-thread, and then read the node code corresponding to the task execution object and its execution order in the sub-thread according to the information of the task execution object; wherein, the task execution object includes multiple node codes.

[0052] It should be noted that the node code is preset by the administrator and processed according to a tree-like logic to ensure loose combination of nodes, a unified interface, and dynamic extensibility. Furthermore, a node code library can be established, allowing all nodes in the library to be reused when creating new task execution objects. All nodes are reusable and their code can be continuously expanded and updated.

[0053] As a preferred embodiment, the step of creating a new task execution object and a new sub-thread, and then reading the node code corresponding to the task execution object and its execution order in the sub-thread according to the information of the task execution object, specifically:

[0054] In response to the task requirement information input by the user, a new task execution object is created, and a sub-thread is created for the task execution object; the sub-thread is called to parse the task execution object, so that the sub-thread reads the node code corresponding to the task requirement information and the execution order of each node code according to the task requirement information obtained by parsing the task execution object.

[0055] In this embodiment, the task requirement information includes the data type of the task, data information, and data processing requirement information. The data processing requirement information includes, but is not limited to, data acquisition, data transformation, data grouping, data organization, data calculation, data storage, data retrieval, and data sorting. Based on the data processing requirement information input by the user, a pre-defined index can be used to establish a relationship between the data processing requirement information and the node code, thereby determining the node code corresponding to the task execution object. For example, for data acquisition, it can be implemented using corresponding node code that integrates data acquisition functions.

[0056] Step S102: According to the execution order, the sub-thread is called to execute the node code sequentially, so that after each node code is executed, the next node code to be executed is updated, and the sub-thread determines whether the node code to be executed is a timer task.

[0057] As a preferred embodiment, the step of calling the sub-threads to execute the node code sequentially according to the execution order specifically includes:

[0058] The child thread determines the node code to be executed based on the execution order; the child thread obtains the input and output instruction parameters of the current node code during execution, and determines the number of times the current node code will be executed in a loop based on the instruction parameters, so that the child thread executes the current node code in a loop; after the loop execution of the current node code ends, the child thread, based on the instruction parameters obtained after each loop execution of the current node code, waits for the return of response data after determining that the current node code is not a callback function; when the response data needs to be verified, the response data is verified, and after the verification is successful, the thread returns to the next node code to be executed; when the response data does not need to be verified, the thread returns to the next node code to be executed based on the information of the task execution object and the execution order of the node code.

[0059] In this embodiment, please refer to Figure 2 and 3 The child thread determines the execution flow of each node's code based on the information of the task execution object, and then determines the execution order of each node's code. At the same time, based on the information of the task execution object and / or the input and output instruction parameters when the current node's code is executed, it determines the number of times the current node's code will be executed in a loop, and executes the corresponding node's code in a loop according to the number of times the current node's code will be executed in a loop.

[0060] It should be noted that each node code has a corresponding execution code or execution function pre-set, so that when connecting to the node code, the response data output by the previous node code can be directly used as the input of the node code, and then the data is processed to execute the node code, and the result of the data processing is used as the output of the node code.

[0061] Furthermore, this embodiment determines whether the current node code is a callback function; if it is a callback function, the callback function is executed, and the execution of the task information ends when the callback function is executed successfully; if the callback function is not executed successfully, it is necessary to wait for the return result; if it is not a callback function, the current instruction needs to be sent, and the return result is waited for according to the preset waiting interval; then it is determined whether the response needs to be checked, and then the next node code is executed.

[0062] In this embodiment, when a response check is required, data validation is performed based on the response data. This determines whether the current node code can execute successfully and obtains the corresponding response data information. Then, execution returns to the next node code to continue. It should be noted that data validation is performed based on the current node code and is generally used to verify the legality, completeness, and whether the data corresponds to the current task node. When a response check is not required, the next associated node code is located based on the execution order and the information of the task execution object.

[0063] Furthermore, it determines whether the next task node is valid, that is, it determines the feasibility and legality of the task node's execution. If the next task node is invalid, the process of the child thread is terminated directly; if the next task node is valid, the child thread recursively executes the next task node.

[0064] As a preferred option, it also includes:

[0065] Based on the response data obtained after the current node code ends, the system automatically matches the next node code to be executed; combined with log data, the response data is input into the simulated node code to be executed for virtual simulation; or, the response data is directly input into the node code to be executed for actual test run; and the data after the simulated virtual simulation or actual test run of the node code to be executed is returned to the current node code.

[0066] It should be noted that by automatically matching the response data obtained after the current node code ends, the system can directly match the next node code to be executed and perform either a simulated virtual run or an actual test run. This ensures that the response data is input into the node code to obtain data after a simulated virtual run or an actual test run, thereby verifying the validity of the data. This allows for both human simulation and real-time testing, ensuring that the node code to be executed is legal and valid under real-world conditions and reducing the error rate of node code execution.

[0067] As a preferred option, it also includes:

[0068] Based on the information of the task execution object and the execution order of the node code, as well as the simulation virtual run or actual test run, the validity of the node code to be executed is verified; if the node code to be executed is invalid, the sub-thread is terminated; if the node code to be executed is valid, the process recursively proceeds to execute the next node code to be executed, thereby completing the update of the next node code to be executed.

[0069] In this embodiment, the information of the task execution object and the execution order of the node code are used to further verify the validity of the next node code to be executed, ensuring that the next node code to be executed is executable and that the order and execution object are correct. This avoids the situation where data input and output disorder of repeatedly called node code can easily occur during the execution of node code due to the input and output of other response data and the joint work of multiple sub-threads.

[0070] Understandably, the judgment of node code is dynamically processed in real time, and the solution is a tree structure (and automatically judges closed loops and eliminates infinite loops). Each execution can automatically match the next node code to be executed based on the response data of the previous node in real time. This can be applied to all process-oriented work, reducing code / manual work and lowering the error rate.

[0071] As a preferred embodiment, the sub-thread determines whether the node code to be executed is a timer task, specifically as follows:

[0072] The child thread determines the timer task for the next node code to be executed based on the input and output instruction parameters during the execution of the current node code.

[0073] In this embodiment, the determination of whether a task is a timer task is made by analyzing the instruction parameters of the current task information. For example, the `checkExists(JobKey jobKey)` method of the Scheduler in the instruction parameters of the current task information can be used to determine whether the next node code to be executed is a timer task.

[0074] Step S103: If the node code to be executed is a timer task, then return the timer task so that the main thread executes the timer task.

[0075] In this embodiment, executing the timer task through the main thread ensures that the child thread is not interfered with by the timer task, reducing the pressure on the child thread to execute the node code. Furthermore, executing the timer task through the main thread improves the efficiency and accuracy of the entire task execution object processing and increases the fault tolerance of the node code execution.

[0076] Step S104: If the node code to be executed is not a timer task, then according to the preset time interval, continue to refresh whether there is a newly created task execution object, and call the sub-thread to execute the updated node code.

[0077] As a preferred embodiment, the step of continuously refreshing for newly created task execution objects according to a preset time interval specifically involves:

[0078] According to a preset time interval, the task requirement information input by the user is continuously parsed to refresh whether a new task execution object has been created. When a new task execution object exists, a new sub-thread is created for the new task execution object, and the new task execution object is processed by the sub-thread.

[0079] It should be noted that the task information refreshed periodically by the main thread can be determined based on a preset task information relationship diagram. This diagram can be pre-set by the administrator or developers, or it can be implemented using standardized process task requirements and task execution objects. The preset task information relationship diagram specifies the execution order or sequence of each task node, which can also be a tree-like logical sequence. For tree-like logical sequences, a second and third sub-thread needs to be created to execute the task nodes at the same level.

[0080] In this embodiment, if no new task execution object is refreshed, it means that the task node has been reached and is basically being executed in the sub-thread. The main thread then needs to wait for the sub-thread to finish executing all the node code before it can stop refreshing the task information.

[0081] Step S105: The execution of the node code is complete once all node code has been executed and no new task execution objects are created.

[0082] Please see Figure 2 and 3 This is a flowchart illustrating the specific execution process of the main thread and sub-thread in this embodiment of the invention. After creating a new task execution object and a new sub-thread, the sub-thread reads and executes the task node (node ​​code). This allows for accurate execution of the current node code by tracking the execution order and number of executions of each node code during the execution of the task node (node ​​code), and continues to anchor the execution of the next node code. This improves code reusability and the efficiency of host computer development, eliminating the need for administrators or developers to write the task code for each project sequentially, and enabling the direct construction of automated projects.

[0083] Implementing the above embodiments has the following effects:

[0084] The technical solution of this invention creates new task execution objects and sub-threads. In the sub-threads, based on the information of the task execution object, the corresponding node code and its execution order are read. The sub-threads then execute the node code sequentially. After each node code is executed, the next node code to be executed is updated. The sub-threads determine whether the node code to be executed is a timer task, ensuring that the main thread executes timer tasks while the sub-threads uniformly execute node code. This avoids problems such as low code reuse and inability to automatically process data streams. Simultaneously, the main thread continues to refresh for newly created task execution objects and corresponding sub-threads. This achieves automatic construction of process-oriented projects without requiring administrators or developers to write the task code for each project sequentially.

[0085] Example 2

[0086] Please refer to Figure 4 The present invention provides a node code execution device, comprising: a task execution object module 201, a node code execution module 202, a first judgment module 203, a second judgment module 204, and a final execution module 205.

[0087] The task execution object module 201 is used to create a new task execution object and a new sub-thread, so that the node code corresponding to the task execution object and its execution order can be read in the sub-thread according to the information of the task execution object; wherein, the task execution object includes multiple node codes.

[0088] The node code execution module 202 is used to call the sub-thread to execute the node code sequentially according to the execution order, so that after each node code is executed, the next node code to be executed is updated, and the sub-thread determines whether the node code to be executed is a timer task.

[0089] The first judgment module 203 is used to return the timer task if the node code to be executed is a timer task, so that the main thread executes the timer task.

[0090] The second judgment module 204 is used to refresh whether there is a newly created task execution object according to a preset time interval if the node code to be executed is not a timer task, and call the sub-thread to execute the updated node code.

[0091] The final execution module 205 is used to complete the execution of the node code after all node code has been executed and no new task execution object has been created.

[0092] As a preferred embodiment, the step of creating a new task execution object and a new sub-thread, and then reading the node code corresponding to the task execution object and its execution order in the sub-thread according to the information of the task execution object, specifically:

[0093] In response to the task requirement information input by the user, a new task execution object is created, and a sub-thread is created for the task execution object; the sub-thread is called to parse the task execution object, so that the sub-thread reads the node code corresponding to the task requirement information and the execution order of each node code according to the task requirement information obtained by parsing the task execution object.

[0094] As a preferred embodiment, the step of calling the sub-threads to execute the node code sequentially according to the execution order specifically includes:

[0095] The child thread determines the node code to be executed based on the execution order; the child thread obtains the input and output instruction parameters of the current node code during execution, and determines the number of times the current node code will be executed in a loop based on the instruction parameters, so that the child thread executes the current node code in a loop; after the loop execution of the current node code ends, the child thread, based on the instruction parameters obtained after each loop execution of the current node code, waits for the return of response data after determining that the current node code is not a callback function; when the response data needs to be verified, the response data is verified, and after the verification is successful, the thread returns to the next node code to be executed; when the response data does not need to be verified, the thread returns to the next node code to be executed based on the information of the task execution object and the execution order of the node code.

[0096] As a preferred option, it also includes:

[0097] Based on the response data obtained after the current node code ends, the system automatically matches the next node code to be executed; combined with log data, the response data is input into the simulated node code to be executed for virtual simulation; or, the response data is directly input into the node code to be executed for actual test run; and the data after the simulated virtual simulation or actual test run of the node code to be executed is returned to the current node code.

[0098] As a preferred option, it also includes:

[0099] Based on the information of the task execution object, the execution order of the node code, and the data after simulation virtual operation or actual test operation, the validity of the node code to be executed is verified; if the node code to be executed is invalid, the sub-thread is terminated; if the node code to be executed is valid, the process recursively proceeds to execute the next node code to be executed, thereby updating the next node code to be executed.

[0100] As a preferred embodiment, the sub-thread determines whether the node code to be executed is a timer task, specifically as follows:

[0101] The child thread determines the timer task for the next node code to be executed based on the input and output instruction parameters during the execution of the current node code.

[0102] As a preferred embodiment, the step of continuously refreshing for newly created task execution objects according to a preset time interval specifically involves:

[0103] According to a preset time interval, the task requirement information input by the user is continuously parsed to refresh whether a new task execution object has been created. When a new task execution object exists, a new sub-thread is created for the new task execution object, and the new task execution object is processed by the sub-thread.

[0104] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0105] Implementing the embodiments of the present invention has the following effects:

[0106] The technical solution of this invention creates new task execution objects and sub-threads. In the sub-threads, based on the information of the task execution object, the corresponding node code and its execution order are read. The sub-threads then execute the node code sequentially. After each node code is executed, the next node code to be executed is updated. The sub-threads determine whether the node code to be executed is a timer task, ensuring that the main thread executes timer tasks while the sub-threads uniformly execute node code. This avoids problems such as low code reuse and inability to automatically process data streams. Simultaneously, the main thread continues to refresh for newly created task execution objects and corresponding sub-threads. This achieves automatic construction of process-oriented projects without requiring administrators or developers to write the task code for each project sequentially.

[0107] Example 3

[0108] Accordingly, the present invention also provides a terminal device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the node code execution method as described in any of the above embodiments.

[0109] The terminal device in this embodiment includes a processor, a memory, and a computer program and computer instructions stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps described in Embodiment 1 above, for example... Figure 1 The steps S101 to S105 are shown. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the above-described device embodiment, such as the node code execution module 202.

[0110] For example, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device. For example, the node code execution module 202 is used to call the sub-thread to execute the node code sequentially according to the execution order, so that after each node code is executed, the next node code to be executed is updated, and the sub-thread determines whether the node code to be executed is a timer task.

[0111] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the schematic diagram is merely an example of a terminal device and does not constitute a limitation on the terminal device. It may include more or fewer components than illustrated, or combine certain components, or different components. For example, the terminal device may also include input / output devices, network access devices, buses, etc.

[0112] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.

[0113] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on the use of the mobile terminal, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0114] Wherein, if the modules / units integrated in the terminal device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, it can implement the steps of the various method embodiments described above. Wherein, the computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0115] Example 4

[0116] Accordingly, the present invention also provides a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the node code execution method described in any of the above embodiments.

[0117] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A method for running node code, characterized in that, include: A new task execution object is created, and a new sub-thread is created. In the sub-thread, the node code corresponding to the task execution object and its execution order are read according to the information of the task execution object. The task execution object includes multiple node codes, and each node code is connected in a tree-like topological structure. According to the execution order, the child thread is called to execute the node code in sequence, so that after each node code is executed, the next node code to be executed is updated, and the child thread determines whether the node code to be executed is a timer task. If the node code to be executed is a timer task, then the timer task is returned so that the main thread can execute the timer task; If the node code to be executed is not a timer task, then according to the preset time interval, continue to refresh whether there is a newly created task execution object, and call the child thread to execute the updated node code; The execution of the node code is complete once all node code has been executed and no new task execution objects have been created.

2. The method for running node code as described in claim 1, characterized in that, The process involves creating a new task execution object and a new sub-thread. Within the sub-thread, the node code corresponding to the task execution object and its execution order are read based on the information of the task execution object. Specifically: In response to the task requirements input by the user, a new task execution object is created, and a child thread is created for the task execution object; The sub-thread is invoked to parse the task execution object, so that the sub-thread can read the node code corresponding to the task requirement information and the execution order of each node code based on the task requirement information obtained from parsing the task execution object.

3. The method for running node code as described in claim 1, characterized in that, The step of calling the sub-threads to execute the node code sequentially according to the execution order is specifically as follows: The child thread determines the node code that needs to be executed at the current time based on the execution order. The child thread obtains the input and output instruction parameters when the current node code is executed, and determines the number of times the currently executing node code is executed in a loop based on the instruction parameters, so that the child thread executes the current node code in a loop; After the loop finishes executing the current node code, the child thread, based on the instruction parameters obtained after each iteration of the current node code execution, waits for the response data to be returned after the loop finishes executing the current node code, once it has determined that the current node code is not a callback function. When it is necessary to verify the response data, the response data is verified, and after the verification is successful, the process returns to the next node code to be executed. When response data validation is not required, the system returns to the next node code to be executed, based on the information of the task execution object and the execution order of the node code.

4. The method for running node code as described in claim 3, characterized in that, Also includes: Based on the response data obtained after the current node code is terminated, the next node code to be executed is automatically matched; Based on the log data, the response data is input into the node code to be executed after simulation for virtual simulation; or, the response data is directly input into the node code to be executed for actual test run. Returns the data from the simulation of virtual or actual test runs of the node code to be executed to the current node code.

5. The method for running node code as described in claim 4, characterized in that, Also includes: Based on the information of the task execution object, the execution order of the node code, and the data after simulation virtual operation or actual test operation, the validity of the node code to be executed is verified. If the code to be executed is invalid, the child thread is terminated. If the node code to be executed is valid, then the process recursively moves to executing the next node code to be executed, thereby completing the update of the next node code to be executed.

6. The method for running node code as described in claim 5, characterized in that, The sub-thread determines whether the node code to be executed is a timer task, specifically as follows: The child thread determines the timer task for the next node code to be executed based on the input and output instruction parameters during the execution of the current node code.

7. The method for running node code as described in claim 2, characterized in that, The step of continuously refreshing for newly created task execution objects at preset time intervals specifically involves: According to a preset time interval, the task request information input by the user is continuously parsed, and then refreshed to see if there is a newly created task execution object; If a new task execution object exists, a new child thread is created for that new task execution object, and the new task execution object is processed by that child thread.

8. A device for running node code, characterized in that, include: The module consists of a task execution object module, a node code execution module, a first judgment module, a second judgment module, and a final execution module. The task execution object module is used to create a new task execution object and a new sub-thread, so that the sub-thread can read the node code corresponding to the task execution object and its execution order according to the information of the task execution object; wherein, the task execution object includes multiple node codes; The node code execution module is used to call the sub-thread to execute the node code sequentially according to the execution order, so that after each node code is executed, the next node code to be executed is updated, and the sub-thread determines whether the node code to be executed is a timer task. The first judgment module is used to return the timer task if the node code to be executed is a timer task, so that the main thread executes the timer task; The second judgment module is used to refresh whether a new task execution object has been created according to a preset time interval if the node code to be executed is not a timer task, and call the sub-thread to execute the updated node code. The final execution module is used to complete the execution of the node code after all node code has been executed and no new task execution object has been created.

9. A terminal device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a method for running node code as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to execute the node code as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Jamming positioning method and device

    CN111625456A

  • Task polling method and task management system based on PYTHON

    CN114936077A