Method and apparatus for generating code, and electronic device and program product

By drawing the orchestration process in a graphical user interface and automatically converting it into code in the target language, the usability and cross-platform compatibility issues of existing process orchestration paradigms are solved, realizing a low-threshold and highly flexible process orchestration method.

WO2026025220A1PCT designated stage Publication Date: 2026-02-05BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/108183
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2026-02-05

AI Technical Summary

Technical Problem

Existing process orchestration paradigms neglect usability when considering the lifecycle and affinity of process nodes, resulting in a high barrier to entry, incompatibility with various platforms, and a lack of flexibility and adaptability.

Method used

The process can be drawn using a graphical user interface and automatically converted into process orchestration code and process node code in the target language, generating an executable file package in the target language that supports cross-platform operation.

Benefits of technology

It lowers the programming threshold for ordinary users, improves user experience and the flexibility of process orchestration, and ensures that the generated code is controllable and reliable.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024108183_05022026_PF_FP_ABST
    Figure CN2024108183_05022026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a method and apparatus for generating code, and an electronic device and a program product. The method comprises: acquiring a user-defined orchestration process drawn by a user on a canvas of a graphical user interface, and on the basis of the orchestration process, generating process orchestration code and process node code in a target language, wherein the process orchestration code represents process semantics, and a process node represents a task in the orchestration process. The method further comprises: on the basis of the process orchestration code and the process node code, generating an executable file package in the target language. In the embodiments of the present disclosure, by means of such a method for converting the orchestration process drawn by the user into the process orchestration code and process node code in the target language and further generating the executable file package in the target language, the code in the target language can be automatically generated from the user-defined orchestration process, such that the barrier to entry for user programming is reduced, and the flexibility of the user orchestration process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device, electronic device and program product for generating code TECHNICAL FIELD

[0001] The present disclosure relates generally to the field of computers, and more specifically, to a method, device, electronic device and program product for generating code. BACKGROUND

[0002] Process orchestration refers to the organization, definition and management of the execution flow of computer programs or automated systems through a series of ordered steps. This process involves a deep understanding of business logic and a meticulous planning of system functions to ensure that the software or system can efficiently and accurately perform tasks in a predetermined logical order.

[0003] Currently, there are various paradigms for process orchestration, including business process orchestration (such as JBPM), microservice orchestration (such as Conductor), intra-service component process orchestration (such as Camel), programming language-based process orchestration (such as Python), and container orchestration platform-based process orchestration (such as Kubernetes), etc. Through process orchestration, developers can break down complex business processes into clear and manageable task units, thereby improving the reliability, efficiency and flexibility of the system. At the same time, such orchestration also makes the system more adaptable to changes in business requirements, facilitating subsequent maintenance and optimization.

[0004] SUMMARY

[0005] Embodiments of the present disclosure provide a method, device, electronic device and program product for generating code.

[0006] According to a first aspect of the present disclosure, a method for generating code is provided. The method comprises obtaining an orchestration flow drawn by a user on a canvas of a graphical user interface. The method further comprises generating, based on the orchestration flow, a process orchestration code and a process node code in a target language, wherein the process orchestration code represents process semantics, and the process node represents a task in the orchestration flow. In addition, the method further comprises generating, based on the process orchestration code and the process node code, an executable file package in the target language.

[0007] In a second aspect of the present disclosure, a device for generating code is provided. The device comprises an orchestration flow obtaining module configured to obtain an orchestration flow drawn by a user on a canvas of a graphical user interface. The device further comprises a code generating module configured to generate, based on the orchestration flow, a process orchestration code and a process node code in a target language, wherein the process orchestration code represents process semantics, and the process node represents a task in the orchestration flow. In addition, the device further comprises an executable file package generating module configured to generate, based on the process orchestration code and the process node code, an executable file package in the target language.

[0008] In a third aspect of the disclosure, an electronic device is provided. The electronic device includes a processor and a memory coupled with the processor, the memory having stored therein instructions which, when executed by the processor, cause the electronic device to perform the method according to the first aspect.

