1 #ifndef _ots_ARTDAQSupervisor_h
2 #define _ots_ARTDAQSupervisor_h
4 #if __cplusplus > 201402L
5 #pragma GCC diagnostic push
6 #pragma GCC diagnostic ignored "-Wregister"
8 #pragma GCC diagnostic pop
17 #include "artdaq/ExternalComms/CommanderInterface.hh"
18 #include "otsdaq/CoreSupervisors/CoreSupervisorBase.h"
19 #include "otsdaq/TablePlugins/ARTDAQTableBase/ARTDAQTableBase.h"
46 virtual void transitionConfiguring(toolbox::Event::Reference event)
override;
49 virtual void transitionPausing(toolbox::Event::Reference event)
override;
50 virtual void transitionResuming(toolbox::Event::Reference event)
override;
51 virtual void transitionStarting(toolbox::Event::Reference event)
override;
52 virtual void transitionStopping(toolbox::Event::Reference event)
override;
53 virtual void enteringError(toolbox::Event::Reference event)
override;
55 virtual std::vector<SupervisorInfo::SubappInfo> getSubappInfo(
void)
override;
58 if(!theStateMachine_.isInTransition() &&
59 (theStateMachine_.getCurrentStateName() ==
60 RunControlStateMachine::HALTED_STATE_NAME ||
61 theStateMachine_.getCurrentStateName() ==
62 RunControlStateMachine::INITIAL_STATE_NAME))
65 std::lock_guard<std::mutex> lk(thread_mutex_);
66 __COUTVS__(20, thread_progress_message_);
67 return thread_progress_message_;
71 std::pair<DAQInterfaceProcessInfo, std::unique_ptr<artdaq::CommanderInterface>>>
72 makeCommandersFromProcessInfo();
78 std::set<std::string> getConfiguredArtdaqHosts(
void);
80 static std::list<std::string> tokenize_(std::string
const& input);
83 void configuringThread(
void);
84 void startingThread(
void);
90 explicit PyObjectGuard(PyObject* o)
97 PyObjectGuard(
const PyObjectGuard&) =
delete;
98 PyObjectGuard& operator=(
const PyObjectGuard&) =
delete;
99 PyObject* get()
const {
return obj; }
102 PyObject *daqinterface_ptr_, *stringIO_out_,
104 std::recursive_mutex daqinterface_pythonMutex_;
105 std::mutex daqinterface_statusMutex_;
106 std::string daqinterface_status_;
108 std::string daqinterface_state_;
109 std::unique_ptr<std::thread> runner_thread_;
110 std::atomic<bool> runner_running_;
112 std::mutex thread_mutex_;
113 ProgressBar thread_progress_bar_;
114 std::string thread_progress_message_;
115 std::string thread_error_message_;
116 int last_thread_progress_read_;
117 time_t last_thread_progress_update_;
118 std::map<std::string, std::string> label_to_proc_type_map_;
120 std::string capturePyErr(std::string label =
"");
121 bool checkPythonError(
123 std::string captureStderrAndStdout_(std::string label =
"");
124 void getDAQState_(
void);
125 std::string getProcessInfo_(
void);
126 std::string artdaqStateToOtsState(std::string state);
127 std::string labelToProcType_(std::string label);
128 std::list<DAQInterfaceProcessInfo> getAndParseProcessInfo_(
void);
129 void daqinterfaceRunner_(
void);
130 void stop_runner_(
void);
131 void start_runner_(
void);
132 void set_thread_message_(std::string msg)
134 std::lock_guard<std::mutex> lk(thread_mutex_);
135 thread_progress_message_ = msg;
virtual void transitionHalting(toolbox::Event::Reference event) override
virtual void transitionInitializing(toolbox::Event::Reference event) override
virtual std::string getStatusProgressDetail(void) override
virtual std::string getStatusProgressDetail(void)
defines used also by OtsConfigurationWizardSupervisor