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

By automatically converting the orchestration process drawn by the user on the graphical user interface into code in the target language and generating an executable file package, the problems of high threshold and insufficient flexibility of process orchestration in the prior art are solved, and a simple and easy-to-use process orchestration experience is achieved.

CN119948457APending Publication Date: 2025-05-06BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202480003834.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

The existing process orchestration paradigm has shortcomings in ensuring the control and flexibility of the orchestration process. Especially for ordinary users, the threshold for the existing technology is relatively high and it is difficult to achieve simple and easy-to-use process orchestration.

Method used

By obtaining the orchestration process drawn by the user on the graphical user interface canvas, it is automatically converted into the process orchestration code of the target language and the process node code, and generating an executable file package, so that the user-defined orchestration process can be directly executed in the corresponding operating environment.

Benefits of technology

It lowers the threshold for user programming, improves the flexibility and user experience of process orchestration, and allows ordinary users to easily perform code process orchestration operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119948457A_ABST
    Figure CN119948457A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and device for generating codes, electronic equipment and a program product. The method includes obtaining a user-defined arrangement process drawn by a user on a canvas of a graphical user interface, and based on the arrangement process, generating a process arrangement code and a process node code of a target language, where the process arrangement code represents process semantics and the process node represents a task in the arrangement process. The method further includes generating an executable file package of the target language based on the process orchestration code and the process node code. According to the embodiment of the invention, through the method for converting the orchestration process drawn by the user into the process orchestration code and the process node code of the target language and further generating the executable file package of the target language, the orchestration process defined by the user can be automatically generated into a code form of the target language; the user programming portal is reduced, and the flexibility of the user arrangement process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates generally to the field of computers, and more particularly, to methods, apparatuses, electronic devices, and program products for generating codes. Background Art

[0002] Process orchestration refers to organizing, defining and managing the execution process of a computer program or automated system through a series of orderly steps. This process involves a deep understanding of business logic and careful planning of system functions to ensure that the software or system can perform tasks efficiently and accurately 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), 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). Through process orchestration, developers can decompose complex business processes into clear and manageable task units, thereby improving the reliability, efficiency, and flexibility of the system. At the same time, this kind of orchestration also makes it easier for the system to adapt to changes in business needs, facilitating subsequent maintenance and optimization. Summary of the invention

[0004] Embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a program product for generating codes.

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

[0006] In a second aspect of the present disclosure, a device for generating code is provided. The device includes an orchestration process acquisition module configured to acquire an orchestration process drawn by a user on a canvas of a graphical user interface. The device also includes a code generation module configured to generate a process orchestration code and a process node code in a target language based on the orchestration process, wherein the process orchestration code represents process semantics, and the process node represents a task in the orchestration process. In addition, the device also includes an executable file package generation module configured to generate an executable file package in a target language based on the process orchestration code and the process node code.

[0007] In a third aspect of the present disclosure, an electronic device is provided, comprising a processor and a memory coupled to the processor, wherein the memory has instructions stored therein, and when the instructions are executed by the processor, the electronic device executes the method according to the first aspect.

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

[0009] The purpose of this Summary is to introduce a selection of concepts in a simplified form that are further described in the Detailed Description below. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0011] Figure 1 A schematic diagram illustrating an example environment in which some embodiments of the present disclosure may be implemented;

[0012] Figure 2 A flowchart of a method for generating code according to some embodiments of the present disclosure is shown;

[0013] Figure 3 A schematic diagram showing a process for generating an executable package according to some embodiments of the present disclosure;

[0014] Figure 4A A schematic diagram showing some embodiments of the present disclosure for generating an executable file package according to a serialized file obtained from a canvas;

[0015] Figure 4B A schematic diagram showing some embodiments of the present disclosure for generating process choreography code and process node code by using a process definition language;

[0016] Figure 4C A schematic diagram showing some embodiments of the present disclosure for optimizing generated process orchestration codes and process node codes;

[0017] Figure 4D A schematic diagram showing some embodiments of the present disclosure for optimizing generated process orchestration codes and process node codes at runtime;

[0018] Figure 4EA schematic diagram showing viewing, modifying or writing process node codes in some embodiments of the present disclosure is shown;

[0019] Figure 5 A block diagram showing an apparatus for generating code according to some embodiments of the present disclosure; and

[0020] Figure 6 A block diagram of an electronic device according to some embodiments of the present disclosure is shown.

[0021] Throughout the drawings, the same or similar reference numbers denote the same or similar elements. DETAILED DESCRIPTION

[0022] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, but rather these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0024] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects, unless explicitly stated. Other explicit and implicit definitions may also be included below.

[0025] As mentioned above, process orchestration plays an important role in the efficient operation of business systems, and there are many types of process orchestration paradigms. In related technologies, a process orchestration paradigm (such as Kubernetes) focuses on the life cycle and affinity of process nodes in process orchestration, but ignores the simplicity and understandability of process orchestration, and the entry threshold of this process orchestration paradigm is also high, which affects the experience of ordinary users. There is another process orchestration paradigm that 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 on a specific platform, is not compatible with various platforms, and lacks flexibility and adaptability.

[0026] According to an embodiment of the present disclosure, the orchestration process drawn by the user through the interface is automatically converted into the process orchestration code and process node code of the corresponding target language, wherein the process orchestration code is responsible for describing the structure of the entire process, and the process node code represents the specific tasks in the orchestration process. Furthermore, based on these generated process orchestration codes and process node codes, executable file packages in the target language are generated, and these executable file packages can be flexibly run directly in the corresponding operating environment, thereby realizing the orchestration process defined by the user through the canvas. This simple and easy-to-operate method of realizing process orchestration through canvas facilitates the code process orchestration operations of ordinary users, lowers the threshold for ordinary users to use code orchestration processes, and improves the user experience.

[0027] Figure 1 1 is a schematic diagram of an example environment 100 in which some embodiments of the present disclosure may be implemented. Figure 1 As shown, a user can draw an orchestration process 112 on a canvas of a graphical user interface (GUI) 110, which is a complete orchestration process defined by the user. For example, the user can drag and drop and connect different graphic elements to represent each link and step in the orchestration process, thereby building the framework and logic of the entire orchestration process. Each graphic element represents a process node, and each edge represents the dependency relationship between process nodes.

[0028] Specifically, users can select the required graphic elements from the graphic element library on the canvas, and drag and drop the selected graphic elements to the appropriate position on the canvas to lay out. In this process, users can customize the orchestration process by adjusting the size, position and properties of the graphic elements. After the graphic elements are placed, users can further configure the logic and function of each graphic element. Users can also preview the display effect of the orchestration process on the graphical user interface. In this way, users can quickly build the orchestration process through intuitive drag-and-drop operations and configurations. This not only lowers the technical threshold, but also improves development efficiency, allowing non-professional developers to participate in the development process.

[0029] Continue to refer Figure 1 ,like Figure 1 The illustrated area 114 shows the logic of the framework corresponding to the orchestration process 112 defined by the user through dragging and dropping. The user can quickly find the corresponding process node by entering the corresponding process node name in the search box, so as to adjust the process node.

[0030] Continue to refer Figure 1, the code generation tool 120 of the embodiment of the present disclosure can automatically convert the orchestration process expressed by the orchestration process 112 into an executable package 130 in a target language, where the target language can be other programming languages ​​such as Python, depending on the needs of the user. For example, the process orchestration code 132 and process node code 134 in the target language (such as Python) corresponding to the orchestration process 112 can be generated according to the user-defined orchestration process 112. The process orchestration code 132 is mainly responsible for describing the structure and semantics of the entire orchestration process 112, such as the start and end of the orchestration process, the order and dependencies between various links, etc. The process node code 134 represents the specific tasks in the orchestration process, and each node may correspond to one or more specific operations or functions.

[0031] In some embodiments, the generated process arrangement code 132 and process node code 134 of the target language can also be compiled into an executable package 130 of the target language. For example, the executable file package of the generated Python language can be combined with a Python third-party package for cross-platform execution. In some embodiments, the generated process arrangement code 132 and process node code 134 can also be compiled into an intermediate representation independent of the platform according to the needs of the user running on each platform, so that the execution of the cross-platform can be realized according to these intermediate representations. In some embodiments, the process arrangement code 132 and the process node code 134 of the target language can be debugged / optimized in real time in the process of generating relevant codes.

[0032] By converting the orchestration process drawn by the user into process orchestration code and process node code in the target language through a code generation tool, and further generating an executable file package in the target language, the user-defined orchestration process can be automatically generated into the code form of the target language, which lowers the threshold for user programming, and this executable file package improves the flexibility of user process orchestration.

[0033] The following will combine Figures 2 to 6 The process according to the embodiment of the present disclosure is described in detail. For ease of understanding, the specific data mentioned in the following description are exemplary and are not intended to limit the scope of protection of the present disclosure. It is understood that the embodiments described below may also include additional actions not shown and / or the actions shown may be omitted, and the scope of the present disclosure is not limited in this respect.

[0034] Figure 2 FIG. 2 is a flowchart of a method 200 for generating code according to some embodiments of the present disclosure. Figure 2, method 200 includes frame 202, frame 204 and frame 206. The execution subject of method 200 may be a device for generating code, and the device may be a server, such as a computing system, a single server, a distributed server, or a system of servers configured in the cloud, or an independent device or system. The device may be implemented in software and / or hardware. The method 200 will be described below with the execution subject being a device for generating code.

[0035] In block 202, the orchestration process drawn by the user on the canvas of the graphical user interface is obtained. Figure 1 The code generation tool 120 obtains the orchestration process 112 drawn by the user on the canvas of the graphical user interface. The orchestration process 112 is a complete orchestration process defined by the user through the graphical tool. The user can drag and drop and connect different graphic elements to represent each link and step in the orchestration process, thereby building the framework and logic of the entire orchestration process.

[0036] In box 204, based on the choreography process, the process choreography code and process node code in the target language are generated, wherein the process choreography code represents the process semantics, and the process node code represents the tasks in the choreography process. The code generation tool 120 can automatically generate the process choreography code 132 and process node code 134 in the corresponding target language based on the user-defined choreography process 112. Among them, the process choreography code is mainly responsible for describing the semantics of the entire process choreography, such as the start and end of the choreography process, the order and dependency between each link, etc. The process node code represents the specific tasks in the choreography process, for example, each node may correspond to one or more specific operations or functions.

[0037] In block 206, an executable file package in the target language is generated based on the process choreography code and the process node code. With the help of these generated process choreography codes and process node codes, an executable file package in the target language can be further generated. In some embodiments, this executable file package contains all necessary codes and resources and can be directly executed in the corresponding operating environment, thereby realizing the process choreography defined by the user through the choreography process 112.

[0038] In this embodiment, the orchestration process drawn by the user is automatically converted into the process orchestration code and process node code of the corresponding target language, wherein the process orchestration code is responsible for describing the structure of the entire process, and the process node code represents the specific tasks in the orchestration process. Furthermore, based on these generated process orchestration codes and process node codes, executable file packages in the target language are generated, and these executable file packages can be flexibly and directly run in the corresponding operating environment, thereby realizing the user-defined orchestration process. This simple and easy-to-operate process orchestration method lowers the threshold of development technology, facilitates the code process orchestration operation of ordinary users, and improves the user experience.

[0039] Figure 3 A schematic diagram 300 of a process for generating an executable file package in some embodiments of the present disclosure is shown. Given that Python has a good developer ecosystem and Python has a relatively complete set of third-party libraries that can be easily referenced by other Python projects, Python can be determined as the target language. The following will describe the process of using Python as the target language. Figure 3 .

