mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 03:08:27 +08:00
db,worker: fix realtime result initialization
This commit is contained in:
parent
7a1d60ee15
commit
2b3641ac0a
@ -118,7 +118,8 @@ def main():
|
||||
if args.arguments:
|
||||
print("Run arguments are not supported in ELF mode")
|
||||
sys.exit(1)
|
||||
exp_inst = ELFRunner(dps)
|
||||
exp_inst = ELFRunner(dbh)
|
||||
rdb.build()
|
||||
exp_inst.run(args.file)
|
||||
else:
|
||||
module = file_import(args.file)
|
||||
@ -159,6 +160,7 @@ def main():
|
||||
scheduler=DummyScheduler(),
|
||||
run_params=run_params,
|
||||
**run_params["arguments"])
|
||||
rdb.build()
|
||||
exp_inst.run()
|
||||
exp_inst.analyze()
|
||||
|
||||
|
@ -83,7 +83,7 @@ class AutoDB:
|
||||
object.__setattr__(self, k, dev)
|
||||
self.build()
|
||||
if self.dbh is not None:
|
||||
self.dbh.init_results(self.realtime_results)
|
||||
self.dbh.add_rt_results(self.realtime_results)
|
||||
|
||||
def __getattr__(self, name):
|
||||
ak = getattr(self.DBKeys, name)
|
||||
|
@ -10,13 +10,18 @@ class ResultDB:
|
||||
def __init__(self, init_rt_results, update_rt_results):
|
||||
self.init_rt_results = init_rt_results
|
||||
self.update_rt_results = update_rt_results
|
||||
self.rtr_description = dict()
|
||||
|
||||
def init(self, rtr_description):
|
||||
assert not hasattr(self, "realtime_data")
|
||||
assert not hasattr(self, "data")
|
||||
def add_rt_results(self, rtr_description):
|
||||
intr = set(self.rtr_description.keys()).intersection(
|
||||
set(rtr_description.keys()))
|
||||
if intr:
|
||||
raise ValueError("Duplicate realtime results: " + ", ".join(intr))
|
||||
self.rtr_description.update(rtr_description)
|
||||
|
||||
def build(self):
|
||||
realtime_results_set = set()
|
||||
for rtr in rtr_description.keys():
|
||||
for rtr in self.rtr_description.keys():
|
||||
if isinstance(rtr, tuple):
|
||||
for e in rtr:
|
||||
realtime_results_set.add(e)
|
||||
@ -26,7 +31,7 @@ class ResultDB:
|
||||
self.realtime_data = Notifier({x: [] for x in realtime_results_set})
|
||||
self.data = Notifier(dict())
|
||||
|
||||
self.init_rt_results(rtr_description)
|
||||
self.init_rt_results(self.rtr_description)
|
||||
self.realtime_data.publish = lambda notifier, data: \
|
||||
self.update_rt_results(data)
|
||||
|
||||
@ -83,7 +88,7 @@ class DBHub:
|
||||
|
||||
self.get_parameter = pdb.request
|
||||
self.set_parameter = pdb.set
|
||||
self.init_results = rdb.init
|
||||
self.add_rt_results = rdb.add_rt_results
|
||||
self.get_result = rdb.request
|
||||
self.set_result = rdb.set
|
||||
|
||||
|
@ -112,6 +112,7 @@ def main():
|
||||
scheduler=Scheduler,
|
||||
run_params=run_params,
|
||||
**run_params["arguments"])
|
||||
rdb.build()
|
||||
put_object({"action": "completed"})
|
||||
elif action == "run":
|
||||
exp_inst.run()
|
||||
|
Loading…
Reference in New Issue
Block a user