From 2fbe22e15eabedfc3d31d510c0944ac0026da63f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 30 Jan 2015 20:36:54 +0800 Subject: [PATCH] master,client: support changing real-time results group --- artiq/frontend/artiq_client.py | 7 ++++++- artiq/frontend/artiq_master.py | 4 +++- artiq/gui/explorer.py | 3 ++- artiq/master/scheduler.py | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/artiq/frontend/artiq_client.py b/artiq/frontend/artiq_client.py index 4dc47a252..f60223eea 100755 --- a/artiq/frontend/artiq_client.py +++ b/artiq/frontend/artiq_client.py @@ -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) diff --git a/artiq/frontend/artiq_master.py b/artiq/frontend/artiq_master.py index a4298f38f..8f53f61b5 100755 --- a/artiq/frontend/artiq_master.py +++ b/artiq/frontend/artiq_master.py @@ -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())) diff --git a/artiq/gui/explorer.py b/artiq/gui/explorer.py index 6e610267a..401e3586f 100644 --- a/artiq/gui/explorer.py +++ b/artiq/gui/explorer.py @@ -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)) diff --git a/artiq/master/scheduler.py b/artiq/master/scheduler.py index 3b2e0ab7b..e05af2e3a 100644 --- a/artiq/master/scheduler.py +++ b/artiq/master/scheduler.py @@ -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: