Commit af7cd135 authored by André Anjos's avatar André Anjos 💬

[scripts][ci] List new files opened

parent 11fd6d23
Pipeline #28957 passed with stages
in 10 minutes and 5 seconds
......@@ -229,3 +229,18 @@ def verbosity_option(**kwargs):
"(e.g. '-vvv' for debug).",
callback=callback, **kwargs)(f)
return custom_verbosity_option
def open_files():
'''Returns the number of open file descriptors for current process
.. warning: will only work on UNIX-like os-es.
'''
import os
import subprocess
pid = os.getpid()
procs = subprocess.check_output(['lsof', '-w', '-p', str(pid)])
return [k.split()[-1].decode('ascii') for k in procs.split(b'\n') if k][1:]
......@@ -16,7 +16,7 @@ from ..constants import SERVER, CONDA_BUILD_CONFIG, CONDA_RECIPE_APPEND, \
WEBDAV_PATHS, BASE_CONDARC
from ..deploy import deploy_conda_package, deploy_documentation
from ..log import verbosity_option, get_logger, echo_normal
from ..log import verbosity_option, get_logger, echo_normal, open_files
logger = get_logger(__name__)
......@@ -481,7 +481,6 @@ def nightlies(ctx, order, dry_run):
token = os.environ['CI_JOB_TOKEN']
import git
import psutil
from .build import build
from urllib.request import urlopen
......@@ -510,8 +509,9 @@ def nightlies(ctx, order, dry_run):
private = urlopen('https://gitlab.idiap.ch/%s' % package).getcode() != 200
stable = 'STABLE' in os.environ
current_open_files = open_files()
logger.warn('Number of open files before build: %d',
len(psutil.Process().open_files()))
len(current_open_files))
ctx.invoke(build,
recipe_dir=[os.path.join(clone_to, 'conda')],
......@@ -528,8 +528,10 @@ def nightlies(ctx, order, dry_run):
ci=True,
)
logger.warn('Number of open files after build: %d',
len(psutil.Process().open_files()))
after_open_files = open_files()
logger.warn('Number of open files after build: %d', len(after_open_files))
logger.warn('New files opened: %s',
', '.join(list(set(after_open_files) - set(current_open_files))))
is_master = os.environ['CI_COMMIT_REF_NAME'] == 'master'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment