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

View File

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

View File

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

View File

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

View File

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