Page MenuHomePhabricator

pyflakes-py3 and pyflakes-pypy commands fails since 1 June, blocking merges in pywikibot
Closed, ResolvedPublic

Description

pyflakes-py3 and pyflakes-pypy commands failes due to invocation error:
ERROR: InvocationError: '/home/jenkins/workspace/tox-jessie/.tox/pyflakes-pypy/bin/ffind --ignore-vcs . (?<!user-config).py$ --module=pyflakes'

The last successful merge was https://gerrit.wikimedia.org/r/#/c/292118/ (June 1), which is very likely to be the last time these tox rules worked in jenkins.

See https://integration.wikimedia.org/ci/job/tox-jessie/8702/console

these tox envs, and the use of ffind, was introduced in 7c6c3fd4c8ad, to reduce the tox jenkins time to complete while also adding more tests for T101592: Add PyPy 3 support. (ideas for alternative approaches can be found in the earlier patches of https://gerrit.wikimedia.org/r/#/c/260909/)

Event Timeline

If I read the output correctly, pyflakes is parsing the entire python standard library, which of course does not follow pyflakes standards....

It happened a few times before the big crash, and then didnt happen again for a few days
It should be skipping hidden files in`.tox` by default.

jayvdb renamed this task from pyflakes-py3 and pyflakes-pypy commands failes to pyflakes-py3 and pyflakes-pypy commands fails.Jun 12 2016, 7:13 AM
jayvdb triaged this task as Unbreak Now! priority.

T117570 is unrelated; it is about improving the results of the flake8 rule

I havent been able to reproduce this locally.

The logs on https://gerrit.wikimedia.org/r/#/c/294907/ show it is definitely entering the .tox directory.

I tested ffind with tox 1.9.2 at https://travis-ci.org/jayvdb/ffind/builds/138550696 , and ffind 1.0.2 with tox on pywikibot-core at
https://travis-ci.org/jayvdb/pywikibot-core/builds/138559286

Only the desired files, and not .tox files, are shown, and the pyflakes command succeeds.

So I suspect there is some obscure change to the CI nodes on June 1-2.

If it cant be fixed soon, we test revert to using flake8 instead of ffind to do the pyflakes checks on multiple environments.

We just got lucky.
https://bitbucket.org/hpk42/tox/commits/b609deef30f3 allows find to be a replacement for ffind. It isnt cross platform by default, but gnu find does exist for windows.

So alternatives on https://gerrit.wikimedia.org/r/#/c/260909/ were two incomplete/unusable solutions:

  • pyflakes . (PS1..) : included .tox
  • pyflakes [a-z]* (PS5) - depends on shell globbing, which tox and pyflakes does not do.

And two usable solutions:

  • find . -name '*.py' -and -not -name '.*' | xargs pyflakes (PS6)
  • ffind .. (PS7)

Using find and xargs invokes non-Windows GNU tools, but there should be python equivalents, and that is how I found ffind which worked efficiently after a bit of improvement.

fwiw, the find command should be find . -name '*.py' -a '!' -path '*/.*' -a '!' -name 'user-config.py'

Other solutions on the xargs area would be

https://github.com/drmikehenry/findx is a very nice wrapper of find and xargs , and doesnt require {} , which currently tox mishandles (but will be fixed in the next version). findx is very likely to be Unix and even GNU specific though. But it works (see PS17 of https://gerrit.wikimedia.org/r/#/c/294907 ), with a little modification, and gives us a quick fix for this bug.

Change 294907 had a related patch set uploaded (by John Vandenberg):
Replace ffind with findx

https://gerrit.wikimedia.org/r/294907

The findx customisation has been PR'd Upstream : https://github.com/drmikehenry/findx/pull/3

Note the maintainer is active and helpful. Seems like waiting for a brief period will bring a better long term solution.

Jdforrester-WMF renamed this task from pyflakes-py3 and pyflakes-pypy commands fails to pyflakes-py3 and pyflakes-pypy commands fails since 1 June, blocking merges in pywikibot.Jun 23 2016, 8:23 AM

Change 294907 merged by jenkins-bot:
Replace ffind with findx

https://gerrit.wikimedia.org/r/294907

jayvdb lowered the priority of this task from Unbreak Now! to High.Jun 26 2016, 10:20 AM

Need to work with Upstream to merge the customisation, and other polishing acts.

Change 296190 had a related patch set uploaded (by John Vandenberg):
Use released findx 0.9.9

https://gerrit.wikimedia.org/r/296190

Change 296190 merged by jenkins-bot:
Use released findx 0.9.9

https://gerrit.wikimedia.org/r/296190

Xqt claimed this task.