mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 11:18:27 +08:00
master/client: remove function parameter
This commit is contained in:
parent
3befafc4e0
commit
f352e7f752
@ -11,7 +11,7 @@ class _QueueStoreSyncer(ListSyncer):
|
||||
def convert(self, x):
|
||||
rid, run_params, timeout = x
|
||||
row = [rid, run_params["file"]]
|
||||
for e in run_params["unit"], run_params["function"], timeout:
|
||||
for e in run_params["unit"], timeout:
|
||||
row.append("-" if e is None else str(e))
|
||||
return row
|
||||
|
||||
@ -29,7 +29,7 @@ class _PeriodicStoreSyncer:
|
||||
next_run, run_params, timeout, period = x
|
||||
row = [time.strftime("%m/%d %H:%M:%S", time.localtime(next_run)),
|
||||
prid, run_params["file"]]
|
||||
for e in run_params["unit"], run_params["function"], timeout:
|
||||
for e in run_params["unit"], timeout:
|
||||
row.append("-" if e is None else str(e))
|
||||
row.append(str(period))
|
||||
return row
|
||||
@ -81,10 +81,9 @@ class SchedulerWindow(Window):
|
||||
notebook = Gtk.Notebook()
|
||||
topvbox.pack_start(notebook, True, True, 0)
|
||||
|
||||
self.queue_store = Gtk.ListStore(int, str, str, str, str)
|
||||
self.queue_store = Gtk.ListStore(int, str, str, str)
|
||||
tree = Gtk.TreeView(self.queue_store)
|
||||
for i, title in enumerate(["RID", "File", "Unit",
|
||||
"Function", "Timeout"]):
|
||||
for i, title in enumerate(["RID", "File", "Unit", "Timeout"]):
|
||||
renderer = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(title, renderer, text=i)
|
||||
tree.append_column(column)
|
||||
@ -105,10 +104,10 @@ class SchedulerWindow(Window):
|
||||
vbox.set_border_width(6)
|
||||
notebook.insert_page(vbox, Gtk.Label("Queue"), -1)
|
||||
|
||||
self.periodic_store = Gtk.ListStore(str, int, str, str, str, str, str)
|
||||
self.periodic_store = Gtk.ListStore(str, int, str, str, str, str)
|
||||
tree = Gtk.TreeView(self.periodic_store)
|
||||
for i, title in enumerate(["Next run", "PRID", "File", "Unit",
|
||||
"Function", "Timeout", "Period"]):
|
||||
"Timeout", "Period"]):
|
||||
renderer = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn(title, renderer, text=i)
|
||||
tree.append_column(column)
|
||||
|
@ -8,7 +8,7 @@ from artiq.language.context import AutoContext
|
||||
from artiq.management.dpdb import DeviceParamSupplier
|
||||
|
||||
|
||||
def run(dps, file, unit, function):
|
||||
def run(dps, file, unit):
|
||||
module = file_import(file)
|
||||
if unit is None:
|
||||
units = [v for k, v in module.__dict__.items()
|
||||
@ -22,8 +22,7 @@ def run(dps, file, unit, function):
|
||||
else:
|
||||
unit = getattr(module, unit)
|
||||
unit_inst = unit(dps)
|
||||
f = getattr(unit_inst, function)
|
||||
f()
|
||||
unit_inst.run()
|
||||
|
||||
|
||||
def get_object():
|
||||
|
@ -33,8 +33,6 @@ def _get_args():
|
||||
parser_add.add_argument(
|
||||
"-t", "--timeout", default=None, type=float,
|
||||
help="specify a timeout for the experiment to complete")
|
||||
parser_add.add_argument("-f", "--function", default="run",
|
||||
help="function to run")
|
||||
parser_add.add_argument("-u", "--unit", default=None,
|
||||
help="unit to run")
|
||||
parser_add.add_argument("file", help="file containing the unit to run")
|
||||
@ -79,8 +77,7 @@ def _get_args():
|
||||
def _action_submit(remote, args):
|
||||
run_params = {
|
||||
"file": args.file,
|
||||
"unit": args.unit,
|
||||
"function": args.function
|
||||
"unit": args.unit
|
||||
}
|
||||
if args.periodic is None:
|
||||
rid = remote.run_once(run_params, args.timeout)
|
||||
@ -117,10 +114,10 @@ def _action_del_parameter(remote, args):
|
||||
def _show_queue(queue):
|
||||
clear_screen()
|
||||
if queue:
|
||||
table = PrettyTable(["RID", "File", "Unit", "Function", "Timeout"])
|
||||
table = PrettyTable(["RID", "File", "Unit", "Timeout"])
|
||||
for rid, run_params, timeout in queue:
|
||||
row = [rid, run_params["file"]]
|
||||
for x in run_params["unit"], run_params["function"], timeout:
|
||||
for x in run_params["unit"], timeout:
|
||||
row.append("-" if x is None else x)
|
||||
table.add_row(row)
|
||||
print(table)
|
||||
@ -131,13 +128,13 @@ def _show_queue(queue):
|
||||
def _show_periodic(periodic):
|
||||
clear_screen()
|
||||
if periodic:
|
||||
table = PrettyTable(["Next run", "PRID", "File", "Unit", "Function",
|
||||
table = PrettyTable(["Next run", "PRID", "File", "Unit",
|
||||
"Timeout", "Period"])
|
||||
sp = sorted(periodic.items(), key=lambda x: (x[1][0], x[0]))
|
||||
for prid, (next_run, run_params, timeout, period) in sp:
|
||||
row = [time.strftime("%m/%d %H:%M:%S", time.localtime(next_run)),
|
||||
prid, run_params["file"]]
|
||||
for x in run_params["unit"], run_params["function"], timeout:
|
||||
for x in run_params["unit"], timeout:
|
||||
row.append("-" if x is None else x)
|
||||
row.append(period)
|
||||
table.add_row(row)
|
||||
|
Loading…
Reference in New Issue
Block a user