Go to the documentation of this file.
23 #ifndef PYTHON_ENGINE_GRPC_NRP_CLIENT_H
24 #define PYTHON_ENGINE_GRPC_NRP_CLIENT_H
33 #include "nrp_python_grpc_engine/config/cmake_constants.h"
35 #include "nrp_protobuf/engine_grpc.pb.h"
38 #include <sys/types.h>
40 #include <sys/prctl.h>
49 :
public EngineGrpcClient<PythonEngineGRPCNRPClient, PythonGrpcConfigConst::EngineSchema>
58 setDefaultProperty<std::string>(
"EngineProcCmd", NRP_PYTHON_GRPC_EXECUTABLE_PATH);
80 catch(std::exception &e)
83 this->_initErrMsg = e.what();
90 NRPLogger::debug(
"PythonEngineGRPCNRPClientBase::initialize(...) completed with no errors.");
101 catch(std::exception &e)
104 std::string msg = e.what();
124 std::vector<std::string> startParams = this->
engineConfig().at(
"EngineProcStartParams");
126 std::string name = this->
engineConfig().at(
"EngineName");
129 std::string address = this->
engineConfig().at(
"ServerAddress");
139 std::string _initErrMsg =
"";
148 #endif // PYTHON_ENGINE_GRPC_NRP_CLIENT_H
Definition: engine_grpc_client.h:45
std::unique_ptr< ProcessLauncherInterface > unique_ptr
Definition: ptr_templates.h:34
void resetEngineTime() override
Definition: engine_grpc_client.h:414
void sendShutdownCommand(const nlohmann::json &data)
Definition: engine_grpc_client.h:178
void sendInitializeCommand(const nlohmann::json &data)
Definition: engine_grpc_client.h:135
const nlohmann::json & engineConfig() const override final
Get Engine Configuration.
Definition: engine_client_interface.h:278
PythonGRPCEngine client.
Definition: python_engine_grpc_nrp_client.h:48
virtual void initialize() override
Initialize engine.
Definition: python_engine_grpc_nrp_client.h:66
static constexpr std::string_view SimulationTimeRatio
Ratio used by SimulationTime.
Definition: python_grpc_config.h:42
virtual void reset() override
Reset engine.
Definition: python_engine_grpc_nrp_client.h:93
static constexpr std::string_view EngineNameArg
Parameter name that is used to pass along the engine name.
Definition: engine_grpc_config.h:37
static EXCEPTION logCreate(LOG_EXCEPTION_T &exception, const std::string &msg, NRPLogger::spdlog_out_fcn_t spdlogCall=NRPLogger::critical)
Definition: nrp_exceptions.h:73
static constexpr std::string_view EngineServerAddrArg
Parameter name that is used to pass along the server address.
Definition: engine_grpc_config.h:32
PythonEngineGRPCNRPClient::EngineLauncher< PythonGrpcConfigConst::EngineType > PythonEngineGRPCLauncher
Definition: python_engine_grpc_nrp_client.h:142
CREATE_NRP_ENGINE_LAUNCHER(PythonEngineGRPCLauncher)
PythonEngineGRPCNRPClient(nlohmann::json &config, ProcessLauncherInterface::unique_ptr &&launcher)
Definition: python_engine_grpc_nrp_client.h:53
static void error(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for error level.
Definition: nrp_logger.h:160
virtual const std::vector< std::string > engineProcStartParams() const override
Get all Engine Process Startup parameters.
Definition: python_engine_grpc_nrp_client.h:120
virtual void shutdown() override
Shutdown engine.
Definition: python_engine_grpc_nrp_client.h:113
void sendResetCommand()
Definition: engine_grpc_client.h:157
static void debug(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for debug level.
Definition: nrp_logger.h:127
virtual ~PythonEngineGRPCNRPClient() override
Definition: python_engine_grpc_nrp_client.h:61
#define NRP_LOGGER_TRACE(...)
trace log macro. It is voided by defining \PRODUCTION_RELEASE
Definition: nrp_logger.h:39
nlohmann::json json
Definition: engine_json_server.cpp:31