[0040] refer to Figure 3 , at 310, the orchestration process 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, and the back-end refers to the server side of the Web application, which handles the core tasks of the Web application such as business logic, data processing, and data storage. There is an intermediate layer between the front-end and the back-end, for example, it can be BFF (Backend for Frontends). BFF is a back-end service designed specifically for the front-end. As an intermediate layer, it can process and convert data to adapt to different system components.

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

[0042] Combination Figure 4A , Figure 4A A schematic diagram 400A of some embodiments of the present disclosure for generating an executable file package according to a serialized file obtained from a canvas is shown. In some embodiments, the arrangement process expressed by the canvas of the front end can be stored in a code generation tool in a digital and serialized form, for example, data in JSON format can be stored in the code generation tool. Figure 4AAs shown, in the data structure 410A, a serialized file 412A about the user-defined orchestration process in JSON format stored between the front-end and back-end can be obtained.

[0043] Return to reference Figure 3 , at 320, the serialized file is converted into a process orchestration code and a process node code in a target language, and the generated process orchestration code and process node code in the target language are analyzed and optimized. For example, at 330, the serialized file in JSON format is converted into a process orchestration code and a process node code presented in Python language. Figure 4A In some embodiments, a serialized file in JSON format, for example, may be converted into a process definition language 414A through 416A. Next, the process definition language 414A is converted into a process orchestration code 422A and a process node code 424A. The process definition language is a structured language for describing and defining business logic. Specifically, in combination with Figure 4B , Figure 4B A schematic diagram of generating process choreography code and process node code 400B according to a process definition language according to some embodiments of the present disclosure is shown.

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

[0045] return Figure 4AAlternatively, in other embodiments, the serialized file 412A of the middle layer of the front end and the back end can be directly converted into a process arrangement code 422A and a process node code 424A through 418A, for example, the process arrangement code 422A and the process node code 424A can be converted into Python format. In some embodiments, taking JSON files as an example, the JSON files can be read by using the standard library or 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, after reading the JSON file, it can be parsed into a data structure that the program can operate. 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 predefined logic. The process arrangement code 422A and the process node code 424A form a programming paradigm 420A that reflects the arrangement process drawn by the user. Through such a programming paradigm 420A, it can be ensured that the corresponding generated code is trustworthy.

[0046] Back to Figure 3 When generating process arrangement code and process node code in Python form at 330, the code generated by this process can be analyzed and optimized at 320. These optimization processes are repeatable and iterative. Figure 4C , Figure 4C The schematic diagram of 400C for optimizing the generated process arrangement code and process node code of some embodiments of the present disclosure is shown. In 410C, a plurality of process nodes in the process arrangement can be identified by analyzing the directed acyclic graph in the data format, and then in 420C, the optimal optimizer for each process node is determined according to the types of the identified plurality of process nodes and the context of the generated process node code and the process arrangement code. The selectable optimizer can be an optimizer such as numba or Cython. In certain embodiments, it is possible to start running from a specified process node by setting a timestamp. In certain embodiments, the optimizer can also be expanded. In this way, the code generation tool can select different optimizers for different scenarios.

[0047] Continue to refer Figure 4CAt 430C, after identifying multiple process nodes, the process nodes can 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.

[0048] Return to reference Figure 3 At 340, the execution status of the code is observed and recorded at runtime. Figure 4A As shown, the programming paradigm 432A can be optimized at runtime 430A, that is, the generated process arrangement code 422A and process node code 424A can be optimized, so that a cross-platform execution file package can be generated at 440A. Specifically, combined with Figure 4D , Figure 4D A schematic diagram of some embodiments of the present disclosure for optimizing generated process orchestration code and process node code 400D at runtime is shown.

[0049] refer to Figure 4D At 410D, the type of the process node is inferred at runtime. In some embodiments, the type of the identified process node can be inferred at runtime of the process choreography code and the process node code.

