NRP Core  1.4.1
LaunchCommandInterface Class Referenceabstract

#include <launch_command.h>

Inheritance diagram for LaunchCommandInterface:
PtrTemplates< LaunchCommandInterface > LaunchCommand< LAUNCH_COMMAND > LaunchCommand< EmptyLaunchC > LaunchCommand< LAUNCH_DOCKER_COMMAND > BasicFork EmptyLaunchCommand DockerLauncher

Public Types

enum  ENGINE_RUNNING_STATUS { UNKNOWN = -1, RUNNING, STOPPED }
 Engine Process status. More...
 
- Public Types inherited from PtrTemplates< LaunchCommandInterface >
using shared_ptr = std::shared_ptr< LaunchCommandInterface >
 
using const_shared_ptr = std::shared_ptr< const LaunchCommandInterface >
 
using unique_ptr = std::unique_ptr< LaunchCommandInterface >
 
using const_unique_ptr = std::unique_ptr< const LaunchCommandInterface >
 

Public Member Functions

 LaunchCommandInterface ()=default
 
virtual ~LaunchCommandInterface ()=default
 
virtual pid_t launchProcess (const nlohmann::json &launcherConfig, const std::string &procCmd, const std::vector< std::string > &envParams, const std::vector< std::string > &startParams, bool appendParentEnv=true, int logFD=-1)=0
 Fork a new process for the given engine. Will read environment variables and start params from engineConfig The function should take the environment parameters and start parameters defined in engineConfig, and append any additional strings defined in envParams and startParams before starting the Engine specified in engineConfig. If appendParentEnv is set to true, use the parent environment in the forked child. If set to false, scrub the environment before continuing. More...
 
virtual pid_t stopProcess (unsigned int killWait)=0
 Stop a running engine process. More...
 
virtual ENGINE_RUNNING_STATUS getProcessStatus ()
 Get the current engine process status. If status cannot be retrieved, return ENGINE_RUNNING_STATUS::UNKNOWN. More...
 
virtual std::string_view launchType () const =0
 Get launch command type. More...
 

Member Enumeration Documentation

◆ ENGINE_RUNNING_STATUS

Engine Process status.

Enumerator
UNKNOWN 
RUNNING 
STOPPED 

Constructor & Destructor Documentation

◆ LaunchCommandInterface()

LaunchCommandInterface::LaunchCommandInterface ( )
default

◆ ~LaunchCommandInterface()

virtual LaunchCommandInterface::~LaunchCommandInterface ( )
virtualdefault

Member Function Documentation

◆ getProcessStatus()

virtual ENGINE_RUNNING_STATUS LaunchCommandInterface::getProcessStatus ( )
inlinevirtual

Get the current engine process status. If status cannot be retrieved, return ENGINE_RUNNING_STATUS::UNKNOWN.

Returns
Returns status as enum ProcessLauncherInterface::ENGINE_RUNNING_STATUS

Reimplemented in EmptyLaunchCommand, BasicFork, and DockerLauncher.

◆ launchProcess()

virtual pid_t LaunchCommandInterface::launchProcess ( const nlohmann::json launcherConfig,
const std::string &  procCmd,
const std::vector< std::string > &  envParams,
const std::vector< std::string > &  startParams,
bool  appendParentEnv = true,
int  logFD = -1 
)
pure virtual

Fork a new process for the given engine. Will read environment variables and start params from engineConfig The function should take the environment parameters and start parameters defined in engineConfig, and append any additional strings defined in envParams and startParams before starting the Engine specified in engineConfig. If appendParentEnv is set to true, use the parent environment in the forked child. If set to false, scrub the environment before continuing.

Parameters
launcherConfigConfiguration specific to the launch command
procCmdProcess command
envParamsAdditional Environment Variables for Engine process. Will take precedence over default env params if appendParentEnv is true
startParamsAdditional Start parameters
appendParentEnvShould parent env variables be appended to Engine process
Returns
Returns PID of child process on success

Implemented in BasicFork, DockerLauncher, and EmptyLaunchCommand.

◆ launchType()

virtual std::string_view LaunchCommandInterface::launchType ( ) const
pure virtual

Get launch command type.

Implemented in LaunchCommand< LAUNCH_COMMAND >.

◆ stopProcess()

virtual pid_t LaunchCommandInterface::stopProcess ( unsigned int  killWait)
pure virtual

Stop a running engine process.

Parameters
killWaitTime (in seconds) to wait for process to quit by itself before force killing it. 0 means it will wait indefinetly
Returns
Returns 0 on success, negative value on error

Implemented in EmptyLaunchCommand, BasicFork, and DockerLauncher.


The documentation for this class was generated from the following file: