RTC Toolkit 6.0.0-pre2
Loading...
Searching...
No Matches
deploymentDaemonBusinessLogic.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMON_BUSINESSLOGIC_HPP
14#define RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMON_BUSINESSLOGIC_HPP
15
21
22#include <pybind11/pybind11.h>
23
24#include <mutex>
25
27
29namespace py = pybind11;
30
37public:
39 DeploymentDaemonBusinessLogic(const std::string& name,
40 ServiceContainer& services,
41 const elt::mal::Uri& sde);
42
44
45 void ActivityDeploying(StopToken st, std::string args) override;
46 void ActivityUndeploying(StopToken st) override;
47
48 std::string ActionGetActiveDeployment() override;
49 std::string ActionGetDescription() override;
50
51 std::vector<std::string> ActionGetDeploymentSets() override;
52
53 std::vector<std::string> ActionGetComponents() override;
54
61 std::vector<std::string> ActionGetActiveComponents() override;
62
63 void ActionStartComponent(std::string component_name) override;
64 void ActionStopComponent(std::string component_name) override;
65
66 void ActivityStarting(cfw::StopToken st) override;
67
68 std::vector<std::string> ActionGetServices() override;
69 std::vector<std::string> ActionGetActiveServices() override;
70
71protected:
76 void DeployServices(const DataPointPath& depl_set_path);
77
82 void DeployComponents(const DataPointPath& depl_set_path);
83
89 void UndeployProcesses(std::vector<std::string>& proceses);
90
98 void StartProcess(const std::string& name,
99 const std::string& type,
100 const DataPointPath& depl_set_path);
101
107 void StopProcess(const std::string& component_name, const bool check_error = true);
108
116 void GetDeploymentSets();
117
122 void InitPythonObjects();
123
128 void CleanupPythonObjects() noexcept;
129
130 log4cplus::Logger& m_logger;
131
135 const std::string m_name;
136
142
144
149
154 std::vector<std::string> m_deployment_sets;
155
161
167
172 std::vector<std::string> m_services;
173
178 std::vector<std::string> m_components;
179
184 elt::mal::Uri m_sde;
185
190 std::mutex m_mutex;
191
193 py::module m_module;
196 };
197
198 std::unique_ptr<PythonObjects> m_pyobjects;
199
205};
206
207} // namespace rtctk::deploymentDaemon
208
209#endif // RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMON_BUSINESSLOGIC_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:77
Base interface for all Persistent Configuration Repository adapters.
Definition persistentRepoIf.hpp:25
Container class that holds services of any type.
Definition serviceContainer.hpp:39
Class that implements a very basic service discovery mechanism.
Definition serviceDiscovery.hpp:33
void ActionStartComponent(std::string component_name) override
Definition deploymentDaemonBusinessLogic.cpp:66
log4cplus::Logger & m_logger
Definition deploymentDaemonBusinessLogic.hpp:130
void ActionStopComponent(std::string component_name) override
Definition deploymentDaemonBusinessLogic.cpp:92
std::string ActionGetDescription() override
Definition deploymentDaemonBusinessLogic.cpp:167
std::vector< std::string > ActionGetComponents() override
Definition deploymentDaemonBusinessLogic.cpp:122
std::vector< std::string > ActionGetDeploymentSets() override
Definition deploymentDaemonBusinessLogic.cpp:114
std::vector< std::string > m_deployment_sets
List of deployment sets.
Definition deploymentDaemonBusinessLogic.hpp:154
std::vector< std::string > ActionGetActiveServices() override
Definition deploymentDaemonBusinessLogic.cpp:148
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:204
void ActivityDeploying(StopToken st, std::string args) override
Definition deploymentDaemonBusinessLogic.cpp:211
rtctk::componentFramework::ServiceDiscovery & m_service_discovery
Definition deploymentDaemonBusinessLogic.hpp:143
std::vector< std::string > ActionGetActiveComponents() override
Returns active components from the active deployment set.
Definition deploymentDaemonBusinessLogic.cpp:127
std::vector< std::string > ActionGetServices() override
Definition deploymentDaemonBusinessLogic.cpp:143
DeploymentDaemonBusinessLogic(const std::string &name, ServiceContainer &services, const elt::mal::Uri &sde)
Definition deploymentDaemonBusinessLogic.cpp:37
const std::string m_name
component name
Definition deploymentDaemonBusinessLogic.hpp:135
void StopProcess(const std::string &component_name, const bool check_error=true)
Implements the StopProcess command.
Definition deploymentDaemonBusinessLogic.cpp:395
rtctk::componentFramework::ServiceContainer & m_service_container
Reference to container services needed to access run-time repository for configuration,...
Definition deploymentDaemonBusinessLogic.hpp:141
LifeCycle ComponentType
Definition deploymentDaemonBusinessLogic.hpp:38
std::vector< std::string > m_services
List of deployed services.
Definition deploymentDaemonBusinessLogic.hpp:172
std::string m_description
Deployment set description.
Definition deploymentDaemonBusinessLogic.hpp:166
void CleanupPythonObjects() noexcept
Clean up Python objects.
Definition deploymentDaemonBusinessLogic.cpp:460
void ActivityUndeploying(StopToken st) override
Definition deploymentDaemonBusinessLogic.cpp:171
void DeployComponents(const DataPointPath &depl_set_path)
Deploys all components.
Definition deploymentDaemonBusinessLogic.cpp:471
void ActivityStarting(cfw::StopToken st) override
Definition deploymentDaemonBusinessLogic.cpp:61
std::string ActionGetActiveDeployment() override
Definition deploymentDaemonBusinessLogic.cpp:163
void DeployServices(const DataPointPath &depl_set_path)
Deploys all services if any.
Definition deploymentDaemonBusinessLogic.cpp:610
std::string m_active_deployment_set
Name of active deployment set.
Definition deploymentDaemonBusinessLogic.hpp:160
void GetDeploymentSets()
Fetches the available Deployment Sets from the Persistent Configuration Repository and caches the val...
Definition deploymentDaemonBusinessLogic.cpp:291
elt::mal::Uri m_sde
Service Discovery EndPoint URI.
Definition deploymentDaemonBusinessLogic.hpp:184
std::unique_ptr< rtctk::componentFramework::PersistentRepoIf > m_persistent_repo
References to the persistent repository.
Definition deploymentDaemonBusinessLogic.hpp:148
void InitPythonObjects()
Initialise Python object for py bind calls.
Definition deploymentDaemonBusinessLogic.cpp:441
std::vector< std::string > m_components
List of deployed components.
Definition deploymentDaemonBusinessLogic.hpp:178
void UndeployProcesses(std::vector< std::string > &proceses)
Undeploys all components.
Definition deploymentDaemonBusinessLogic.cpp:563
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:312
std::unique_ptr< PythonObjects > m_pyobjects
Definition deploymentDaemonBusinessLogic.hpp:198
std::mutex m_mutex
Mutex as a temporary workaround to protect python jobfile generation.
Definition deploymentDaemonBusinessLogic.hpp:190
Definition deploymentDaemonLifeCycle.hpp:123
#define RTCTK_LOCAL
Helper to hide a class or function from the public symbol table.
Definition config.hpp:60
Header file for ComponentMetricsIf.
Lifecycle of the 'Deployment Daemon Component'.
Definition statePublisher.hpp:20
Definition commandReplier.cpp:22
rad::StopToken StopToken
Definition stopToken.hpp:20
Definition deploymentDaemonBusinessLogic.cpp:35
DeploymentDaemonLifeCycle LifeCycle
Definition deploymentDaemonBusinessLogic.hpp:28
Definition commandReplier.cpp:22
Definition ddsSub.hpp:156
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:192
py::module m_module
Definition deploymentDaemonBusinessLogic.hpp:193
py::object m_init_logger_config
Definition deploymentDaemonBusinessLogic.hpp:194
py::object m_generate_nomad_job_from_dp
Definition deploymentDaemonBusinessLogic.hpp:195
Life cycle for DeploymentDaemonComponent.
Definition deploymentDaemonLifeCycle.hpp:122