|
|
@ -32,6 +32,7 @@ import sys
|
|
|
|
import pipes
|
|
|
|
import pipes
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import getpass
|
|
|
|
import getpass
|
|
|
|
|
|
|
|
import resource
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger('injector') # pylint: disable=locally-disabled, invalid-name
|
|
|
|
logger = logging.getLogger('injector') # pylint: disable=locally-disabled, invalid-name
|
|
|
|
# pylint: disable=locally-disabled, invalid-name
|
|
|
|
# pylint: disable=locally-disabled, invalid-name
|
|
|
@ -90,6 +91,17 @@ def main():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
logger.debug('Self: %s', __file__)
|
|
|
|
logger.debug('Self: %s', __file__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# to achieve a consistent nofile ulimit, set to 16k here, this can affect performance in subprocess.Popen when
|
|
|
|
|
|
|
|
# being called with close_fds=True on Python (8x the time on some environments)
|
|
|
|
|
|
|
|
nofile_limit = 16 * 1024
|
|
|
|
|
|
|
|
current_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
|
|
|
|
|
|
new_limit = (nofile_limit, nofile_limit)
|
|
|
|
|
|
|
|
if current_limit > new_limit:
|
|
|
|
|
|
|
|
logger.debug('RLIMIT_NOFILE: %s -> %s', current_limit, new_limit)
|
|
|
|
|
|
|
|
resource.setrlimit(resource.RLIMIT_NOFILE, (nofile_limit, nofile_limit))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
logger.debug('RLIMIT_NOFILE: %s', current_limit)
|
|
|
|
|
|
|
|
|
|
|
|
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'injector.json')
|
|
|
|
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'injector.json')
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|