forked from M-Labs/artiq
1
0
Fork 0

remove timeout from run_params (to be replaced by a better mechanism)

This commit is contained in:
Sebastien Bourdeauducq 2015-03-09 10:51:32 +01:00
parent d95a9cac9a
commit ec1d082730
5 changed files with 23 additions and 22 deletions

View File

@ -37,9 +37,6 @@ def get_argparser():
help="run the experiment in timed mode. " help="run the experiment in timed mode. "
"argument specifies the time of the first run, " "argument specifies the time of the first run, "
"use 'now' to run immediately") "use 'now' to run immediately")
parser_add.add_argument(
"-t", "--timeout", default=None, type=float,
help="specify a timeout for the experiment to complete")
parser_add.add_argument("-e", "--experiment", default=None, parser_add.add_argument("-e", "--experiment", default=None,
help="experiment to run") help="experiment to run")
parser_add.add_argument("--rtr-group", default=None, type=str, parser_add.add_argument("--rtr-group", default=None, type=str,
@ -105,7 +102,6 @@ def _action_submit(remote, args):
run_params = { run_params = {
"file": args.file, "file": args.file,
"experiment": args.experiment, "experiment": args.experiment,
"timeout": args.timeout,
"arguments": arguments, "arguments": arguments,
"rtr_group": args.rtr_group if args.rtr_group is not None \ "rtr_group": args.rtr_group if args.rtr_group is not None \
else args.file else args.file
@ -148,12 +144,13 @@ def _action_del_parameter(remote, args):
def _show_queue(queue): def _show_queue(queue):
clear_screen() clear_screen()
if queue: if queue:
table = PrettyTable(["RID", "File", "Experiment", "Timeout", table = PrettyTable(["RID", "File", "Experiment", "Arguments"])
"Arguments"])
for rid, run_params in queue: for rid, run_params in queue:
row = [rid, run_params["file"]] row = [rid, run_params["file"]]
for x in run_params["experiment"], run_params["timeout"]: if run_params["experiment"] is None:
row.append("" if x is None else x) row.append("")
else:
row.append(run_params["experiment"])
row.append(format_arguments(run_params["arguments"])) row.append(format_arguments(run_params["arguments"]))
table.add_row(row) table.add_row(row)
print(table) print(table)
@ -165,13 +162,15 @@ def _show_timed(timed):
clear_screen() clear_screen()
if timed: if timed:
table = PrettyTable(["Next run", "TRID", "File", "Experiment", table = PrettyTable(["Next run", "TRID", "File", "Experiment",
"Timeout", "Arguments"]) "Arguments"])
sp = sorted(timed.items(), key=lambda x: (x[1][0], x[0])) sp = sorted(timed.items(), key=lambda x: (x[1][0], x[0]))
for trid, (next_run, run_params) in sp: for trid, (next_run, run_params) in sp:
row = [time.strftime("%m/%d %H:%M:%S", time.localtime(next_run)), row = [time.strftime("%m/%d %H:%M:%S", time.localtime(next_run)),
trid, run_params["file"]] trid, run_params["file"]]
for x in run_params["experiment"], run_params["timeout"]: if run_params["experiment"] is None:
row.append("" if x is None else x) row.append("")
else:
row.append(run_params["experiment"])
row.append(format_arguments(run_params["arguments"])) row.append(format_arguments(run_params["arguments"]))
table.add_row(row) table.add_row(row)
print(table) print(table)

View File

@ -140,7 +140,6 @@ def main():
run_params = { run_params = {
"file": args.file, "file": args.file,
"experiment": args.experiment, "experiment": args.experiment,
"timeout": None,
"arguments": arguments "arguments": arguments
} }
exp_inst = exp(dbh, exp_inst = exp(dbh,

View File

@ -147,7 +147,6 @@ class ExplorerWindow(Window):
run_params = { run_params = {
"file": data["file"], "file": data["file"],
"experiment": data["experiment"], "experiment": data["experiment"],
"timeout": None,
"arguments": arguments, "arguments": arguments,
"rtr_group": data["file"] "rtr_group": data["file"]
} }

View File

@ -12,8 +12,10 @@ class _QueueStoreSyncer(ListSyncer):
def convert(self, x): def convert(self, x):
rid, run_params = x rid, run_params = x
row = [rid, run_params["file"]] row = [rid, run_params["file"]]
for e in run_params["experiment"], run_params["timeout"]: if run_params["experiment"] is None:
row.append("" if e is None else str(e)) row.append("")
else:
row.append(run_params["experiment"])
row.append(format_arguments(run_params["arguments"])) row.append(format_arguments(run_params["arguments"]))
return row return row
@ -27,8 +29,10 @@ class _TimedStoreSyncer(DictSyncer):
next_run, run_params = x next_run, run_params = x
row = [time.strftime("%m/%d %H:%M:%S", time.localtime(next_run)), row = [time.strftime("%m/%d %H:%M:%S", time.localtime(next_run)),
trid, run_params["file"]] trid, run_params["file"]]
for e in run_params["experiment"], run_params["timeout"]: if run_params["experiment"] is None:
row.append("" if e is None else str(e)) row.append("")
else:
row.append(run_params["experiment"])
row.append(format_arguments(run_params["arguments"])) row.append(format_arguments(run_params["arguments"]))
return row return row
@ -55,9 +59,9 @@ class SchedulerWindow(Window):
notebook = Gtk.Notebook() notebook = Gtk.Notebook()
topvbox.pack_start(notebook, True, True, 0) 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)
self.queue_tree = Gtk.TreeView(self.queue_store) self.queue_tree = Gtk.TreeView(self.queue_store)
for i, title in enumerate(["RID", "File", "Experiment", "Timeout", "Arguments"]): for i, title in enumerate(["RID", "File", "Experiment", "Arguments"]):
renderer = Gtk.CellRendererText() renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(title, renderer, text=i) column = Gtk.TreeViewColumn(title, renderer, text=i)
self.queue_tree.append_column(column) self.queue_tree.append_column(column)
@ -79,10 +83,10 @@ class SchedulerWindow(Window):
vbox.set_border_width(6) vbox.set_border_width(6)
notebook.insert_page(vbox, Gtk.Label("Queue"), -1) notebook.insert_page(vbox, Gtk.Label("Queue"), -1)
self.timed_store = Gtk.ListStore(str, int, str, str, str, str) self.timed_store = Gtk.ListStore(str, int, str, str, str)
self.timed_tree = Gtk.TreeView(self.timed_store) self.timed_tree = Gtk.TreeView(self.timed_store)
for i, title in enumerate(["Next run", "TRID", "File", "Experiment", for i, title in enumerate(["Next run", "TRID", "File", "Experiment",
"Timeout", "Arguments"]): "Arguments"]):
renderer = Gtk.CellRendererText() renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(title, renderer, text=i) column = Gtk.TreeViewColumn(title, renderer, text=i)
self.timed_tree.append_column(column) self.timed_tree.append_column(column)

View File

@ -67,7 +67,7 @@ class Worker:
if obj != "ack": if obj != "ack":
raise WorkerFailed("Incorrect acknowledgement") raise WorkerFailed("Incorrect acknowledgement")
while True: while True:
obj = yield from self._recv(run_params["timeout"]) obj = yield from self._recv(None)
action = obj["action"] action = obj["action"]
if action == "report_completed": if action == "report_completed":
if obj["status"] != "ok": if obj["status"] != "ok":