Source code construction method and system and storage medium
By acquiring and processing source code information, the target code process, resources and services are generated, and the problem of low construction efficiency of cross -structure assembly lines is solved, and target container images that quickly build and cross -platform compatibility are achieved.
Patent Information
- Application Number
- CN202411403253.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2044-10-09
AI Technical Summary
When cross-architecture pipelines deal with construction tasks of different architectures, the waiting time increases due to the dependencies between construction tasks, which reduces the efficiency of code construction.
By obtaining the source code information, the data information of each node of the pipeline is determined, including code process information, code resource information and code service information, and then the target code process, target code resources and target code services are generated, and finally the target container image of the source code is generated.
Through parallel processing simplified target code process, matching target code resources and sequence processing target code services, the source code construction is significantly accelerated, the efficiency of code construction is improved, and a variety of hardware architecture and operating systems are supported. Seamless operation.
Smart Images

Figure CN119336303A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of pipeline technology, and in particular to a source code construction method, system and storage medium. Background Art
[0002] With the development of cloud computing and containerization technology, software can be run on any platform that supports the technology. Specifically, the pipelined construction process can be used to decompose code construction, testing, and packaging tasks into multiple stages, and the above tasks can be performed in parallel on different hardware architectures and operating systems to generate binary code or container images compatible with different architectures, thereby achieving cross-platform operation of software.
[0003] However, when a cross-architecture pipeline processes build tasks of different architectures, the dependencies between different build tasks may also increase the waiting time during the build process, thereby reducing the efficiency of code building. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a source code construction method, system and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, a method for constructing source code is provided, the method comprising:
[0006] Acquire source code information, and determine each pipeline node corresponding to the source code based on the source code information;
[0007] Determining data information of each node in the pipeline;
[0008] Determining the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline;
[0009] Based on the target code process, target code resources and target code services, a target container image of the source code is generated.
[0010] Optionally, in an embodiment of the present disclosure, the data information includes: code flow information, code resource information and code service information.
[0011] Optionally, in an embodiment of the present disclosure, determining the target code flow, target code resources, and target code services corresponding to the source code based on the data information of each node in the pipeline includes:
[0012] Simplifying the code flow based on the code flow information of each node in the pipeline to obtain a target code flow;
[0013] Matching code resources based on code resource information of each node in the pipeline to obtain target code resources;
[0014] The code service is sequenced based on the code service information of each node in the pipeline to obtain a target code service.
[0015] Optionally, in an embodiment of the present disclosure, the code flow information includes source code information and weights of hidden layer vectors of each node; the code flow is simplified based on the code flow information of each node in the pipeline to obtain a target code flow, including:
[0016] Based on the source code information, determining a hidden layer vector corresponding to each node in the pipeline;
[0017] Based on the hidden layer vector and the weight of the hidden layer vector of each node, a vector value of the hidden layer state sequence of each node in the source code is obtained by calculation;
[0018] Based on the vector value of the hidden layer state sequence of each node, a decoder is used to obtain a decoded code value of each node;
[0019] The code flow is simplified based on the code values decoded from each node to obtain a target code flow.
[0020] Optionally, in an embodiment of the present disclosure, the code resource information includes source code information and a standard code vector; matching the code resources based on the code resource information of each node in the pipeline to obtain the target code resource includes:
[0021] Based on the source code information, determining a hidden layer vector corresponding to each node in the pipeline;
[0022] Based on the hidden layer vector, determining the maximum value among the hidden layer vectors of each node;
[0023] Based on the maximum value in the hidden layer vector of each node, obtaining the maximum pooled semantic vector of each node through global maximum pooling;
[0024] Based on the standard code vector and the semantic vector of each node, the cosine similarity of each node is obtained by calculation;
[0025] The code resources are matched based on the cosine similarity of each node to obtain the target code resource.
[0026] Optionally, in an embodiment of the present disclosure, the code service information includes a given generated value of each node code, an actual generated value of each node code, a given generated code length of each node, and an actual generated code length of each node; the code service is sequentially processed based on the code service information of each node in the pipeline to obtain a target code service, including:
[0027] Based on the given generated value of each node code, the actual generated value of each node code and the given generated code length of each node, the accuracy of each node code sequence is obtained by calculation;
[0028] Based on the given generated value of each node code, the actual generated value of each node code and the actual generated code length of each node, the recall rate of each node code sequence is obtained by calculation;
[0029] Based on the accuracy of the code sequence of each node and the recall rate of the code sequence of each node, a quality value of each node sequence is obtained by calculation;
[0030] The code service is sequence-processed based on the sequence quality values of each node to obtain a target code service.
[0031] Optionally, in the embodiment of the present disclosure, generating a target container image of the source code based on the target code process, the target code resource and the target code service includes:
[0032] Obtain a configuration file, wherein the configuration file includes instructions and configurations for building an image;
[0033] Based on the target code process, target code resources and target code services, a target container image of the source code is generated through the configuration file;
[0034] The target container image is stored locally and pushed to the remote image repository.
[0035] According to a second aspect of an embodiment of the present disclosure, a source code construction system is provided, the system comprising:
[0036] A first determination module, configured to obtain source code information, and determine each pipeline node corresponding to the source code based on the source code information;
[0037] A second determination module, used to determine data information of each node in the pipeline;
[0038] A third determination module, for determining the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline;
[0039] A generation module is used to generate a target container image of the source code based on the target code process, target code resources and target code services.
[0040] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0041] processor;
[0042] a memory for storing processor-executable instructions;
[0043] The processor is configured to implement the method described in the first aspect above.
[0044] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, wherein the computer storage medium stores computer-executable instructions; after the computer-executable instructions are executed by a processor, the method described in the first aspect above can be implemented.
[0045] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0046] The present disclosure proposes a method, system and storage medium for constructing source code, the method comprising obtaining source code information, and determining each node of the pipeline corresponding to the source code based on the source code information; determining the data information of each node in the pipeline; determining the target code process, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline; generating a target container image of the source code based on the target code process, target code resources and target code services. Thus, the present disclosure can determine the simplified target code process, the target code resources after matching the construction and the target code services after sequence processing based on the data information of each node in the pipeline, decompose the construction task and perform sequence processing, so that the source code construction speed can be accelerated by parallel processing, and the code construction efficiency is improved. At the same time, the present disclosure can support a variety of hardware architectures and operating systems, so that the source code can run seamlessly on different platforms, reducing the workload of adapting to different platforms.
[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0049] Figure 1 is a flowchart of a source code construction method according to some embodiments of the present disclosure;
[0050] Figure 2 is a schematic diagram of a structure of a source code construction system according to some embodiments of the present disclosure;
[0051] Figure 3 It is a block diagram of an electronic device suitable for executing a source code construction method according to some embodiments of the present disclosure. DETAILED DESCRIPTION
[0052] Some embodiments of the present disclosure will be described in detail here, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. Various changes, modifications and equivalents of the methods, systems and / or systems described herein will become apparent after understanding the present disclosure. For example, the order of operations described herein is merely an example and is not limited to those orders set forth herein, but can be changed as becomes apparent after understanding the present disclosure, except for operations that must be performed in a specific order. In addition, for clarity and brevity, descriptions of features known in the art may be omitted.
[0053] The embodiments described in some embodiments of the present disclosure below do not represent all embodiments consistent with the present disclosure. Instead, they are only examples of systems and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0054] Figure 1 is a flow chart of a source code construction method according to some embodiments of the present disclosure, such as Figure 1 As shown, the method may include the following steps:
[0055] Step 101: Obtain source code information, and based on the source code information, determine each pipeline node corresponding to the source code.
[0056] It should be noted that the execution subject of the above-mentioned source code construction method is the source code construction system, and the source code construction system can be implemented by software and / or hardware. The source code construction system in this embodiment can be configured in an electronic device.
[0057] In this example embodiment, the electronic device may include devices such as terminal devices and servers, and this embodiment does not limit the electronic device.
[0058] In the embodiment of the present disclosure, the above source code information may include source code information of ARM architecture and X86 architecture.
[0059] Among them, in the embodiment of the present disclosure, after the source code information is obtained, a database can be constructed based on the source code information, and the source code information can be stored in the database.
[0060] Furthermore, in the embodiment of the present disclosure, after obtaining the source code information, the processing process of the source code can be decomposed into n nodes based on the source code information, and each of the n nodes can be determined as the corresponding pipeline node i, where i = 1, 2, 3, ..., i, ..., n, and the output of each node step is used as the input of the next node step.
[0061] Step 102: Determine the data information of each node in the pipeline.
[0062] In the embodiment of the present disclosure, the above data information may include: code flow information, code resource information and code service information.
[0063] Among them, in the embodiment of the present disclosure, the above-mentioned code flow information may include source code information and the weight of the hidden layer vector of each node; the above-mentioned code resource information may include source code information and standard code vectors; the above-mentioned code service information may include the given generated value of each node code, the actual generated value of each node code, the given generated code length of each node and the actual generated code length of each node.
[0064] Furthermore, in the disclosed embodiments, the data information of each node in the above pipeline can be determined through expert experience or existing public tools.
[0065] Step 103: Based on the data information of each node in the pipeline, determine the target code flow, target code resources and target code services corresponding to the source code.
[0066] In the disclosed embodiment, after obtaining the data information of each node in the pipeline through the above steps, the target code flow, target code resources and target code services corresponding to the source code can be determined based on the data information of each node in the pipeline.
[0067] Specifically, in the embodiment of the present disclosure, the method for determining the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline may include the following steps:
[0068] Step 1031, simplifying the code flow based on the code flow information of each node in the pipeline to obtain a target code flow;
[0069] Step 1032: Match the code resources based on the code resource information of each node in the pipeline to obtain the target code resources;
[0070] Step 1033: perform sequence processing on the code service based on the code service information of each node in the pipeline to obtain the target code service.
[0071] Among them, in the embodiment of the present disclosure, the method for simplifying the code flow based on the code flow information of each node in the pipeline to obtain the target code flow may include the following steps:
[0072] Step 10311: Determine the hidden layer vector corresponding to each node in the pipeline based on the source code information;
[0073] Step 10312: Based on the hidden layer vector and the weight of the hidden layer vector of each node, obtain the vector value of the hidden layer state sequence of each node in the source code by calculation;
[0074] Step 10313: Based on the vector value of the hidden layer state sequence of each node, obtain the decoded code value of each node through a decoder;
[0075] Step 10314: Simplify the code flow based on the code values after decoding each node to obtain the target code flow.
[0076] In the embodiment of the present disclosure, the initial vectors x1, x2, ..., x of each node in the pipeline can be determined based on the source code information. i , ..., x n , and encode the initial vector of each node in the pipeline into the corresponding hidden layer vector h1, h2, ..., h i , ..., h n .
[0077] Furthermore, in the embodiment of the present disclosure, the method for obtaining the vector value of the hidden layer state sequence of each node in the source code by calculation based on the hidden layer vector and the weight of the hidden layer vector of each node may include: obtaining the vector value of the hidden layer state sequence of each node in the source code by calculation based on the hidden layer vector and the weight of the hidden layer vector of each node by a first formula, wherein the first formula is:
[0078] z i =ω i ×h i
[0079] Among them, ω i is the weight of the hidden layer vector of node i, z i is the vector value of the hidden layer state sequence of node i.
[0080] Further, in the embodiment of the present disclosure, the method of obtaining the decoded code value of each node through a decoder based on the vector value of the hidden layer state sequence of each node may include: obtaining the decoded code value of each node through a decoder using a second formula based on the vector value of the hidden layer state sequence of each node, wherein the second formula is:
[0081] w i =log(yi-1 ×s i × i )
[0082] Among them, y i-1 is the input vector of the previous node i-1 of node i, s i is the hidden layer state of the decoder of node i, w i It is the decoded code value of the i-node.
[0083] Furthermore, in the embodiment of the present disclosure, after obtaining the decoded code value of each node through the above steps, the decoded code value of each node can be compared, and the nodes with the same code value can be deleted, so as to simplify the code flow, and the simplified code flow can be determined as the target code flow.
[0084] Furthermore, in the embodiment of the present disclosure, the method for matching code resources based on the code resource information of each node in the pipeline to obtain the target code resource may include the following steps:
[0085] Step 10321: Determine the hidden layer vector corresponding to each node in the pipeline based on the source code information;
[0086] Step 10322: Based on the hidden layer vector, determine the maximum value in the hidden layer vector of each node;
[0087] Step 10323: Based on the maximum value in the hidden layer vector of each node, obtain the maximum pooled semantic vector of each node through global maximum pooling;
[0088] Step 10324: Based on the standard code vector and the semantic vector of each node, the cosine similarity of each node is obtained by calculation;
[0089] Step 10325: Match the code resources based on the cosine similarity of each node to obtain the target code resources.
[0090] In the embodiment of the present disclosure, the hidden layer vectors h1, h2, ..., h corresponding to the initial vectors of each node can be i , ..., h n The maximum value in is determined as the maximum value in the hidden layer vector of each node. For example, max(h i ) is the hidden layer vector h of node i i The maximum value in .
[0091] And, in the embodiment of the present disclosure, the method for obtaining the maximum pooled semantic vector of each node through global maximum pooling based on the maximum value in the hidden layer vector of each node may include: obtaining the maximum pooled semantic vector of each node through global maximum pooling using a third formula based on the maximum value in the hidden layer vector of each node, wherein the third formula is:
[0092]
[0093] in, is the maximum pooled semantic vector of node i.
[0094] Further, in the embodiment of the present disclosure, the method for obtaining the cosine similarity of each node by calculation based on the standard code vector and the semantic vector of each node may include: obtaining the cosine similarity of each node by calculation based on the standard code vector and the semantic vector of each node by a fourth formula, wherein the fourth formula is:
[0095]
[0096] in, is the cosine similarity between the standard code and the i-node, is the standard code vector.
[0097] Furthermore, in the embodiment of the present disclosure, after the cosine similarity of each node is obtained through the above steps, the cosine similarity of each node can be compared with a preset threshold, and the nodes whose cosine similarity is greater than or equal to the preset threshold are automatically matched with resources to obtain the target code resource.
[0098] Furthermore, in the embodiment of the present disclosure, the method for performing sequence processing on the code service based on the code service information of each node in the pipeline to obtain the target code service may include the following steps:
[0099] Step 10331: Based on the given generated value of each node code, the actual generated value of each node code and the given generated code length of each node, the accuracy of the code sequence of each node is obtained by calculation;
[0100] Step 10332: Based on the given generated value of each node code, the actual generated value of each node code and the actual generated code length of each node, the recall rate of each node code sequence is calculated;
[0101] Step 10333: Based on the accuracy of each node code sequence and the recall rate of each node code sequence, the quality value of each node sequence is obtained by calculation;
[0102] Step 10334: perform sequence processing on the code service based on the sequence quality value of each node to obtain the target code service.
[0103] In the embodiment of the present disclosure, the method for obtaining the accuracy of the code sequence of each node by calculation based on the given generated value of each node code, the actual generated value of each node code and the given generated code length of each node may include: obtaining the accuracy of the code sequence of each node by calculation based on the given generated value of each node code, the actual generated value of each node code and the given generated code length of each node by the fifth formula, wherein the fifth formula is:
[0104]
[0105] in, is the i-node code sequence precision, X i Given the generated value for the i-node code, Y i The actual generated value for the i-node code, The generated code length is given for the i-node.
[0106] And, in the embodiment of the present disclosure, the method for obtaining the recall rate of each node code sequence by calculation based on the given generated value of each node code, the actual generated value of each node code and the actual generated code length of each node may include: based on the given generated value of each node code, the actual generated value of each node code and the actual generated code length of each node, obtaining the recall rate of each node code sequence by calculation through the sixth formula, wherein the sixth formula is:
[0107]
[0108] in, is the i-node code sequence recall rate, The actual generated code length for the i-node.
[0109] Further, in the embodiment of the present disclosure, the method for obtaining the quality value of each node sequence by calculation based on the accuracy of each node code sequence and the recall rate of each node code sequence may include: obtaining the quality value of each node sequence by calculation based on the accuracy of each node code sequence and the recall rate of each node code sequence by a seventh formula, wherein the seventh formula is:
[0110]
[0111] Among them, M i is the quality value of the i-node sequence,
[0112] Furthermore, in the embodiment of the present disclosure, after obtaining the quality value of each node sequence through the above steps, the node sequence can be reconstructed in descending order according to the quality value of each node sequence to obtain the target code service.
[0113] Step 104: Generate a target container image of the source code based on the target code process, target code resources, and target code services.
[0114] In the disclosed embodiment, after obtaining the target code process, target code resources and target code services through the above steps, a target container image of the source code can be generated based on the target code process, target code resources and target code services.
[0115] Specifically, in the embodiment of the present disclosure, the method for generating a target container image of a source code based on a target code process, a target code resource, and a target code service may include the following steps:
[0116] Step 1041: Obtain a configuration file, wherein the configuration file includes instructions and configurations for building an image.
[0117] Step 1042: Generate a target container image of the source code through a configuration file based on the target code process, target code resources, and target code services;
[0118] Step 1043: Store the target container image locally and push it to the remote image repository.
[0119] Among them, in the embodiment of the present disclosure, the above-mentioned configuration file can be a configuration file based on Dockerfile, wherein Dockerfile is a text file that contains instructions and configurations required to build an image.
[0120] Furthermore, in the embodiment of the present disclosure, after obtaining the configuration file through the above steps, the image can be packaged based on the simplified target code process, the target code resources after matching and construction, and the target code service after sequence processing as the starting point to obtain the target container image, and the target container image can be stored locally and pushed to the remote image repository.
[0121] Further, in the disclosed embodiment, after obtaining the target container image through the above steps, the container can be installed and run on the target architecture, and then the target container image can be pulled from the container image repository. After running the target container image using the container command, the application can be started and run on the target architecture. The target architecture can be ARM architecture and X86 architecture, so that the QEMU virtualization technology can realize the coordinated operation of ARM architecture and X86 architecture.
[0122] The present disclosure proposes a method for constructing source code, which includes obtaining source code information, and based on the source code information, determining each node of the pipeline corresponding to the source code; determining the data information of each node in the pipeline; determining the target code process, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline; and generating a target container image of the source code based on the target code process, target code resources and target code services. Thus, the present disclosure can determine the simplified target code process, the target code resources after matching the construction and the target code services after sequence processing based on the data information of each node in the pipeline, decompose the construction task and perform sequence processing, so that the source code construction speed can be accelerated by parallel processing, and the code construction efficiency is improved. At the same time, the present disclosure can support a variety of hardware architectures and operating systems, so that the source code can run seamlessly on different platforms, reducing the workload of adapting to different platforms.
[0123] Figure 2 A source code construction system is shown according to some embodiments of the present disclosure, such as Figure 2 As shown, the system may include:
[0124] A first determination module 201 is used to obtain source code information and determine each pipeline node corresponding to the source code based on the source code information;
[0125] A second determination module 202, used to determine data information of each node in the pipeline;
[0126] The third determination module 203 is used to determine the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline;
[0127] The generation module 204 is used to generate a target container image of the source code based on the target code process, the target code resources and the target code service.
[0128] In the disclosed embodiment, the first determination module 201 includes a code database construction module and a pipeline instruction input module. The code database construction module is used to obtain source code information, and to construct a database based on the source code information, and to store the source code information in the database; the pipeline instruction input module is used to determine each pipeline node corresponding to the source code based on the source code information.
[0129] Optionally, in an embodiment of the present disclosure, the above data information includes: code flow information, code resource information and code service information.
[0130] Optionally, in the embodiment of the present disclosure, the third determination module 203 includes a code flow orchestration module, a code resource orchestration module, and a code service orchestration module. The code flow orchestration module is used to simplify the code flow based on the code flow information of each node in the pipeline to obtain the target code flow; the code resource orchestration module is used to match the code resources based on the code resource information of each node in the pipeline to obtain the target code resources; the code service orchestration module is used to sequence the code services based on the code service information of each node in the pipeline to obtain the target code service.
[0131] Optionally, in an embodiment of the present disclosure, the code flow information includes source code information and weights of hidden layer vectors of each node; the code flow arrangement module is specifically used to:
[0132] Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline;
[0133] Based on the hidden layer vector and the weight of each node's hidden layer vector, the vector value of the hidden layer state sequence of each node in the source code is obtained by calculation;
[0134] Based on the vector value of the hidden layer state sequence of each node, the decoded code value of each node is obtained through the decoder;
[0135] The code flow is simplified based on the code values decoded at each node to obtain the target code flow.
[0136] Optionally, in an embodiment of the present disclosure, the code resource information includes source code information and standard code vectors; the code resource arrangement module is specifically used to:
[0137] Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline;
[0138] Based on the hidden layer vector, determine the maximum value in the hidden layer vector of each node;
[0139] Based on the maximum value of the hidden layer vector of each node, the maximum pooled semantic vector of each node is obtained through global maximum pooling;
[0140] Based on the standard code vector and the semantic vector of each node, the cosine similarity of each node is calculated;
[0141] The code resources are matched based on the cosine similarity of each node to obtain the target code resources.
[0142] Optionally, in an embodiment of the present disclosure, the code service information includes a given generated value of each node code, an actual generated value of each node code, a given generated code length of each node, and an actual generated code length of each node; the code service orchestration module is specifically used to:
[0143] Based on the given generated value of each node code, the actual generated value of each node code and the given generated code length of each node, the accuracy of each node code sequence is obtained by calculation;
[0144] Based on the given generated value of each node code, the actual generated value of each node code and the actual generated code length of each node, the recall rate of each node code sequence is calculated;
[0145] Based on the accuracy of each node code sequence and the recall rate of each node code sequence, the quality value of each node sequence is obtained by calculation;
[0146] The code service is sequenced based on the sequence quality value of each node to obtain the target code service.
[0147] Optionally, in the embodiment of the present disclosure, the generation module includes a container image packaging module and a cross-architecture operation module. The container image packaging module is specifically used to:
[0148] Obtain a configuration file, where the configuration file includes instructions and configurations for building an image;
[0149] Generate the target container image of the source code through the configuration file based on the target code process, target code resources and target code services;
[0150] Store the target container image locally and push it to the remote image repository.
[0151] And, the above-mentioned cross-architecture running module is used to install and run the container on the target architecture, pull the target container image from the container image repository, and use the container command to run the target container image, so that the application is started and run on the target architecture.
[0152] In one or more embodiments of the present disclosure, source code information is obtained, and based on the source code information, each node of the pipeline corresponding to the source code is determined; data information of each node in the pipeline is determined; based on the data information of each node in the pipeline, the target code process, target code resources and target code services corresponding to the source code are determined; based on the target code process, target code resources and target code services, a target container image of the source code is generated. Thus, the present disclosure can determine the simplified target code process, the target code resources after matching the construction and the target code services after sequence processing based on the data information of each node in the pipeline, decompose the construction task and perform sequence processing, so that the source code construction speed can be accelerated by parallel processing, and the code construction efficiency is improved. At the same time, the present disclosure can support a variety of hardware architectures and operating systems, so that the source code can run seamlessly on different platforms, reducing the workload of adapting to different platforms.
[0153] like Figure 3As shown, the electronic device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 302 or a computer program loaded from a storage unit 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 can also be stored. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0154] A number of components in the electronic device 300 are connected to the I / O interface 305, including: an input unit 308, such as a keyboard, a mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the electronic device 300 to exchange information / data with other electronic devices through a computer network such as the Internet and / or various telecommunication networks.
[0155] The computing unit 301 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 301 performs the various methods and processes described above, such as the construction method of the source code. For example, in some embodiments, the construction method of the source code may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 300 via ROM 302 and / or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the construction method of the source code described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to execute the construction method of the source code by any other appropriate means (e.g., by means of firmware).
[0156] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input system, and at least one output system, and transmit data and instructions to the storage system, the at least one input system, and the at least one output system.
[0157] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing system, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0158] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, system, or electronic device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or electronic device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage electronic device, a magnetic storage electronic device, or any suitable combination of the foregoing.
[0159] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display system (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing system (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of systems can also be used to provide interaction with a user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0160] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0161] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0162] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0163] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for constructing source code, characterized in that: The method comprises: Acquire source code information, and determine each pipeline node corresponding to the source code based on the source code information; Determining data information of each node in the pipeline; Determining the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline; Based on the target code process, target code resources and target code services, a target container image of the source code is generated.
2. The method according to claim 1, characterized in that The data information includes: code flow information, code resource information and code service information.
3. The method according to claim 2, characterized in that The determining, based on the data information of each node in the pipeline, the target code flow, target code resources and target code services corresponding to the source code includes: Simplifying the code flow based on the code flow information of each node in the pipeline to obtain a target code flow; Matching code resources based on code resource information of each node in the pipeline to obtain target code resources; The code service is sequenced based on the code service information of each node in the pipeline to obtain a target code service.
4. The method according to claim 3, characterized in that The code flow information includes source code information and the weight of the hidden layer vector of each node; The code flow is simplified based on the code flow information of each node in the pipeline to obtain a target code flow, including: Based on the source code information, determining a hidden layer vector corresponding to each node in the pipeline; Based on the hidden layer vector and the weight of the hidden layer vector of each node, a vector value of the hidden layer state sequence of each node in the source code is obtained by calculation; Based on the vector value of the hidden layer state sequence of each node, obtaining the decoded code value of each node through a decoder; The code flow is simplified based on the code values decoded from each node to obtain a target code flow.
5. The method according to claim 3, characterized in that The code resource information includes source code information and standard code vectors; the code resource is matched based on the code resource information of each node in the pipeline to obtain the target code resource, including: Based on the source code information, determining a hidden layer vector corresponding to each node in the pipeline; Based on the hidden layer vector, determining the maximum value among the hidden layer vectors of each node; Based on the maximum value in the hidden layer vector of each node, obtaining the maximum pooled semantic vector of each node through global maximum pooling; Based on the standard code vector and the semantic vector of each node, the cosine similarity of each node is obtained by calculation; The code resources are matched based on the cosine similarity of each node to obtain the target code resource.
6. The method according to claim 3, characterized in that The code service information includes a given generated value of each node code, an actual generated value of each node code, a given generated code length of each node, and an actual generated code length of each node; The code service is processed sequentially based on the code service information of each node in the pipeline to obtain the target code service, including: Based on the given generated value of each node code, the actual generated value of each node code and the given generated code length of each node, the accuracy of each node code sequence is obtained by calculation; Based on the given generated value of each node code, the actual generated value of each node code and the actual generated code length of each node, the recall rate of each node code sequence is obtained by calculation; Based on the accuracy of the code sequence of each node and the recall rate of the code sequence of each node, a quality value of each node sequence is obtained by calculation; The code service is sequence-processed based on the sequence quality values of each node to obtain a target code service.
7. The method according to claim 1, characterized in that The generating a target container image of the source code based on the target code process, the target code resources and the target code service includes: Obtain a configuration file, wherein the configuration file includes instructions and configurations for building an image; Based on the target code process, target code resources and target code services, a target container image of the source code is generated through the configuration file; The target container image is stored locally and pushed to the remote image repository.
8. A source code construction system, characterized in that: The system comprises: A first determination module, configured to obtain source code information, and determine each pipeline node corresponding to the source code based on the source code information; A second determination module, used to determine data information of each node in the pipeline; A third determination module, for determining the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline; A generation module is used to generate a target container image of the source code based on the target code process, target code resources and target code services.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory in communication with the at least one processor, wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, wherein the computer storage medium stores computer-executable instructions; after the computer-executable instructions are executed by a processor, the method according to any one of claims 1 to 7 can be implemented.
Citation Information
Patent Citations
Dependent packet information acquisition method and device, equipment and computer medium
CN112084391A
Source code cross-architecture synchronous construction method and device, equipment and storage medium
CN113849159A
Container configuration code completion method, device and equipment based on multi-task learning
CN118151982A
Contextual image translation using neural networks
WO2021242645A1