[0009] In a fourth aspect of the disclosure, a computer program product is provided, having stored thereon computer executable instructions, wherein the computer executable instructions are executed by a processor to implement the method of the first aspect.

[0010] The summary is presented to introduce some aspects of the concepts in a simplified form that are further described below in the detailed description. The summary is not intended to identify key or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF DRAWINGS

[0011] The above and other features, aspects and advantages of various embodiments of the present disclosure will become more apparent from the following detailed description taken in conjunction with the accompanying drawings, in which like reference characters designate like elements in which:

[0012] FIG. 1 shows a schematic diagram of an example environment in which some embodiments of the present disclosure can be implemented;

[0013] FIG. 2 shows a flowchart of a method for generating code according to some embodiments of the present disclosure;

[0014] FIG. 3 shows a schematic diagram of a flow for generating an executable package according to some embodiments of the present disclosure;

[0015] FIG. 4A shows a schematic diagram for generating an executable file package from a serialized file obtained from a canvas according to some embodiments of the present disclosure;

[0016] FIG. 4B shows a schematic diagram for generating flow orchestration code and flow node code by a flow definition language according to some embodiments of the present disclosure;

[0017] FIG. 4C shows a schematic diagram for optimizing generated flow orchestration code and flow node code according to some embodiments of the present disclosure;

[0018] FIG. 4D shows a schematic diagram for optimizing generated flow orchestration code and flow node code at runtime according to some embodiments of the present disclosure;

[0019] FIG. 4E shows a schematic diagram for viewing, modifying or authoring flow node code according to some embodiments of the present disclosure;

[0020] FIG. 5 shows a block diagram of an apparatus for generating code according to some embodiments of the present disclosure; and

[0021] FIG. 6 shows a block diagram of an electronic device according to some embodiments of the present disclosure.

[0022] In all the drawings, like or similar reference numerals refer to like or similar elements. DETAILED DESCRIPTION

[0023] It can be understood that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the relevant laws and regulations and relevant provisions.

[0024] Embodiments of the present disclosure will be described in more detail below with reference to the drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein, but rather these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only and are not intended to limit the scope of protection of the present disclosure.

[0025] In the description of embodiments of the present disclosure, the term "comprising" and similar terms are to be interpreted as open-ended including, i.e., "including but not limited to". The term "based on" is to be interpreted as "based, at least in part, on". The term "one embodiment" or "the embodiment" is to be interpreted as "at least one embodiment". The terms "first", "second", etc. can refer to different or similar objects unless explicitly stated otherwise. Other explicit and implicit definitions can also be included below.

[0026] As described above, process orchestration plays an important role in the efficient operation of a business system, and there are various kinds of process orchestration paradigms. In the related art, one process orchestration paradigm (such as Kubernetes) focuses on considering the life cycle and affinity of process nodes in process orchestration, but ignores the simplicity and ease of understanding of process orchestration, and the entry threshold of this process orchestration paradigm is also relatively high, affecting the experience of ordinary users. Another process orchestration paradigm is committed to solving the ease of use of process node orchestration, but this process orchestration paradigm ignores the control of the entire orchestration process, and this orchestration process can only be implemented in a specific platform, cannot be compatible with various platforms, and lacks flexibility and adaptability.

[0027] According to an embodiment of the present disclosure, the user-drawn orchestration flow through the interface is automatically converted into flow orchestration code and flow node code in the corresponding target language, where the flow orchestration code is responsible for describing the structure of the entire flow, and the flow node code represents a specific task in the orchestration flow. Further, based on these generated flow orchestration code and flow node code, executable file packages in the target language are generated, which can be flexibly run directly in the corresponding running environment, thereby realizing the orchestration flow defined by the user through the canvas. This simple and easy-to-operate flow orchestration method through the canvas facilitates the code flow orchestration operation of ordinary users, reduces the threshold for ordinary users to use code to orchestrate the flow, and improves the user experience.

