Cloud simulation method and system, electronic equipment and storage medium
By configuring and managing containers to achieve simulation, the problems of waste and high costs in cloud simulation are solved, and flexible use and efficient utilization of resources are achieved.
Patent Information
- Application Number
- CN202411298743.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing cloud simulation method requires renting a large number of cloud servers to stand by, resulting in waste of resources and excessive costs.
By receiving the simulation request from the front end, configure the idle container in the container management system, start the simulation engine for simulation, and close the container after the simulation is completed to avoid resource waste and reduce costs.
It realizes the use of computing resources when needed, and timely releases resources after the simulation is completed to avoid resource waste, reduce costs, and improve resource utilization efficiency.
Smart Images

Figure CN119127403A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of simulation technology, and in particular to a cloud simulation method and system, electronic equipment, and storage medium. Background Art
[0002] In simulation software, the overall business is generally divided into two parts: one is modeling, and the other is simulation. Among them, simulation refers to calculating the results of the established model or project according to the internal algorithm. Simulation calculation requires dynamic acquisition of some computing resources, that is, it requires the support of computing resources.
[0003] The current simulation method is to run modeling and simulation at the same time on a designated computer. However, this method requires running modeling and simulation tools at the same time, and the simulation equipment is fixed, so it is not convenient enough. Therefore, another simulation method is to simulate through the cloud. Usually, the corresponding cloud server is rented according to the needs of a simulation project, and the simulation engine is deployed on the cloud server. Then the address of the simulation engine is recorded in the application, so that the simulation engine can be linked to the address through the application for simulation.
[0004] However, this method requires renting a large number of cloud servers to be on standby at any time, so that each simulation project can be simulated in time when the simulation demand is large. Therefore, when the simulation demand is small, these cloud servers are idle. Therefore, this method will occupy a large amount of computing resources, which will cause a large amount of resource waste when idle, and also lead to excessively high costs. Summary of the invention
[0005] Based on the above-mentioned deficiencies of the prior art, the present application provides a cloud simulation method and system, an electronic device, and a storage medium to solve the problem that the prior art occupies a large amount of resources, causes waste of resources, and is high in cost.
[0006] In order to achieve the above objectives, this application provides the following technical solutions:
[0007] The first aspect of the present application provides a cloud simulation method, comprising:
[0008] Receive a current simulation request sent by the front end to the back end in the cloud; wherein the current simulation request at least includes an identifier of the current simulation project;
[0009] According to the identifier of the current simulation project, searching the path where the current simulation project is stored in the file storage service from the database to obtain the storage path of the current simulation project;
[0010] Configure the network and environment variables of any idle target container in the container management system;
[0011] According to the storage path of the current simulation project, configure the file path where the target container is mounted;
[0012] Notify the container management system to start the target container, so as to use the simulation engine in the target container to perform simulation based on the environment variables and the current simulation project to generate simulation results;
[0013] When receiving the simulation success notification fed back by the target container through the callback application program interface, the container management system is notified to close the target container.
[0014] Optionally, in the above cloud simulation method, before querying the path of the current simulation project according to the identifier of the current simulation project, the method further includes:
[0015] Verify the legitimacy of the current simulation request with a database; wherein, if the current simulation request passes the legitimacy verification, query the path of the current simulation project based on the identifier of the current simulation project.
[0016] Optionally, in the above-mentioned cloud simulation method, after notifying the container management system to start the target container so as to use the simulation engine in the target container to perform simulation based on the environment variables and use the current simulation project to generate simulation results, it further includes:
[0017] When the current simulation request includes information indicating an offline simulation, storing the simulation result in a time series database in real time;
[0018] After the target container is closed, the user's contact information is obtained from the database, and the simulation result in the time series database is fed back to the user according to the user's contact information.
[0019] Optionally, in the above cloud simulation method, before configuring the network and environment variables of any idle target container in the container management system, the method further includes:
[0020] If the current simulation request includes information indicating online simulation, querying the container management system for the opening status of each container;
[0021] Based on the opening status of each of the containers, ports occupied by the opened containers and abnormal ports are excluded;
[0022] Selecting a port of the target container from the ports that are not excluded;
[0023] Generate a one-time callback password and a connection password; wherein the callback password is used for the target container to call back; and the connection password is used for the simulation engine in the target container to connect with the front end.
[0024] Optionally, in the above-mentioned cloud simulation method, the notifying the container management system to start the target container so as to perform simulation using the current simulation project based on the environment variables through the simulation engine in the target container to generate simulation results includes:
[0025] Notify the container management system to start the target container;
[0026] When the target container starts and executes the simulation engine, a notification of successful simulation engine startup is sent to the front end, and the IP address, port number and connection password of the target container are fed back to the front end;
[0027] When the front end is connected to the simulation engine using the IP, port and connection password of the target container, the simulation engine performs simulation based on the environment variables and the current simulation project to generate simulation results.
[0028] Optionally, in the above cloud simulation method, after the simulation engine performs simulation based on the environment variables and uses the current simulation project to generate simulation results, the method further includes:
[0029] The generated simulation results are written into a timing database in real time and fed back to the connected front end, so that the feedback results can be displayed to the user in real time through the front end.
[0030] Optionally, in the above-mentioned cloud simulation method, after notifying the container management system to start the target container so as to use the simulation engine in the target container to perform simulation based on the environment variables and use the current simulation project to generate simulation results, it further includes:
[0031] When receiving the abnormal notification fed back by the target container through the callback application program interface, the abnormal event is processed and the container management system is notified to close the target container.
[0032] A second aspect of the present application provides a cloud simulation system, including:
[0033] A receiving unit, configured to receive a current simulation request sent by the front end to the back end in the cloud; wherein the current simulation request at least includes an identifier of a current simulation project;
[0034] A path search unit, used to search the path where the current simulation project is stored in the file storage service from a database according to the identifier of the current simulation project, and obtain the storage path of the current simulation project;
[0035] An information configuration unit, used to configure the network and environment variables of any idle target container in the container management system;
[0036] A path configuration unit, used to configure the file path mounted on the target container according to the storage path of the current simulation project;
[0037] Simulation reflection, used to notify the container management system to start the target container, so as to generate simulation results by using the current simulation project through the simulation engine in the target container based on the environment variables;
[0038] The closing unit is used to notify the container management system to close the target container when receiving a simulation success notification fed back by the target container through the callback application program interface.
[0039] Optionally, in the above cloud simulation system, it also includes:
[0040] A legality verification unit is used to verify the legality of the current simulation request to the database; wherein, if the current simulation request passes the legality verification, the path of the current simulation project is queried according to the identifier of the current simulation project.
[0041] Optionally, in the above cloud simulation system, it also includes:
[0042] A first storage unit, configured to store the simulation result in a time series database in real time when the current simulation request includes information indicating an offline simulation;
[0043] The first result feedback unit is used to obtain the user's contact information from the database after closing the target container, and feed back the simulation result in the time series database to the user according to the user's contact information.
[0044] Optionally, in the above cloud simulation system, it also includes:
[0045] a status query unit, configured to include information indicating online simulation in the current simulation request, and query the container management system for the opening status of each container;
[0046] An exclusion unit, configured to exclude ports occupied by the opened containers and abnormal ports based on the opening status of each of the containers;
[0047] A port selection unit, used for selecting a port of the target container from the ports that are not excluded;
[0048] The password generating unit is used to generate a one-time callback password and a connection password; wherein the callback password is used for the target container to perform a callback; and the connection password is used for the simulation engine in the target container to connect with the front end.
[0049] Optionally, in the above-mentioned cloud simulation system, when the simulation unit executes the notifying the container management system to start the target container so as to perform simulation based on the environment variables using the current simulation project through the simulation engine in the target container and generate simulation results, it is used to:
[0050] Notify the container management system to start the target container;
[0051] When the target container starts and executes the simulation engine, a notification of successful simulation engine startup is sent to the front end, and the IP address, port number and connection password of the target container are fed back to the front end;
[0052] When the front end is connected to the simulation engine using the IP, port and connection password of the target container, the simulation engine performs simulation based on the environment variables and the current simulation project to generate simulation results.
[0053] Optionally, in the above cloud simulation system, it also includes:
[0054] The second result feedback unit is used to write the generated simulation result into the time series database in real time and feed back to the connected front end, so that the feedback result can be displayed to the user in real time through the front end.
[0055] Optionally, in the above cloud simulation system, it also includes:
[0056] The exception handling unit is used to handle the exception event and notify the container management system to close the target container when receiving the exception notification fed back by the target container through the callback application program interface.
[0057] A third aspect of the present application provides an electronic device, including:
[0058] Memory and processor;
[0059] Wherein, the memory is used to store programs;
[0060] The processor is used to execute the program, and when the program is executed, it is specifically used to implement the cloud simulation method as described in any one of the above items.
[0061] A fourth aspect of the present application provides a computer storage medium for storing a computer program, which, when executed by a processor, is used to implement a cloud simulation method as described in any one of the above.
[0062] An embodiment of the present application provides a cloud simulation method, which receives a current simulation request sent by a front end to a back end in the cloud. The current simulation request includes at least an identifier of the current simulation project. According to the identifier of the current simulation project, the path where the current simulation project is stored in the file storage service is found from the database, and the storage path of the current simulation project is obtained, so that the current simulation project can be accessed and simulated according to its storage path. Then, the network and environment variables of any idle target container in the container management system are configured, and according to the storage path of the current simulation project, the file path mounted on the target container is configured to complete the preparation for the simulation. Then, the container management system is notified to start the target container, so that the simulation engine in the target container can be used to simulate the current simulation project based on the environment variables to generate simulation results. And when the simulation success notification is received from the target container through the callback application program interface, that is, when the simulation is successfully completed, the container management system is notified to close the target container, so that the resources occupied by the target container during the simulation after it is started can be used in time to avoid waste of resources. By encapsulating the simulation engine as a container and flexibly controlling the opening and closing of the container, computer resources are used only when simulation is needed, and resources are released in time after the simulation is completed, so that a large amount of resources will not be occupied, resulting in waste of resources, and costs are effectively reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present application 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 embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0064] Figure 1 A schematic diagram of the architecture of a cloud simulation system provided in an embodiment of the present application;
[0065] Figure 2 A flowchart of a cloud simulation method provided in an embodiment of the present application;
[0066] Figure 3 A flowchart of an offline cloud simulation method provided in an embodiment of the present application;
[0067] Figure 4 A flowchart of an online cloud simulation method provided in an embodiment of the present application;
[0068] Figure 5 A schematic diagram of the architecture of another cloud simulation system provided in an embodiment of the present application;
[0069] Figure 6A schematic diagram of the architecture of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0071] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0072] The embodiment of the present application provides a cloud simulation method to solve the problem that the prior art easily leads to waste of resources and excessively high costs.
[0073] Optionally, in order to implement the cloud simulation method provided in the embodiment of the present application, the embodiment of the present application provides a cloud simulation system. Figure 1 As shown, a cloud simulation system provided in an embodiment of the present application includes:
[0074] Backend, file storage service (OBS), database (DB), time series database (TSDB), and container management system (K8s).
[0075] The backend is deployed in the cloud and is mainly used to manage the container management system (K8s) and the containers (Docker) therein, such as startup, shutdown, and network configuration. In addition, it also provides an interface to the frontend, so that it can respond to frontend requests and realize simulation by controlling the container management system and containers.
[0076] The file storage service is mainly used to store simulation projects. The database is a user management database, which is mainly used to store user management information, including but not limited to the storage path of the simulation project, user information, permission information, etc. The time series database is a simulation result database, which is mainly used to store simulation results.
[0077] The container management system is mainly used to manage various containers (Docker), and each container is obtained by simulating the simulation engine (ES) and stored in the cloud, so the simulation of the simulation project can be realized through each container.
[0078] Based on the cloud simulation system provided above, the present application embodiment provides a cloud simulation method, such as Figure 2 As shown, the following steps are included:
[0079] S201. Receive a current simulation request sent by the front end to the back end in the cloud.
[0080] The current simulation request at least includes an identifier of the current simulation project. The current simulation project refers to the project that needs to be simulated currently.
[0081] It should be noted that the backend deployed in the cloud provides an application program interface to the outside, so when the user needs to perform simulation, he can access the backend through the frontend and send the current simulation request to the backend. Among them, the current simulation request at least includes the identifier of the current simulation project to determine the project that needs to be simulated. At this time, the backend will receive the current simulation request sent by the frontend.
[0082] Optionally, in order to ensure security and avoid access by illegal users, in another embodiment of the present application, after executing step S201 and before executing step S202, the following steps are further performed:
[0083] Verify the validity of the current simulation request with the database.
[0084] Specifically, the database stores information of critical legitimacy, such as information of users allowed to access, so the legitimacy of the current simulation request can be verified by obtaining corresponding information from the database and comparing it with the information in the current access request.
[0085] If the current simulation request passes the legality verification, then step S202 may be executed to start the simulation-related work.
[0086] S202. According to the identifier of the current simulation project, find out from the database the path where the current simulation project is stored in the file storage service to obtain the storage path of the current simulation project.
[0087] It should be noted that the engineering entity of the simulation project is stored in the file storage service in advance, and the metadata of the simulation project is stored in the database.
[0088] Therefore, in order to enable the simulation engine to find the current simulation project for simulation during simulation, it is necessary to first find the path where the current simulation project is stored in the file storage service from the database according to the identifier of the current simulation project, that is, to find the storage path of the current simulation project.
[0089] S203: Configure the network and environment variables of any idle target container in the container management system.
[0090] It should be noted that, considering that multiple simulation tasks may need to be performed at the same time, multiple containers are encapsulated in the embodiment of the present application. Therefore, when the current simulation project needs to be simulated, a container needs to be selected from the idle containers as the target container, that is, as the container for simulating the current simulation project.
[0091] In order to allow the target container to have a simulated environment, the backend needs to configure the corresponding network after determining the target container. Since the container is dynamically opened and closed, a shared elastic IP can be used so that the corresponding network will not be occupied all the time. And it is also necessary to configure environment variables for it. Specifically, the connection password, network, access path and other contents can be passed into its environment variables, so that when the simulation engine starts, the environment variables can be read to obtain the information required for external transmission, avoiding frequent modification and packaging of docker images.
[0092] S204. According to the storage path of the current simulation project, configure the file path where the target container is mounted.
[0093] It should be noted that in the embodiment of the present application, when starting the target container, the current simulation project needs to be mounted to the target container, so that when the simulation engine accesses it, it can access the current access project just like accessing files in the local hard disk, so that the simulation of the current simulation project can be realized. Therefore, the backend needs to first configure the file path of the target container mount according to the storage path of the current simulation project.
[0094] S205 , informing the container management system to start the target container, so as to generate simulation results by using the current simulation project through the simulation engine in the target container based on the environment variables.
[0095] Specifically, the backend notifies the container management system to start the target container. After the target container is started, it will automatically execute the simulation engine. At this time, the simulation engine will access the current simulation project and simulate the current simulation project based on environment variables and cloud computing resources, thereby continuously generating simulation results.
[0096] S206: When receiving a simulation success notification fed back by the target container through the callback application program interface, notify the container management system to close the target container.
[0097] In order to know the end of the simulation at this time, so as to close the target container in time and release the resources occupied by the target container, in the embodiment of the present application, after the simulation is successfully completed, the simulation engine in the target container will call back the application result of the backend and feedback the simulation success notification to the backend. At this time, the backend will notify the container management system to close the target container.
[0098] Optionally, considering that the simulation process may be abnormal, in another embodiment of the present application, after executing step S205, the following may be further included:
[0099] When receiving an exception notification fed back by the target container through the callback application program interface, the exception event is processed and the container management system is notified to close the target container.
[0100] It should be noted that in the embodiment of the present application, when an exception occurs in the simulation, the simulation engine in the target container will also call back the application result of the backend to feedback the exception notification. At this time, the backend will handle the exception event. In addition, since the simulation is abnormal at this time and cannot be simulated normally, the container management system will be notified to close the target container so that the occupied resources can be released in time.
[0101] An embodiment of the present application provides a cloud simulation method, which receives a current simulation request sent by a front end to a back end in the cloud. The current simulation request includes at least an identifier of the current simulation project. According to the identifier of the current simulation project, the path where the current simulation project is stored in the file storage service is found from the database, and the storage path of the current simulation project is obtained, so that the current simulation project can be accessed and simulated according to its storage path. Then, the network and environment variables of any idle target container in the container management system are configured, and according to the storage path of the current simulation project, the file path mounted on the target container is configured to complete the preparation for the simulation. Then, the container management system is notified to start the target container, so that the simulation engine in the target container can be used to simulate the current simulation project based on the environment variables to generate simulation results. And when the simulation success notification is received from the target container through the callback application program interface, that is, when the simulation is successfully completed, the container management system is notified to close the target container, so that the resources occupied by the target container during the simulation after it is started can be used in time to avoid waste of resources. By encapsulating the simulation engine as a container and flexibly controlling the opening and closing of the container, computer resources are used only when simulation is needed, and resources are released in time after the simulation is completed, so that a large amount of resources will not be occupied, resulting in waste of resources, and costs are effectively reduced.
[0102] In order to meet different needs of users, namely the needs of offline simulation and online simulation, the current simulation request may also include information indicating online simulation or wired simulation, so as to implement online cloud simulation method and offline cloud simulation method based on the information.
[0103] Another embodiment of the present application improves an offline cloud simulation method, such as Figure 3 As shown, the following steps are included:
[0104] S301, receiving a current simulation request sent by the front end to the back end in the cloud.
[0105] The current simulation request at least includes an identifier of the current simulation project and information indicating an offline simulation.
[0106] S302: Verify with the database whether the current simulation request is legal.
[0107] If the current simulation request passes the legality verification, step S303 is executed.
[0108] S303. According to the identifier of the current simulation project, find out from the database the path where the current simulation project is stored in the file storage service to obtain the storage path of the current simulation project.
[0109] S304: Generate a one-time callback password.
[0110] It should be noted that the callback is to access the backend, and for security reasons, a one-time callback password will be generated in the embodiment of the present application, that is, the callback password is limited to the current simulation and will become invalid after the current simulation ends. The callback password is subsequently passed into the environment variable, and then passed to the simulation engine through the environment variable.
[0111] S305: Configure the network and environment variables of any idle target container in the container management system.
[0112] S306. Configure the file path where the target container is mounted according to the storage path of the current simulation project.
[0113] S307: Notify the container management system to start the target container, so as to use the simulation engine in the target container to perform simulation based on the environment variables and the current simulation project to generate simulation results.
[0114] S308. Store the simulation results in a time series database in real time.
[0115] Since the simulation results cannot be fed back to the front end for the user in real time during offline simulation, the simulation results need to be stored first. Therefore, in an embodiment of the present application, the generated simulation results are first stored in a timing database in real time. That is, when the simulation request includes information indicating offline simulation, the simulation results need to be stored in the timing database in real time.
[0116] S309: When receiving a simulation success notification or an exception notification fed back by the target container through the callback application program interface, notify the container management system to close the target container.
[0117] It should be noted that if a simulation success notification is received, the container management system can be directly notified to close the target container. If an abnormality notification is received, the container management system must not only be notified to close the target container, but also handle the abnormal event.
[0118] It should be noted that when the target container calls back the backend application program interface, it needs to use the callback password in the environment variable to make the callback.
[0119] S310, obtaining the user's contact information from the database, and feeding back the simulation results in the time series database to the user based on the user's contact information.
[0120] Specifically, in an embodiment of the present application, after closing the target container, whether the closure is successfully completed due to normal simulation or due to abnormal closure, the simulation results of this simulation stored need to be fed back to the user. However, since it is an offline simulation, that is, the front end is offline after sending the current simulation request, it is impossible to directly feed back the simulation results to the front end and provide them to the user. Therefore, it is necessary to obtain the user's contact information from the database at this time, such as a mobile phone or email address. After accommodating, the simulation results of this time are found from the time series database, and based on the user's contact information, the simulation results of this time are fed back to the user.
[0121] Another embodiment of the present application improves an online cloud simulation method, such as Figure 4 As shown, the following steps are included:
[0122] S401, receiving a current simulation request sent by the front end to the back end in the cloud.
[0123] The current simulation request at least includes an identifier of the current simulation project and information indicating online simulation.
[0124] S402: Verify with the database whether the current simulation request is legal.
[0125] If the current simulation request passes the legality verification, step S403 is executed.
[0126] S403. According to the identifier of the current simulation project, find out from the database the path where the current simulation project is stored in the file storage service to obtain the storage path of the current simulation project.
[0127] S404: query the container management system for the opening status of each container, and based on the opening status of each container, exclude ports occupied by opened containers and abnormal ports.
[0128] Since this is an online simulation, that is, the front end is online in real time, it needs to connect to the simulation engine to obtain simulation information in real time, so it is necessary to select a port for the target container as the port for connecting to the front end. In order to avoid port conflicts and use of abnormal ports and ensure successful connection, the back end needs to first query the container management system for the open status of each container, and based on the open status of each container, exclude ports occupied by opened containers and abnormal ports.
[0129] S405: Select a port of the target container from the ports that are not excluded.
[0130] Specifically, a simple algorithm can be used to exclude the occupied ports and abnormal ports from a range of ports, and then select ports from the remaining ports as the ports of the target container. For example, the port range is 1-65535, and some ports in 0-11000 are already occupied by the system, so the occupied and abnormal ports in 11000-65535 can be directly excluded, and then the port of the target container can be selected from the range.
[0131] S406: Generate a one-time callback password and connection password.
[0132] The callback password is used for the target container to perform callback, and the connection password is used for the simulation engine in the target container to connect with the front end.
[0133] Similarly, in order to ensure the security of the target container's simulation engine accessing the backend, the backend will generate a one-time callback password, which is only used for this simulation and is used by the target container to call back the backend. In order to ensure the security and accuracy of the connection between the target container's simulation engine and the frontend, a one-time connection password for this simulation will also be generated accordingly. This password is used for the simulation engine to connect to the frontend.
[0134] The callback password is configured into the environment variable when executing step S407, so that the simulation engine can obtain the callback password through the environment variable. The connection password is sent to the front end when executing step S410.
[0135] S407: Configure the network and environment variables of any idle target container in the container management system.
[0136] S408. Configure the file path where the target container is mounted according to the storage path of the current simulation project.
[0137] S409: Notify the container management system to start the target container.
[0138] S410: After the target container starts and executes the simulation engine, a notification of successful simulation engine startup is sent to the front end, and the IP, port, and connection password of the target container are fed back to the front end.
[0139] In order to connect the front end to the target container, the network IP, port and connection password of the target container need to be fed back to the front end. The simulation engine needs to wait for the front end to connect before starting the simulation to ensure that the simulation results can be fed back to the connected front end in real time.
[0140] S411. After the front end uses the IP, port and connection password of the target container to connect to the simulation engine, the simulation engine uses the current simulation project to perform simulation based on environment variables to generate simulation results.
[0141] S412, writing the generated simulation results into the time series database in real time and feeding back to the connected front end, so that the feedback results can be displayed to the user in real time through the front end.
[0142] It should be noted that, since this is an online simulation and the front end is already connected to the simulation engine, the simulation engine will feed back the results to the front end in real time through the connection during the simulation process. In order to facilitate subsequent queries on the simulation, in the embodiment of the present application, the generated simulation results will also be written into the time series database.
[0143] S413: When receiving a simulation success notification or an exception notification fed back by the target container through the callback application program interface, notify the container management system to close the target container.
[0144] It should be noted that the specific implementation of step S403 may refer to step S309 in the above embodiment, which will not be described in detail here.
[0145] Another embodiment of the present application provides another cloud simulation system, such as Figure 5 As shown, including:
[0146] The receiving unit 501 is used to receive a current simulation request sent by the front end to the back end in the cloud; wherein the current simulation request at least includes an identifier of the current simulation project;
[0147] A path search unit 502 is used to search the path where the current simulation project is stored in the file storage service from a database according to the identifier of the current simulation project, and obtain the storage path of the current simulation project;
[0148] An information configuration unit 503 is used to configure the network and environment variables of any idle target container in the container management system;
[0149] A path configuration unit 504, configured to configure a file path for mounting the target container according to a storage path of the current simulation project;
[0150] Simulation response 505, used to notify the container management system to start the target container, so as to perform simulation based on the environment variables and the current simulation project through the simulation engine in the target container to generate simulation results;
[0151] The closing unit 506 is configured to notify the container management system to close the target container when receiving a simulation success notification fed back by the target container through the callback application program interface.
[0152] Optionally, in another embodiment of the present application, the cloud simulation system further includes:
[0153] A legality verification unit is used to verify the legality of the current simulation request to the database; wherein, if the current simulation request passes the legality verification, the path of the current simulation project is queried according to the identifier of the current simulation project.
[0154] Optionally, in another embodiment of the present application, the cloud simulation system further includes:
[0155] A first storage unit, configured to store the simulation result in a time series database in real time when the current simulation request includes information indicating an offline simulation;
[0156] The first result feedback unit is used to obtain the user's contact information from the database after closing the target container, and feed back the simulation result in the time series database to the user according to the user's contact information.
[0157] Optionally, in another embodiment of the present application, the cloud simulation system further includes:
[0158] The status query unit is used to include information indicating online simulation in the current simulation request and query the container management system for the opening status of each container.
[0159] The exclusion unit is used to exclude ports occupied by opened containers and abnormal ports based on the opening status of each container.
[0160] The port selection unit is used to select a port of a target container from the ports that are not excluded.
[0161] The password generation unit is used to generate a one-time callback password and a connection password. The callback password is used for the target container to call back. The connection password is used for the simulation engine in the target container to connect with the front end.
[0162] Optionally, in a cloud simulation system provided in another embodiment of the present application, the simulation unit executes to notify the container management system to start the target container, so as to use the simulation engine in the target container to perform simulation based on the environment variables and use the current simulation project to generate simulation results, which is used to:
[0163] Notify the container management system to start the target container.
[0164] When the target container starts and executes the simulation engine, a notification of successful simulation engine startup is sent to the front end, and the IP, port, and connection password of the target container are fed back to the front end.
[0165] When the front end connects to the simulation engine using the IP, port, and connection password of the target container, the simulation engine uses the current simulation project to perform simulation based on environment variables and generate simulation results.
[0166] Optionally, in another embodiment of the present application, the cloud simulation system further includes:
[0167] The second result feedback unit is used to write the generated simulation results into the time series database in real time and feed back to the connected front end, so that the feedback results can be displayed to the user in real time through the front end.
[0168] Optionally, in the above cloud simulation system, it also includes:
[0169] The exception handling unit is used to handle the exception event and notify the container management system to close the target container when receiving the exception notification fed back by the target container through the callback application program interface.
[0170] It should be noted that the various units provided in the above embodiments of the present application may specifically be Figure 1 The component units of each module of the system shown may be the component units of the backend. Moreover, the specific working process of each unit may refer to the implementation process of the corresponding steps in the above method embodiment, which will not be repeated here.
[0171] Another embodiment of the present application provides an electronic device, such as Figure 6 As shown, including:
[0172] Memory 601 and processor 602 .
[0173] The memory 601 is used to store programs.
[0174] The processor 601 is used to execute the program stored in the memory 601. When the program is executed, it is specifically used to implement the cloud simulation method provided in any one of the above embodiments.
[0175] Another embodiment of the present application provides a computer storage medium for storing a computer program. When the computer program is executed by a processor, it is used to implement the cloud simulation method provided in any of the above embodiments.
[0176] Computer storage media includes 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.
[0177] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0178] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A cloud simulation method, characterized in that: include: Receive a current simulation request sent by the front end to the back end in the cloud; wherein the current simulation request at least includes an identifier of the current simulation project; According to the identifier of the current simulation project, searching the path where the current simulation project is stored in the file storage service from the database to obtain the storage path of the current simulation project; Configure the network and environment variables of any idle target container in the container management system; According to the storage path of the current simulation project, configure the file path where the target container is mounted; Notify the container management system to start the target container, so as to use the simulation engine in the target container to perform simulation based on the environment variables and the current simulation project to generate simulation results; When receiving the simulation success notification fed back by the target container through the callback application program interface, the container management system is notified to close the target container.
2. The method according to claim 1, characterized in that: Before querying the path of the current simulation project according to the identifier of the current simulation project, the method further includes: Verify the legitimacy of the current simulation request with a database; wherein, if the current simulation request passes the legitimacy verification, query the path of the current simulation project based on the identifier of the current simulation project.
3. The method according to claim 1, characterized in that The notifying the container management system to start the target container so as to use the simulation engine in the target container to perform simulation based on the environment variables and the current simulation project to generate simulation results further includes: When the current simulation request includes information indicating an offline simulation, storing the simulation result in a time series database in real time; After the target container is closed, the user's contact information is obtained from the database, and the simulation result in the time series database is fed back to the user based on the user's contact information.
4. The method according to claim 1, characterized in that Before configuring the network and environment variables of any idle target container in the container management system, the method further includes: If the current simulation request includes information indicating online simulation, querying the container management system for the opening status of each container; Based on the opening status of each of the containers, ports occupied by the opened containers and abnormal ports are excluded; Selecting a port of the target container from the ports that are not excluded; Generate a one-time callback password and a connection password; wherein the callback password is used for the target container to call back; and the connection password is used for the simulation engine in the target container to connect with the front end.
5. The method according to claim 4, characterized in that The notifying the container management system to start the target container so as to use the simulation engine in the target container to perform simulation based on the environment variables and the current simulation project to generate simulation results includes: Notify the container management system to start the target container; When the target container starts and executes the simulation engine, a notification of successful simulation engine startup is sent to the front end, and the IP address, port number and connection password of the target container are fed back to the front end; When the front end is connected to the simulation engine using the IP, port and connection password of the target container, the simulation engine performs simulation based on the environment variables and the current simulation project to generate simulation results.
6. The method according to claim 5, characterized in that After the simulation engine performs simulation based on the environment variables and uses the current simulation project to generate simulation results, the method further includes: The generated simulation results are written into a timing database in real time and fed back to the connected front end, so that the feedback results can be displayed to the user in real time through the front end.
7. The method according to claim 1, characterized in that The notifying the container management system to start the target container so as to use the simulation engine in the target container to perform simulation based on the environment variables and the current simulation project to generate simulation results further includes: When receiving the abnormal notification fed back by the target container through the callback application program interface, the abnormal event is processed and the container management system is notified to close the target container.
8. A cloud simulation system, characterized in that: include: A receiving unit, configured to receive a current simulation request sent by the front end to the back end in the cloud; wherein the current simulation request at least includes an identifier of a current simulation project; A path search unit, used to search the path where the current simulation project is stored in the file storage service from a database according to the identifier of the current simulation project, and obtain the storage path of the current simulation project; An information configuration unit, used to configure the network and environment variables of any idle target container in the container management system; A path configuration unit, used to configure the file path mounted on the target container according to the storage path of the current simulation project; Simulation reflection, used to notify the container management system to start the target container, so as to generate simulation results by using the current simulation project through the simulation engine in the target container based on the environment variables; The closing unit is used to notify the container management system to close the target container when receiving a simulation success notification fed back by the target container through the callback application program interface.
9. An electronic device, characterized in that: include: Memory and processor; Wherein, the memory is used to store programs; The processor is used to execute the program, and when the program is executed, it is specifically used to implement the cloud simulation method as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, is used to implement the cloud simulation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Cloud simulation integration and scheduling method and device, computer equipment and storage medium
CN111459621A
K8S-based automatic driving cloud simulation implementation method and system, and medium
CN112597048A
Batch simulation method, device and system
CN115048771A
Cloud simulation environment management system and method for combat scenario, equipment and medium
CN116384094A
Cloud simulation system and cloud simulation method based on digital twin control and protection equipment
CN118606212A
