Bug #7654
closedpylint job on buildbot takes too long
0%
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
Related issues
Updated by Rajmund Hruška over 1 year ago
- File profiler_stats_updated profiler_stats_updated added
- File profiler_stats_original profiler_stats_original added
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.
Updated by Rajmund Hruška over 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.
Updated by Pavel Kácha over 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?
Updated by Rajmund Hruška over 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.
Updated by Rajmund Hruška over 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.
Updated by Rajmund Hruška over 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.
Updated by Pavel Kácha over 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
Updated by Jakub Judiny over 1 year ago
- Status changed from Deferred to Resolved
Solved in #7652. Now it takes about a minute.
Updated by Rajmund Hruška over 1 year ago
- Status changed from Resolved to In Review
- Target version changed from Backlog to 2.11
Updated by Rajmund Hruška over 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.
Updated by Pavel Kácha over 1 year ago
- Related to Task #7652: Make Pylint usable added
Updated by Rajmund Hruška over 1 year ago
- Status changed from In Review to Closed