Line data Source code
1 : #include "TRACE/tracemf.h"
2 : #include "artdaq/DAQdata/Globals.hh"
3 : #define TRACE_NAME (app_name + "_CommandableInterface").c_str() // definition with variable should be after includes (which may or may not have TLOG/TRACE statements)
4 :
5 : #include "artdaq-core/Utilities/TimeUtils.hh"
6 : #include "artdaq/Application/Commandable.hh"
7 :
8 : // ELF 3/22/18:
9 : // We may want to separate these onto different levels later,
10 : // but I think the TRACE_NAME separation is enough for now...
11 : #define TLVL_INIT TLVL_INFO
12 : #define TLVL_STOP TLVL_INFO
13 : #define TLVL_STATUS TLVL_DEBUG + 33
14 : #define TLVL_START TLVL_INFO
15 : #define TLVL_PAUSE TLVL_INFO
16 : #define TLVL_RESUME TLVL_INFO
17 : #define TLVL_SHUTDOWN TLVL_INFO
18 : #define TLVL_ROLLOVER TLVL_INFO
19 : #define TLVL_SOFT_INIT TLVL_INFO
20 : #define TLVL_REINIT TLVL_INFO
21 : #define TLVL_INRUN_FAILURE TLVL_INFO
22 : #define TLVL_LEGAL_COMMANDS TLVL_INFO
23 :
24 1 : artdaq::Commandable::Commandable()
25 1 : : fsm_(*this)
26 :
27 1 : {}
28 :
29 : // **********************************************************************
30 : // *** The following methods implement the externally available commands.
31 : // **********************************************************************
32 :
33 1 : bool artdaq::Commandable::initialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
34 : {
35 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
36 1 : external_request_status_ = true;
37 1 : report_string_ = "All is OK.";
38 :
39 1 : Globals::SetMFModuleName("Initializing");
40 :
41 3 : TLOG(TLVL_INIT) << "Initialize transition started";
42 1 : auto start_time = std::chrono::steady_clock::now();
43 1 : std::string initialState = fsm_.getState().getName();
44 1 : fsm_.init(pset, timeout, timestamp);
45 1 : if (external_request_status_)
46 : {
47 1 : std::string finalState = fsm_.getState().getName();
48 :
49 1 : Globals::SetMFModuleName(finalState);
50 2 : TLOG(TLVL_DEBUG + 32)
51 0 : << "States before and after an init transition: "
52 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
53 1 : }
54 1 : if (metricMan && metricMan->Initialized())
55 : {
56 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
57 : }
58 :
59 3 : TLOG(TLVL_INIT) << "Initialize transition complete";
60 1 : return (external_request_status_);
61 1 : }
62 :
63 1 : bool artdaq::Commandable::start(art::RunID id, uint64_t timeout, uint64_t timestamp)
64 : {
65 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
66 1 : external_request_status_ = true;
67 1 : report_string_ = "All is OK.";
68 :
69 1 : Globals::SetMFModuleName("Starting");
70 :
71 3 : TLOG(TLVL_START) << "Start transition started";
72 1 : auto start_time = std::chrono::steady_clock::now();
73 1 : std::string initialState = fsm_.getState().getName();
74 1 : fsm_.start(id, timeout, timestamp);
75 1 : if (external_request_status_)
76 : {
77 1 : std::string finalState = fsm_.getState().getName();
78 :
79 1 : Globals::SetMFModuleName(finalState);
80 2 : TLOG(TLVL_DEBUG + 32)
81 0 : << "States before and after a start transition: "
82 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
83 1 : }
84 1 : if (metricMan && metricMan->Initialized())
85 : {
86 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
87 : }
88 :
89 3 : TLOG(TLVL_START) << "Start transition complete";
90 1 : return (external_request_status_);
91 1 : }
92 :
93 1 : bool artdaq::Commandable::stop(uint64_t timeout, uint64_t timestamp)
94 : {
95 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
96 1 : external_request_status_ = true;
97 1 : report_string_ = "All is OK.";
98 :
99 1 : Globals::SetMFModuleName("Stopping");
100 :
101 3 : TLOG(TLVL_STOP) << "Stop transition started";
102 1 : auto start_time = std::chrono::steady_clock::now();
103 1 : std::string initialState = fsm_.getState().getName();
104 1 : fsm_.stop(timeout, timestamp);
105 1 : if (external_request_status_)
106 : {
107 1 : std::string finalState = fsm_.getState().getName();
108 :
109 1 : Globals::SetMFModuleName(finalState);
110 2 : TLOG(TLVL_DEBUG + 32)
111 0 : << "States before and after a stop transition: "
112 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
113 1 : }
114 1 : if (metricMan && metricMan->Initialized())
115 : {
116 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
117 : }
118 :
119 3 : TLOG(TLVL_STOP) << "Stop transition complete";
120 1 : return (external_request_status_);
121 1 : }
122 :
123 1 : bool artdaq::Commandable::pause(uint64_t timeout, uint64_t timestamp)
124 : {
125 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
126 1 : external_request_status_ = true;
127 1 : report_string_ = "All is OK.";
128 :
129 1 : Globals::SetMFModuleName("Pausing");
130 :
131 3 : TLOG(TLVL_PAUSE) << "Pause transition started";
132 1 : auto start_time = std::chrono::steady_clock::now();
133 1 : std::string initialState = fsm_.getState().getName();
134 1 : fsm_.pause(timeout, timestamp);
135 1 : if (external_request_status_)
136 : {
137 1 : std::string finalState = fsm_.getState().getName();
138 :
139 1 : Globals::SetMFModuleName(finalState);
140 2 : TLOG(TLVL_DEBUG + 32)
141 0 : << "States before and after a pause transition: "
142 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
143 1 : }
144 1 : if (metricMan && metricMan->Initialized())
145 : {
146 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
147 : }
148 :
149 3 : TLOG(TLVL_PAUSE) << "Pause transition complete";
150 1 : return (external_request_status_);
151 1 : }
152 :
153 1 : bool artdaq::Commandable::resume(uint64_t timeout, uint64_t timestamp)
154 : {
155 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
156 1 : external_request_status_ = true;
157 1 : report_string_ = "All is OK.";
158 :
159 1 : Globals::SetMFModuleName("Resuming");
160 :
161 3 : TLOG(TLVL_RESUME) << "Resume transition started";
162 1 : auto start_time = std::chrono::steady_clock::now();
163 1 : std::string initialState = fsm_.getState().getName();
164 1 : fsm_.resume(timeout, timestamp);
165 1 : if (external_request_status_)
166 : {
167 1 : std::string finalState = fsm_.getState().getName();
168 1 : Globals::SetMFModuleName(finalState);
169 2 : TLOG(TLVL_DEBUG + 32)
170 0 : << "States before and after a resume transition: "
171 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
172 1 : }
173 1 : if (metricMan && metricMan->Initialized())
174 : {
175 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
176 : }
177 :
178 3 : TLOG(TLVL_RESUME) << "Resume transition complete";
179 1 : return (external_request_status_);
180 1 : }
181 :
182 1 : bool artdaq::Commandable::shutdown(uint64_t timeout)
183 : {
184 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
185 1 : external_request_status_ = true;
186 1 : report_string_ = "All is OK.";
187 1 : Globals::SetMFModuleName("Shutting Down");
188 :
189 3 : TLOG(TLVL_SHUTDOWN) << "Shutdown transition started";
190 1 : auto start_time = std::chrono::steady_clock::now();
191 1 : std::string initialState = fsm_.getState().getName();
192 1 : fsm_.shutdown(timeout);
193 1 : if (external_request_status_)
194 : {
195 1 : std::string finalState = fsm_.getState().getName();
196 : // Globals::SetMFModuleName(finalState); // ELF, 12/17/20: We may have already shut down MessageFacility
197 2 : TLOG(TLVL_DEBUG + 32)
198 0 : << "States before and after a shutdown transition: "
199 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
200 1 : }
201 1 : if (metricMan && metricMan->Initialized())
202 : {
203 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
204 : }
205 :
206 3 : TLOG(TLVL_SHUTDOWN) << "Shutdown transition complete";
207 1 : return (external_request_status_);
208 1 : }
209 :
210 1 : bool artdaq::Commandable::soft_initialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
211 : {
212 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
213 1 : external_request_status_ = true;
214 1 : report_string_ = "All is OK.";
215 :
216 1 : Globals::SetMFModuleName("Soft_initializing");
217 :
218 3 : TLOG(TLVL_SOFT_INIT) << "Soft_initialize transition started";
219 1 : auto start_time = std::chrono::steady_clock::now();
220 1 : std::string initialState = fsm_.getState().getName();
221 1 : fsm_.soft_init(pset, timeout, timestamp);
222 1 : if (external_request_status_)
223 : {
224 1 : std::string finalState = fsm_.getState().getName();
225 :
226 1 : Globals::SetMFModuleName(finalState);
227 2 : TLOG(TLVL_DEBUG + 32)
228 0 : << "States before and after a soft_init transition: "
229 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
230 1 : }
231 1 : if (metricMan && metricMan->Initialized())
232 : {
233 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
234 : }
235 :
236 3 : TLOG(TLVL_SOFT_INIT) << "Soft_initialize transition complete";
237 1 : return (external_request_status_);
238 1 : }
239 :
240 1 : bool artdaq::Commandable::reinitialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
241 : {
242 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
243 1 : external_request_status_ = true;
244 1 : report_string_ = "All is OK.";
245 :
246 1 : Globals::SetMFModuleName("Reinitializing");
247 :
248 3 : TLOG(TLVL_REINIT) << "Reinitialize transition started";
249 1 : auto start_time = std::chrono::steady_clock::now();
250 1 : std::string initialState = fsm_.getState().getName();
251 1 : fsm_.reinit(pset, timeout, timestamp);
252 1 : if (external_request_status_)
253 : {
254 1 : std::string finalState = fsm_.getState().getName();
255 :
256 1 : Globals::SetMFModuleName(finalState);
257 2 : TLOG(TLVL_DEBUG + 32)
258 0 : << "States before and after a reinit transition: "
259 1 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
260 1 : }
261 1 : if (metricMan && metricMan->Initialized())
262 : {
263 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
264 : }
265 :
266 3 : TLOG(TLVL_REINIT) << "Reinitialize transition complete";
267 1 : return (external_request_status_);
268 1 : }
269 :
270 0 : bool artdaq::Commandable::in_run_failure()
271 : {
272 0 : std::lock_guard<std::mutex> lk(primary_mutex_);
273 0 : external_request_status_ = true;
274 0 : report_string_ = "An error condition was reported while running.";
275 :
276 0 : Globals::SetMFModuleName("Failing");
277 :
278 0 : TLOG(TLVL_INRUN_FAILURE) << "In_Run_Failure transition started";
279 0 : auto start_time = std::chrono::steady_clock::now();
280 0 : std::string initialState = fsm_.getState().getName();
281 0 : fsm_.in_run_failure();
282 0 : if (external_request_status_)
283 : {
284 0 : std::string finalState = fsm_.getState().getName();
285 :
286 0 : Globals::SetMFModuleName(finalState);
287 0 : TLOG(TLVL_DEBUG + 32)
288 0 : << "States before and after an in_run_failure transition: "
289 0 : << initialState << " and " << finalState << ". Transition Duration: " << TimeUtils::GetElapsedTime(start_time) << " s.";
290 0 : }
291 0 : if (metricMan && metricMan->Initialized())
292 : {
293 0 : metricMan->sendMetric("DAQ Transition Time", TimeUtils::GetElapsedTime(start_time), "s", 4, artdaq::MetricMode::Accumulate);
294 : }
295 :
296 0 : TLOG(TLVL_INRUN_FAILURE) << "in_run_failure complete";
297 0 : return (external_request_status_);
298 0 : }
299 :
300 1 : std::string artdaq::Commandable::status() const
301 : {
302 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
303 2 : TLOG(TLVL_STATUS) << "Status command started";
304 1 : std::string currentState = this->current_state();
305 1 : if (currentState == "InRunError")
306 : {
307 0 : return "Error";
308 : }
309 2 : TLOG(TLVL_STATUS) << "Status command complete";
310 1 : return currentState;
311 1 : }
312 :
313 1 : std::vector<std::string> artdaq::Commandable::legal_commands() const
314 : {
315 1 : std::lock_guard<std::mutex> lk(primary_mutex_);
316 3 : TLOG(TLVL_LEGAL_COMMANDS) << "legal_commands started";
317 1 : std::string currentState = this->current_state();
318 :
319 1 : if (currentState == "Ready")
320 : {
321 3 : return {"init", "soft_init", "start", "shutdown"};
322 : }
323 0 : if (currentState == "Running")
324 : {
325 : // 12-May-2015, KAB: in_run_failure is also possible, but it
326 : // shouldn't be requested externally.
327 0 : return {"pause", "stop"};
328 : }
329 0 : if (currentState == "Paused")
330 : {
331 0 : return {"resume", "stop"};
332 : }
333 0 : if (currentState == "InRunError")
334 : {
335 0 : return {"pause", "stop"};
336 : }
337 :
338 : // Booted and Error
339 0 : TLOG(TLVL_LEGAL_COMMANDS) << "legal_commands complete";
340 0 : return {"init", "shutdown"};
341 1 : }
342 :
343 : // *******************************************************************
344 : // *** The following methods implement the state machine operations.
345 : // *******************************************************************
346 :
347 1 : bool artdaq::Commandable::do_initialize(fhicl::ParameterSet const& /*unused*/, uint64_t /*unused*/, uint64_t /*unused*/)
348 : {
349 2 : TLOG(TLVL_DEBUG + 32) << "do_initialize called.";
350 1 : external_request_status_ = true;
351 1 : return external_request_status_;
352 : }
353 :
354 1 : bool artdaq::Commandable::do_start(art::RunID /*unused*/, uint64_t /*unused*/, uint64_t /*unused*/)
355 : {
356 2 : TLOG(TLVL_DEBUG + 32) << "do_start called.";
357 1 : external_request_status_ = true;
358 1 : return external_request_status_;
359 : }
360 :
361 1 : bool artdaq::Commandable::do_stop(uint64_t /*unused*/, uint64_t /*unused*/)
362 : {
363 2 : TLOG(TLVL_DEBUG + 32) << "do_stop called.";
364 1 : external_request_status_ = true;
365 1 : return external_request_status_;
366 : }
367 :
368 1 : bool artdaq::Commandable::do_pause(uint64_t /*unused*/, uint64_t /*unused*/)
369 : {
370 2 : TLOG(TLVL_DEBUG + 32) << "do_pause called.";
371 1 : external_request_status_ = true;
372 1 : return external_request_status_;
373 : }
374 :
375 1 : bool artdaq::Commandable::do_resume(uint64_t /*unused*/, uint64_t /*unused*/)
376 : {
377 2 : TLOG(TLVL_DEBUG + 32) << "do_resume called.";
378 1 : external_request_status_ = true;
379 1 : return external_request_status_;
380 : }
381 :
382 1 : bool artdaq::Commandable::do_shutdown(uint64_t /*unused*/)
383 : {
384 2 : TLOG(TLVL_DEBUG + 32) << "do_shutdown called.";
385 1 : external_request_status_ = true;
386 1 : return external_request_status_;
387 : }
388 :
389 1 : bool artdaq::Commandable::do_reinitialize(fhicl::ParameterSet const& /*unused*/, uint64_t /*unused*/, uint64_t /*unused*/)
390 : {
391 2 : TLOG(TLVL_DEBUG + 32) << "do_reinitialize called.";
392 1 : external_request_status_ = true;
393 1 : return external_request_status_;
394 : }
395 :
396 1 : bool artdaq::Commandable::do_soft_initialize(fhicl::ParameterSet const& /*unused*/, uint64_t /*unused*/, uint64_t /*unused*/)
397 : {
398 2 : TLOG(TLVL_DEBUG + 32) << "do_soft_initialize called.";
399 1 : external_request_status_ = true;
400 1 : return external_request_status_;
401 : }
402 :
403 0 : void artdaq::Commandable::badTransition(const std::string& trans)
404 : {
405 0 : std::string currentState = this->current_state();
406 0 : if (currentState == "InRunError")
407 : {
408 0 : currentState = "Error";
409 : }
410 :
411 0 : report_string_ = "An invalid transition (";
412 0 : report_string_.append(trans);
413 0 : report_string_.append(") was requested; transition not allowed from this process's current state of \"");
414 0 : report_string_.append(currentState);
415 0 : report_string_.append("\"");
416 :
417 0 : TLOG(TLVL_WARNING) << report_string_;
418 :
419 0 : external_request_status_ = false;
420 0 : }
421 :
422 1 : void artdaq::Commandable::BootedEnter()
423 : {
424 2 : TLOG(TLVL_DEBUG + 32) << "BootedEnter called.";
425 1 : }
426 :
427 1 : void artdaq::Commandable::InRunExit()
428 : {
429 2 : TLOG(TLVL_DEBUG + 32) << "InRunExit called.";
430 1 : }
431 :
432 : #if TRACE_REVNUM < 1394
433 : #define traceLvls_p traceNamLvls_p
434 : #define TRACE_TID2NAME(idx) traceNamLvls_p[idx].name
435 : #endif
436 1 : std::string artdaq::Commandable::do_trace_get(std::string const& name)
437 : {
438 2 : TLOG(TLVL_DEBUG + 32) << "Getting masks for name " << name;
439 1 : std::ostringstream ss;
440 1 : if (name == "ALL")
441 : {
442 0 : unsigned ii = 0;
443 0 : unsigned ee = traceControl_p->num_namLvlTblEnts;
444 0 : for (ii = 0; ii < ee; ++ii)
445 : {
446 0 : if (TRACE_TID2NAME(ii)[0] != 0) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
447 : {
448 0 : ss << TRACE_TID2NAME(ii) << " " << std::hex << std::showbase << traceLvls_p[ii].M << " " << traceLvls_p[ii].S << " " << traceLvls_p[ii].T << " " << std::endl; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
449 : }
450 : }
451 : }
452 : else
453 : {
454 1 : unsigned ii = 0;
455 1 : unsigned ee = traceControl_p->num_namLvlTblEnts;
456 269 : for (ii = 0; ii < ee; ++ii)
457 : {
458 269 : if ((TRACE_TID2NAME(ii)[0] != 0) && TMATCHCMP(name.c_str(), TRACE_TID2NAME(ii))) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
459 : {
460 1 : break;
461 : }
462 : }
463 1 : if (ii == ee)
464 : {
465 0 : return "";
466 : }
467 :
468 1 : ss << std::hex << traceLvls_p[ii].M << " " << traceLvls_p[ii].S << " " << traceLvls_p[ii].T; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
469 : }
470 1 : return ss.str();
471 1 : }
472 :
473 1 : bool artdaq::Commandable::do_trace_set(std::string const& name, std::string const& type, std::string const& mask_in_string_form)
474 : {
475 2 : TLOG(TLVL_DEBUG + 32) << "Setting msk " << type << " for name " << name << " to " << mask_in_string_form;
476 1 : auto mask = static_cast<uint64_t>(std::stoull(mask_in_string_form, nullptr, 0));
477 2 : TLOG(TLVL_DEBUG + 32) << "Mask has been converted to " << mask;
478 :
479 1 : if (name != "ALL")
480 : {
481 1 : if (!type.empty())
482 : {
483 1 : switch (type[0])
484 : {
485 1 : case 'M':
486 1 : TRACE_CNTL("lvlmsknM", name.c_str(), mask);
487 1 : break;
488 0 : case 'S':
489 0 : TRACE_CNTL("lvlmsknS", name.c_str(), mask);
490 0 : break;
491 0 : case 'T':
492 0 : TRACE_CNTL("lvlmsknT", name.c_str(), mask);
493 0 : break;
494 : }
495 : }
496 : else
497 : {
498 0 : TLOG(TLVL_ERROR) << "Cannot set mask: no type specified!";
499 : }
500 : }
501 : else
502 : {
503 0 : if (!type.empty())
504 : {
505 0 : switch (type[0])
506 : {
507 0 : case 'M':
508 0 : TRACE_CNTL("lvlmskMg", mask);
509 0 : break;
510 0 : case 'S':
511 0 : TRACE_CNTL("lvlmskSg", mask);
512 0 : break;
513 0 : case 'T':
514 0 : TRACE_CNTL("lvlmskTg", mask);
515 0 : break;
516 : }
517 : }
518 : else
519 : {
520 0 : TLOG(TLVL_ERROR) << "Cannot set mask: no type specified!";
521 : }
522 : }
523 1 : return true;
524 : }
525 :
526 1 : bool artdaq::Commandable::do_meta_command(std::string const& cmd, std::string const& arg)
527 : {
528 2 : TLOG(TLVL_DEBUG + 32) << "Meta-Command called: cmd=" << cmd << ", arg=" << arg;
529 1 : return true;
530 : }
531 :
532 1 : bool artdaq::Commandable::do_rollover_subrun(uint64_t /*unused*/, uint32_t /*unused*/)
533 : {
534 2 : TLOG(TLVL_DEBUG + 32) << "do_rollover_subrun called.";
535 1 : external_request_status_ = true;
536 1 : return external_request_status_;
537 : }
538 :
539 0 : bool artdaq::Commandable::do_add_config_archive_entry(std::string const& key, std::string const& value)
540 : {
541 0 : TLOG(TLVL_DEBUG + 32) << "do_add_config_archive_entry called: key=" << key << ", value=" << value;
542 0 : return true;
543 : }
544 :
545 0 : bool artdaq::Commandable::do_clear_config_archive()
546 : {
547 0 : TLOG(TLVL_DEBUG + 32) << "do_clear_config_archive called.";
548 0 : external_request_status_ = true;
549 0 : return external_request_status_;
550 : }
551 :
552 : // *********************
553 : // *** Utility methods.
554 : // *********************
555 :
556 2 : std::string artdaq::Commandable::current_state() const
557 : {
558 2 : std::string fullStateName = (const_cast<Commandable*>(this))->fsm_.getState().getName(); // NOLINT(cppcoreguidelines-pro-type-const-cast)
559 2 : size_t pos = fullStateName.rfind("::");
560 2 : if (pos != std::string::npos)
561 : {
562 2 : return fullStateName.substr(pos + 2);
563 : }
564 :
565 0 : return fullStateName;
566 2 : }
|