NRP Core  1.4.1
DockerLauncher Class Reference

#include <docker_launcher.h>

Inheritance diagram for DockerLauncher:
LaunchCommand< LAUNCH_DOCKER_COMMAND > LaunchCommandInterface PtrTemplates< LaunchCommandInterface >

Public Member Functions

 ~DockerLauncher () override
 
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) override
 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...
 
pid_t stopProcess (unsigned int killWait) override
 Stop a running engine process. More...
 
ENGINE_RUNNING_STATUS getProcessStatus () override
 Get the current engine process status. If status cannot be retrieved, return ENGINE_RUNNING_STATUS::UNKNOWN. More...
 
- Public Member Functions inherited from LaunchCommand< LAUNCH_DOCKER_COMMAND >
std::string_view launchType () const override final
 Get launch command type. More...
 
- Public Member Functions inherited from LaunchCommandInterface
 LaunchCommandInterface ()=default
 
virtual ~LaunchCommandInterface ()=default
 
virtual std::string_view launchType () const =0
 Get launch command type. More...
 

Additional Inherited Members

- Public Types inherited from LaunchCommandInterface
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 >
 
- Static Public Attributes inherited from LaunchCommand< LAUNCH_DOCKER_COMMAND >
static constexpr auto LaunchType
 

Constructor & Destructor Documentation

◆ ~DockerLauncher()

DockerLauncher::~DockerLauncher ( )
override

Member Function Documentation

◆ getProcessStatus()

LaunchCommandInterface::ENGINE_RUNNING_STATUS DockerLauncher::getProcessStatus ( )
overridevirtual

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 from LaunchCommandInterface.

◆ launchProcess()

pid_t DockerLauncher::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 
)
overridevirtual

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

Implements LaunchCommandInterface.

◆ stopProcess()

pid_t DockerLauncher::stopProcess ( unsigned int  killWait)
overridevirtual

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

Implements LaunchCommandInterface.


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