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

Adds HV into dispatcher #73

Merged
merged 4 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 10 additions & 3 deletions dispatcher/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import os
import daqnt
import json
import subprocess

from MongoConnect import MongoConnect
from DAQController import DAQController
from hypervisor import Hypervisor

def main():

Expand All @@ -30,8 +32,8 @@ def main():
# Declare necessary classes
sh = daqnt.SignalHandler()
SlackBot = daqnt.DaqntBot(os.environ['SLACK_KEY'])
Hypervisor = daqnt.Hypervisor(control_mc[config['ControlDatabaseName']], logger,
daq_config, vme_config, control_inputs=config['ControlKeys'].split(), sh=sh,
Hypervisor = Hypervisor(control_mc[config['ControlDatabaseName']], logger,
daq_config, vme_config, control_inputs=config['ControlKeys'].split(),
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)
Expand All @@ -41,7 +43,12 @@ def main():

sleep_period = int(config['PollFrequency'])

logger.info('Dispatcher starting up')
try:
commit = subprocess.run('git log -n 1 --pretty=oneline'.split(), capture_output=True).stdout.decode().split(' ')[0]
except Exception as e:
logger.debug(f'Couldn\'t get commit hash: {type(e)}, {e}')
commit = 'unknown'
Comment on lines +70 to +74

Choose a reason for hiding this comment

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

Could use https://github.com/XENONnT/daqnt/pull/79/files as well (also for related packages like daqnt)

Copy link
Author

Choose a reason for hiding this comment

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

We could, but now that the biggest part of daqnt is here, the only things from daqnt that we still use are the logger, the bot, and the Mongo Client. I think it's much more important that we have a strict and accurate version for the dispatcher and hypervisor because these things affect uptime, while the bot and logger don't. Also the dispatcher isn't a module, and I don't see much reason to change this.

logger.info(f'Dispatcher starting on commit: {commit}')

while sh.event.is_set() == False:
sh.event.wait(sleep_period)
Expand Down
Loading