[0028] FIG. 1 shows a schematic diagram of an example environment 100 in which some embodiments of the present disclosure can be implemented. As shown in FIG. 1, a user can draw an orchestration flow 112 on a canvas of a graphical user interface (GUI) 110, which is a complete orchestration flow defined by the user. For example, the user can represent each link and step in the orchestration flow by dragging and connecting different graphical elements, thereby constructing the framework and logic of the entire orchestration flow. Each graphical element represents a flow node, and each edge represents the dependency relationship between flow nodes.

[0029] Specifically, the user can select the required graphical elements from the graphical element library on the canvas and drag the selected graphical elements to the appropriate position on the canvas for layout. In this process, the user can customize the orchestration flow by adjusting the size, position, and attributes of the graphical elements. After the graphical elements are placed, the user can further configure the logic and function of each graphical element. The user can also preview the display effect of the orchestration flow on the graphical user interface. In this way, the user can quickly build an orchestration flow through intuitive drag-and-drop operations and configurations. This not only reduces the technical threshold, but also improves development efficiency, enabling non-professional developers to participate in the development process.

[0030] With continued reference to FIG. 1, as shown in region 114 of FIG. 1, the logic of the framework corresponding to the orchestration flow 112 defined by the user through dragging and dropping is shown. The user can quickly find the corresponding flow node by entering the corresponding flow node name in the search box, thereby being able to adjust the flow node.

[0031] With reference back to FIG. 1, the code generation tool 120 according to the embodiments of the present disclosure can automatically convert the orchestration flow expressed by the orchestration flow 112 into executable packages 130 in a target language, which can be Python or other programming languages, depending on the user's needs. For example, the orchestration flow arrangement code 132 and the flow node code 134 in the target language (e.g., Python) corresponding to the orchestration flow 112 can be generated according to the user-defined orchestration flow 112. The orchestration flow arrangement code 132 is mainly responsible for describing the structure and semantics of the entire orchestration flow 112, such as the beginning and end of the orchestration flow, the order and dependency relationship between the links, etc. The flow node code 134 represents the specific tasks in the orchestration flow, and each node can correspond to one or more specific operations or functions.

[0032] In some embodiments, the generated orchestration flow arrangement code 132 and flow node code 134 in the target language can also be compiled into executable packages 130 in the target language. For example, the generated executable file package in Python can be combined with Python third-party packages for cross-platform execution. In some embodiments, the generated orchestration flow arrangement code 132 and flow node code 134 can also be compiled into platform-independent intermediate representations according to the user's needs for running on various platforms, so that cross-platform execution can be achieved according to these intermediate representations. In some embodiments, the orchestration flow arrangement code 132 in the target language and the flow node code 134 in the target language can be real-time tested / optimized during the generation of the related code.

[0033] By this method of converting the user-drawn orchestration flow into orchestration flow arrangement code and flow node code in the target language through the code generation tool, and further generating executable file packages in the target language, the user-defined orchestration flow can be automatically generated in the form of code in the target language, reducing the threshold of user programming, and the executable file package improves the flexibility of user orchestration.

[0034] The processes according to the embodiments of the present disclosure will be described in detail below with reference to FIGS. 2-6. For ease of understanding, the specific data mentioned in the following description are exemplary and do not limit the protection scope of the present disclosure. It can be understood that the embodiments described below can also include additional actions not shown and / or can omit the actions shown, and the scope of the present disclosure is not limited in this respect.

[0035] FIG. 2 illustrates a flowchart of a method 200 for generating code according to some embodiments of the present disclosure. Referring to FIG. 2, the method 200 includes block 202, block 204, and block 206. The execution subject of the method 200 can be a code generation apparatus, which can be a server, such as a computing system, a single server, a distributed server, a system of servers configured in the cloud, or an independent apparatus or system. The apparatus can be implemented by software and / or hardware. The method 200 will be described below with the execution subject being a code generation apparatus.

[0036] At block 202, an orchestration flow drawn by a user on a canvas of a graphical user interface is obtained. For example, referring to FIG. 1, the code generation tool 120 obtains the orchestration flow 112 drawn by the user on the canvas of the graphical user interface, which is a complete orchestration flow defined by the user through the graphical tool. The user can construct the framework and logic of the entire orchestration flow by dragging and connecting different graphical elements to represent each link and step in the orchestration flow.

[0037] At block 204, based on the orchestration flow, a flow orchestration code in a target language and a flow node code are generated, where the flow orchestration code represents the flow semantics and the flow node code represents the tasks in the orchestration flow. The code generation tool 120 can automatically generate the flow orchestration code 132 and the flow node code 134 in the corresponding target language based on the user-defined orchestration flow 112. The flow orchestration code is mainly responsible for describing the semantics of the entire flow orchestration, such as the start and end of the orchestration flow, the order and dependency relationship between each link, etc. The flow node code represents specific tasks in the orchestration flow, such as each node may

[0038] At block 206, an executable file package in the target language is generated based on the flow orchestration code and the flow node code. With the generated flow orchestration code and flow node code, an executable file package in the target language can be further generated. In some embodiments, the executable file package contains all necessary codes and resources, which can be directly executed in the corresponding running environment, thereby realizing the flow orchestration defined by the user through the orchestration flow 112.

[0039] In this embodiment, the user-drawn orchestration flow is automatically converted into corresponding target language flow orchestration code and flow node code, where the flow orchestration code is responsible for describing the structure of the entire flow, and the flow node code represents specific tasks in the orchestration flow. Further, based on these generated flow orchestration code and flow node code, executable file packages in the target language are generated, which can be flexibly run directly in the corresponding running environment, thereby realizing the user-defined orchestration flow. This simple and easy-to-operate flow orchestration method reduces the development threshold, facilitates the code flow orchestration operation of ordinary users, and improves the user experience.

[0040] FIG. 3 shows a schematic diagram of a flow 300 for generating an executable file package according to some embodiments of the present disclosure. Since the developer ecosystem of Python language is good, and the third-party libraries of Python are relatively complete, it can be conveniently referenced by other Python projects, therefore, Python language can be determined as the target language. In the following, the target language will be described as Python language in FIG. 3.

[0041] Referring to FIG. 3, at 310, the orchestration flow expressed by the front-end canvas is obtained. The front-end and the back-end are two parts in web development, where the front-end is the user interface of the web application, including all the content that the user sees and interacts with, while the back-end refers to the server side of the web application, which handles the core tasks such as business logic, data processing, data storage, etc. of the web application. There is an intermediate layer between the front-end and the back-end, which can be, for example, BFF (Backend for Frontends). BFF is a backend service designed specifically for the front-end, which acts as an intermediate layer and can process and convert data to adapt to different system components.

[0042] In the code generation tool, the data structure can be described by schema, which refers to the structure definition of the database or other data storage system, which describes the organization of data, including data types, relationships, constraints, etc. It can be used to describe relational databases, and also can be used to describe the data structure of non-relational databases such as JSON, XML, etc.

[0043] In combination with FIG. 4A, FIG. 4A shows a schematic diagram of 400A for generating an executable file package according to the serialized file obtained from the canvas according to some embodiments of the present disclosure. In some embodiments, the orchestration flow expressed by the canvas of the front-end can be stored in the code generation tool in a digitized and serialized form, for example, the data in JSON format can be stored in the code generation tool. As shown in FIG. 4A, in the data structure 410A, the serialized file 412A about the user-defined orchestration flow in JSON format stored between the front-end and the back-end can be obtained.

[0044] Referring back to FIG. 3, at 320, the serialized file is converted into the target language flow orchestration code and flow node code, and the generated target language flow orchestration code and flow node code are analyzed for optimization. For example, at 330, the serialized file in JSON format is converted into flow orchestration code and flow node code in Python language. In conjunction with FIG. 4A, in some embodiments, the serialized file, for example, in JSON format, can be converted into a process definition language 414A by 416A. Then, the process definition language 414A is converted into flow orchestration code 422A and flow node code 424A. The process definition language is a structured language for describing and defining business logic. In particular, in conjunction with FIG. 4B, FIG. 4B illustrates a schematic diagram for generating flow orchestration code and flow node code 400B from a process definition language in accordance with some embodiments of the present disclosure.

[0045] Referring to FIG. 4B, the serialized file 412A of the middle layer of the front end and the back end shown in FIG. 4A is mapped into a process definition language at 402B. Then, the process definition language is converted into a directed acyclic graph (DAG) in data format at 404B. For example, the directed acyclic graph can be converted into YAML format. The directed acyclic graph is composed of vertices and edges, each edge points from one vertex to another vertex, representing a one-way relationship or dependency. The vertex can be regarded as a flow node, and the edge can be regarded as a dependency relationship between flow nodes. YAML is a human-readable data serialization standard that can be used for configuration files, data exchange, etc., and has strong readability and conciseness. Then, the serialized format of the directed acyclic graph is converted into flow orchestration code at 406B. In some embodiments, at 408B, the process definition language can also be directly converted into flow node code.

[0046] Returning to FIG. 4A, alternatively, in other embodiments, the serialized files 412A of the front end and the intermediate layers of the back end can be directly converted into the process orchestration code 422A and the process node code 424A, such as the process orchestration code 422A and the process node code 424A in Python format, through 418A. In some embodiments, using a JSON file as an example, the JSON file can be read by using a standard library or a third-party library of the target language. For example, in Python, the json library and the open function can be used to read and parse the JSON file. In some embodiments, when the JSON file is read, it can be parsed into a data structure that the program can operate on. In Python, the json.load() or json.loads() function can parse the JSON string into a Python dictionary or list. In some embodiments, the JSON data can be parsed into a dictionary or a list, and then the JSON data can be processed like a normal Python data structure. In some embodiments, the JSON data can also be converted into the code of the Python language according to the predefined logic. The process orchestration code 422A and the process node code 424A constitute a programming paradigm 420A that reflects the orchestration process drawn by the user. Through such a programming paradigm 420A, it can be ensured that the corresponding code generated is trustworthy.

[0047] Returning to FIG. 3, when the process of generating the process orchestration code and the process node code in Python format is to be generated at 330, the code generated by this process can be analyzed and optimized at 320. These optimization processes are repeatable and iterative. In conjunction with FIG. 4C, FIG. 4C shows a schematic diagram of 400C for optimizing the generated process orchestration code and process node code according to some embodiments of the present disclosure. At 410C, the multiple process nodes in the process orchestration can be identified by analyzing the data format of the directed acyclic graph, and then at 420C, the optimal optimizer for each process node can be determined according to the type of the identified multiple process nodes and the context of the generated process node code and the context of the process orchestration code. The alternative optimizer can be an optimizer such as numba or Cython. In some embodiments, the optimizer can be run from a specified process node by setting a timestamp. In some embodiments, the optimizer can also be extended. In this way, the code generation tool can select different optimizers for different scenarios.

[0048] With continued reference to FIG. 4C, at 430C, after the multiple process nodes are identified, the process nodes can also be optimized by improving the abstract syntax tree (AST) or the concrete syntax tree (CST). For example, the abstract syntax tree of the generated Python format code can be updated by calling the LibCST library.

[0049] Referring back to FIG. 3, at 340, the execution state of the code is observed and recorded at runtime. As shown in FIG. 4A, the programming paradigm 432A can be optimized at runtime 430A, i.e., the generated orchestration code 422A and the flow node code 424A are optimized, so that a cross-platform executable package can be generated at 440A. In particular, in connection with FIG. 4D, FIG. 4D illustrates a schematic diagram of the generated orchestration code and the flow node code 400D for optimization at runtime, according to some embodiments of the present disclosure.

