6 #ifndef __DDS__AGENT__CCommanderChannel__ 7 #define __DDS__AGENT__CCommanderChannel__ 40 using pidContainer_t = std::vector<pid_t>;
41 using stringContainer_t = std::vector<std::string>;
42 using timer_t = boost::asio::steady_timer;
43 using timerPtr_t = std::unique_ptr<timer_t>;
44 using terminateChildrenOnComplete_t = std::function<void()>;
48 uint64_t _ProtocolHeaderID,
49 boost::asio::io_context& _intercomService);
82 bool on_cmdGET_HOST_INFO(
87 bool on_cmdBINARY_ATTACHMENT_RECEIVED(
96 bool on_cmdASSIGN_USER_TASK(
99 bool on_cmdACTIVATE_USER_TASK(
102 bool on_cmdSTOP_USER_TASK(
111 void send_cmdUPDATE_KEY(
114 bool on_cmdUSER_TASK_DONE(
119 void readAgentIDFile();
120 void createAgentIDFile()
const;
121 void deleteAgentIDFile()
const;
122 void onNewUserTask(uint64_t _slotID, pid_t _pid);
129 void terminateChildrenProcesses(pid_t _parentPid,
const terminateChildrenOnComplete_t& _onCompleteSlot);
130 void terminateChildrenProcesses(timerPtr_t& _timer,
131 const pidContainer_t& _children,
132 const std::chrono::steady_clock::time_point& _wait_until,
133 const terminateChildrenOnComplete_t& _onCompleteSlot);
134 void enumChildProcesses(pid_t _forPid, stringContainer_t& _chilren);
135 void taskExited(uint64_t _taskID,
int _exitCode);
137 bool isLowDiskSpace(uintmax_t* _available =
nullptr);
138 void startResourceMonitor(boost::asio::io_context& _service,
const std::chrono::seconds& _interval);
142 uint16_t m_connectionAttempts{ 1 };
143 std::mutex m_taskIDToSlotIDMapMutex;
144 std::map<uint64_t, uint64_t> m_taskIDToSlotIDMap;
146 std::mutex m_topoMutex;
150 std::mutex m_mutexSlots;
152 size_t m_nSlots{ 0 };
153 timerPtr_t m_resourceMonitorTimer;
Definition: ProtocolCommands.h:49
Definition: BaseEventHandlersImpl.h:48
Definition: ProtocolCommands.h:45
Definition: ProtocolCommands.h:68
Definition: ProtocolCommands.h:65
#define REGISTER_DEFAULT_REMOTE_ID_STRING
Definition: BaseChannelImpl.h:185
std::string m_collectionName
Definition: CommanderChannel.h:33
std::string m_taskPath
Definition: CommanderChannel.h:31
uint32_t m_collectionIndex
Definition: CommanderChannel.h:30
slotId_t m_id
Definition: CommanderChannel.h:25
Definition: CommanderChannel.h:38
std::shared_ptr< SEmptyCmd > ptr_t
Definition: CommandAttachmentImpl.h:64
uint32_t m_taskIndex
Definition: CommanderChannel.h:29
Definition: ProtocolCommands.h:30
std::map< slotId_t, SSlotInfo > container_t
Definition: CommanderChannel.h:23
Definition: ProtocolCommands.h:43
Definition: ProtocolCommands.h:33
REGISTER_DEFAULT_REMOTE_ID_STRING BEGIN_MSG_MAP(CCommanderChannel) MESSAGE_HANDLER(cmdREPLY
std::shared_ptr< CSMIntercomChannel > connectionPtr_t
Definition: BaseSMChannelImpl.h:188
CCommanderChannel(boost::asio::io_context &_service, uint64_t _ProtocolHeaderID, boost::asio::io_context &_intercomService)
Definition: CommanderChannel.cpp:33
#define END_MSG_MAP()
Definition: BaseChannelImpl.h:148
Definition: ProtocolCommands.h:36
Miscellaneous functions and helpers are located here.
Definition: AgentConnectionManager.h:13
Definition: ProtocolCommands.h:62
std::string m_groupName
Definition: CommanderChannel.h:32
taskId_t m_taskID
Definition: CommanderChannel.h:28
Definition: ProtocolCommands.h:55
REGISTER_DEFAULT_REMOTE_ID_STRING on_cmdREPLY on_cmdGET_HOST_INFO on_cmdBINARY_ATTACHMENT_RECEIVED on_cmdSET_ID on_cmdASSIGN_USER_TASK on_cmdSTOP_USER_TASK on_cmdCUSTOM_CMD on_cmdUSER_TASK_DONE END_MSG_MAP() public void setNumberOfSlots(size_t _nSlots)
Definition: CommanderChannel.cpp:127
Definition: ProtocolCommands.h:52
std::string m_sUsrExe
Definition: CommanderChannel.h:26
Definition: ProtocolCommands.h:51
Definition: BaseChannelImpl.h:35
Definition: ProtocolCommands.h:46
Definition: CommanderChannel.h:21
Definition: ProtocolCommands.h:41
std::shared_ptr< CTopoCore > Ptr_t
std::shared_ptr
Definition: TopoCore.h:36
Definition: ProtocolCommands.h:53
uint64_t slotId_t
Definition: CommanderChannel.h:18
pid_t m_pid
Definition: CommanderChannel.h:35
uint64_t taskId_t
Definition: CommanderChannel.h:19
std::string m_taskName
Definition: CommanderChannel.h:34
REGISTER_DEFAULT_REMOTE_ID_STRING on_cmdREPLY MESSAGE_HANDLER(cmdSIMPLE_MSG, on_cmdSIMPLE_MSG) MESSAGE_HANDLER(cmdGET_HOST_INFO
std::string m_sUsrEnv
Definition: CommanderChannel.h:27