Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r8] Apply pylint excessive memory usage fix #3017

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dockerfile/anaconda-ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN echo dnf update -y && \
libicu \
lttng-ust \
rpm-ostree \
patch \
pykickstart \
python3-pip \
python3-lxml \
Expand All @@ -39,6 +40,10 @@ RUN pip-3.6 install \
nose-testconfig \
rpmfluff

# HACK: Apply fix from https://github.com/PyCQA/astroid/pull/847 to avoid
# excessive memory usage, until astroid > 2.4.2 gets released
RUN curl https://github.com/PyCQA/astroid/commit/d62349a424c549b4634c90e471c9f876b99edfeb.patch | patch /usr/local/lib/python3*/site-packages/astroid/manager.py

# see https://github.com/martinpitt/anaconda/settings/actions/add-new-runner
RUN mkdir actions-runner && cd actions-runner && \
URL_BASE=https://github.com/actions/runner/releases && \
Expand Down
17 changes: 0 additions & 17 deletions tests/pylint/censorship.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,6 @@ def run(self):
def _prepare_args(self):
args = []

# pylint uses a lot of memory and doesn't handle ENOMEM well, so set --jobs based on memory
# do this early so that command_line_args can override -j
avail_mem_kb = 0
with open("/proc/meminfo") as f:
for line in f:
if line.startswith("MemAvailable:"):
avail_mem_kb = int(line.split()[1])
break
num_cpus = multiprocessing.cpu_count()
# each process uses ~ 2 GiB RAM, leave some breathing space
jobs = max(1, avail_mem_kb // 3000000)
# but also clip to nproc
jobs = min(jobs, num_cpus)
print("Using", jobs, "parallel jobs based on", avail_mem_kb, "kB available RAM and",
num_cpus, "CPUs")
args.append("-j%i" % jobs)

if self._config.command_line_args:
args = self._config.command_line_args

Expand Down
4 changes: 4 additions & 0 deletions tests/pylint/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ ignore-patterns=
# pygtk.require().
init-hook='import gi.overrides, os; gi.overrides.__path__[0:0] = (os.environ["ANACONDA_WIDGETS_OVERRIDES"].split(":") if "ANACONDA_WIDGETS_OVERRIDES" in os.environ else [])'

# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
jobs=0

# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
Expand Down