RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
deploymentDaemonBusinessLogic.hpp
Go to the documentation of this file.
1
12#ifndef RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMON_BUSINESSLOGIC_HPP
13#define RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMON_BUSINESSLOGIC_HPP
14
20
21#include <pybind11/pybind11.h>
22
23#include <mutex>
24
26
28namespace py = pybind11;
29
36public:
38 DeploymentDaemonBusinessLogic(const std::string& name,
39 ServiceContainer& services,
40 const elt::mal::Uri& sde);
41
43
44 void ActivityDeploying(StopToken st, std::string args) override;
45 void ActivityUndeploying(StopToken st) override;
46
47 std::string ActionGetActiveDeployment() override;
48 std::string ActionGetDescription() override;
49
50 std::vector<std::string> ActionGetDeploymentSets() override;
51
52 std::vector<std::string> ActionGetComponents() override;
53
60 std::vector<std::string> ActionGetActiveComponents() override;
61
62 void ActionStartComponent(std::string component_name) override;
63 void ActionStopComponent(std::string component_name) override;
64
65 void ActivityStarting(cfw::StopToken st) override;
66
67 std::vector<std::string> ActionGetServices() override;
68 std::vector<std::string> ActionGetActiveServices() override;
69
70protected:
75 void DeployServices(const DataPointPath& depl_set_path);
76
81 void DeployComponents(const DataPointPath& depl_set_path);
82
88 void UndeployProcesses(std::vector<std::string>& proceses);
89
97 void StartProcess(const std::string& name,
98 const std::string& type,
99 const DataPointPath& depl_set_path);
100
106 void StopProcess(const std::string& component_name, const bool check_error = true);
107
115 void GetDeploymentSets();
116
120 void InitPythonObjects();
121
125 void CleanupPythonObjects() noexcept;
126
127 log4cplus::Logger& m_logger;
128
132 const std::string m_name;
133
139
141
146
150 std::vector<std::string> m_deployment_sets;
151
156
161
165 std::vector<std::string> m_services;
166
170 std::vector<std::string> m_components;
171
175 elt::mal::Uri m_sde;
176
180 std::mutex m_mutex;
181
183 py::module m_module;
186 };
187
188 std::unique_ptr<PythonObjects> m_pyobjects;
189
195};
196
197} // namespace rtctk::deploymentDaemon
198
199#endif // RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMON_BUSINESSLOGIC_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:76
Base interface for all Persistent Configuration Repository adapters.
Definition persistentRepoIf.hpp:24
Container class that holds services of any type.
Definition serviceContainer.hpp:38
Class that implements a very basic service discovery mechanism.
Definition serviceDiscovery.hpp:32
void ActionStartComponent(std::string component_name) override
Definition deploymentDaemonBusinessLogic.cpp:65
log4cplus::Logger & m_logger
Definition deploymentDaemonBusinessLogic.hpp:127
void ActionStopComponent(std::string component_name) override
Definition deploymentDaemonBusinessLogic.cpp:91
std::string ActionGetDescription() override
Definition deploymentDaemonBusinessLogic.cpp:166
std::vector< std::string > ActionGetComponents() override
Definition deploymentDaemonBusinessLogic.cpp:121
std::vector< std::string > ActionGetDeploymentSets() override
Definition deploymentDaemonBusinessLogic.cpp:113
std::vector< std::string > m_deployment_sets
List of deployment sets.
Definition deploymentDaemonBusinessLogic.hpp:150
std::vector< std::string > ActionGetActiveServices() override
Definition deploymentDaemonBusinessLogic.cpp:147
uint16_t m_sd_check_timeout_s
Timeout in seconds to check if the components/service has been registered to Service Discovery.
Definition deploymentDaemonBusinessLogic.hpp:194
void ActivityDeploying(StopToken st, std::string args) override
Definition deploymentDaemonBusinessLogic.cpp:210
rtctk::componentFramework::ServiceDiscovery & m_service_discovery
Definition deploymentDaemonBusinessLogic.hpp:140
std::vector< std::string > ActionGetActiveComponents() override
Returns active components from the active deployment set.
Definition deploymentDaemonBusinessLogic.cpp:126
std::vector< std::string > ActionGetServices() override
Definition deploymentDaemonBusinessLogic.cpp:142
DeploymentDaemonBusinessLogic(const std::string &name, ServiceContainer &services, const elt::mal::Uri &sde)
Definition deploymentDaemonBusinessLogic.cpp:36
const std::string m_name
The component name.
Definition deploymentDaemonBusinessLogic.hpp:132
void StopProcess(const std::string &component_name, const bool check_error=true)
Implements the StopProcess command.
Definition deploymentDaemonBusinessLogic.cpp:394
rtctk::componentFramework::ServiceContainer & m_service_container
Reference to container services needed to access run-time repository for configuration,...
Definition deploymentDaemonBusinessLogic.hpp:138
LifeCycle ComponentType
Definition deploymentDaemonBusinessLogic.hpp:37
std::vector< std::string > m_services
List of deployed services.
Definition deploymentDaemonBusinessLogic.hpp:165
std::string m_description
Deployment set description.
Definition deploymentDaemonBusinessLogic.hpp:160
void CleanupPythonObjects() noexcept
Clean up Python objects.
Definition deploymentDaemonBusinessLogic.cpp:459
void ActivityUndeploying(StopToken st) override
Definition deploymentDaemonBusinessLogic.cpp:170
void DeployComponents(const DataPointPath &depl_set_path)
Deploys all components.
Definition deploymentDaemonBusinessLogic.cpp:470
void ActivityStarting(cfw::StopToken st) override
Definition deploymentDaemonBusinessLogic.cpp:60
std::string ActionGetActiveDeployment() override
Definition deploymentDaemonBusinessLogic.cpp:162
void DeployServices(const DataPointPath &depl_set_path)
Deploys all services if any.
Definition deploymentDaemonBusinessLogic.cpp:609
std::string m_active_deployment_set
Name of active deployment set.
Definition deploymentDaemonBusinessLogic.hpp:155
void GetDeploymentSets()
Fetches the available Deployment Sets from the Persistent Configuration Repository and caches the val...
Definition deploymentDaemonBusinessLogic.cpp:290
elt::mal::Uri m_sde
Service Discovery EndPoint URI.
Definition deploymentDaemonBusinessLogic.hpp:175
std::unique_ptr< rtctk::componentFramework::PersistentRepoIf > m_persistent_repo
References to the persistent repository.
Definition deploymentDaemonBusinessLogic.hpp:145
void InitPythonObjects()
Initialise Python object for py bind calls.
Definition deploymentDaemonBusinessLogic.cpp:440
std::vector< std::string > m_components
List of deployed components.
Definition deploymentDaemonBusinessLogic.hpp:170
void UndeployProcesses(std::vector< std::string > &proceses)
Undeploys all components.
Definition deploymentDaemonBusinessLogic.cpp:562
void StartProcess(const std::string &name, const std::string &type, const DataPointPath &depl_set_path)
Implements the StartProcess command: starts Nomad job process for give component or service.
Definition deploymentDaemonBusinessLogic.cpp:311
std::unique_ptr< PythonObjects > m_pyobjects
Definition deploymentDaemonBusinessLogic.hpp:188
std::mutex m_mutex
Mutex as a temporary workaround to protect python jobfile generation.
Definition deploymentDaemonBusinessLogic.hpp:180
Definition deploymentDaemonLifeCycle.hpp:122
#define RTCTK_LOCAL
Helper to hide a class or function from the public symbol table.
Definition config.hpp:59
Header file for ComponentMetricsIf.
Lifecycle of the 'Deployment Daemon Component'.
Definition statePublisher.hpp:19
Definition commandReplier.cpp:21
rad::StopToken StopToken
Definition stopToken.hpp:19
Definition deploymentDaemonBusinessLogic.cpp:34
DeploymentDaemonLifeCycle LifeCycle
Definition deploymentDaemonBusinessLogic.hpp:27
Definition commandReplier.cpp:21
Definition ddsSub.hpp:155
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.
A container that can hold any type of service.
Class that implements a very basic service discover mechanism.
Definition deploymentDaemonBusinessLogic.hpp:182
py::module m_module
Definition deploymentDaemonBusinessLogic.hpp:183
py::object m_init_logger_config
Definition deploymentDaemonBusinessLogic.hpp:184
py::object m_generate_nomad_job_from_dp
Definition deploymentDaemonBusinessLogic.hpp:185
Life cycle for DeploymentDaemonComponent.
Definition deploymentDaemonLifeCycle.hpp:121