[0050] Referring to FIG. 4D, at 410D, the type of the flow node is inferred at runtime. In some embodiments, the type of the identified flow node can be inferred at runtime of the orchestration code and the flow node code.

[0051] With continued reference to FIG. 4D, at 420D, it is determined whether the type of the flow node is successfully inferred. If the type of a flow node is detected to be unsuccessfully inferred, the information of the input parameters received by the flow node at runtime can be recorded at 430D, and then the orchestration code and the flow node code can be optimized based on the recorded information of the flow node at 440D. In some embodiments, the optimization process can be implemented by a JIT compilation method, so as to accelerate the execution speed and the compilation efficiency. If the type of a flow node is detected to be successfully inferred, it means that the generated code can be correctly executed, and no further optimization is needed temporarily.

[0052] Referring back to FIG. 3, at 350, an executable package is generated for cross-platform execution. For example, a Python package can be directly generated, so as to be compatible with the Python developer ecosystem, thereby facilitating the installation and reference of third-party libraries by users. In some embodiments, a platform-independent intermediate representation (e.g., MLIR or LLVM IR) can be generated for cross-platform or environment execution. For example, the corresponding intermediate representation can be generated from the abstract syntax tree of each flow node according to the type of each flow node, and then the intermediate representations are executed across platforms or environments (e.g., a virtual environment based on mamba Cpython). For example, the intermediate representations can also be directly executed in the relevant platform or environment (e.g., x86 / arm / risic-v / wasm, etc.).

[0053] In some embodiments, a timestamp about each flow node can also be inserted in the context of each flow node code, so that the running status of the generated flow orchestration code and flow node code can be displayed on the user panel in real time during debugging or tuning, including the status of the runtime hardware. In this way, the user can realize real-time monitoring of the hardware running status and code running status without the need to understand the hardware information, enhancing the controllability of the user on the flow orchestration and improving the user experience.

[0054] FIG. 4E shows a schematic diagram of viewing, modifying or flow node code 400E according to some embodiments of the present disclosure. Referring to FIG. 4E, the user-drawn orchestration flow 420E is shown on the left side of the graphical user interface 410E, and the user can further set the flow node by clicking the graphical element of the flow node, for example, clicking the graphical element representing the Script_1 flow node to display the code editing page 430E on the graphical user interface 410E, so as to facilitate the user to view the relevant code. In the code editing page 430E, the user can further modify or write the code about the flow node. Through this method of facilitating the user to view the code, it can be ensured that the generated code matches the user's needs, and it can also be ensured that the executable file package compiled according to the generated code is trustworthy.

[0055] Through this method of converting the user-drawn orchestration flow into the flow orchestration code and flow node code of the target language by the code generation tool, and further generating the executable file package of the target language, the user-defined orchestration flow can be automatically converted into the code form of the target language, reducing the difficulty of user programming and improving the flexibility of user flow orchestration. In addition, it can be ensured that the code about the user-defined orchestration flow generated according to the embodiments of the present disclosure is controllable and trustworthy.

[0056] FIG. 5 shows a block diagram of an apparatus 500 for generating code according to some embodiments of the present disclosure. As shown in FIG. 5, the apparatus 500 includes an orchestration flow obtaining module 502 configured to obtain the orchestration flow drawn by the user on the canvas of the graphical user interface. The apparatus 500 further includes a code generating module 504 configured to generate the flow orchestration code and flow node code of the target language based on the orchestration flow, wherein the flow orchestration code represents the flow semantics and the flow node represents the task in the orchestration flow. In addition, the apparatus 500 further includes an executable file package generating module 506 configured to generate the executable file package of the target language based on the flow orchestration code and the flow node code.

[0057] In some embodiments, the code generation module comprises: a first determination module configured to determine, based on the orchestration flow, a serialized file corresponding to the orchestration flow; and a first generation module configured to generate, based on the serialized file, the flow orchestration code and the flow node code in the target language.

[0058] In some embodiments, the first generation module comprises: a second determination module configured to determine, based on the serialized file, a flow definition language corresponding to the serialized file; and a third determination module configured to determine, based on the flow definition language, the flow orchestration code and the flow node code.

[0059] In some embodiments, the third determination module comprises: a first conversion module configured to convert the flow definition language into a directed acyclic graph in a data serialization format; and a fourth determination module configured to determine, based on the directed acyclic graph in the data serialization format, the flow orchestration code.

[0060] In some embodiments, the third determination module further comprises: an identification module configured to identify a plurality of flow nodes by analyzing the directed acyclic graph in the data serialization format; a fifth determination module configured to determine, based on a type of each flow node and a context of the flow orchestration code and a context of the flow node code, an optimizer for each flow node, wherein the optimizer is used to optimize the flow orchestration code and the flow node code; or an update module configured to update, based on the type of each flow node and the context of the flow orchestration code and the context of the flow node code, an abstract syntax tree of each flow node.

[0061] In some embodiments, the executable package generation module comprises: a compilation module configured to compile, based on the determined optimizer, the flow orchestration code and the flow node code into the executable package.

[0062] In some embodiments, the executable package generation module comprises: a second generation module configured to generate, based on the type of each flow node, a corresponding intermediate representation from the abstract syntax tree of each flow node; and a first optimization module configured to optimize, based on the intermediate representation, the executable package.

[0063] In some embodiments, the apparatus 500 comprises: an inference module configured to infer, at runtime of the flow orchestration code and the flow node code, the type of the flow node; a recording module configured to record, in response to detecting a failed inference of the type of the flow node, information of an input parameter received by the flow node at the runtime; and a second optimization module configured to optimize, based on the information, the flow orchestration code and the flow node code.

[0064] In some embodiments, the apparatus 500 further includes a display module configured to display the flow orchestration code and the running status of the flow node code at the corresponding time stamp based on the time stamp of the flow node

[0065] FIG. 6 illustrates a block diagram of an electronic device 600, which can be a device or apparatus described in embodiments of the present disclosure, according to some embodiments of the present disclosure. As shown in FIG. 6, the device 600 includes a central processing unit (CPU) and / or a graphics processing unit (GPU) 601, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 602 or loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for operation of the device 600 can also be stored in the RAM 603. The CPU / GPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604. Although not shown in FIG. 6, the device 600 can also include a coprocessor.

[0066] A plurality of components in the device 600 are connected to the I / O interface 605, including an input unit 606, such as a keyboard, a mouse, etc., an output unit 607, such as various types of displays, a speaker, etc., a storage unit 608, such as a magnetic disk, an optical disk, etc., and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0067] The various methods or processes described above can be performed by the CPU / GPU 601. For example, in some embodiments, the methods can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the CPU / GPU 601, one or more steps or actions of the methods or processes described above can be performed.

[0068] In some embodiments, the methods and processes described above can be implemented as a computer program product. The computer program product can include a computer readable storage medium having computer readable program instructions embodied therewith.

[0069] A computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium can be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

[0070] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.

[0071] Computer readable program instructions for carrying out operations of the present disclosure can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including object oriented programming languages and conventional procedural programming languages. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate array (FPGA), or programmable logic array (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.

[0072] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium that can direct a computer, a programmable data processing apparatus, and / or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function / act specified in the flowchart and / or block diagram block or blocks.

[0073] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0074] The computer program product of the second aspect can include a computer readable storage medium. The computer readable storage medium can include instructions. The instructions can include one or both of: instructions for causing a computer to enable a user equipment device to receive a configuration message from a base station, the configuration message comprising an indication of a set of one or more parameters for a first type of hybrid automatic repeat request process, the first type of hybrid automatic repeat request process being associated with a first type of data; and instructions for causing a computer to enable a user equipment device to receive a configuration message from a base station, the configuration message comprising an indication of a set of one or more parameters for a first type of hybrid automatic repeat request process, the first type of hybrid automatic repeat request process being associated with a first type of data.

