CN117130624A - Environment migration method, device and equipment - Google Patents
Environment migration method, device and equipment Download PDFInfo
- Publication number
- CN117130624A CN117130624A CN202311006517.7A CN202311006517A CN117130624A CN 117130624 A CN117130624 A CN 117130624A CN 202311006517 A CN202311006517 A CN 202311006517A CN 117130624 A CN117130624 A CN 117130624A
- Authority
- CN
- China
- Prior art keywords
- environment
- file
- image
- instruction
- packaging
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 230000005012 migration Effects 0.000 title claims abstract description 35
- 238000013508 migration Methods 0.000 title claims abstract description 35
- 238000004806 packaging method and process Methods 0.000 claims abstract description 67
- 238000010276 construction Methods 0.000 claims abstract description 55
- 238000011161 development Methods 0.000 claims abstract description 43
- 238000005538 encapsulation Methods 0.000 claims abstract description 11
- 230000001419 dependent effect Effects 0.000 claims description 19
- 230000002085 persistent effect Effects 0.000 claims description 19
- 238000010801 machine learning Methods 0.000 claims description 15
- 230000004044 response Effects 0.000 claims description 4
- 230000007613 environmental effect Effects 0.000 claims description 3
- 230000001960 triggered effect Effects 0.000 abstract description 11
- 238000004590 computer program Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 9
- 230000008859 change Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 8
- 230000008569 process Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 6
- 238000009434 installation Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000013135 deep learning Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000013136 deep learning model Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012856 packing Methods 0.000 description 1
- 230000010076 replication Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012549 training Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
- G06F8/63—Image based installation; Cloning; Build to order
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/76—Adapting program code to run in a different environment; Porting
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application provides an environment migration method, device and equipment, wherein the method comprises the following steps: responding to an encapsulation instruction, and acquiring mirror image construction information corresponding to the encapsulation instruction; acquiring an environment corresponding to the packaging instruction through the mirror image construction information, and packaging the environment to obtain a corresponding mirror image file; uploading the image file to an image warehouse, and constructing a container based on the image file; according to the method and the device for the development environment migration, the environment required by the development of the project can be rapidly packaged and uploaded to the platform according to the packaging instruction triggered by the user, so that other users can rapidly migrate the development environment.
Description
Technical Field
The present application relates to the field of security operation services, and in particular, to an environment migration method, apparatus, and device.
Background
In recent years, with the continuous development of machine learning, deep learning and artificial intelligence technology, an MLOps (Machine Learning Operations, machine learning operation) platform is also receiving attention, and a dependency library required in an algorithm development process of the MLOps platform may change frequently, and some dependency library changes even have requirements on the version of application software, so that a final result is that a project development environment may change frequently.
Currently, when team project development is performed, after code is acquired in a website or other team members, a container needs to be created by using an initial image provided on an MLOps platform, and a user needs to install software or a dependency library in the container again for achieving the purpose of development environment migration, but the method needs to consume a great deal of time for some users unfamiliar with the dependency library or users unfamiliar with certain software, and various problems are likely to occur in installation.
Disclosure of Invention
The application provides an environment migration method, device and equipment, which can rapidly package and upload the environment required by the development of a project to a platform according to a package instruction triggered by a user, so that other users can rapidly migrate the development environment.
In a first aspect, the present application provides an environment migration method, including:
responding to an encapsulation instruction, and acquiring mirror image construction information corresponding to the encapsulation instruction;
acquiring an environment corresponding to the packaging instruction through the mirror image construction information, and packaging the environment to obtain a corresponding mirror image file;
uploading the image file to an image warehouse, and constructing a container based on the image file.
According to the environment migration method provided by the application, a trigger mechanism of the packaging instruction is additionally arranged on the platform, after the user triggers the packaging instruction on the platform, mirror image construction information in a user persistent volume corresponding to the packaging instruction is automatically obtained, a mirror image file corresponding to the project is obtained, and the mirror image file is uploaded to a mirror image warehouse corresponding to the project; the image file is downloaded in the image warehouse much faster than the dependency library is downloaded in the external network, the image construction information is information of a container used by a user for constructing the project, and the image file uploaded to the image warehouse is constructed according to an environment required by project development obtained by the image construction information, so that the image file is downloaded in the image warehouse, and the aim of safely and quickly migrating the development environment can be achieved.
In one or more possible embodiments, the obtaining the image construction information corresponding to the package instruction includes:
acquiring the mounting position of the user persistent volume corresponding to the item in the database according to the item information carried by the packaging instruction;
obtaining mirror image construction information in the user persistent volume corresponding to the packaging instruction according to the mounting position of the persistent volume; and the corresponding codes are quickly found according to the positions of the persistent volumes stored in the platform database in the container.
In one or more possible embodiments, the environment includes any of an operating system, environment variables, software and software versions, software dependent libraries, and software dependent library versions.
In one or more possible embodiments, the image build information includes a Dockerfile image build file and/or a requirements.
In one or more possible embodiments, the obtaining, by the mirror image build information, the environment corresponding to the package instruction includes:
after determining that the image construction information comprises a Dockerf file, acquiring environment information and a downloading method corresponding to the packaging instruction according to the Dockerf file, determining an environment according to the environment information, and downloading the environment according to the downloading method; or (b)
After the image construction information is determined to comprise a requirements file, environment information corresponding to the packaging instruction is obtained according to the requirements file, and the environment is downloaded according to the environment information by a preset method.
In one or more possible embodiments, the encapsulating the environment to obtain the corresponding image file includes:
if the mirror image construction information comprises a Dockerf file, acquiring an environment according to the Dockerf file, and packaging the acquired environment through the packaging instruction to obtain a corresponding mirror image file; or (b)
If the image construction information comprises a request-based file, acquiring an environment according to the request-based file, packaging the environment through the packaging instruction, and installing the packaged environment to a corresponding original image file to obtain a corresponding image file; or (b)
And if the image construction information comprises a request-based file, acquiring an environment according to the request-based file, and updating a corresponding original image file according to the environment to obtain a corresponding image file.
In one or more possible embodiments, in response to the encapsulated instruction, further comprising:
and if the package instruction cannot acquire the corresponding image construction information, uploading the corresponding original image file to an image warehouse, and constructing a container based on the original image file.
In one or more possible embodiments, the method is applied to MLOps machine learning operation platform development environment migration.
In a second aspect, the present application provides an environment migration apparatus, the apparatus comprising:
the information acquisition module is used for responding to the packaging instruction and acquiring mirror image construction information corresponding to the packaging instruction;
the mirror image packaging module is used for acquiring an environment corresponding to the packaging instruction through the mirror image construction information, and packaging the environment to obtain a corresponding mirror image file;
and the image uploading module is used for uploading the image file to an image warehouse and constructing a container based on the image file.
In a third aspect, the present application also provides an environment migration apparatus, the apparatus comprising:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of context migration as claimed in any one of the first aspects.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application and do not constitute a undue limitation on the application.
FIG. 1 is a flow chart of an environment migration method provided in accordance with an embodiment;
FIG. 2 is a flow chart of interaction between a user and a platform according to an embodiment;
FIG. 3 is a flowchart illustrating an environment migration method according to an embodiment;
FIG. 4 is a schematic diagram of an apparatus for environmental migration provided in accordance with an embodiment;
FIG. 5 is a schematic diagram of an environment-migrated electronic device provided in accordance with an embodiment;
fig. 6 is a schematic diagram of a storage medium according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described in further detail below with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the prior art, when a machine learning model is cooperatively developed by a team, development environments used by all members in the team should be kept consistent all the time, such as a common deep learning library tensorf low, and a large version gap can cause codes written by all members to be unable to operate in the same development environment, for example, version changes of typical tensorf low1 and tensorf low2 are particularly large, so that the consistency of the development environments is kept. The TensorFlow is a powerful open source software library for training the deep learning model, and an end-to-end open source machine learning platform is adopted, so that a beginner and an expert can create the machine learning model in desktop, mobile, network and cloud environments by means of the TensorFlow.
The following description is made with respect to the technical terms involved in the present application:
MLOps is machine learning operation and maintenance, and english is fully called: machine Learning Operations, which is a technical practice, is intended to help teams develop, deploy and maintain machine learning models more efficiently.
Dock is an open-source application container engine that allows developers to package their applications and rely on packages into a portable image and then release them onto any popular operating system machine to also enable virtualization.
The development environment refers to the environment required by all development programs, such as an operating system, environment variables, python versions, various software, and dependent library versions of python, which are required by the development of the machine learning program;
the Dockerfile image build file is a text document that contains commands for building images. The configuration environment installation method and the like required for project development are stored.
The mirror image is a special file system, and besides the files for providing programs, libraries, resources, configurations and the like required by the development of the container, the mirror image also comprises configuration parameters prepared for the development; the mirror does not contain any dynamic data, nor does its content change after construction.
A container is a standard unit of packaged code and all its dependent software for development, delivery, and deployment, allowing applications to be quickly and reliably developed from one environment to another.
The dependency library information recorded in the requirements. Txt requirements file includes a name and version number.
Persistent volumes, (PersistentVolume, PV) are a block of storage in a cluster, which may be supplied in advance by an administrator, or dynamically using storage classes (Storageclasses), are cluster resources, just as nodes are cluster resources.
The current MLOps platform can edit codes in the platform to develop the model. Meanwhile, most platforms support reproduction and secondary development of codes for downloading codes to or from a gitub (hosting platform facing open source and private software projects), however, the pulled files are often in the following forms:
1. only code files are contained and the environment on which the code runs requires the programmer to guess itself. Some simple items can run successfully by installing the latest version of the dependent library, but complex items need to constantly adjust the version of the dependent library to run successfully.
2. Including code files and requirements. The user can install the corresponding environment by manually installing the dependent library and version recorded in the requirements. Txt file, however, the library on which part of the machine learning project depends also includes the underlying system architecture, software, etc., the requirements. Txt file can only record the dependent library of python and cannot be completely covered, and the programmer is required to install the corresponding software, driver, etc. according to the project profile.
3. Including code files and Dockerfile files. The user can encapsulate the mirror image through the provided Dockerf file, and create a container according to the mirror image, so that the code runs in the container. This method is very simple compared to the first two, but has two more serious problems. Firstly, the time for installing software or relying libraries when the mirror image is packaged is long, some software or relying libraries need to be connected with an external network, and access is often unstable; secondly, in the MLOps platform under the cloud primary environment, as the service in one container is exposed to the user, the form of container sleeve container can appear when the Dockerfile file package mirror image is used, and the operation is too bulky and time-consuming.
4. Mirror names stored on the docker hub (used for source code management integration, as well as for build and test tools to accelerate deployment cycles, which are reduced from days to minutes of computation) are provided, and user downloads can directly create containers and run items in containers. The method is more convenient, but the same as the previous point, the problems of slow image downloading and difficult use of the MLOps platform still exist.
In the conventional software development process, a programmer will not change the development environment (such as a computer programming language java, a michael database mysql, etc.) for years as long as no special requirements are required after the local configuration is completed. However, the dependent libraries in the algorithm development process often need to be changed frequently, and the change of some dependent libraries even has requirements on the version of the computer programming language python, and the development environment needs to be changed frequently, so that a means for quickly building and migrating the development environment is needed to reduce the workload of algorithm engineers.
Based on the problems, the application provides an environment migration method, an environment migration device and environment migration equipment, which can rapidly package and upload the environment required by the development of a project to a platform according to a package instruction triggered by a user, so that other users can rapidly migrate the development environment.
Example 1
The application provides an environment migration method, as shown in fig. 1, comprising the following steps:
s101, responding to a packaging instruction, and acquiring mirror image construction information corresponding to the packaging instruction;
in one or more possible embodiments, the package instruction is triggered by the first user, where the triggering manner in the package instruction triggered by the first user includes multiple manners, for example, the first user touches or clicks a related button, or may also receive a voice of the user, for example, a button is newly added on the platform, and after the first user touches or clicks the button, the package instruction is determined to be triggered; or, a voice recognition module is arranged in the equipment where the platform is located, and when the first user speaks voices such as 'project encapsulation' or 'mirror image encapsulation', the equipment recognizes the voices and determines to trigger the encapsulation instruction; in this embodiment, the manner of encapsulating the instruction triggered by the first user is not particularly limited.
In one or more possible embodiments, the mirror image can be built by using a command, however, the command must be run outside the user's container, and since the MLOps platform is to ensure its security, only allows the user to access its container, it is impossible for the user to execute the command package mirror image on the server bare machine; for example, the application sets a button for the MLOps platform, thereby not only ensuring that the user cannot access the resources outside the user container, but also ensuring that the user enjoys the convenience of the Dockerfile package.
The application acquires the mirror image construction information corresponding to the package instruction in the following way, which comprises the following steps:
and acquiring the mounting position of the user persistent volume corresponding to the item in the database according to the item information carried by the packaging instruction.
And acquiring mirror image construction information in the user persistent volume corresponding to the packaging instruction according to the mounting position of the persistent volume.
In one or more possible embodiments, for example, a code of a first user-created item may be stored in a persistent volume, and the persistent volume is mounted to a designated location in a container according to an instruction of the first user, and a mounting location of the persistent volume may be recorded in a database of a platform, where the mounting location is a location where the persistent volume is mounted in the container, so as to be capable of finding a user code that needs to be copied and automatically copying, where the code includes image construction information.
For example, a first user creates an item on the MLOps platform that includes the package instruction button, and writes or downloads some code files in the item from the gitsub. The code files comprise python code files required by running a machine learning task, various model files with the end of the suffix such as pkl/. Bin/. H5 and various data files with the end of the suffix such as csv/. Pcap/. Jpg; meanwhile, the system may further include image construction information, and based on the MLOps platform, the image construction information in the application refers to a Dockerfile file and/or a requirements file; the above-mentioned requirements. Txt file records the names and version numbers of all python dependent libraries required for running the project, and the user can install the required installation library in the container by means of a command; the Dockerfile file comprises a command for constructing a mirror image, can cover all functions which can be performed by the requirements.txt file, and can also support functions of designating an operating system, modifying environment variables, downloading software in various fields such as network security/machine learning and the like; whether or not the image construction information is included in the code file is determined according to a code writer.
S102, acquiring an environment corresponding to the packaging instruction through the mirror image construction information, and packaging the environment to obtain a corresponding mirror image file.
In one or more possible embodiments, the environment corresponding to the package instruction is obtained through the image construction information, where the environment includes, but is not limited to, any multiple of an operating system, an environment variable, software and a software version, a software dependent library, and a software dependent library version; when determining that a project needs to be developed, the operating system firstly needs to determine a development system corresponding to the project to develop; the environment variables refer to parameters used for specifying the running environment of the operating system in the operating system, such as temporary folders, system folder positions and the like; the dependency library and the version of the dependency library can change frequently in the project development process, meanwhile, the corresponding software and the version of the software also need to change based on the change of the dependency library, and only if the dependency library and the version of the software are determined to be correct, the code can be run; the image construction information refers to a Dockerfile image construction file and/or a requirements file, and particularly please view the term interpretation part provided above; the packaged image can be operated by directly downloading the image by including software and a dependency library.
S103, uploading the image file to an image warehouse, and constructing a container based on the image file.
In one or more possible embodiments, the image repository may be set according to a name of a user created item, for example, a first repository corresponding to a first item, a second repository corresponding to a second item, or the like, or different images corresponding to a plurality of different items may be uploaded to the same repository, and different names may be set for image files corresponding to different items; uploading the obtained image files to image warehouses corresponding to the project on a platform, and searching the image warehouses corresponding to the project names and downloading the corresponding image files according to image downloading instructions including the project names triggered by a second user when the second user needs the environment required by the project development, or directly searching the image files corresponding to the project names in the image warehouses and downloading the image files; constructing containers required during project development according to the image files; the second user container is constructed according to the image file, the image file is obtained by packaging based on an environment required by project development, and the first user container is constructed according to the environment, so that migration of development environments is completed. Meanwhile, downloading the images in the image warehouse is much faster than downloading the dependency library on the external network, and the downloading will not fail and the time of the developer is wasted.
In one or more possible embodiments, as shown in fig. 2, an interaction schematic between the platform and the user includes:
s201, a first user clicks a packaging button;
s202, responding to a packaging instruction triggered by a first user by a platform, and acquiring mirror image construction information corresponding to the packaging instruction;
s203, the platform acquires the environment corresponding to the packaging instruction according to the mirror image construction information, and packages the environment to obtain a corresponding mirror image file;
s204, uploading the mirror image file to a mirror image warehouse set by the platform, and waiting for downloading of a second user;
s205, triggering a mirror image downloading instruction comprising the project name by a second user;
s206, the platform searches the mirror image warehouse of the platform according to the project name, downloads the corresponding mirror image file and constructs a corresponding container.
According to the environment migration method provided by the application, according to the package instruction triggered by the user, the environment required by the development of the project can be rapidly packaged and uploaded to the platform, so that other users can rapidly migrate the development environment.
In one or more possible implementations, the obtaining, by the mirror construction information, the environment corresponding to the package instruction includes: after determining that the image construction information comprises a Dockerf file, acquiring environment information and a downloading method of an item corresponding to the packaging instruction according to the Dockerf file, determining an environment according to the environment information, and downloading the environment corresponding to the item according to the downloading method; or after determining that the image construction information comprises a request-based file, acquiring environment information corresponding to the packaging instruction according to the request-based file, and downloading the environment according to the environment information by a preset method.
The method comprises the steps that a command for constructing a mirror image is recorded in the Dockerfile, all functions which can be made by a required information txt file can be covered, meanwhile, functions of designating an operating system, modifying environment variables, downloading software in various fields such as network security/machine learning and the like can be supported, specifically, when the mirror image construction information is determined to comprise the Dockerfile file, the Dockerfile file comprises environment information and a downloading method, the environment information is used for determining the environment, for example, the environment information is software name version information, dependent library name and version information, downloaded software and dependent library can be determined according to the software name version information, the dependent library name and the version information, and the software and the dependent library are downloaded by adopting the downloading method in the Dockerfile file; when it is determined that the image construction information includes a request file, environment information is obtained according to the request file, and an environment is downloaded according to the environment information by a preset method, where the preset method may be determined according to a specific item, for example, may be a pop-up download box, etc., so long as the environment can be downloaded.
In one or more possible embodiments, the encapsulating the environment to obtain the corresponding image file includes:
if the mirror image construction information comprises a Dockerf file, acquiring an environment according to the Dockerf file, and packaging the acquired environment through the packaging instruction to obtain a corresponding mirror image file;
in one or more possible embodiments, the instructions to package the image are similar to such: the dock build-f dock file-t image_name is obtained by packing the environment required by project development obtained through the dock file, and finally obtaining an image file corresponding to the project;
or if the image construction information comprises a request-based file, acquiring an environment according to the request-based file, packaging the environment through the packaging instruction, and installing the packaged environment to a corresponding original image file to obtain a corresponding image file;
in one or more possible embodiments, the original image file is recorded in a database of the platform, so as to be quickly acquired when determining that the original image file corresponding to the item is needed; for example, when it is determined that the original image file does not include the dependency library corresponding to the dependency library version information included in the current requirements.txt file, the corresponding dependency library is directly downloaded according to the dependency library version information included in the current requirements.txt file, and packaged by the packaging instruction, and the packaged dependency library is installed in the original image file corresponding to the item, so as to finally obtain the corresponding image file.
Or if the image construction information comprises a request file, acquiring an environment according to the request file, and updating the corresponding original image file according to the environment to obtain the corresponding image file.
In one or more possible embodiments, for example, when it is determined that the image construction information includes a request, the dependency library is downloaded according to version information of the dependency library in the request, and it is determined that the corresponding original image file also includes the dependency library, but the versions of the dependency libraries are different, the original image file is updated according to the dependency library corresponding to the request, and the updated original image file is used as the image file corresponding to the item.
In one or more possible embodiments, in response to the encapsulated instruction, further comprising: and if the package instruction cannot acquire the corresponding image construction information, uploading the corresponding original image file to an image warehouse, and constructing a container based on the original image file. That is, the code in the persistent user volume does not include the Dockerfile file and the requirements file, and at this time, no environment information required by downloading software, a dependency library, etc. is required, and the original image file corresponding to the item is directly used as the corresponding image file and uploaded to the image repository; and the second user can construct a container for developing the project based on the original image file through the developing device.
In one or more possible embodiments, when the second user wants to develop the project through the container, a replication process is started under the corresponding project of the platform, the container for developing the project is constructed according to the image file, a corresponding database on the platform is queried, the location of the permanent volume where the code is located is queried, the corresponding code in the permanent volume on the container in the first user project is replicated, and the code is also mounted in the permanent volume form in the container corresponding to the project for the second user to use, so that all development environments and migration processes of the project are completed.
The application provides an environment migration method, as shown in fig. 3, comprising the following steps:
s301, responding to a packaging instruction, determining whether a user persistent volume corresponding to the packaging instruction comprises a Dockerfile, if so, executing S302, otherwise, executing S303;
s302, acquiring an environment according to the Dockerfile file, packaging the acquired environment through the packaging instruction, and executing S306 after obtaining a corresponding mirror image file;
s303, determining whether a user persistent volume corresponding to the packaging instruction comprises a requirements file, if so, executing S304, otherwise, executing S305;
s304, acquiring an environment according to the requirements.txt file, packaging through the packaging instruction, and installing the packaged environment to a corresponding original image file to obtain a corresponding image file; or updating the corresponding original image file according to the environment to obtain the corresponding image file, and executing S306;
s305, taking the original image file as an image file of the project, and executing S306;
s306, uploading the image file to an image warehouse so that the second user builds a container based on the image file.
In one or more possible embodiments, the above-mentioned method of automatically encapsulating images by the platform may not be limited to detecting the Dockerfile or request. Txt files existing in the user code file, and the above-mentioned platform may provide a separate entry for writing environment dependencies for the user, where the user may record the operating system, environment variables, installed software, dependency library, etc. required for running the project. The platform automatically identifies the information filled by the user, converts the information into Dockerfile for mirror image packaging; for example, when the filling operating system is ubuntu:22.04, the platform converts it into the corresponding Dockerfile statement: FROM ubuntu 22.04; when filling in the environment variables, the platform converts the environment variables into corresponding ENV xxx=xxx; when filling software and relying on libraries, the platform converts the software and relying libraries into corresponding RUN apt inst or RUN pip inst sentences to realize mirror image packaging.
According to the environment migration method provided by the application, the environment required by the development of the project can be rapidly packaged and uploaded to the platform according to the packaging instruction triggered by the user, so that other users can rapidly migrate the development environment.
Example 2
The application also provides an environment migration device, as shown in fig. 4, which comprises:
an information obtaining module 401, configured to obtain mirror image construction information corresponding to an encapsulation instruction in response to the encapsulation instruction;
the mirror image packaging module 402 is configured to obtain an environment corresponding to the packaging instruction through the mirror image construction information, and package the environment to obtain a corresponding mirror image file;
and the image uploading module 403 is configured to upload the image file to an image repository, and construct a container based on the image file.
Example 3
The application also provides an environment migration device, which comprises at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the context migration method described above.
As shown in fig. 5, the device comprises a processor 501, a memory 502, a communication interface 503 and a bus 504. Wherein the processor 501, the memory 502 and the communication interface 503 are interconnected by a bus 504.
The processor 501 is configured to read and execute the instructions in the memory 502, so that at least one processor can execute the environment migration method provided in the foregoing embodiment.
The memory 502 is used for storing various instructions and programs of the environment migration method provided in the above embodiment.
Bus 504 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus or one type of bus.
The processor 501 may be any combination of a central processor (central processing unit, CPU for short), a network processor (network processor, NP for short), an image processor (Graphic Processing Unit, GPU for short) or CPU, NP, GPU. But also a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (programmable logic device, PLD), or a combination thereof. The PLD may be a complex programmable logic device (complex programmable logic device, CPLD for short), a field-programmable gate array (field-programmable gate array, FPGA for short), general-purpose array logic (generic array logic, GAL for short), or any combination thereof.
Example 4
In addition, the present application also provides a computer-readable storage medium, as shown in fig. 6, in which a computer program is stored, the computer program being configured to cause a computer to execute any one of the methods in the above embodiments.
The memory may include readable media in the form of volatile memory, such as Random Access Memory (RAM) 621 and/or cache memory 622, and may further include Read Only Memory (ROM) 623.
The memory may also include a program/utility 625 having a set (at least one) of program modules 624, such program modules 624 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.
Claims (10)
1. An environmental migration method, comprising:
responding to an encapsulation instruction, and acquiring mirror image construction information corresponding to the encapsulation instruction;
acquiring an environment corresponding to the packaging instruction through the mirror image construction information, and packaging the environment to obtain a corresponding mirror image file;
uploading the image file to an image warehouse, and constructing a container based on the image file.
2. The method of claim 1, wherein the obtaining the image construction information corresponding to the package instruction includes:
acquiring the mounting position of the user persistent volume corresponding to the item in the database according to the item information carried by the packaging instruction;
and acquiring mirror image construction information in the user persistent volume corresponding to the packaging instruction according to the mounting position of the persistent volume.
3. The method of claim 1, wherein the environment comprises any of an operating system, environment variables, software and software versions, software dependent libraries and software dependent library versions.
4. The method of claim 1, wherein the image build information comprises a Dockerfile image build file and/or a requirements.
5. The method of claim 4, wherein the obtaining, by the mirror build information, the environment corresponding to the package instruction comprises:
after determining that the image construction information comprises a Dockerf file, acquiring environment information and a downloading method corresponding to the packaging instruction according to the Dockerf file, determining an environment according to the environment information, and downloading the environment according to the downloading method; or (b)
After the image construction information is determined to comprise a requirements file, environment information corresponding to the packaging instruction is obtained according to the requirements file, and the environment is downloaded according to the environment information by a preset method.
6. The method according to claim 4 or 5, wherein said encapsulating the environment to obtain the corresponding image file includes:
if the mirror image construction information comprises a Dockerf file, acquiring an environment according to the Dockerf file, and packaging the acquired environment through the packaging instruction to obtain a corresponding mirror image file; or (b)
If the image construction information comprises a request-based file, acquiring an environment according to the request-based file, packaging the environment through the packaging instruction, and installing the packaged environment to a corresponding original image file to obtain a corresponding image file; or (b)
And if the image construction information comprises a request-based file, acquiring an environment according to the request-based file, and updating a corresponding original image file according to the environment to obtain a corresponding image file.
7. The method of any of claims 1-5, further comprising, in response to the packaging instruction:
and if the package instruction cannot acquire the corresponding image construction information, uploading the corresponding original image file to an image warehouse, and constructing a container based on the original image file.
8. The method of any one of claims 1-5, applied to MLOps machine learning operation platform development environment migration.
9. An environmental migration apparatus, the apparatus comprising:
the information acquisition module is used for responding to the packaging instruction and acquiring mirror image construction information corresponding to the packaging instruction;
the mirror image packaging module is used for acquiring an environment corresponding to the packaging instruction through the mirror image construction information, and packaging the environment to obtain a corresponding mirror image file;
and the image uploading module is used for uploading the image file to an image warehouse and constructing a container based on the image file.
10. An environment migration apparatus, the apparatus comprising:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of context migration of any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311006517.7A CN117130624A (en) | 2023-08-10 | 2023-08-10 | Environment migration method, device and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311006517.7A CN117130624A (en) | 2023-08-10 | 2023-08-10 | Environment migration method, device and equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117130624A true CN117130624A (en) | 2023-11-28 |
Family
ID=88851928
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311006517.7A Pending CN117130624A (en) | 2023-08-10 | 2023-08-10 | Environment migration method, device and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117130624A (en) |
-
2023
- 2023-08-10 CN CN202311006517.7A patent/CN117130624A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107766126B (en) | Container mirror image construction method, system and device and storage medium | |
US10241778B2 (en) | Microservices version state visualization | |
CN112416524A (en) | Implementation method and device of cross-platform CI/CD (compact disc/compact disc) based on docker and kubernets offline | |
CN108319460B (en) | Method and device for generating application program installation package, electronic equipment and storage medium | |
US20200057654A1 (en) | Method and system for mirror image package preparation and application operation | |
EP3035191A1 (en) | Identifying source code used to build executable files | |
CN108563440B (en) | Automatic adding method and device of list controller codes and readable storage medium | |
EP3320436B1 (en) | System and method for provisioning cloud services across heterogeneous computing environments | |
CN108733553B (en) | Docker-based test device configuration method, device and system | |
EP3137989A1 (en) | Fast deployment across cloud platforms | |
US11307839B2 (en) | Updating of container-based applications | |
CN114651233A (en) | Instant container | |
US11061739B2 (en) | Dynamic infrastructure management and processing | |
US20230128866A1 (en) | Source code conversion from application program interface to policy document | |
US9886272B1 (en) | Transformation of a web application into a hybrid mobile application | |
US10698666B2 (en) | Automatically building software projects | |
CN111273965B (en) | Container application starting method, system and device and electronic equipment | |
US11853752B2 (en) | Migration of web applications between different web application frameworks | |
US20210304068A1 (en) | Data processing system and data processing method | |
US20210019169A1 (en) | Container-based virtualization system | |
CN114064079A (en) | Packing method and device of algorithm application element, equipment and storage medium | |
CN117555563B (en) | Method and device for constructing platform mirror image, computer equipment and storage medium | |
CN107092472B (en) | Dynamic publishing method and device | |
CN117130624A (en) | Environment migration method, device and equipment | |
CN117055913A (en) | Method, device, equipment and medium for constructing environment of perception system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |