forked from M-Labs/artiq
master,client: support changing real-time results group
This commit is contained in:
parent
9bfc2070d4
commit
2fbe22e15e
|
@ -42,6 +42,9 @@ def get_argparser():
|
||||||
help="specify a timeout for the experiment to complete")
|
help="specify a timeout for the experiment to complete")
|
||||||
parser_add.add_argument("-u", "--unit", default=None,
|
parser_add.add_argument("-u", "--unit", default=None,
|
||||||
help="unit to run")
|
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("file", help="file containing the unit to run")
|
||||||
parser_add.add_argument("arguments", nargs="*",
|
parser_add.add_argument("arguments", nargs="*",
|
||||||
help="run arguments")
|
help="run arguments")
|
||||||
|
@ -101,7 +104,9 @@ def _action_submit(remote, args):
|
||||||
run_params = {
|
run_params = {
|
||||||
"file": args.file,
|
"file": args.file,
|
||||||
"unit": args.unit,
|
"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:
|
if args.timed is None:
|
||||||
rid = remote.run_queued(run_params, args.timeout)
|
rid = remote.run_queued(run_params, args.timeout)
|
||||||
|
|
|
@ -43,13 +43,15 @@ def main():
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
atexit.register(lambda: loop.close())
|
atexit.register(lambda: loop.close())
|
||||||
|
|
||||||
|
def run_cb(rid, run_params):
|
||||||
|
rtr.current_group = run_params["rtr_group"]
|
||||||
scheduler = Scheduler({
|
scheduler = Scheduler({
|
||||||
"req_device": ddb.request,
|
"req_device": ddb.request,
|
||||||
"req_parameter": pdb.request,
|
"req_parameter": pdb.request,
|
||||||
"set_parameter": pdb.set,
|
"set_parameter": pdb.set,
|
||||||
"init_rt_results": rtr.init,
|
"init_rt_results": rtr.init,
|
||||||
"update_rt_results": rtr.update
|
"update_rt_results": rtr.update
|
||||||
})
|
}, run_cb)
|
||||||
loop.run_until_complete(scheduler.start())
|
loop.run_until_complete(scheduler.start())
|
||||||
atexit.register(lambda: loop.run_until_complete(scheduler.stop()))
|
atexit.register(lambda: loop.run_until_complete(scheduler.stop()))
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,7 @@ class ExplorerWindow(Window):
|
||||||
run_params = {
|
run_params = {
|
||||||
"file": data["file"],
|
"file": data["file"],
|
||||||
"unit": data["unit"],
|
"unit": data["unit"],
|
||||||
"arguments": arguments
|
"arguments": arguments,
|
||||||
|
"rtr_group": data["file"]
|
||||||
}
|
}
|
||||||
asyncio.Task(self.schedule_ctl.run_queued(run_params, None))
|
asyncio.Task(self.schedule_ctl.run_queued(run_params, None))
|
||||||
|
|
|
@ -6,7 +6,8 @@ from artiq.master.worker import Worker
|
||||||
|
|
||||||
|
|
||||||
class Scheduler:
|
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.worker = Worker(worker_handlers)
|
||||||
self.next_rid = 0
|
self.next_rid = 0
|
||||||
self.queue = Notifier([])
|
self.queue = Notifier([])
|
||||||
|
@ -64,6 +65,7 @@ class Scheduler:
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _run(self, rid, run_params, timeout):
|
def _run(self, rid, run_params, timeout):
|
||||||
|
self.run_cb(rid, run_params)
|
||||||
try:
|
try:
|
||||||
yield from self.worker.run(run_params, timeout)
|
yield from self.worker.run(run_params, timeout)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue