Configure limit of opened files for the test runner process
For some reason, when Tobiko retries many times ssh connection and logs a lot of data in the log file, pytest may fail with "Too many open files" exception raised. To avoid that lets try to configure soft ulimit for opened files to be as high as possible (same as hard limit). Change-Id: I6fb8977d7909798a5ab6be499044cc74ac34dfa2
This commit is contained in:
parent
97fb1ce5d0
commit
d1d3ea7c19
@ -16,6 +16,7 @@ from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import psutil
|
||||
import resource
|
||||
import signal
|
||||
import sys
|
||||
import subprocess
|
||||
@ -106,6 +107,7 @@ def main():
|
||||
|
||||
|
||||
def run_tests():
|
||||
setup_ulimits()
|
||||
setup_timeout()
|
||||
cleanup_report_dir()
|
||||
log_environ()
|
||||
@ -122,6 +124,16 @@ def run_tests():
|
||||
return succeeded
|
||||
|
||||
|
||||
def setup_ulimits():
|
||||
try:
|
||||
hard_nofile_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
|
||||
resource.setrlimit(
|
||||
resource.RLIMIT_NOFILE,
|
||||
(hard_nofile_limit, hard_nofile_limit))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
def setup_timeout():
|
||||
|
||||
if RUN_TESTS_TIMEOUT > 0.:
|
||||
|
Loading…
x
Reference in New Issue
Block a user