Closed rhcarvalho closed 6 years ago
For future reference:
(env) [vagrant@localhost openshift-ansible]$ date
Wed Feb 8 15:44:06 UTC 2017
(env) [vagrant@localhost openshift-ansible]$ time detox
py27-ansible22-pylint create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py27-ansible22-pylint
py27-ansible22-unit create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py27-ansible22-unit
py27-ansible22-flake8 create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py27-ansible22-flake8
py27-ansible22-yamllint create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py27-ansible22-yamllint
py27-ansible22-generate_validation create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py27-ansible22-generate_validation
py35-ansible22-pylint create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-pylint
py35-ansible22-unit create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-unit
py35-ansible22-flake8 create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-flake8
py35-ansible22-yamllint create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-yamllint
py35-ansible22-generate_validation create: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-generate_validation
py27-ansible22-flake8 installdeps: -rtest-requirements.txt, ansible~=2.2
py27-ansible22-pylint installdeps: -rtest-requirements.txt, ansible~=2.2
py27-ansible22-unit installdeps: -rtest-requirements.txt, ansible~=2.2
py27-ansible22-yamllint installdeps: -rtest-requirements.txt, ansible~=2.2
py27-ansible22-generate_validation installdeps: -rtest-requirements.txt, ansible~=2.2
py35-ansible22-flake8 installdeps: -rtest-requirements.txt, flake8-bugbear, ansible~=2.2
py35-ansible22-unit installdeps: -rtest-requirements.txt, ansible~=2.2
py35-ansible22-pylint installdeps: -rtest-requirements.txt, ansible~=2.2
py35-ansible22-yamllint installdeps: -rtest-requirements.txt, ansible~=2.2
py35-ansible22-generate_validation installdeps: -rtest-requirements.txt, ansible~=2.2
ERROR: invocation failed (exit code 2), logfile: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-yamllint/log/py35-ansible22-yamllint-1.log
ERROR: actionid: py35-ansible22-yamllint
...
************* Module openshift_checks.package_version
roles/openshift_health_checker/openshift_checks/package_version.py:1: [C0111(missing-docstring), ] Missing module docstring
error: lint error 30.
ERROR: InvocationError: /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py27-ansible22-pylint/bin/python setup.py lint (see /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py27-ansible22-pylint/log/py27-ansible22-pylint-2.log)
_______________________________________________ summary _______________________________________________
ERROR: py27-ansible22-pylint: commands failed
py27-ansible22-unit: commands succeeded
ERROR: py27-ansible22-flake8: commands failed
py27-ansible22-yamllint: commands succeeded
py27-ansible22-generate_validation: commands succeeded
ERROR: py35-ansible22-pylint: commands failed
py35-ansible22-unit: commands succeeded
ERROR: py35-ansible22-flake8: commands failed
ERROR: py35-ansible22-yamllint: could not install deps [-rtest-requirements.txt, ansible~=2.2]; v = InvocationError('/home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-yamllint/bin/pip install -rtest-requirements.txt ansible~=2.2 (see /home/vagrant/src/github.com/openshift/openshift-ansible/.tox/py35-ansible22-yamllint/log/py35-ansible22-yamllint-1.log)', 2)
py35-ansible22-generate_validation: commands succeeded
real 10m1.925s
user 5m30.399s
sys 5m42.938s
Over 200 lines of output. Some lint errors in the current branch, apparently some installation errors too.
Weird. My tests are giving me different results than you.
Quick clone of the 11MiB from the openshift-ansible repo
[/tmp/tmp.Kt1GdBt8yg] 7:46:13
$ git clone git@github.com:openshift/openshift-ansible.git
Cloning into 'openshift-ansible'...
remote: Counting objects: 38592, done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 38592 (delta 24), reused 0 (delta 0), pack-reused 38542
Receiving objects: 100% (38592/38592), 8.97 MiB | 1.40 MiB/s, done.
Resolving deltas: 100% (22522/22522), done.
Checking connectivity... done.
[/tmp/tmp.Kt1GdBt8yg] 7:46:24
And running detox -v
from the master branch works in less than a minute
[/tmp/tmp.Kt1GdBt8yg] 7:46:24
$ cd ./openshift-ansible
[/tmp/tmp.Kt1GdBt8yg/openshift-ansible] 7:46:29 (master)
$ time detox -v
using tox.ini: /tmp/tmp.Kt1GdBt8yg/openshift-ansible/tox.ini
py27-ansible22-pylint create: /tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint
/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox$ /usr/bin/python2 -m virtualenv --python /usr/bin/python2.7 py27-ansible22-pylint >/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/log/py27-ansible22-pylint-0.log
py27-ansible22-unit create: /tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-unit
/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox$ /usr/bin/python2 -m virtualenv --python /usr/bin/python2.7 py27-ansible22-unit >/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-unit/log/py27-ansible22-unit-0.log
...
______________________________________________________________________________________________________ summary ______________________________________________________________________________________________________
py27-ansible22-pylint: commands succeeded
py27-ansible22-unit: commands succeeded
py27-ansible22-flake8: commands succeeded
py27-ansible22-yamllint: commands succeeded
py27-ansible22-generate_validation: commands succeeded
py35-ansible22-pylint: commands succeeded
py35-ansible22-unit: commands succeeded
py35-ansible22-flake8: commands succeeded
py35-ansible22-yamllint: commands succeeded
py35-ansible22-generate_validation: commands succeeded
congratulations :)
detox -v 231.76s user 10.10s system 451% cpu 53.597 total
I've got 8 cores in this system, so detox can run a lot of tests in parallel. Maybe that's different? When I run with just tox
(so all tests in serial, not parallel) it takes longer:
[/tmp/tmp.Kt1GdBt8yg/openshift-ansible] 7:54:22 (master)
$ time tox -v
using tox.ini: /tmp/tmp.Kt1GdBt8yg/openshift-ansible/tox.ini
using tox-2.3.1 from /usr/lib/python3.5/site-packages/tox/__init__.py
py27-ansible22-pylint create: /tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint
/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox$ /usr/bin/python3 -m virtualenv --python /usr/bin/python2.7 py27-ansible22-pylint >/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/log/py27-ansible22-p
ylint-0.log
py27-ansible22-pylint installdeps: -rtest-requirements.txt, ansible~=2.2
/tmp/tmp.Kt1GdBt8yg/openshift-ansible$ /tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/bin/pip install -rtest-requirements.txt ansible~=2.2 >/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/log/py27-ansible22-pylint-1.log
/tmp/tmp.Kt1GdBt8yg/openshift-ansible$ /tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/bin/pip freeze >/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/log/py27-ansible22-pylint-2.log
....
py27-ansible22-pylint: commands succeeded
py27-ansible22-unit: commands succeeded
py27-ansible22-flake8: commands succeeded
py27-ansible22-yamllint: commands succeeded
py27-ansible22-generate_validation: commands succeeded
py35-ansible22-pylint: commands succeeded
py35-ansible22-unit: commands succeeded
py35-ansible22-flake8: commands succeeded
py35-ansible22-yamllint: commands succeeded
py35-ansible22-generate_validation: commands succeeded
congratulations :)
tox -v 153.41s user 6.74s system 101% cpu 2:37.95 total
[/tmp/tmp.Kt1GdBt8yg/openshift-ansible] 7:57:05 (master)
Still, only a total of 2½ minutes.
Once tox has all the deps downloaded a second run is even quicker, 1 minute+15s was trimmed off:
[/tmp/tmp.Kt1GdBt8yg/openshift-ansible] 7:58:55 (master)
$ time tox -v
using tox.ini: /tmp/tmp.Kt1GdBt8yg/openshift-ansible/tox.ini
using tox-2.3.1 from /usr/lib/python3.5/site-packages/tox/__init__.py
py27-ansible22-pylint reusing: /tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint
/tmp/tmp.Kt1GdBt8yg/openshift-ansible$ /tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/bin/pip freeze >/tmp/tmp.Kt1GdBt8yg/openshift-ansible/.tox/py27-ansible22-pylint/log/py27-ansible22-pylint-
3.log
...
py35-ansible22-yamllint: commands succeeded
py35-ansible22-generate_validation: commands succeeded
congratulations :)
tox -v 80.83s user 1.66s system 107% cpu 1:16.54 total
[/tmp/tmp.Kt1GdBt8yg/openshift-ansible] 8:00:12 (master)
I wonder what's causing your installation to run the tests so much slower? You obviously couldn't be the only person who the tests run slow for.
Can you tell me the following stats for your system?
How many CPUs you have (mine in the example below shows 8)
$ grep -c '^processor' /proc/cpuinfo
8
Internet speeds. If you download a large file, what's the average transfer rate look like?
$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.8.tar.xz
...
linux-4.9.8.tar.xz 43%[============> ] 38.55M 1.37MB/s eta 43s
What's your current load/memory usage like?
$ uptime && free -m
08:07:03 up 1 day, 19:18, 1 user, load average: 0.52, 0.58, 0.74
total used free shared buff/cache available
Mem: 15470 8931 370 1251 6169 4755
Swap: 15359 394 14965
@tbielawa thanks for the data for comparison. tox
is taking 16 min.
It took me more than 10 min (time not tracked scientifically) to run detox locally, and the amount of output is enormous, making it very hard to read what pylint or pyflake or what not is being complained about.
The only time I've seen this is when I have an extraneous virutalenv in the repo that isn't in the exclude list for the tests.
Objective: discuss ways to to improve both time and amount of output to improve developer experience.
One thing that comes to mind for improving the runtimes would be limit some of the tests to just code that has changed since a specified commit id. That would drastically decrease the scope of what is being tested for that workflow and would meet your criteria.
Further notes/questions: How serious are we about supporting both Python 2.7 and 3.5 in the code base?
We are already hitting python2/python3 issues in some places with Fedora installs, which is what prompted adding testing support for python 3.5. Ansible is also increasing it's python3 support with every release and I fully expect that we are going to hit a point within the next few Ansible releases that they will default to python3 as well.
It feels a bit counter productive to need commits like 7767df1 that are "making peace with linters" (and git log --grep=lint --no-merges --oneline reveals at least 59 of them). There are over 700 comments like # pylint: ... in about 140 files. Following a code style is good, but coding to satisfy tools and sprinkling comments to configure such tools may not always lead to the intended effects of higher code quality. This might be a separate topic for discussion, though.
There are a few different reasons for this, and I agree with you here for the most part.
(FTR) Got it down to 3'17" yesterday. Indeed I had a utils/oo-installenv/
with a virtualenv (created by make ci
)...
I'm noticing that since we merged the tests for root and utils into one tox config (excellent thing), we're reinstalling some dependencies apparently all the time.
$ tox -e py27-unit -- test/modify_yaml_tests.py
py27-unit installed: ansible==2.2.1.0,appdirs==1.4.3,asn1crypto==0.22.0,astroid==1.4.9,backports.functools-lru-cache==1.3,backports.shutil-get-terminal-size==1.0.0,cffi==1.9.1,click==6.7,configparser==3.5.0,cove
rage==4.3.4,cryptography==1.8.1,decorator==4.0.11,enum34==1.1.6,flake8==3.3.0,flake8-mutable==1.1.0,flake8-print==2.0.2,funcsigs==1.0.2,idna==2.5,ipaddress==1.0.18,ipdb==0.10.2,ipython==5.3.0,ipython-genutils==0
.2.0,isort==4.2.5,Jinja2==2.8.1,lazy-object-proxy==1.2.2,MarkupSafe==1.0,mccabe==0.6.1,mock==2.0.0,-e git+git@github.com:rhcarvalho/openshift-ansible.git@874aeab775a848e7ce9f8a5e417a9690663f5b36#egg=ooinstall&su
bdirectory=utils,packaging==16.8,paramiko==2.1.2,pathlib2==2.2.1,pbr==2.0.0,pexpect==4.2.1,pickleshare==0.7.4,prompt-toolkit==1.0.13,ptyprocess==0.5.1,py==1.4.32,pyasn1==0.2.3,pycodestyle==2.3.1,pycparser==2.17,
pycrypto==2.6.1,pyflakes==1.5.0,Pygments==2.2.0,pylint==1.6.5,pyOpenSSL==16.2.0,pyparsing==2.2.0,pytest==3.0.7,pytest-cov==2.4.0,PyYAML==3.12,scandir==1.5,setuptools-lint==0.5.2,simplegeneric==0.8.1,six==1.10.0,
traitlets==4.3.2,wcwidth==0.1.7,wrapt==1.10.10,yamllint==1.6.1
py27-unit runtests: PYTHONHASHSEED='2161935373'
py27-unit runtests: commands[0] | pip install -e utils
Obtaining file:///home/rodolfo/openshift/src/github.com/openshift/openshift-ansible/utils
Requirement already satisfied: click in ./.tox/py27-unit/lib/python2.7/site-packages (from ooinstall==3.0.0)
Requirement already satisfied: PyYAML in ./.tox/py27-unit/lib/python2.7/site-packages (from ooinstall==3.0.0)
Requirement already satisfied: ansible in ./.tox/py27-unit/lib/python2.7/site-packages (from ooinstall==3.0.0)
Requirement already satisfied: paramiko in ./.tox/py27-unit/lib/python2.7/site-packages (from ansible->ooinstall==3.0.0)
Requirement already satisfied: setuptools in ./.tox/py27-unit/lib/python2.7/site-packages (from ansible->ooinstall==3.0.0)
Requirement already satisfied: jinja2<2.9 in ./.tox/py27-unit/lib/python2.7/site-packages (from ansible->ooinstall==3.0.0)
Requirement already satisfied: pycrypto>=2.6 in ./.tox/py27-unit/lib/python2.7/site-packages (from ansible->ooinstall==3.0.0)
Requirement already satisfied: pyasn1>=0.1.7 in ./.tox/py27-unit/lib/python2.7/site-packages (from paramiko->ansible->ooinstall==3.0.0)
Requirement already satisfied: cryptography>=1.1 in ./.tox/py27-unit/lib/python2.7/site-packages (from paramiko->ansible->ooinstall==3.0.0)
Requirement already satisfied: appdirs>=1.4.0 in ./.tox/py27-unit/lib/python2.7/site-packages (from setuptools->ansible->ooinstall==3.0.0)
Requirement already satisfied: packaging>=16.8 in ./.tox/py27-unit/lib/python2.7/site-packages (from setuptools->ansible->ooinstall==3.0.0)
Requirement already satisfied: six>=1.6.0 in ./.tox/py27-unit/lib/python2.7/site-packages (from setuptools->ansible->ooinstall==3.0.0)
Requirement already satisfied: MarkupSafe in ./.tox/py27-unit/lib/python2.7/site-packages (from jinja2<2.9->ansible->ooinstall==3.0.0)
Requirement already satisfied: asn1crypto>=0.21.0 in ./.tox/py27-unit/lib/python2.7/site-packages (from cryptography>=1.1->paramiko->ansible->ooinstall==3.0.0)
Requirement already satisfied: ipaddress in ./.tox/py27-unit/lib/python2.7/site-packages (from cryptography>=1.1->paramiko->ansible->ooinstall==3.0.0)
Requirement already satisfied: idna>=2.1 in ./.tox/py27-unit/lib/python2.7/site-packages (from cryptography>=1.1->paramiko->ansible->ooinstall==3.0.0)
Requirement already satisfied: enum34 in ./.tox/py27-unit/lib/python2.7/site-packages (from cryptography>=1.1->paramiko->ansible->ooinstall==3.0.0)
Requirement already satisfied: cffi>=1.4.1 in ./.tox/py27-unit/lib/python2.7/site-packages (from cryptography>=1.1->paramiko->ansible->ooinstall==3.0.0)
Requirement already satisfied: pyparsing in ./.tox/py27-unit/lib/python2.7/site-packages (from packaging>=16.8->setuptools->ansible->ooinstall==3.0.0)
Requirement already satisfied: pycparser in ./.tox/py27-unit/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography>=1.1->paramiko->ansible->ooinstall==3.0.0)
Installing collected packages: ooinstall
Found existing installation: ooinstall 3.0.0
Uninstalling ooinstall-3.0.0:
Successfully uninstalled ooinstall-3.0.0
Running setup.py develop for ooinstall
Successfully installed ooinstall
py27-unit runtests: commands[1] | pytest test/modify_yaml_tests.py
...
That makes the output a bit more messier, and the process a bit more slow to running single / a fraction of tests.
Installing once is great, re-installing all the time is the problem.
Not sure how this would affect code under utils if there were local changes (is the install copying or symlinking files?!).
Re-raising a point for discussion similar to #2933.
Nowadays we're using
tox
and the CONTRIBUTING.md guide says that one is supposed to usetox
ordetox
to run tests.It took me more than 10 min (time not tracked scientifically) to run
detox
locally, and the amount of output is enormous, making it very hard to read what pylint or pyflake or what not is being complained about.A recent Travis run took 4 min 45 sec. Here is a run with errors, notice the amount a output, over a thousand lines where we need to dig to find the errors.
Objective: discuss ways to to improve both time and amount of output to improve developer experience.
Further notes/questions:
git log --grep=lint --no-merges --oneline
reveals at least 59 of them). There are over 700 comments like# pylint: ...
in about 140 files. Following a code style is good, but coding to satisfy tools and sprinkling comments to configure such tools may not always lead to the intended effects of higher code quality. This might be a separate topic for discussion, though.