Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added hypervisor command ctl to dispatcher loop + config chages #51

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions dispatcher/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Comment on lines +84 to +89

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not include any of the NV/MV crates? Perhaps it is worth a comment in the config

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, for bookkeeping it might be nice to add some description of the PR wink

Totally right. Sorry. I will add descriptions next time. Let me add some for this one now:

The only change for the dispatcher is that it commands the Hypervisor to look for commands in the db and execute them, now. The actual point where this bit is called in the dispatcher's event loop is probably the most critical bit. At the end of the loop, all the changes depending on the current status should have been executed already, that's why mostly Darryl (but I agree, as far as I can tell), think that either the end of the loop or the beginnig (which is more or less the same spot) would be the best place to put it. Do you see a reason why this wouldn't be a good idea?

In the Hypervisor (mentioned daqnt PR) we now want to have access to NIM IPs, also. That's why we extended the config. Darryl wanted a nested dict for that. I hope I found all the places, where we thus require to ask for the VME part of the nested dict, instead of using the entire dict, as before. I also changed the naming to be consistent with what the object holds.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of comment would you like?
In some nuclear restart option, I think all the crates (so far only VME) are shut down and restarted. So every crate we add here will be affected by this. So that's probably at least one thing we should consider before adding more crates here. Maybe we want this even.

Copy link

@JoranAngevaare JoranAngevaare May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having looked a bit into PR46, I think this is a fine place for such an option.

In some nuclear restart option, I think all the crates (so far only VME) are shut down and restarted.

The comment I would add explicitly is that these are all the TPC crates, not all crates.

}
}

[TESTING]
LogName = dispatcher_test
Expand Down
5 changes: 3 additions & 2 deletions dispatcher/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down