From 39cb021827ed3e22cac729b716ff3f6ee3c61603 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Mon, 19 Feb 2024 14:37:13 +0100 Subject: [PATCH] Add 'no control' controller --- fairmq/plugins/control/Control.cxx | 18 +++++++++++------- test/device/_config.cxx | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/fairmq/plugins/control/Control.cxx b/fairmq/plugins/control/Control.cxx index cce908c4a..778825358 100644 --- a/fairmq/plugins/control/Control.cxx +++ b/fairmq/plugins/control/Control.cxx @@ -65,13 +65,17 @@ Control::Control(const string& name, Plugin::Version version, const string& main }); try { - TakeDeviceControl(); - auto control = GetProperty("control"); + if (control != "none") { + TakeDeviceControl(); + } + if (control == "static") { LOG(debug) << "Running builtin controller: static"; fControllerThread = thread(&Control::StaticMode, this); + } else if (control == "none") { + LOG(debug) << "Builtin controller: disabled"; } else if (control == "gui") { LOG(debug) << "Running builtin controller: gui"; fControllerThread = thread(&Control::GUIMode, this); @@ -142,7 +146,7 @@ auto ControlPluginProgramOptions() -> Plugin::ProgOptions namespace po = boost::program_options; auto pluginOptions = po::options_description{"Control (builtin) Plugin"}; pluginOptions.add_options() - ("control", po::value()->default_value("dynamic"), "Control mode, 'static' or 'dynamic' (aliases for dynamic are external and interactive)") + ("control", po::value()->default_value("dynamic"), "Control mode, 'static' or 'dynamic' (aliases for dynamic are external and interactive), 'none', 'gui'") ("catch-signals", po::value()->default_value(1), "Enable signal handling (1/0)."); return pluginOptions; } @@ -271,11 +275,11 @@ auto Control::InteractiveMode() -> void try { RunStartupSequence(); - if(!fDeviceShutdownRequested) { + if (!fDeviceShutdownRequested) { RunREPL(); } - if(!fDeviceShutdownRequested) { + if (!fDeviceShutdownRequested) { RunShutdownSequence(); } } catch (PluginServices::DeviceControlError& e) { @@ -404,7 +408,7 @@ try { // or for device shutdown request (Ctrl-C) fStateQueue.WaitForNextOrCustom([this]{ return fDeviceShutdownRequested.load(); }); - if(!fDeviceShutdownRequested) { + if (!fDeviceShutdownRequested) { RunShutdownSequence(); } } catch (PluginServices::DeviceControlError& e) { @@ -421,7 +425,7 @@ try { // Wait for device shutdown request (Ctrl-C) fStateQueue.WaitForCustom([this]{ return fDeviceShutdownRequested.load(); }); - if(!fDeviceShutdownRequested) { + if (!fDeviceShutdownRequested) { RunShutdownSequence(); } } catch (PluginServices::DeviceControlError& e) { diff --git a/test/device/_config.cxx b/test/device/_config.cxx index 6be5f7afa..411ce1872 100644 --- a/test/device/_config.cxx +++ b/test/device/_config.cxx @@ -27,7 +27,7 @@ class TestDevice : public Device { public: TestDevice(const string& transport) - : fDeviceThread(&Device::RunStateMachine, this) + : fDeviceThread(&Device::RunStateMachine, this) { SetTransport(transport); test::Control(*this, test::Cycle::ToRun);