From c4f3f7f6042f1c9d1d956f4282a16bf5c036701c Mon Sep 17 00:00:00 2001 From: Robin Glade-Beucke Date: Mon, 3 May 2021 15:54:29 +0200 Subject: [PATCH] added hypervisor command ctl to dispatcher loop + config chages --- dispatcher/config.ini | 26 ++++++++++++++++++-------- dispatcher/dispatcher.py | 5 +++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dispatcher/config.ini b/dispatcher/config.ini index a2ed8874..b8085bb1 100644 --- a/dispatcher/config.ini +++ b/dispatcher/config.ini @@ -23,7 +23,7 @@ RunsDatabaseCollection = runs # Timeouts (seconds to wait until we assume it failed) # Give Arm command some time in case baselines noisy ArmCommandTimeout = 60 -#Maximum number of times the arming sequence is allowed to timeout +#Maximum number of times the arming sequence is allowed to timeout MaxArmCycles=3 # Give start command less time because there's not really anything complicated to do StartCommandTimeout = 20 @@ -71,14 +71,24 @@ MasterDAQConfig = { } } -# Addresses for the VME crates -VMEConfig = { - "0": "192.168.131.60", - "1": "192.168.131.61", - "2": "192.168.131.62", - "3": "192.168.131.63", - "4": "192.168.131.64" +# Adresses for VME and NIM crates: +CrateConfig = { + 'vme': { + "0": "192.168.131.60", + "1": "192.168.131.61", + "2": "192.168.131.62", + "3": "192.168.131.63", + "4": "192.168.131.64" } + 'nim': { + "0": "192.168.131.90", + "1": "192.168.131.91", + "2": "192.168.131.92", + "3": "192.168.131.93", + "4": "192.168.131.94", + "5": "192.168.131.95" + } +} [TESTING] LogName = dispatcher_test diff --git a/dispatcher/dispatcher.py b/dispatcher/dispatcher.py index 0f89c084..df9da7e5 100755 --- a/dispatcher/dispatcher.py +++ b/dispatcher/dispatcher.py @@ -29,13 +29,13 @@ def main(): control_mc = daqnt.get_client('daq') runs_mc = daqnt.get_client('runs') logger = daqnt.get_daq_logger(config['LogName'], level=args.log, mc=control_mc) - vme_config = json.loads(config['VMEConfig']) + crate_config = json.loads(config['CrateConfig']) # Declare necessary classes sh = daqnt.SignalHandler() SlackBot = daqnt.DaqntBot(os.environ['SLACK_KEY']) Hypervisor = daqnt.Hypervisor(control_mc[config['ControlDatabaseName']], logger, - daq_config['tpc'], vme_config, sh=sh, testing=args.test, slackbot=SlackBot) + daq_config['tpc'], crate_config, sh=sh, testing=args.test, slackbot=SlackBot) MongoConnector = MongoConnect(config, daq_config, logger, control_mc, runs_mc, Hypervisor, args.test) DAQControl = DAQController(config, daq_config, MongoConnector, logger, Hypervisor) # connect the triangle @@ -72,6 +72,7 @@ def main(): # Decision time. Are we actually in our goal state? If not what should we do? DAQControl.solve_problem(latest_status, goal_state) + Hypervisor.process_control() MongoConnector.quit() return