Embodiment
Below with reference to accompanying drawings exemplary embodiment of the present disclosure is described in more detail.Although show exemplary embodiment of the present disclosure in accompanying drawing, however should be appreciated that can realize the disclosure in a variety of manners and not should limit by the embodiment set forth here.On the contrary, provide these embodiments to be in order to more thoroughly the disclosure can be understood, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
The embodiment of the present invention provides a kind of construction method of container process control, and as shown in Figure 1, the method comprises:
101, the function services in the first container is obtained.
Based on different Linux release versions, container based on the exploitation of Linux release version also there are differences, when the function services that exploitation container is corresponding, often use different programming languages, thus the environment for use of function services be there are differences, the function services in a kind of container may be caused can not to be applied directly in other container, and namely the compatibility of function services between different vessels is poor.In the specific implementation, the type of container is including, but not limited to following content, and such as, black class schemes Ubuntu type, community's Enterprise Operation System (Community Enterprise Operating System, CentOS) type; Or, DebianGNU/Linux type, Fedora type etc.The particular type of the embodiment of the present invention to container does not limit.
In order to reach the object starting multiple subprocess in a container simultaneously, first, obtain the function services in the first container, this function services can realize calling of multiple subprocess by calling a process.
102, start-up performance service in second container.
By obtain after function services start in second container, if this function services can start in second container, then without the need to performing step 103, directly by obtain function services " transplanting " in second container.But in actual mechanical process, because function services compatibility is poor, the function services in a container often directly can not start in another kind of container; If this function services cannot start in second container, then perform step 103.
103, adaptation is carried out to the environment for use of function services, generate the container process control being applicable to second container.
Wherein, the environment for use of function services is the container environment of the first container, and the container environment of the first container is computer program programming language, because different computer program programming languages supported by different containers, therefore, container environment in different containers is caused to there are differences.The computer program programming language that the embodiment of the present invention provides includes but are not limited to following content, such as, and Python, C language, JAVA, ASP, ASP.NET, Visual Basic, Visual Basic.NET; Or, C++, C#, Perl, PHP, SQL, FoRTRAN, Visual Foxpro etc.The particular type of the embodiment of the present invention to computer program programming language does not limit, and whether computer program programming language will be supported to determine according in its place container.
After environment for use process adaptation to the function services obtained in step 101, generate the container process control being applicable to second container, the container process control of second container possesses identical function with the function services in the first container in itself, namely can both realize calling a process and realize calling of multiple subprocess.When container process control starts, the process that container process control calls can call multiple subprocess, can receive the solicited message that subprocess sends, also can send control information to subprocess, thus realizes being entered by a multiple son of process transfer.
Supporting different computer program programming languages to better understand different containers, will a concrete scene be provided to be described below.Exemplary, when supposing the function services 1 in exploitation first container, computer program programming language JAVA is used to write, and the computer program programming language in second container only supports Python, can start in second container to make function services 1, adaptation is carried out to the environment for use JAVA of function services, is adapted to the form that Python can run.Wherein, may relate in adaptation procedure the change of name variable, source code replacement, change the function, init state etc. that call.
The construction method of the container process control that the embodiment of the present invention provides, first the function services in the first container is obtained, this function services can realize calling of multiple subprocess by calling a process, function services after obtaining is started in the first container, when this function services cannot start in second container, adaptive to the environment for use process of this function services, generate the container process control being applicable to second container, a container process control is built by this function services " transplanting " to second container, container can be made when calling a process, realize calling of multiple subprocess.
Further, as to the refinement of above-described embodiment and expansion, when adaptation being carried out to the environment for use of function services in above-mentioned steps 103, can adopt but be not limited to following mode and realize, such as, the environment for use of this function services is transform as the container environment of second container.In a kind of implementation of the embodiment of the present invention, first the function services after acquisition is resolved, obtain the command statement that this function services is corresponding, this command statement is converted to the command statement that can perform in the container environment of second container, wherein, the command statement that function services is corresponding is the source code that this function services is corresponding.When the command statement that this function services of acquisition is corresponding, in a kind of implementation of the embodiment of the present invention, the execution sequence according to function services is resolved one by one, obtains the source code that this function services is corresponding; In the another kind of implementation of the embodiment of the present invention, the instrument of any one automatic acquisition source code that those skilled in the art can be used usual, obtains the source code of this function services.The embodiment of the present invention does not limit the imperatival specific implementation obtaining this function services corresponding.
In embodiments of the present invention, based on the prerequisite of function services poor compatibility between different vessels, after the source code that the function services in acquisition first container is corresponding, need this source code to be converted to the source code that can perform in the container environment of second container.When changing this source code, the embodiment of the present invention can adopt but be not limited to following mode and realize, source code corresponding for function services in first container is replaced by the container environment according to second container, replaces to the source code that second container can be compatible.It should be noted that, source code corresponding for function services is converted to the source code that can perform in the container environment of second container, what change is that different vessels environment can identify, compatible computer program programming language, and the functional character that in the first container, function services is corresponding can not be changed, namely the source code that function services is corresponding is converted to the source code that can perform in the container environment of second container, can not change function services can the realize multiple subprocess functional character called by calling a process.Exemplary, apt-get is used to assure the command statement of reason in first container, and in second container, use yum to assure the command statement of reason, apt-get assures command statement that the command statement of reason and yum assure reason and mainly provides and search, install, delete some, the command statement of one group of even whole software package, because the otherness of container environment, second container can not be identified, and apt-get assures the command statement of reason, therefore the command statement of apt-get being assured reason is needed to replace to the command statement that yum assures reason, convert to can in the container environment of second container fill order statement.These are only exemplary citing, imperatival conversion will be as the criterion according to the computer program programming language supported concrete in container, and the embodiment of the present invention does not limit this.
Further, command statement is being converted in the imperatival process that can perform in the container environment at second container, not all command statement all can not perform in second container, in order to the speed of conversion command statement can be improved, fail the command statement performed in the container environment of second container in sense command statement, and the command statement of failing to perform is changed.Owing to there are close or similar service regeulations in computer program programming language, therefore, make between different computer program programming languages, also can there is the mutually general professional word of part or call identical function etc.Exemplary, if the corresponding container environment of the function services of the first container is C language, and the container environment of second container is C Plus Plus, after obtaining command statement corresponding to function services, first according to the container environment C Plus Plus of second container, travel through the command statement obtained by the function services of parsing use C language exploitation, determine which command statement can perform in the container environment of second container, which command statement can not perform in the container environment of second container, and the command statement that can not perform in the container environment of second container is changed, to improve the speed of conversion command statement.Wherein, about the detailed process of conversion command statement, please refer to the above-mentioned detailed description about conversion command statement, the embodiment of the present invention no longer repeats herein.
Further, adaptation is being carried out to the environment for use of function services, generate after being applicable to the container process control of second container, in the construction method of the container process control that the embodiment of the present invention provides, this container process control of start-up operation instruction operation can also be sent, and to the called process sending controling instruction in container process control, realize can running multiple process in a container simultaneously.In the specific implementation, when container process control runs, operating personnel's called process in this container process control of computing machine sends the steering order starting or stop, and such as, in this container process control, called process sends the steering order of promoter process 3; Or called process sends the steering order stopping subprocess 5 in this container process control.In addition, container process control can also receive the process signals that the subprocess under its control sends, such as, and the process signals that the process that container process control receives subprocess 2 transmission terminates; Or container process control receives process signals of the process interrupt that subprocess 3 sends etc.Concrete, the particular content of steering order that the embodiment of the present invention receives container process control, that send does not limit.
When sending start-up operation instruction operation container process control, can adopt but be not limited to following mode and realize running container process control, such as, send start-up operation instruction operation container process control by keyboard; Or, by mouse action start-up operation instruction operation container process control.The specific implementation of the embodiment of the present invention to start-up operation instruction operation container process control does not limit.
Further, as the realization to method shown in above-mentioned Fig. 1, the embodiment of the present invention additionally provides a kind of construction device of container process control, in order to realize the method shown in different implementations that above-described embodiment provides.As shown in Figure 2, this device comprises:
Acquiring unit 21, for obtaining the function services in the first container, function services can realize calling of multiple subprocess by calling a process, based on different Linux release versions, container based on the exploitation of Linux release version also there are differences, when the function services that exploitation container is corresponding, often use different programming languages, thus the environment for use of function services be there are differences, the function services in a kind of container may be caused can not to be applied directly in other container, and namely the compatibility of function services between different vessels is poor;
Start unit 22, in second container, start the function services that acquiring unit 21 obtains, in actual mechanical process, because function services compatibility is poor, the function services in a container often directly can not start in another kind of container;
Adaptation unit 23, when function services cannot start in the second container of start unit 22, carries out adaptation to the environment for use of function services, generates the container process control being applicable to second container; Wherein, the environment for use of function services is the container environment of the first container, and the container environment of the first container is computer program programming language, because different computer program programming languages supported by different containers, therefore, container environment in different containers is caused to there are differences.
Further, adaptation unit 23, also for the environment for use of function services being transform as the container environment of second container, generate the container process control being applicable to second container, the container process control of second container possesses identical function with the function services in the first container in itself, namely can both realize calling a process and realize calling of multiple subprocess.When container process control starts, the process that container process control calls can call multiple subprocess, can receive the solicited message that subprocess sends, also can send control information to subprocess, thus realizes being entered by a multiple son of process transfer.
Further, as shown in Figure 3, adaptation unit 23, comprising:
Parsing module 231, for analytical capabilities service, obtains the command statement that function services is corresponding;
Modular converter 232, command statement for being obtained by parsing module 231 is converted to the command statement that can perform in the container environment of second container, it should be noted that, source code corresponding for function services is converted to the source code that can perform in the container environment of second container, what change is that different vessels environment can identify, compatible computer program programming language, and the functional character that in the first container, function services is corresponding can not be changed, namely the source code that function services is corresponding is converted to the source code that can perform in the container environment of second container, function services can the realize multiple subprocess functional character called by calling a process can not be changed.
Further, as shown in Figure 4, modular converter 232, comprising:
Detection sub-module 2321, for failing the command statement performed in the container environment of second container in sense command statement, wherein, owing to there are close or similar service regeulations in computer program programming language, therefore, make between different computer program programming languages, also can there is the mutually general professional word of part or call identical function etc.First, determine which command statement can perform in the container environment of second container, which command statement can not perform in the container environment of second container, and the command statement that can not perform in the container environment of second container is changed, so that improve the speed of conversion command statement;
Transform subblock 2322, changes for the command statement of failing to perform detection sub-module 2321 detected.
Further, the command statement that parsing module 231 is resolved is the source code that function services is corresponding.
Further, container environment is computer program programming language, computer program programming language comprises: Python, C language, JAVA, ASP, ASP.NET, Visual Basic, Visual Basic.NET, can also comprise: C++, C#, Perl, PHP, SQL, FoRTRAN, Visual Foxpro etc., concrete, the embodiment of the present invention does not limit computer program programming language.
Further, as shown in Figure 5, method also comprises:
Transmitting element 24, for carrying out adaptation in the environment for use of adaptation unit 23 pairs of function services, generates after being applicable to the container process control of second container, sends start-up operation instruction fortune container process control;
Transmitting element 24, also for the called process sending controling instruction in container process control, steering order is for controlling multiple subprocess, and when container process control runs, operating personnel's called process in this container process control of computing machine sends the steering order starting or stop.
The construction device of the container process control that the embodiment of the present invention provides, first the function services in the first container is obtained, this function services can realize calling of multiple subprocess by calling a process, function services after obtaining is started in the first container, when this function services cannot start in second container, adaptive to the environment for use process of this function services, generate the container process control being applicable to second container, a container process control is built by this function services " transplanting " to second container, container can be made when calling a process, realize calling of multiple subprocess.
The embodiment of the invention discloses the construction method of A 1, a kind of container process control, comprising:
Obtain the function services in the first container, described function services can realize calling of multiple subprocess by calling a process;
Described function services is started in second container;
If described function services cannot start in described second container, then adaptation is carried out to the environment for use of described function services, generate the container process control being applicable to described second container; Wherein, the environment for use of described function services is the container environment of described first container.
A2, method according to A1, the described environment for use to described function services carries out adaptation, comprising:
The environment for use of described function services is transform as the container environment of described second container.
A3, method according to A2, the described environment for use to described function services carries out adaptation, comprising:
Resolve described function services, obtain the command statement that described function services is corresponding;
Described command statement is converted to the command statement that can perform in the container environment of described second container.
A4, method according to A3, be describedly converted to the command statement that can perform in the container environment of described second container by described command statement, comprising:
Detect in described command statement the command statement failing to perform in the container environment of second container;
The described command statement of failing to perform is changed.
A5, method according to A3 or A4, described command statement is the source code that described function services is corresponding.
A6, method according to any one of A1-A4, described container environment is computer program programming language, and described computer program programming language comprises: Python, C language, JAVA, ASP, ASP.NET, Visual Basic, Visual Basic.NET.
A7, method according to A1, carrying out adaptation to the environment for use of described function services, and generate after being applicable to the container process control of described second container, described method also comprises:
Send container process control described in start-up operation instruction operation;
To the called process sending controling instruction in described container process control, described steering order is for controlling described multiple subprocess.
The construction device of B8, a kind of container process control, comprising:
Acquiring unit, for obtaining the function services in the first container, described function services can realize calling of multiple subprocess by calling a process;
Start unit, for starting the described function services that described acquiring unit obtains in second container;
Adaptation unit, for when described function services cannot start in described second container, carries out adaptation to the environment for use of described function services, generates the container process control being applicable to described second container; Wherein, the environment for use of described function services is the container environment of described first container.
B9, device according to B8, described adaptation unit, also for the environment for use of described function services being transform as the container environment of described second container.
B10, device according to B9, described adaptation unit, comprising:
Parsing module, for resolving described function services, obtains the command statement that described function services is corresponding;
Modular converter, the described command statement for being obtained by described parsing module is converted to the command statement that can perform in the container environment of described second container.
B11, device according to B10, described modular converter, comprising:
Detection sub-module, for detecting in described command statement the command statement failing to perform in the container environment of second container;
Transform subblock, changes for the described command statement of failing to perform described detection sub-module detected.
B12, device according to any one of B10 or B11, the described command statement that described parsing module is resolved is the source code that described function services is corresponding.
B13, device according to any one of B8-B11, described container environment is computer program programming language, and described computer program programming language comprises: Python, C language, JAVA, ASP, ASP.NET, Visual Basic, Visual Basic.NET.
B14, device according to B8, described device also comprises:
Transmitting element, for carrying out adaptation at described adaptation unit to the environment for use of described function services, generating after being applicable to the container process control of described second container, sending container process control described in start-up operation instruction operation;
Described transmitting element, also for the called process sending controling instruction in described container process control, described steering order is for controlling described multiple subprocess.
In addition, owing to there are close or similar service regeulations in computer program programming language, therefore, make between different computer program programming languages, also can there is the mutually general professional word of part or call identical function etc.Therefore, in order to the speed of conversion command statement can be improved, in sense command statement, fail the command statement performed in the container environment of second container, and the command statement of failing to perform is changed.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.
Be understandable that, the correlated characteristic in said method and device can reference mutually.In addition, " first ", " second " in above-described embodiment etc. are for distinguishing each embodiment, and do not represent the quality of each embodiment.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the system of foregoing description, the specific works process of device and unit, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
Intrinsic not relevant to any certain computer, virtual system or miscellaneous equipment with display at this algorithm provided.Various general-purpose system also can with use based on together with this teaching.According to description above, the structure constructed required by this type systematic is apparent.In addition, the present invention is not also for any certain programmed language.It should be understood that and various programming language can be utilized to realize content of the present invention described here, and the description done language-specific is above to disclose preferred forms of the present invention.
In instructions provided herein, describe a large amount of detail.But can understand, embodiments of the invention can be put into practice when not having these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand in each inventive aspect one or more, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires feature more more than the feature clearly recorded in each claim.Or rather, as claims below reflect, all features of disclosed single embodiment before inventive aspect is to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and adaptively can change the module in the equipment in embodiment and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit be mutually repel except, any combination can be adopted to combine all processes of all features disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) can by providing identical, alternative features that is equivalent or similar object replaces.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in the following claims, the one of any of embodiment required for protection can use with arbitrary array mode.
All parts embodiment of the present invention with hardware implementing, or can realize with the software module run on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that the some or all functions of the some or all parts in the denomination of invention (as determined the device of website internal chaining grade) that microprocessor or digital signal processor (DSP) can be used in practice to realize according to the embodiment of the present invention.The present invention can also be embodied as part or all equipment for performing method as described herein or device program (such as, computer program and computer program).Realizing program of the present invention and can store on a computer-readable medium like this, or the form of one or more signal can be had.Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described instead of limit the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment when not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and does not arrange element in the claims or step.Word "a" or "an" before being positioned at element is not got rid of and be there is multiple such element.The present invention can by means of including the hardware of some different elements and realizing by means of the computing machine of suitably programming.In the unit claim listing some devices, several in these devices can be carry out imbody by same hardware branch.Word first, second and third-class use do not represent any order.Can be title by these word explanations.