master,client: support changing real-time results group

This commit is contained in:
Sebastien Bourdeauducq 2015-01-30 20:36:54 +08:00
parent 9bfc2070d4
commit 2fbe22e15e
4 changed files with 14 additions and 4 deletions

View File

@ -42,6 +42,9 @@ def get_argparser():
help="specify a timeout for the experiment to complete")
parser_add.add_argument("-u", "--unit", default=None,
help="unit to run")
parser_add.add_argument("--rtr-group", default=None, type=str,
help="real-time result group "
"(defaults to filename)")
parser_add.add_argument("file", help="file containing the unit to run")
parser_add.add_argument("arguments", nargs="*",
help="run arguments")
@ -101,7 +104,9 @@ def _action_submit(remote, args):
run_params = {
"file": args.file,
"unit": args.unit,
"arguments": arguments
"arguments": arguments,
"rtr_group": args.rtr_group if args.rtr_group is not None \
else args.file
}
if args.timed is None:
rid = remote.run_queued(run_params, args.timeout)

View File

@ -43,13 +43,15 @@ def main():
loop = asyncio.get_event_loop()
atexit.register(lambda: loop.close())
def run_cb(rid, run_params):
rtr.current_group = run_params["rtr_group"]
scheduler = Scheduler({
"req_device": ddb.request,
"req_parameter": pdb.request,
"set_parameter": pdb.set,
"init_rt_results": rtr.init,
"update_rt_results": rtr.update
})
}, run_cb)
loop.run_until_complete(scheduler.start())
atexit.register(lambda: loop.run_until_complete(scheduler.stop()))

View File

@ -136,6 +136,7 @@ class ExplorerWindow(Window):
run_params = {
"file": data["file"],
"unit": data["unit"],
"arguments": arguments
"arguments": arguments,
"rtr_group": data["file"]
}
asyncio.Task(self.schedule_ctl.run_queued(run_params, None))

View File

@ -6,7 +6,8 @@ from artiq.master.worker import Worker
class Scheduler:
def __init__(self, worker_handlers):
def __init__(self, worker_handlers, run_cb):
self.run_cb = run_cb
self.worker = Worker(worker_handlers)
self.next_rid = 0
self.queue = Notifier([])
@ -64,6 +65,7 @@ class Scheduler:
@asyncio.coroutine
def _run(self, rid, run_params, timeout):
self.run_cb(rid, run_params)
try:
yield from self.worker.run(run_params, timeout)
except Exception as e: