2019-02-18 22:28:25 +01:00
|
|
|
"""Early initialization for ansible-test before most other imports have been performed."""
|
2019-07-12 08:46:20 +02:00
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
__metaclass__ = type
|
2019-02-18 22:28:25 +01:00
|
|
|
|
|
|
|
import resource
|
|
|
|
|
2019-08-06 23:43:29 +02:00
|
|
|
from .constants import (
|
2019-02-18 22:28:25 +01:00
|
|
|
SOFT_RLIMIT_NOFILE,
|
|
|
|
)
|
|
|
|
|
|
|
|
CURRENT_RLIMIT_NOFILE = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
|
|
DESIRED_RLIMIT_NOFILE = (SOFT_RLIMIT_NOFILE, CURRENT_RLIMIT_NOFILE[1])
|
|
|
|
|
|
|
|
if DESIRED_RLIMIT_NOFILE < CURRENT_RLIMIT_NOFILE:
|
|
|
|
resource.setrlimit(resource.RLIMIT_NOFILE, DESIRED_RLIMIT_NOFILE)
|
|
|
|
CURRENT_RLIMIT_NOFILE = DESIRED_RLIMIT_NOFILE
|