A script execution method, device and equipment
By pre-creating the kernel in the container and executing script code therein, the problem of information leakage and unreliability during script execution in the prior art is solved, and the safe and reliable execution of scripts is achieved.
Patent Information
- Application Number
- CN202210713083.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-22
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-06-22
AI Technical Summary
The prior art has problems of information leakage and unreliability during script execution, which leads to the entire execution environment crashing when an exception occurs, affecting the user experience.
The safe and reliable execution of the script is achieved by pre-creating the kernel in a container with a unique container address and executing script code in the kernel to generate execution results.
This implements the direct call and execution of scripts by front-end users. The execution environments of each script are no longer mutually influencing and blocking. The context of script operation can be saved, which improves the security and reliability of script execution.
Smart Images

Figure CN115098222B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a script execution method, device and equipment. Background Art
[0002] In actual applications, front-end users often need to execute various scripts. Currently, they often use a public execution environment to execute scripts, which leads to information leakage and the context cannot be guaranteed. Once an exception occurs, the entire execution environment will crash, affecting the user experience of all users.
[0003] Based on this, a more secure and reliable script execution solution is needed. Summary of the invention
[0004] One or more embodiments of the present specification provide a script execution method, apparatus, device, and storage medium to solve the following technical problem: a more secure and reliable script execution solution.
[0005] To solve the above technical problems, one or more embodiments of this specification are implemented as follows:
[0006] In a first aspect, an embodiment of the present specification provides a script execution method, comprising: obtaining a request to be executed;
[0007] Determine a kernel corresponding to the request to be executed, wherein the kernel is pre-created in a container with a unique container address
[0008] ; obtaining the script code corresponding to the request to be executed; executing the script code in the kernel to generate an execution result.
[0009] In a second aspect, an embodiment of the present specification provides a script execution device, comprising: a request acquisition module, obtaining
[0010] Get a request to be executed; determine a module to determine a kernel corresponding to the request to be executed, wherein the kernel is pre-created in a container with a unique container address; a code acquisition module to obtain a script code corresponding to the request to be executed; and an execution module to execute the script code in the kernel to generate an execution result.
[0011] In a third aspect, an embodiment of the present specification provides an electronic device, including:
[0012] at least one processor; and,
[0013] a memory communicatively connected to the at least one processor; wherein,
[0014] 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 the first aspect.
[0015] In a fourth aspect, an embodiment of the present specification provides a non-volatile computer storage medium storing computer executable instructions. When a computer reads the computer executable instructions in the storage medium, the instructions enable one or more processors to execute the method described in the first aspect.
[0016] At least one of the above technical solutions adopted in one or more embodiments of this specification can achieve the following beneficial effects: by obtaining the request to be executed; determining the kernel corresponding to the request to be executed, wherein the kernel is pre-created in a container with a unique container address; obtaining the script code corresponding to the request to be executed; executing the script code in the kernel to generate an execution result. Thus, the front-end user can directly call and execute the script, and the execution environments of the scripts will no longer have mutual influence and blockage during the execution process, and the context of the script running can also be saved, thereby achieving more secure and reliable script execution. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 It is a schematic diagram of the architecture of the script execution mode involved in the current environment;
[0019] Figure 2 A flowchart of a script execution method provided in an embodiment of this specification;
[0020] Figure 3 A schematic diagram of a script execution system provided in an embodiment of this specification;
[0021] Figure 4 A schematic diagram of the architecture of a system provided in an embodiment of this specification;
[0022] Figure 5 A schematic diagram of the structure of a script execution device provided in an embodiment of this specification;
[0023] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0024] The embodiments of this specification provide a script execution method, device, equipment and storage medium
[0025] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0026] Traditional script call execution requires the backend to maintain a common call resource, and the frontend requests the backend to initiate code execution through the Hyper Text Transfer Protocol (HTTP) interface. Figure 1 As shown, Figure 1 The following is a schematic diagram of the current script execution mode. In this execution mode, the implementation based on the HTTP interface itself increases the complexity of the link and the request response time, which greatly reduces the user's interactive experience.
[0027] From the perspective of calling resources, the management and control of resources itself has a very high cost. Calling resources to share information will cause information leakage, and the context cannot be guaranteed. Once an exception occurs, the entire environment will collapse, affecting the user experience of all users. Based on this, the embodiments of this specification provide a more secure and reliable script execution solution.
[0028] In the first aspect, Figure 2 As shown, Figure 2 A flowchart of a script execution method provided in an embodiment of this specification includes the following steps:
[0029] S201: Obtain a request to be executed.
[0030] The pending request is sent by the user and is used to call the backend to execute the corresponding script code. When there are multiple pending requests, the backend can group the pending requests into a corresponding sequence and execute them in sequence.
[0031] S203: Determine the kernel corresponding to the request to be executed.
[0032] In the embodiments of this specification, a kernel refers to an execution environment including a context. The kernel is created in advance based on the user's request, and the kernels created by each user are isolated from each other. The same user can create multiple different kernels to complete different experiments.
[0033] For example, user 1 can create kernel A and kernel B at the same time, where kernel A is used to execute various scripts included in experiment A that user 1 wants to implement, and kernel B is used to execute various scripts in experiment B that user 1 wants to implement. Kernel A and kernel B are independent of each other, and kernels A, B and kernel C created by user 2 are also independent of each other. Independence means that the execution environment and context of each kernel do not affect each other.
[0034] like Figure 3 As shown, Figure 3 A schematic diagram of the framework of a script execution system provided in the embodiment of this specification. In this schematic diagram, each user can link with each kernel created independently by himself. When the link is established, the front end will directly connect and communicate with the kernel through the kernel connector (Kernel Connector). The delay is affected by the network and the size of the request body, and can be basically ignored under ideal conditions.
[0035] The execution environment refers to the mechanism that the script code relies on when it is running. It is used to complete the processing of the script in terms of scope and lifetime when it is running. The execution environment defines whether a variable or function has the permission to access other data, and then determines their respective behaviors. The execution environment can include the global execution environment and the function execution environment, etc. In different execution environments, the same script code may have different output results after being executed.
[0036] Context refers to the text environment created for the execution of script code after some preparation before the script code is executed. The text environment records all variable names, function names, class names, etc. The context itself is also part of the execution environment. The execution of any script code depends on the context, but it can be changed.
[0037] For example, Figure 3 As shown in the figure, user 1 can execute script 1 and script 2 in kernel A in sequence through front-end 1. The execution of script 1 depends on the context in the initial execution environment, but after it is executed, the context in kernel A is changed and stored in it, and the execution of script 2 depends on the changed context. Each individual context has its own corresponding kernel, so as to achieve isolation between environments to avoid information leakage.
[0038] As shown above, each user has its own corresponding kernel. If not, one or more kernels corresponding to the user can be pre-initialized based on the user's request. That is, the backend can receive the user's kernel creation request; allocate a container address according to the kernel creation request, create a container corresponding to the container address; and create a kernel corresponding to the kernel creation request in the container.
[0039] For example, when a user communicates with the backend through a visual interface on the frontend, the user initiates a script execution request to the backend through the kernel connector. The backend finds that the user does not have a corresponding kernel. Then, a request can be initiated to the corresponding container manager, which pulls up a container in the K8S cluster and assigns a unique container address to the container.
[0040] Therefore, under the container, one or more corresponding kernels can be created for the user, and a corresponding path can be allocated to each kernel under the container address.
[0041] When the user has only created one kernel, then the kernel may be determined as the kernel corresponding to the request to be executed.
[0042] When a user creates multiple kernels, it means that the types of script codes executed by the user may be multiple, and different execution environments have an impact on the output results, so each kernel needs to be distinguished.
[0043] In one embodiment, in order to facilitate the user to distinguish the kernels created by the user, a kernel identifier can also be added to each kernel. For example, when creating a kernel, the user is reminded that the kernel identifier can be customized, and the kernel identifier is used to represent the script type identifier corresponding to the kernel, so that when the kernel is created in the container, the corresponding relationship between the script type identifier and the kernel identifier can be established and saved at the same time.
[0044] like Figure 3 As shown in , when user 1 creates kernel B, he can add the corresponding kernel identifier "kernel B" to kernel B, thereby establishing a corresponding relationship (kernel B, test B) and saving it with the backend. And, based on the needs of the user, this corresponding relationship can also be visualized, edited, added, and deleted.
[0045] Furthermore, when determining the kernel corresponding to the request to be executed, the script type identifier in the request to be executed can be obtained, and the kernel identifier can be determined according to the pre-established corresponding relationship; and the kernel corresponding to the request to be executed can be determined according to the kernel identifier.
[0046] For example, when user 1 wants to execute the related script of experiment B, he can add the corresponding script type identifier "Experiment B" in the script execution request. The backend can determine kernel B as the kernel corresponding to the request to be executed based on the correspondence between the pre-created script type identifier and the kernel identifier (Experiment B, Kernel B).
[0047] S205: Obtain the script code corresponding to the request to be executed.
[0048] The script code may be pre-edited and stored in a specified directory. The request to be executed only needs to provide the corresponding directory or corresponding name of the script code, and the backend can obtain the script code corresponding to the request to be executed.
[0049] The script code may be a code encoded in various languages, for example, it may be a python script code, or a JS (JavaScript) script code, and the like.
[0050] In one embodiment, the user may want to execute multiple script codes. For example, in one execution request, multiple execution codes are requested to be executed. Then, the backend can obtain the multiple execution codes respectively and form a script code sequence with the multiple script codes. The sorting method can be specified by the user in the execution request, or can be arranged in sequence based on the order in the execution request.
[0051] For example, in an execution request, the user may specify to execute script 1 first and then script 2; or, the user does not specify the execution order, but script 1 is arranged before script 2 in the execution request, then script 1 and script 2 can be arranged in sequence to generate a script code sequence.
[0052] S207, executing the script code in the kernel to generate an execution result.
[0053] When a script code sequence consisting of multiple script codes is obtained, the script code sequence can be executed in sequence in the kernel. For example, the script code at the top of the script code sequence is executed in sequence. After execution, the context of the kernel is updated and saved. By executing in sequence in the form of a script code sequence, it is possible to avoid blocking caused by the kernel executing multiple scripts at the same time.
[0054] In actual applications, a code executor (CodeRunner) can be created to call and execute script code. The specific execution of the script code is the responsibility of the Code Runner module. Specifically, it can format the code execution request into the original script code and initiate execution in the kernel to generate the execution result.
[0055] In one embodiment, Code Runner can also format the execution result and return the formatted execution result to the front end. The formatted execution result can be a classification of the execution process and statistics of the results, etc. For example, the classification of the execution process can include "correct execution", "no error", "error point", etc. The corresponding statistics of the generated results can be: the number, proportion, total amount, statistical error, etc. of the covered population, so that the front end can make corresponding policy adjustments, condition modifications, and visual displays, etc. for the formatted execution results.
[0056] By obtaining the request to be executed; determining the kernel corresponding to the request to be executed, wherein the kernel is pre-created in a container with a unique container address; obtaining the script code corresponding to the request to be executed; and executing the script code in the kernel to generate an execution result. Thus, the front-end user can directly call and execute the script, and during the execution process, the execution environments of the scripts will no longer have mutual influence and blockage, and the context of the script running can also be saved, thereby achieving more secure and reliable script execution.
[0057] In one embodiment, the front end can also visually display the kernel created by the user. For example, the front end displays each kernel in the front end interface in the form of an icon, and displays the name of each kernel, the kernel identifier, etc. The user's script can also be displayed in the front end interface in the form of visual text. At this time, the user can move the script to the corresponding kernel for execution by dragging and selecting, so as to directly generate the execution result.
[0058] In this way, in order to avoid user's non-operation, a custom naming operation function for each kernel can also be provided. That is, the naming request of the user is received, and the name of the kernel is modified according to the naming request, so that the modified name of the kernel is also displayed when the kernel is displayed on the front end. For example, user 1 selects kernel A, double-clicks it, right-clicks it, and initiates a custom naming request, which includes the modified name "Interactive Strategy Test". Therefore, the back end can modify the name of kernel A to "Interactive Strategy Test" according to the request, and display it in the front end interface of user 1, so that user 1 can execute related scripts and avoid misoperation.
[0059] When the script code is executed in the kernel, the context may not be modified. However, in one embodiment, if the context is modified, the script code needs to be executed based on the modified context. Based on this, when the script code is executed in the kernel, the context of the kernel can be obtained in advance, and the script code can be executed according to the context to generate an execution result; accordingly, the context of the kernel is modified according to the execution result and saved, so that subsequent scripts can be executed based on the changed context.
[0060] For example, the kernel context may be modified when the script code is executed and enters the following situations: entering global code, entering function body code, entering code specified by eval function parameters, entering module code, etc. When these codes are entered or called in the script code, the values of related variables in the kernel may change, that is, the kernel context has changed, and the kernel context needs to be modified and saved according to the execution result. Therefore, the subsequent script code is executed based on the modified context. In this way, the context in the same kernel can be saved, and the contexts in different kernels are isolated from each other.
[0061] In order to make the solution of the present application clearer and easier to understand, an example of a specific real-time scenario is given below for illustration.
[0062] In the data visualization scenario of the interactive strategy recommendation algorithm, front-end business personnel often need to execute scripts written in various languages (for example, Python scripts) to perform tasks such as machine learning, testing, and data visualization. For example, for a front-end user who performs an interactive strategy recommendation algorithm, he or she may implement his or her work content through the following three types of scripts: strategy selection script, condition replacement script, and result visualization script. In this way, various strategies can be tested on the target group conveniently to obtain a better recommendation strategy for the target group.
[0063] Among them, the strategy selection script is used to select different types of strategies, the condition replacement script is used to replace the relevant conditions in the selected strategy, and the result visualization script visualizes the selected targets.
[0064] Furthermore, for the same front-end user, he may need to develop interactive strategies for multiple different tasks at the same time. For example, he may need to develop a route recommendation strategy and a multimedia recommendation strategy at the same time. In other words, the front-end user needs multiple cores to cope with different strategy development tasks.
[0065] Based on this type of situation, the embodiments of this specification provide the following system architecture: Figure 4 As shown, Figure 4This is a schematic diagram of the architecture of a system provided in the embodiment of this specification. It includes a front end and a back end, wherein the back end provides Web services and K8s cluster services. Based on K8S cluster scheduling, the problem of container resource allocation can be easily solved.
[0066] In this system architecture, the front-end user can maintain a connection with the kernel through the kernel connector. If the kernel exists, the front-end user can communicate directly with the kernel.
[0067] When there is no kernel, that is, when kernel initialization is required, the user can initiate a kernel creation request to the container manager in the backend web service through the kernel connector. After the container manager pulls up the jupyter ServerContainer in the K8S cluster, it informs the kernel connector of the unique container address, and the kernel connector performs the corresponding address maintenance. The jupyter Server Container is a container pulled up in K8S that contains the Jupyter Server image.
[0068] The kernel connector will then create the corresponding kernel in the Jupyter Server Container based on the current context (i.e. the context required when the script is initialized, which can be specified by the user or obtained based on the default requirements of the script). The created kernel has a corresponding path under the container address.
[0069] And, when the user wants to create another kernel, the corresponding another kernel can be created in the initialized jupyter ServerContainer, and a corresponding another path can be assigned to the another kernel.
[0070] After the kernel is created, the kernel connector can establish a connection with the kernel, and the script code associated with the user interaction can be called by the front-end maintenance. The script code that the user needs to call is organized into a sequence, and the script code is called in sequence in a queue to prevent the kernel from being blocked. The specific execution of the script code is the responsibility of the code executor. CodeRunner will process the request submitted by Task Manager, format the request into the original Python code, and initiate execution in the Kernel. It will also format the execution result of the Python code for consumption by the front-end.
[0071] Assume that the front-end user needs to debug the multimedia recommendation strategy in this process. He has selected the kernel to execute scripts related to the multimedia recommendation strategy, including strategy selection script, condition change script and result visualization script.
[0072] Then the front-end user can first execute the strategy selection script in this process, thereby changing the context in the execution environment after execution, and then can execute the condition change script again based on the changed context to obtain a combination of a certain strategy under different conditions. At this time, the change to the condition will change the context again. The user can also execute the result visualization script again based on the changed context to obtain a visualized execution result.
[0073] As can be seen, in the above process, since each script execution may change the context of the kernel execution environment, and the kernel is used to correspond to the same debugging task of the user and is isolated from other kernels, the user can easily obtain various strategies, change conditions and display results in the same kernel without being affected by other scripts, solving the resource management problem, and the execution environments of various scripts will no longer affect or block each other. Figure 1 It is impossible to achieve in the architecture shown. And as long as the user needs, it can preset multiple cores to cope with the different execution environments in practice. The executable script code is unlimited, and the front end can implement any script function it wants to achieve through this architecture.
[0074] Based on the same idea, one or more embodiments of this specification also provide devices and apparatuses corresponding to the above methods, such as Figure 5 , Figure 6 shown.
[0075] In the second aspect, Figure 5 As shown, Figure 5 A schematic diagram of a script execution device provided in an embodiment of this specification, the device comprising:
[0076] Acquisition module 501, acquiring a request to be executed;
[0077] A determination module 503 determines a kernel corresponding to the request to be executed, wherein the kernel is pre-created in a container with a unique container address;
[0078] The code acquisition module 505 acquires the script code corresponding to the request to be executed;
[0079] The execution module 507 executes the script code in the kernel to generate an execution result.
[0080] Optionally, the device also includes a kernel creation module 509, which receives a kernel creation request from a user; allocates a container address according to the kernel creation request, creates a container corresponding to the container address; and creates a kernel corresponding to the kernel creation request in the container.
[0081] Optionally, the kernel creation module 509 determines a script type identifier corresponding to the kernel creation request; determines a kernel identifier corresponding to the kernel; creates the kernel in the container, and establishes and saves a correspondence between the script type identifier and the kernel identifier.
[0082] Optionally, the determination module 503 obtains a script type identifier in the request to be executed, determines a kernel identifier according to the pre-established corresponding relationship, and determines a kernel corresponding to the request to be executed according to the kernel identifier.
[0083] Optionally, the device further comprises a renaming module 511 for receiving a naming request from the user and modifying the name of the kernel according to the naming request, so that the modified name of the kernel is simultaneously displayed when the kernel is displayed on the front end.
[0084] Optionally, the device further includes a formatting module 513 for formatting the execution result and returning the formatted execution result to the front end.
[0085] Optionally, the execution module 509 obtains the context of the kernel, executes the script code according to the context, and generates an execution result; accordingly, the method also includes a saving module 515: modifies the context of the kernel according to the execution result, and saves it.
[0086] Optionally, when there are multiple script codes, the code acquisition module 505 combines the multiple script codes into a script code sequence; correspondingly, the execution module 509 executes the script code sequence in sequence in the kernel.
[0087] In the third aspect, Figure 6 As shown, Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification, the device includes:
[0088] at least one processor; and,
[0089] a memory communicatively connected to the at least one processor; wherein,
[0090] 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 the first aspect.
[0091] In the fourth aspect, based on the same idea, the embodiment of this specification also provides a non-volatile computer storage medium corresponding to the above method, storing computer executable instructions. When the computer reads the computer executable instructions in the storage medium, the instructions enable one or more processors to execute the method described in the first aspect.
[0092] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0093] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0094] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0095] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0096] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may be in the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the embodiments of this specification may be in the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0097] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0098] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0099] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0100] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0101] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0102] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0103] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0104] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0105] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0106] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0107] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.
Claims
1. A script execution method, comprising: Get pending requests; Determine a kernel corresponding to the request to be executed, wherein the kernel is pre-created in a container with a unique container address In the container, the kernel refers to the execution environment that contains the context, where multiple different kernels are created; Obtain the script code corresponding to the request to be executed; Executing the script code in the kernel to generate an execution result; The kernel needs to be pre-established based on the following method: receiving a kernel creation request from a user; allocating a container address according to the kernel creation request, and creating a container corresponding to the container address; creating a kernel corresponding to the kernel creation request in the container, and creating one or more corresponding kernels for the user under the container.
2. The method of claim 1, wherein: Create in the container a kernel creation request corresponding to the kernel creation request Kernel, including: Determining a script type identifier corresponding to the kernel creation request; Determining a kernel identifier corresponding to the kernel; The kernel is created in the container, and a corresponding relationship between the script type identifier and the kernel identifier is established and saved.
3. The method of claim 2, wherein: Determining the kernel corresponding to the request to be executed includes: Obtaining a script type identifier in the request to be executed, and determining a kernel identifier according to the pre-established corresponding relationship; The kernel corresponding to the request to be executed is determined according to the kernel identifier.
4. The method of claim 1, wherein: The method further comprises: Receive a naming request from the user, and modify the name of the kernel according to the naming request so as to be displayed on the front end The kernel is displayed together with the modified name of the kernel.
5. The method of claim 1, wherein: The method further comprises: The execution result is formatted, and the formatted execution result is returned to the front end.
6. The method of claim 1, wherein: Executing the script code in the kernel includes: Obtaining the context of the kernel, executing the script code according to the context, and generating an execution result; Correspondingly, the method further includes: modifying the context of the kernel according to the execution result, and saving it.
7. The method of claim 1, wherein: When there are multiple script codes, obtain the request to be executed The corresponding script code includes: Combining the multiple script codes into a script code sequence; Correspondingly, executing the script code in the kernel includes: executing the script code sequence in sequence in the kernel.
8. A script execution device, comprising: Request acquisition module, to obtain requests to be executed; A determination module determines a kernel corresponding to the request to be executed, wherein the kernel is pre-created in a In a container of a container address, a kernel refers to an execution environment including a context, wherein multiple different kernels are created; A code acquisition module, which acquires the script code corresponding to the request to be executed; An execution module executes the script code in the kernel to generate an execution result; The kernel needs to be pre-established based on the following method: receiving a kernel creation request from a user; allocating a container address according to the kernel creation request, and creating a container corresponding to the container address; creating a kernel corresponding to the kernel creation request in the container, and creating one or more corresponding kernels for the user under the container.
9. An electronic device, comprising: at least one processor; as well as, a memory communicatively connected to 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.
Citation Information
Patent Citations
Desktop application construction method and device based on web technology
CN107229480A
Automatic test method and device, computer equipment and storage medium
CN111679965A