From 84de2fb28bf47dc4e781f0a0181c6a29711f0d09 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 15 Jul 2015 11:08:12 +0200 Subject: [PATCH] expid: experiment -> class_name --- artiq/frontend/artiq_client.py | 12 ++++++------ artiq/gui/explorer.py | 6 +++--- artiq/gui/schedule.py | 6 +++--- artiq/master/worker_impl.py | 8 ++++---- artiq/test/hardware_testbench.py | 2 +- artiq/test/scheduler.py | 2 +- artiq/test/worker.py | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/artiq/frontend/artiq_client.py b/artiq/frontend/artiq_client.py index 78e4a49ac..8305bc787 100755 --- a/artiq/frontend/artiq_client.py +++ b/artiq/frontend/artiq_client.py @@ -43,8 +43,8 @@ def get_argparser(): parser_add.add_argument("-f", "--flush", default=False, action="store_true", help="flush the pipeline before preparing " "the experiment") - parser_add.add_argument("-e", "--experiment", default=None, - help="experiment to run") + parser_add.add_argument("-c", "--class-name", default=None, + help="name of the class to run") parser_add.add_argument("file", help="file containing the experiment to run") parser_add.add_argument("arguments", nargs="*", @@ -102,7 +102,7 @@ def _action_submit(remote, args): expid = { "file": args.file, - "experiment": args.experiment, + "class_name": args.class_name, "arguments": arguments, } if args.timed is None: @@ -142,7 +142,7 @@ def _show_schedule(schedule): x[1]["due_date"] or 0, x[0])) table = PrettyTable(["RID", "Pipeline", " Status ", "Prio", - "Due date", "File", "Experiment", "Arguments"]) + "Due date", "File", "Class name", "Arguments"]) for rid, v in l: row = [rid, v["pipeline"], v["status"], v["priority"]] if v["due_date"] is None: @@ -151,10 +151,10 @@ def _show_schedule(schedule): row.append(time.strftime("%m/%d %H:%M:%S", time.localtime(v["due_date"]))) row.append(v["expid"]["file"]) - if v["expid"]["experiment"] is None: + if v["expid"]["class_name"] is None: row.append("") else: - row.append(v["expid"]["experiment"]) + row.append(v["expid"]["class_name"]) row.append(format_arguments(v["expid"]["arguments"])) table.add_row(row) print(table) diff --git a/artiq/gui/explorer.py b/artiq/gui/explorer.py index df2057b05..4b4529cfd 100644 --- a/artiq/gui/explorer.py +++ b/artiq/gui/explorer.py @@ -85,11 +85,11 @@ class ExplorerDock(dockarea.Dock): return self.explist_model @asyncio.coroutine - def submit(self, pipeline_name, file, experiment, arguments, + def submit(self, pipeline_name, file, class_name, arguments, priority, due_date, flush): expid = { "file": file, - "experiment": experiment, + "class_name": class_name, "arguments": arguments, } rid = yield from self.schedule_ctl.submit(pipeline_name, expid, @@ -107,6 +107,6 @@ class ExplorerDock(dockarea.Dock): else: due_date = None asyncio.async(self.submit(self.pipeline.text(), - expinfo["file"], expinfo["experiment"], + expinfo["file"], expinfo["class_name"], dict(), self.priority.value(), due_date, self.flush.isChecked())) diff --git a/artiq/gui/schedule.py b/artiq/gui/schedule.py index c9e6eb2b3..cd9c8d402 100644 --- a/artiq/gui/schedule.py +++ b/artiq/gui/schedule.py @@ -13,7 +13,7 @@ class _ScheduleModel(DictSyncModel): def __init__(self, parent, init): DictSyncModel.__init__(self, ["RID", "Pipeline", "Status", "Prio", "Due date", - "File", "Experiment", "Arguments"], + "File", "Class name", "Arguments"], parent, init) def sort_key(self, k, v): @@ -38,10 +38,10 @@ class _ScheduleModel(DictSyncModel): elif column == 5: return v["expid"]["file"] elif column == 6: - if v["expid"]["experiment"] is None: + if v["expid"]["class_name"] is None: return "" else: - return v["expid"]["experiment"] + return v["expid"]["class_name"] elif column == 7: return format_arguments(v["expid"]["arguments"]) else: diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 2262f31fb..23de27b22 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -86,9 +86,9 @@ class Scheduler: self.priority = priority -def get_exp(file, exp): +def get_exp(file, class_name): module = file_import(file) - if exp is None: + if class_name is None: exps = [v for k, v in module.__dict__.items() if is_experiment(v)] if len(exps) != 1: @@ -96,7 +96,7 @@ def get_exp(file, exp): .format(len(exps))) return exps[0] else: - return getattr(module, exp) + return getattr(module, class_name) register_experiment = make_parent_action("register_experiment", @@ -154,7 +154,7 @@ def main(): start_time = time.localtime() rid = obj["rid"] expid = obj["expid"] - exp = get_exp(expid["file"], expid["experiment"]) + exp = get_exp(expid["file"], expid["class_name"]) dmgr.virtual_devices["scheduler"].set_run_info( obj["pipeline_name"], expid, obj["priority"]) exp_inst = exp(dmgr, ParentPDB, rdb, diff --git a/artiq/test/hardware_testbench.py b/artiq/test/hardware_testbench.py index a082a676c..1734852cc 100644 --- a/artiq/test/hardware_testbench.py +++ b/artiq/test/hardware_testbench.py @@ -40,7 +40,7 @@ class ExperimentCase(unittest.TestCase): def execute(self, cls, **kwargs): expid = { "file": sys.modules[cls.__module__].__file__, - "experiment": cls.__name__, + "class_name": cls.__name__, "arguments": kwargs } self.dmgr.virtual_devices["scheduler"].expid = expid diff --git a/artiq/test/scheduler.py b/artiq/test/scheduler.py index 7493e53d4..9c1b2717e 100644 --- a/artiq/test/scheduler.py +++ b/artiq/test/scheduler.py @@ -28,7 +28,7 @@ class BackgroundExperiment(EnvExperiment): def _get_expid(name): return { "file": sys.modules[__name__].__file__, - "experiment": name, + "class_name": name, "arguments": dict() } diff --git a/artiq/test/worker.py b/artiq/test/worker.py index 2616a3656..b40e7b6c8 100644 --- a/artiq/test/worker.py +++ b/artiq/test/worker.py @@ -46,10 +46,10 @@ def _call_worker(worker, expid): yield from worker.close() -def _run_experiment(experiment): +def _run_experiment(class_name): expid = { "file": sys.modules[__name__].__file__, - "experiment": experiment, + "class_name": class_name, "arguments": dict() } loop = asyncio.get_event_loop()