Skip to content

Commit 9e5fc6d

Browse files
committed
Add timeouts setup from environment
Added ability to set using environment the following timeouts based on appropriate run options: TEST_TIMEOUT --test-timeout NO_OUTPUT_TIMEOUT --no-output-timeout REPLICATION_SYNC_TIMEOUT --replication-sync-timeout Also added these variables print in console in the output head. Closes #258
1 parent 584e273 commit 9e5fc6d

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

dispatcher.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,9 @@ def init_listeners(self):
143143
self.listeners.append(self.fail_watcher)
144144
if watch_hang:
145145
warn_timeout = 60.0 if args.long else 10.0
146-
no_output_timeout = float(args.no_output_timeout or 120)
147146
hang_watcher = listeners.HangWatcher(
148147
output_watcher.not_done_worker_ids, self.kill_all_workers,
149-
warn_timeout, no_output_timeout)
148+
warn_timeout, float(args.no_output_timeout))
150149
self.listeners.append(hang_watcher)
151150

152151
def run_max_workers(self):

lib/options.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,15 @@ def __init__(self):
193193
parser.add_argument(
194194
"--test-timeout",
195195
dest="test_timeout",
196-
default=110,
196+
default=env_int('TEST_TIMEOUT', 110),
197197
type=int,
198198
help="""Break the test process with kill signal if the test runs
199199
longer than this amount of seconds. Default: 110 [seconds].""")
200200

201201
parser.add_argument(
202202
"--no-output-timeout",
203203
dest="no_output_timeout",
204-
default=0,
204+
default=env_int('NO_OUTPUT_TIMEOUT', 120),
205205
type=int,
206206
help="""Exit if there was no output from workers during this
207207
amount of seconds. Set it to -1 to disable hang detection.
@@ -212,7 +212,7 @@ def __init__(self):
212212
parser.add_argument(
213213
"--replication-sync-timeout",
214214
dest="replication_sync_timeout",
215-
default=100,
215+
default=env_int('REPLICATION_SYNC_TIMEOUT', 100),
216216
type=int,
217217
help="""The number of seconds that a replica will wait when
218218
trying to sync with a master in a cluster, or a quorum of

test-run.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
def main_loop_parallel():
7474
color_stdout("Started {0}\n".format(" ".join(sys.argv)), schema='tr_text')
7575

76-
jobs = lib.Options().args.jobs
76+
args = lib.Options().args
77+
jobs = args.jobs
7778
if jobs < 1:
7879
# faster result I got was with 2 * cpu_count
7980
jobs = 2 * multiprocessing.cpu_count()
@@ -83,6 +84,16 @@ def main_loop_parallel():
8384
schema='tr_text')
8485
randomize = True
8586

87+
color_stdout("Timeout options:\n", schema='tr_text')
88+
color_stdout('-' * 19, "\n", schema='separator')
89+
color_stdout("REPLICATION_SYNC_TIMEOUT:" . ljust(26) + "{}\n" .
90+
format(args.replication_sync_timeout), schema='tr_text')
91+
color_stdout("TEST_TIMEOUT:" . ljust(26) + "{}\n" .
92+
format(args.test_timeout), schema='tr_text')
93+
color_stdout("NO_OUTPUT_TIMEOUT:" . ljust(26) + "{}\n" .
94+
format(args.no_output_timeout), schema='tr_text')
95+
color_stdout("\n", schema='tr_text')
96+
8697
task_groups = lib.worker.get_task_groups()
8798
if lib.Options().args.reproduce:
8899
task_groups = lib.worker.reproduce_task_groups(task_groups)

0 commit comments

Comments
 (0)