Project

General

Profile

Actions

Bug #7654

closed

pylint job on buildbot takes too long

Added by Rajmund Hruška about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Testing
Target version:
Start date:
05/17/2023
Due date:
% Done:

0%

Estimated time:
To be discussed:
No

Description

For some reason, pylint now takes 12 minutes instead of 2 minutes. The first job where this happened is https://alchemist.cesnet.cz/buildbot/#/builders/17/builds/845. The previous one (https://alchemist.cesnet.cz/buildbot/#/builders/17/builds/844) was still OK. At first, I thought this happened because of #7632. But build 844 was already using a new pylint version.

Build 845 is of mentat 2.10.127, so commit 15361d64, which merged issues #7616 and #7642.


Files

profiler_stats_updated (555 KB) profiler_stats_updated Rajmund Hruška, 05/31/2023 10:34 AM
profiler_stats_original (574 KB) profiler_stats_original Rajmund Hruška, 05/31/2023 10:34 AM

Related issues

Related to Mentat - Task #7652: Make Pylint usableClosedJakub Judiny05/09/2023

Actions
Actions #1

Updated by Rajmund Hruška about 1 year ago

The issue seems to stem from #7642.

Actions #2

Updated by Rajmund Hruška about 1 year ago

I am out of ideas how to solve this one.

I tried profiling pylint with the original version of the packages and then with updated sqlalchemy and flask_sqlalchemy. I didn't see anything useful/unusual there.

The only thing that comes to my mind is that perhaps the new version of the aforementioned libraries are more complex, maybe they have more dependencies and pylint is checking that as well.

Actions #3

Updated by Rajmund Hruška about 1 year ago

Out of despair I asked the chatbot.

From the provided outputs, we can observe the following:

  • The total function calls in the first output are 301,963,730, while in the second output, it is 1,229,618,712. This indicates a significant increase in the number of function calls when using the updated SQLAlchemy and Flask-SQLAlchemy libraries.
  • The cumulative time in the first output is 420.533 seconds, while in the second output, it is 1,645.624 seconds. Again, there is a substantial increase in the execution time when using the updated libraries.
  • The most time-consuming functions in both cases are related to the import mechanism and module loading, as shown by the entries with high cumulative time in the importlib._bootstrap and importlib._bootstrap_external modules.
  • In the second output (with the updated libraries), there are significantly more calls to the infer method of the astroid.nodex.node_ng module. This indicates that the updated SQLAlchemy and Flask-SQLAlchemy libraries might be performing more type inference or static analysis during linting, which can contribute to the increased execution time.

Based on these observations, it seems that the updated SQLAlchemy and Flask-SQLAlchemy libraries have introduced changes that result in a higher number of function calls and longer execution time during pylint profiling. This can be a result of increased type inference or additional analysis performed by the updated libraries. It may be worth investigating the specific changes made in the updated libraries to understand the impact on pylint's performance and determine if any optimizations can be made.

This would support my conjecture about the libraries being more complex.

Actions #4

Updated by Pavel Kácha about 1 year ago

The linter grinds also through external libraries (SQLAlchemy/Flask-SQLAlchemy)? Do we need/want it? Can't we narrow down the linting only to "our" code?

Actions #5

Updated by Rajmund Hruška about 1 year ago

Pavel Kácha wrote in #note-4:

The linter grinds also through external libraries (SQLAlchemy/Flask-SQLAlchemy)? Do we need/want it? Can't we narrow down the linting only to "our" code?

I guess that would be an option. When I disabled all checks (python -m pylint --disable=all --rcfile .pylintrc-lib lib), the execution time was about 50 seconds on my computer. Now, I just need to find the 'right' options to disable.

Actions #6

Updated by Rajmund Hruška about 1 year ago

I don't think we can exclude checking the dependencies as it is built in the code and it seems there is no way of disabling that. Here is a link where it's described in more detail.

What we can do is to run pylint in parallel.

Actions #7

Updated by Rajmund Hruška about 1 year ago

  • Status changed from New to Deferred

There is nothing more to be done with pylint currently.

Maybe we should consider using other linting tool, e.g. ruff.

Actions #8

Updated by Pavel Kácha about 1 year ago

From today's meeting:

  • we could patch out critical SQLAlchemy use ("compile" usage?) before linting (and patch back after)
  • we should make minimal case and raise a bug report to PyLint
Actions #9

Updated by Jakub Judiny about 1 year ago

  • Status changed from Deferred to Resolved

Solved in #7652. Now it takes about a minute.

Actions #10

Updated by Rajmund Hruška about 1 year ago

  • Status changed from Resolved to In Review
  • Target version changed from Backlog to 2.11
Actions #11

Updated by Rajmund Hruška about 1 year ago

Pavel Kácha wrote in #note-8:

From today's meeting:

  • we should make minimal case and raise a bug report to PyLint

The bug report actually exists already (I am surprised no one mentioned this before) - https://github.com/pylint-dev/pylint/issues/8150.

Actions #12

Updated by Pavel Kácha about 1 year ago

Actions #13

Updated by Rajmund Hruška about 1 year ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF