CN114265643A - Method and device for executing code, electronic equipment and storage medium - Google Patents

Method and device for executing code, electronic equipment and storage medium Download PDF

Info

Publication number
CN114265643A
CN114265643A CN202111545287.2A CN202111545287A CN114265643A CN 114265643 A CN114265643 A CN 114265643A CN 202111545287 A CN202111545287 A CN 202111545287A CN 114265643 A CN114265643 A CN 114265643A
Authority
CN
China
Prior art keywords
execution
code
code modules
result information
historical
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111545287.2A
Other languages
Chinese (zh)
Inventor
齐建朝
章东升
孙康
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202111545287.2A priority Critical patent/CN114265643A/en
Publication of CN114265643A publication Critical patent/CN114265643A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for executing code, an electronic device, and a storage medium. According to the control method provided by the embodiment of the disclosure, the method comprises the following steps: acquiring a composite code execution request, wherein the composite code execution request is used for requesting to execute at least two code modules; acquiring historical execution result information of at least two code modules; determining the execution sequence of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules; at least two code modules are executed based on an execution order.

Description

Method and device for executing code, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for executing a code, an electronic device, and a storage medium.
Background
Often, a service request involves multiple service modules. For example, taking a marketing scenario as an example, a business request may involve Remote Procedure Calls (RPCs), marketing asset acquisitions, inventory deductions, participation limit determinations, marketing rule executions, and so on.
When multiple business modules need to be executed, the code writer typically organizes these different business modules in a fixed order by hard-coding for invocation. However, with the change of the execution environment such as the development iteration of the service system, the continuous rising of the system flow, etc., the hard coding mode of the service execution logic is difficult to adapt to the dynamic development of the service system well, which easily causes the problem of system performance.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided a method of executing code, comprising:
acquiring a composite code execution request, wherein the composite code execution request is used for requesting to execute at least two code modules;
obtaining historical execution result information of the at least two code modules;
determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules;
executing the at least two code modules based on the execution order.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided an apparatus for executing code, including:
a request acquisition unit, configured to acquire a composite code execution request, where the composite code execution request is used to request execution of at least two code modules;
a result obtaining unit, configured to obtain historical execution result information of the at least two code modules;
a policy determining unit, configured to determine an execution order of the at least two code modules based on the historical execution result information and a dependency relationship of the at least two code modules;
a code execution unit for executing the at least two code modules based on the execution order.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device including: at least one memory and at least one processor; wherein the memory is configured to store program code, and the processor is configured to call the program code stored in the memory to cause the electronic device to execute a method of executing code provided according to one or more embodiments of the present disclosure.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a non-transitory computer storage medium storing program code which, when executed by a computer device, causes the computer device to perform a method of executing code provided according to one or more embodiments of the present disclosure.
According to one or more embodiments of the present disclosure, by determining the execution order of each code module based on the historical execution result information and the dependency relationship of each code module, the execution order of each code module can be dynamically adjusted, so that the execution efficiency of the code execution request can be improved, and the system can continuously perform self-optimization based on the past code execution effect.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
FIG. 1 is a flow diagram of a method of executing code provided in accordance with an embodiment of the present disclosure;
FIG. 2 is a block diagram of a system for executing code according to an embodiment of the present disclosure;
3A-3B are schematic diagrams of an execution sequence of code modules provided in accordance with embodiments of the present disclosure;
FIG. 4 is a schematic structural diagram of an apparatus for executing code according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the steps recited in the embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Moreover, embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The term "responsive to" and related terms mean that one signal or event is affected to some extent, but not necessarily completely or directly, by another signal or event. If an event x occurs "in response" to an event y, x may respond directly or indirectly to y. For example, the occurrence of y may ultimately result in the occurrence of x, but other intermediate events and/or conditions may exist. In other cases, y may not necessarily result in the occurrence of x, and x may occur even though y has not already occurred. Furthermore, the term "responsive to" may also mean "at least partially responsive to".
The term "determining" broadly encompasses a wide variety of actions that can include obtaining, calculating, computing, processing, deriving, investigating, looking up (e.g., looking up in a table, a database or another data structure), ascertaining and the like, and can also include receiving (e.g., receiving information), accessing (e.g., accessing data in a memory) and the like, as well as resolving, selecting, choosing, establishing and the like, and the like. Relevant definitions for other terms will be given in the following description. Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
For the purposes of this disclosure, the phrase "a and/or B" means (a), (B), or (a and B).
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Referring to fig. 1, fig. 1 shows a flowchart of a method 100 for executing code according to an embodiment of the present disclosure, where the method 100 includes:
step S120: a composite code execution request is obtained, the composite code execution request requesting execution of at least two code modules.
Illustratively, the code modules may be referenced by other code modules or programs, each of which may correspond to at least one business function. By modularizing the code, the reusability, manageability, readability and reliability of the code may be improved. Taking marketing scenario as an example, the composite code execution request may be a request for acquiring marketing information, which involves executing business logic such as remote procedure call, marketing asset acquisition, inventory deduction, participation limitation judgment, marketing rule execution, and the like, wherein each business logic may correspond to one code module.
Step S140: and acquiring historical execution result information of the at least two code modules.
For example, the historical execution result information of the code module may be the execution result information when the code module is executed one or more times within a past preset period.
In some embodiments, the historical execution result information of the code module may include an execution time of the code module, an execution pass rate of the code module, or an execution failure rate of the code module.
For example, the elapsed time of execution of a code module may be used to characterize the length of time required to execute the code module; the execution passing rate of the code modules is applicable to but not limited to the rule modules, the rule modules are used for judging whether the requests to be processed can pass or filter the requests to be processed, the higher the passing rate of one rule module is, the more the requests to be processed need to be processed subsequently, for example, if there are 100 requests to be processed and the passing rate of the rule module is 90%, the more the 100 requests pass 90 requests after being processed by the rule module, the 90 requests still need to be processed by other code modules, and if the passing rate of the rule module is lower, the less the requests need to be processed subsequently, so that the processing resources and the processing time of the system can be saved; the execution failure rate of the code module may be used to reflect whether the code module was successfully executed.
Step S160: determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules.
Illustratively, dependencies include reference relationships between code modules, e.g., class A depends on class B if class B must be referenced to accomplish some function.
In some embodiments, the execution priority of each code module may be determined based on the historical execution result information of the code modules and the dependency relationship between the code modules, and the higher the execution priority, the higher the execution priority. Illustratively, the longer the execution of a certain code module takes, the lower the execution priority; the lower the execution passing rate of a certain code module is, the higher the execution priority is; the higher the execution failure rate of a certain code module is, the lower the execution priority of the code module is; the higher the execution priority of a code module if it is relied upon.
In some embodiments, a corresponding weight may be preset for each index for determining the execution order of the code modules, for example, corresponding weight coefficients are respectively set for the execution time of the code modules, the execution passing rate of the code modules, and the execution failure rate of the code modules, and then the final priority of the code modules is obtained by using weighted summation.
In some embodiments, the at least two modules may be spliced in the determined execution order for final execution.
Step S180: executing the at least two code modules based on the execution order.
Compared with the solidified code module execution sequence set by hard coding, the method for executing the code provided by one or more embodiments of the present disclosure may dynamically adjust the execution sequence of each code module by determining the execution sequence of each code module based on the historical execution result information and the dependency relationship of each code module, so as to improve the execution efficiency of the code execution request, and enable the system to continuously perform self-optimization based on the past code execution effect.
In some embodiments, step S140 includes:
step A1: acquiring code execution logs of the at least two code modules;
step A2: determining historical execution result information of the at least two code modules based on the code execution log.
Illustratively, one or more code execution logs obtained over a period of time may be aggregated and categorized to count historical execution results for each code module, including but not limited to execution time consumption, execution pass rate, or execution failure rate of the code module.
It should be noted that the code execution log may include a system log automatically generated by the system, or other logs for recording the execution condition of the code, and the disclosure is not limited herein.
In some embodiments, the method 100 further comprises:
step S190: and recording the execution result information of the at least two code modules for later determining the execution sequence of the code modules based on the execution result information.
In this embodiment, when responding to the execution request of the present composite code, the execution result information of each code module is recorded, so that when the execution sequence of the code modules is determined later (for example, step S140), the execution result information recorded this time may be referred to, that is, the determination of the execution logic of the subsequent code modules may be guided, and the loop is repeated in this way to form a closed loop, so that the whole system can be continuously optimized by itself.
In some embodiments, step S190 includes:
step B1: and generating a code execution log, wherein the code execution log comprises the execution sequence and the execution result information of the at least two code modules.
In this embodiment, the code execution log includes the execution order of the code modules in addition to the execution time consumption, the execution passing rate, or the execution failure rate of each code module, so that the code execution log is preferentially used when the execution order of the code modules is determined later.
In some embodiments, step S160 includes:
and determining the execution sequence of the at least two code modules based on a preset code initial execution sequence, the historical execution result information and the dependency relationship of the at least two code modules.
For example, the initial execution order of the code may be manually preset by a code writer, and may be used as an initial reference for determining the execution order of the code modules when the system initially responds to the composite code execution request, and may be adjusted based on the historical execution result information to adjust the execution priority of each code module when the system responds to the composite code execution request again.
According to one or more embodiments of the disclosure, execution logs generated in the execution process of the code modules are collected, the execution results of the code modules are analyzed in real time, and the determination of the execution sequence of the code modules is fed back and guided, so that the system is in a continuous self-optimization state, the execution flow of the solidified code modules can be broken away, the execution of the code modules is dynamic, the execution sequence of the code modules is automatically adjusted during the operation of the system, and thus, the codes can be arranged in a more reasonable manner, and the system performance is improved.
Referring to fig. 2, fig. 2 illustrates a business system provided according to an embodiment of the present disclosure. The business system 200 may include a business module execution subsystem 210, a business module analysis subsystem 220, and a business module decision subsystem 230.
When the service system 200 receives a service request for executing the compound code, the service request may be delivered to the service module execution subsystem 210, and the service module execution subsystem 210 requests the service module decision subsystem 230 based on the service request.
The service module decision subsystem 230 decides the priority of the service module to be executed according to the initial service module processing sequence and the preset module parameters, decides the service module execution strategy according to the dependency relationship among the service modules, and sends the execution strategy to the service module execution subsystem 210. Referring to fig. 3A-3B, different traffic module execution policies are shown.
The service module execution subsystem 210 performs actual operation on the code blocks according to the execution strategy, assembles and returns execution results after execution is completed, and sends execution logs to the service module analysis subsystem 220.
The service module analysis subsystem 220 aggregates and classifies the execution logs, counts the execution result information of each service module, including execution time consumption, execution passing rate, execution failure rate, and the like, and delivers the analysis data to the service module decision subsystem 230.
The service module decision subsystem 230 may dynamically adjust the preset module parameters according to the execution result information in the subsequent decision process of the service module execution policy, so as to adjust the execution priority of each service module, thereby implementing self-optimization of the system 200.
Compared with the related art, the embodiment introduces the service module analysis subsystem and the service module decision subsystem to count the execution result information of each service module in real time based on the execution log, so that the execution of each service module can be dynamically adjusted according to the priority, and the self-optimization of the system is realized. Compared with a solidified business execution process, the embodiment can dynamically decide the optimal business module execution sequence during the running process.
As shown in fig. 4, there is provided an apparatus 400 for executing code according to an embodiment of the present disclosure, including:
a request obtaining unit 420, configured to obtain a composite code execution request, where the composite code execution request is used to request execution of at least two code modules;
a result obtaining unit 440, configured to obtain historical execution result information of the at least two code modules;
a policy determining unit 460, configured to determine an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules;
a code execution unit 480 for executing the at least two code modules based on the execution order.
Since the execution efficiency of each code module in a system may change with the change of the running time and the running environment, compared with the execution order of the solidified code modules set by hard coding, the apparatus for executing code according to one or more embodiments of the present disclosure may dynamically adjust the execution order of each code module by determining the execution order of each code module based on the historical execution result information and the dependency relationship of each code module, thereby improving the execution efficiency of the code execution request and enabling the system to continuously perform self-optimization based on the past code execution effect.
In some embodiments, the historical execution result information includes at least one of: time consumed by execution, execution pass rate, and execution failure rate.
In some embodiments, the result obtaining unit includes:
a log obtaining subunit, configured to obtain a code execution log;
a log analysis subunit configured to determine historical execution result information of the at least two code modules based on the code execution log.
In some embodiments, the means for executing code further comprises:
a result recording unit, configured to record execution result information of the at least two code modules after the at least two code modules are executed based on the execution order, so as to determine an execution order of the code modules based on the execution result information later.
In some embodiments, the result recording unit is configured to generate a code execution log, where the code execution log includes execution order and execution result information of the at least two code modules.
In some embodiments, the determining the execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules comprises: and determining the execution sequence of the at least two code modules based on a preset code initial execution sequence, the historical execution result information and the dependency relationship of the at least two code modules.
In some embodiments, the determining the execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules comprises: splicing the at least two code modules based on the determined execution order.
For the embodiments of the apparatus, since they correspond substantially to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described apparatus embodiments are merely illustrative, in that modules illustrated as separate modules may or may not be separate. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Accordingly, in accordance with one or more embodiments of the present disclosure, there is provided an electronic device including:
at least one memory and at least one processor;
wherein the memory is used for storing program codes, and the processor is used for calling the program codes stored in the memory to enable the electronic equipment to execute the method for executing the codes, which is provided by one or more embodiments of the present disclosure.
Accordingly, according to one or more embodiments of the present disclosure, there is provided a non-transitory computer storage medium storing program code executable by a computer device to cause the computer device to perform a method of executing code provided according to one or more embodiments of the present disclosure.
Referring now to fig. 5, a schematic diagram of an electronic device (e.g., a terminal device or server) 800 suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the electronic device 800 may include a processing means (e.g., central processing unit, graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 5 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods of the present disclosure as described above.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The 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, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a method of executing code, including: acquiring a composite code execution request, wherein the composite code execution request is used for requesting to execute at least two code modules; obtaining historical execution result information of the at least two code modules; determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules; executing the at least two code modules based on the execution order.
According to one or more embodiments of the present disclosure, the historical execution result information includes at least one of: time consumed by execution, execution pass rate, and execution failure rate.
According to one or more embodiments of the present disclosure, the obtaining of the historical execution result information of the at least two code modules includes: acquiring a code execution log; determining historical execution result information of the at least two code modules based on the code execution log.
A method of executing code provided in accordance with one or more embodiments of the present disclosure further includes: after the at least two code modules are executed based on the execution sequence, recording the execution result information of the at least two code modules for later determining the execution sequence of the code modules based on the execution result information.
According to one or more embodiments of the present disclosure, the recording of the execution result information of the at least two code modules includes: and generating a code execution log, wherein the code execution log comprises the execution sequence and the execution result information of the at least two code modules.
According to one or more embodiments of the present disclosure, the determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules includes: and determining the execution sequence of the at least two code modules based on a preset code initial execution sequence, the historical execution result information and the dependency relationship of the at least two code modules.
According to one or more embodiments of the present disclosure, the determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules includes: splicing the at least two code modules based on the determined execution order.
According to one or more embodiments of the present disclosure, there is provided an apparatus to execute code, including: a request acquisition unit, configured to acquire a composite code execution request, where the composite code execution request is used to request execution of at least two code modules; a result obtaining unit, configured to obtain historical execution result information of the at least two code modules; a policy determining unit, configured to determine an execution order of the at least two code modules based on the historical execution result information and a dependency relationship of the at least two code modules; a code execution unit for executing the at least two code modules based on the execution order.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: at least one memory and at least one processor; wherein the memory is configured to store program code, and the processor is configured to call the program code stored in the memory to cause the electronic device to execute any of the methods for executing code provided according to one or more embodiments of the present disclosure.
According to one or more embodiments of the present disclosure, there is provided a non-transitory computer storage medium storing program code which, when executed by a computer device, causes the computer device to perform any of the methods of executing code provided according to one or more embodiments of the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A method of executing code, comprising:
acquiring a composite code execution request, wherein the composite code execution request is used for requesting to execute at least two code modules;
obtaining historical execution result information of the at least two code modules;
determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules;
executing the at least two code modules based on the execution order.
2. The method of executing code according to claim 1, wherein the historical execution result information comprises at least one of:
time consumed by execution, execution pass rate, and execution failure rate.
3. The method of claim 1, wherein obtaining historical execution result information of the at least two code modules comprises:
acquiring a code execution log;
determining historical execution result information of the at least two code modules based on the code execution log.
4. The method of executing code according to claim 1, further comprising:
after the at least two code modules are executed based on the execution sequence, recording the execution result information of the at least two code modules for later determining the execution sequence of the code modules based on the execution result information.
5. The method of claim 4, wherein the recording of information about the results of the execution of the at least two code modules comprises:
and generating a code execution log, wherein the code execution log comprises the execution sequence and the execution result information of the at least two code modules.
6. The method of executing code according to claim 1, wherein said determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules comprises:
and determining the execution sequence of the at least two code modules based on a preset code initial execution sequence, the historical execution result information and the dependency relationship of the at least two code modules.
7. The method of executing code according to claim 1, wherein said determining an execution order of the at least two code modules based on the historical execution result information and the dependency relationship of the at least two code modules comprises:
splicing the at least two code modules based on the determined execution order.
8. An apparatus that executes code, comprising:
a request acquisition unit, configured to acquire a composite code execution request, where the composite code execution request is used to request execution of at least two code modules;
a result obtaining unit, configured to obtain historical execution result information of the at least two code modules;
a policy determining unit, configured to determine an execution order of the at least two code modules based on the historical execution result information and a dependency relationship of the at least two code modules;
a code execution unit for executing the at least two code modules based on the execution order.
9. An electronic device, comprising:
at least one memory and at least one processor;
wherein the memory is configured to store program code, and the processor is configured to call the program code stored in the memory to cause the electronic device to perform the method of any of claims 1 to 7.
10. A non-transitory computer storage medium, characterized in that,
the non-transitory computer storage medium stores program code that, when executed by a computer device, causes the computer device to perform the method of any of claims 1 to 7.
CN202111545287.2A 2021-12-16 2021-12-16 Method and device for executing code, electronic equipment and storage medium Pending CN114265643A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111545287.2A CN114265643A (en) 2021-12-16 2021-12-16 Method and device for executing code, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111545287.2A CN114265643A (en) 2021-12-16 2021-12-16 Method and device for executing code, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114265643A true CN114265643A (en) 2022-04-01

Family

ID=80827593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111545287.2A Pending CN114265643A (en) 2021-12-16 2021-12-16 Method and device for executing code, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114265643A (en)

Similar Documents

Publication Publication Date Title
CN111581291A (en) Data processing method and device, electronic equipment and readable medium
CN110516159B (en) Information recommendation method and device, electronic equipment and storage medium
CN111274503B (en) Data processing method, device, electronic equipment and computer readable medium
CN111930534A (en) Data calling method and device and electronic equipment
CN112597047A (en) Test method, test device, electronic equipment and computer readable medium
CN113760674A (en) Information generation method and device, electronic equipment and computer readable medium
CN110955640A (en) Cross-system data file processing method, device, server and storage medium
CN109933508B (en) Method and apparatus for transmitting information
CN111625422A (en) Thread monitoring method and device, electronic equipment and computer readable storage medium
CN111858381B (en) Application fault tolerance capability test method, electronic device and medium
CN111798251A (en) Verification method and device of house source data and electronic equipment
CN111352872A (en) Execution engine, data processing method, apparatus, electronic device, and medium
CN110727558A (en) Information prompting method and device, storage medium and electronic equipment
CN114265643A (en) Method and device for executing code, electronic equipment and storage medium
CN115016794A (en) Code generation method, device, equipment and medium
CN110187987B (en) Method and apparatus for processing requests
CN113486749A (en) Image data collection method, device, electronic equipment and computer readable medium
CN111538577A (en) Program execution control device and method, terminal and storage medium
CN112184406A (en) Data processing method, system, electronic device and computer readable storage medium
CN112817874A (en) User interface test method, device, equipment and medium
CN113760178A (en) Cache data processing method and device, electronic equipment and computer readable medium
CN111367590A (en) Interrupt event processing method and device
CN116701013A (en) Message consumption method, device, electronic equipment and computer readable medium
CN114547456A (en) Distribution control method, device, equipment and medium for training samples
CN111626787A (en) Resource distribution method, device, medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination