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 void request(
const std::string& requestType,
60 virtual std::vector<SupervisorInfo::SubappInfo> getSubappInfo(
void)
override;
63 if(!theStateMachine_.isInTransition() &&
64 (theStateMachine_.getCurrentStateName() ==
65 RunControlStateMachine::HALTED_STATE_NAME ||
66 theStateMachine_.getCurrentStateName() ==
67 RunControlStateMachine::INITIAL_STATE_NAME))
70 std::lock_guard<std::mutex> lk(thread_mutex_);
71 __COUTVS__(20, thread_progress_message_);
72 return thread_progress_message_;
76 std::pair<DAQInterfaceProcessInfo, std::unique_ptr<artdaq::CommanderInterface>>>
77 makeCommandersFromProcessInfo();
83 std::set<std::string> getConfiguredArtdaqHosts(
void);
85 static std::list<std::string> tokenize_(std::string
const& input);
88 void forceSupervisorPropertyValues(
void)
override;
89 void initArtdaqSystemVariables();
90 void saveArtdaqSystemVariables();
91 void loadArtdaqSystemVariables();
92 std::string getServiceDataFilePath()
const;
94 static const std::string ARTDAQ_SYSVAR_NAMESPACE;
96 void configuringThread(
void);
97 void startingThread(
void);
103 explicit PyObjectGuard(PyObject* o)
110 PyObjectGuard(
const PyObjectGuard&) =
delete;
111 PyObjectGuard& operator=(
const PyObjectGuard&) =
delete;
112 PyObject* get()
const {
return obj; }
115 PyObject *daqinterface_ptr_, *stringIO_out_,
117 std::recursive_mutex daqinterface_pythonMutex_;
118 std::mutex daqinterface_statusMutex_;
119 std::string daqinterface_status_;
121 std::string daqinterface_state_;
122 std::unique_ptr<std::thread> runner_thread_;
123 std::atomic<bool> runner_running_;
125 std::mutex thread_mutex_;
126 ProgressBar thread_progress_bar_;
127 std::string thread_progress_message_;
128 std::string thread_error_message_;
129 int last_thread_progress_read_;
130 time_t last_thread_progress_update_;
131 std::map<std::string, std::string> label_to_proc_type_map_;
133 unsigned int cachedMinReadyForEventGenerationStartIteration_ = 0;
135 std::string capturePyErr(std::string label =
"");
136 bool checkPythonError(
138 std::string captureStderrAndStdout_(std::string label =
"");
139 void getDAQState_(
void);
140 std::string getProcessInfo_(
void);
141 std::string artdaqStateToOtsState(std::string state);
142 std::string labelToProcType_(std::string label);
143 std::list<DAQInterfaceProcessInfo> getAndParseProcessInfo_(
void);
144 void daqinterfaceRunner_(
void);
145 void stop_runner_(
void);
146 void start_runner_(
void);
147 void set_thread_message_(std::string msg)
149 std::lock_guard<std::mutex> lk(thread_mutex_);
150 thread_progress_message_ = msg;
void request(const std::string &requestType, cgicc::Cgicc &cgiIn, HttpXmlDocument &xmlOut, const WebUsers::RequestUserInfo &userInfo) override
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