[0050] Continue to refer Figure 4D , at 420D, it is determined whether the inference of the type of the process node fails. If it is detected that the type inference of a certain process node fails, the information of the input parameters received by the process node at runtime can be recorded at 430D, and then at 440D, the process arrangement code and the process node code are optimized based on the recorded information about the process node. In some embodiments, the optimization process can be implemented by a JIT compilation method, so that the execution speed and the compilation efficiency can be accelerated. If it is detected that the type inference of a node for a certain process is successful, it means that the generated code can run correctly and no further optimization is required for the time being.

[0051] return Figure 3, at 350, an executable file package is generated to run across platforms. For example, a Python package can be directly generated, which is 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 (for example, MLIR or LLVM IR) can be generated to achieve cross-platform or environment execution. For example, according to the type of each process node, a corresponding intermediate representation can be generated from the abstract syntax tree of each process node, and then these intermediate representations can be executed across platforms or environments (for example, a virtual environment of Cpython based on mamba) according to these intermediate representations. For example, it is also possible to run directly in relevant platforms or environments (such as: x86 / arm / risic-v / wasm, etc.) through these intermediate representations.

[0052] In some embodiments, the timestamp of each process node can also be inserted into the context of each process node code, so that the running status of the generated process orchestration code and process node code can be displayed in real time on the user panel during debugging or tuning, including the status of the runtime hardware. In this way, the user can monitor the hardware operation status and code running status in real time without knowing the hardware information, which enhances the user's controllability of process orchestration and improves the user experience.

[0053] Figure 4E FIG. 4 is a schematic diagram showing a method of viewing, modifying or processing node code 400E according to some embodiments of the present disclosure. Figure 4E , the left side of the graphical user interface 410E displays the arrangement process 420E drawn by the user. The user can further set the process node by clicking the graphic element of a process node. For example, clicking the graphic element "Script_1" representing the Script_1 process node can display the code editing page 430E on the graphical user interface 410E, so that the user can view the relevant code conveniently. In the code editing page 430E, the user can further modify or write the code about the process node. Through this method that allows users to view the code conveniently, 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 credible.

[0054] By converting the orchestration flow drawn by the user into the process orchestration code and process node code of the target language through the code generation tool, and further generating the executable file package of the target language, the user-defined orchestration flow can be automatically generated into the code form of the target language, which reduces the difficulty of user programming and improves the flexibility of user process orchestration. In addition, it can also ensure that the code generated for the user-defined orchestration flow according to the embodiment of the present disclosure is controllable and reliable.

[0055] Figure 5 FIG. 5 is a block diagram of an apparatus 500 for generating code according to some embodiments of the present disclosure. Figure 5 As shown, the apparatus 500 includes an orchestration process acquisition module 502, which is configured to acquire an orchestration process drawn by a user on a canvas of a graphical user interface. The apparatus 500 also includes a code generation module 504, which is configured to generate a process orchestration code and a process node code in a target language based on the orchestration process, wherein the process orchestration code represents the process semantics, and the process node represents a task in the orchestration process. In addition, the apparatus 500 also includes an executable file package generation module 506, which is configured to generate an executable file package in a target language based on the process orchestration code and the process node code.

[0056] In some embodiments, the code generation module includes: a first determination module, configured to determine a serialization file corresponding to the orchestration process based on the orchestration process; and a first generation module, configured to generate a process orchestration code and a process node code in a target language based on the serialization file.

[0057] In some embodiments, the first generation module includes: a second determination module, configured to determine the process definition language corresponding to the serialization file based on the serialization file; and a third determination module, configured to determine the process orchestration code and the process node code based on the process definition language.

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

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

[0060] In some embodiments, the executable file package generation module includes: a compilation module configured to compile the process orchestration code and the process node code into an executable file package based on the determined optimizer.

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

[0062] In some embodiments, the apparatus 500 includes an inference module configured to infer the type of a process node during the runtime of the process orchestration code and the process node code; a recording module configured to record information about input parameters received by the process node during runtime in response to detecting a failed inference of the type of the process node; and a second optimization module configured to optimize the process orchestration code and the process node code based on the information.

