Loading...
 

CX_WEB_SERVICE_MANAGER::LaunchDedicatedClassiX

CX_WEB_SERVICE_MANAGER::LaunchDedicatedClassiX

4.1.0
204939

Description:

This method instructs the connected MorphIT server to start a new ClassiX process with the specified parameters on the specified launcher instance. For this to work, the following conditions must be met:

  1. The ClassiX is connected to the server(HasMorphITConnection = TRUE)
  2. A MorphIT-Launcher is running under the specified IP/host name and is connected to this MorphIT server
  3. The MorphIT launcher has enough free capacity to launch an instance
  4. A valid start nonce is transferred, which was delivered by the server via RequestMorphITBinding.

If the start fails, this call will fail with a corresponding error message. Otherwise the process ID of the started process is returned. As the process is started via CMD /C, the process ID corresponds to the process ID of the cmd process and not to the actual ClassiX instance. So the value only serves as confirmation that a process has been started on the Launcher.

The initial configuration is an optional CX_JSON_OBJECT with two fields:

  • env - An object that defines the additional environment variables to be set. {name:value, name2:value2, ...}
  • cwd - A string that specifies the working directory with which the command should be started. (Default: ws.launcher.launch.cwd - from the config.js)

The start command is a string which is passed on to CMD /C "...".

The hostname/IP is a string under which a launcher must have registered with the MorphIT server. IP addresses are relative to the MorphIT server, so 127.0.0.1 always designates the launcher running on the same machine as the MorphIT server, regardless of where the ClassiX process that calls this method is running. Therefore, there is the keyword @self, with which the process can refer to the machine, on which it is started. Therefore the starting process does not need to know its own IP address to start a process on the same machine.

Code example:

Start a dedicated ClassiX as a web service instance via the launcher.

LAUNCH_INSTANCE_POST: { LocalVar(endpoint, response) GetManager(WEB_SERVICE) CallWeak(RequestMorphITBinding) -> endpoint endpoint ifnot { //TODO pass error back to the user } launcherHostName "CX_MORPHIT_NONCE" SystemObject Call(GetEnvironment) startCommand NULL GetManager(WEB_SERVICE) CallWeak(LaunchDedicatedClassiX) ifnot { //TODO pass error message back to the user } CreateTansObject(CX_JSON_OBJECT) -> response "dynamic" response Put(type) endpoint response Put(endpoint) response ReturnStack }

Stack
Stack Position Object type Brief description
Stack(In) Top CX_WEB_SERIVCE_MANAGER The Web Service Manager
Top 1 CX_JSON_OBJECT | ZERO Start configuration
top 2 STRING Start command
top 3 STRING Start nonce value
top 4 STRING Hostname/IP of the Launcher
Stack(Out) Top INTEGER Process ID of the started process
Function call: Call(LaunchDedicatedClassiX)