[0075] Embodiments of the present disclosure have been described above, with the understanding that these embodiments are exemplary only, and are not restrictive, and are not limited to the disclosed embodiments. Many modifications and changes to the described embodiments are possible, without departing from the scope and spirit of the described embodiments. The selection of terms to be used herein is intended to best explain the principles of the embodiments, practical application, or technical improvement over the technology in the market, or to enable other ordinary skilled persons in the art to understand the embodiments disclosed herein.

Claims

1. A method for generating code, comprising: obtaining an orchestration flow drawn by a user on a canvas of a graphical user interface; generating, based on the orchestration flow, a flow orchestration code in a target language and a flow node code, the flow orchestration code representing flow semantics and the flow node representing a task in the orchestration flow; and generating, based on the flow orchestration code and the flow node code, an executable package in the target language.

2. The method of claim 1, wherein generating, based on the orchestration flow, a flow orchestration code in a target language and a flow node code comprises: determining, based on the orchestration flow, a serialized file corresponding to the orchestration flow; and generating, based on the serialized file, the flow orchestration code and the flow node code in the target language.

3. The method of claim 2, wherein generating, based on the serialized file, a flow orchestration code in a target language and a flow node code comprises: determining, based on the serialized file, a process definition language corresponding to the serialized file; and determining, based on the process definition language, the flow orchestration code and the flow node code.

4. The method of claim 3, wherein determining, based on the process definition language, the flow orchestration code and the flow node code comprises: converting the process definition language into a directed acyclic graph in a data serialization format; and determining, based on the directed acyclic graph in the data serialization format, the flow orchestration code.

5. The method of claim 4, further comprising: identifying a plurality of flow nodes by analyzing the directed acyclic graph in the data serialization format; determining, based on a type of each flow node and a context of the flow orchestration code and a context of the flow node code, an optimizer for each flow node, the optimizer being used to optimize the flow orchestration code and the flow node code; or updating, based on the type of each flow node and the context of the flow orchestration code and the context of the flow node code, an abstract syntax tree of each flow node.

6. The method of claim 5, wherein generating, based on the flow orchestration code and the flow node code, an executable package in the target language comprises: compiling, based on the determined optimizers, the flow orchestration code and the flow node code into an executable package.

7. The method of claim 6, further comprising: generating, based on the type of each flow node, a corresponding intermediate representation from the abstract syntax tree of each flow node; and optimizing, based on the intermediate representation, the executable package.

8. The method of claim 1, further comprising: inference, at runtime of the flow orchestration code and the flow node code, a type of the flow node; in response to detecting a failed inference for the type of the flow node, recording information of input parameters received by the flow node at runtime; and optimizing, based on the information, the flow orchestration code and the flow node code. ​ ​ ​ ​ ​ ​ ​ 9.The method of claim 8, further comprising: displaying the orchestration code and the flow node code at a corresponding time stamp based on the time stamp of the flow node. 10.An apparatus for generating code, comprising: an orchestration flow obtaining module configured to obtain a user-defined orchestration flow drawn by a user on a canvas of a graphical user interface; a code generating module configured to generate, based on the orchestration flow, an orchestration code and a flow node code in a target language, the orchestration code representing a flow semantics and the flow node representing a task in the orchestration flow; and an executable package generating module configured to generate, based on the orchestration code and the flow node code, an executable package in the target language. 11.An electronic device, comprising: a processor; and a memory coupled with the processor, the memory having stored therein instructions that, when executed by the processor, cause the electronic device to perform the method according to any one of claims 1 to 9. 12.A computer program product comprising computer-executable instructions, wherein the computer-executable instructions are executed by a processor to implement the method according to any one of claims 1 to 9. ​ ​

Citation Information

Patent Citations

  • Process arrangement method and system, medium and computer program product

    CN114428613A

  • Service capability using method, device and equipment

    CN115202623A

  • Business logic arrangement method and device, electronic equipment and storage medium

    CN115686487A

  • Data driven orchestration of business processes

    US20100121740A1