[0063] In some embodiments, the apparatus 500 further includes a display module configured to display the operation status of the process arrangement code and the process node code at the corresponding timestamp based on the timestamp of the process node.

[0064] Figure 6 1 is a block diagram of an electronic device 600 of some embodiments of the present disclosure, and the device 600 may be a device or apparatus described in the embodiments of the present disclosure. Figure 6 As shown, 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 to a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The CPU / GPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604. Although not shown in FIG. Figure 6 As shown in FIG. 6 , device 600 may further include a co-processor.

[0065] A number 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, speakers, etc.; a storage unit 608, such as a 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.

[0066] The various methods or processes described above may be performed by the CPU / GPU 601. For example, in some embodiments, the methods may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may 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 in the methods or processes described above may be performed.

[0067] In some embodiments, the methods and processes described above may be implemented as a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.

[0068] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.

[0069] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0070] The computer program instructions for performing the disclosed operation may be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, programming languages ​​including object-oriented programming languages, and conventional procedural programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In certain embodiments, by utilizing the state information of a computer-readable program instruction to customize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the present disclosure.

[0071] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0072] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0073] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the equipment, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous frames can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the functions involved. It should also be noted that each frame in the block diagram and / or flow chart, and the combination of frames in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0074] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for generating code, comprising: Get the orchestration flow drawn by the user on the canvas of the graphical user interface; Based on the choreography process, generating a process choreography code and a process node code in a target language, wherein the process choreography code represents process semantics, and the process node represents a task in the choreography process; as well as An executable file package in the target language is generated based on the process arrangement code and the process node code.

2. The method according to claim 1, wherein generating a process choreography code and a process node code in a target language based on the choreography process comprises: Based on the orchestration process, determining a serialization file corresponding to the orchestration process; as well as Based on the serialization file, the process arrangement code and the process node code in the target language are generated.

3. The method according to claim 2, wherein generating the process arrangement code and process node code in the target language based on the serialization file comprises: Based on the serialization file, determining a process definition language corresponding to the serialization file; as well as Based on the process definition language, the process choreography code and the process node code are determined.

4. The method according to claim 3, wherein determining the process choreography code and the process node code based on the process definition language comprises: Converting the process definition language into a directed acyclic graph in a data serialization format; as well as The process orchestration code is determined based on the directed acyclic graph in the data serialization format.

5. The method according to claim 4, further comprising: Identifying multiple process nodes by analyzing a directed acyclic graph of the data serialization format; Determine an optimizer for each process node based on the type of each process node and the context of the process choreography code and the context of the process node code, wherein the optimizer is used to optimize the process choreography code and the process node code; or Based on the type of each process node and the context of the process choreography code and the context of the process node code, an abstract syntax tree of each process node is updated.

6. The method according to claim 5, wherein generating the executable file package in the target language based on the process arrangement code and the process node code comprises: Based on the determined optimizer, the process orchestration code and the process node code are compiled into an executable file package.

7. The method according to claim 6, further comprising: Based on the type of each process node, generating a corresponding intermediate representation from the abstract syntax tree of each process node; as well as The executable file package is optimized based on the intermediate representation.

8. The method according to claim 1, further comprising: Inferring the type of the process node when the process arrangement code and the process node code are running; In response to detecting a failed inference of the type for the process node, recording information of input parameters received by the process node during runtime; as well as Based on the information, the process orchestration code and the process node code are optimized.

9. The method according to claim 8, further comprising: Based on the timestamp of the process node, the running status of the process arrangement code and the process node code at the corresponding timestamp is displayed.

10. A device for generating a code, comprising: An orchestration process acquisition module is configured to acquire a user-defined orchestration process drawn by a user on a canvas of a graphical user interface; A code generation module is configured to generate a process choreography code and a process node code in a target language based on the choreography process, wherein the process choreography code represents process semantics, and the process node represents a task in the choreography process; as well as The executable file package generation module is configured to generate an executable file package in the target language based on the process arrangement code and the process node code.

11. An electronic device, comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, wherein when the instructions are executed by the processor, the electronic device executes 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.