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

deprecation warnings in pip/_vendor/pkg_resources/__init__.py explode OpenStack test logs #2326

Closed
sdague opened this Issue Jan 5, 2015 · 9 comments

Comments

Projects
None yet
5 participants
@sdague

sdague commented Jan 5, 2015

The OpenStack Nova unit tests (stable/juno) running on python 2.6 now explode hitting sanity limits on log size due to a deprecation warning that was added in this commit:

Author: Donald Stufft donald@stufft.io
Date: Fri Jan 2 23:01:25 2015 -0500

Merge pull request #2301 from dstufft/upgrade-setuptools

Upgrade setuptools and packaging
(cherry picked from commit 7228a6a1fae418bcfac4d9f95bafcffe6b7abe16)

The issue is here:

def load(self, require=True, env=None, installer=None):
    if require:
        self.require(env, installer)
    else:
        warnings.warn(
            "`require` parameter is deprecated. Use "
            "EntryPoint._load instead.",
            DeprecationWarning,
        )
    return self._load()

Every call to load issues the DeprecationWarning. This should instead be issued once per executable run otherwise long running environments are going to be blasted with this over and over again.

Also the DeprecationWarning isn't sufficient to have any idea what's calling it (so what needs to be fixed).

This is being tracked in Nova via this bug - https://bugs.launchpad.net/nova/+bug/1407736

@dstufft

This comment has been minimized.

Member

dstufft commented Jan 5, 2015

This looks like a problem with the latest version of setuptools that we pulled in paging @jaraco.

@alex

This comment has been minimized.

Member

alex commented Jan 5, 2015

Whether or not a warning is shown multiple times is controlled by the warning filters (which you can set up either with some apis in teh warnings module, or with the PYTHONWARNINGS env var) -- the call site doesn't control this.

@dstufft

This comment has been minimized.

Member

dstufft commented Jan 5, 2015

Well, pkg_resources can append a rule to the warnings filter to change how often it's displayed.

@sdague

This comment has been minimized.

sdague commented Jan 5, 2015

attempting to set the warnings filter to "once" doesn't seem to have changed how often this is actually logged - https://review.openstack.org/#/c/145026/

@alex Is there a different way that this should be configured to get the result that I'm expecting?

@dstufft

This comment has been minimized.

Member

dstufft commented Jan 5, 2015

If the warning is triggered before that warnings.simplefilter("once", DeprecationWarning) then you'll get any of those warnings regardless. I'm not sure that the once filter is going to help you though, in Python 2.6 the default filter level was "once per unique location", and since this is the exact same location raising the same warning a whole bunch of times it's probably something like you're starting a bunch of processes up or something which each trigger their own warnings.

@jaraco

This comment has been minimized.

Member

jaraco commented Jan 5, 2015

Setuptools 11.2 uses stacklevel=2 to make it easier to discover the source of the call.

@jaraco

This comment has been minimized.

Member

jaraco commented Jan 5, 2015

I'm not sure there's anything else Setuptools should do here, unless this issue can't be solved and the warning needs to be pulled. Let me know if that's the case.

@dhellmann

This comment has been minimized.

dhellmann commented Jan 5, 2015

@jaraco The warning suggests using what looks like a private API. Since stevedore is currently using the require flag, I want to make certain that _load() is going to be maintained as a public API before I change the call in stevedore.

@dstufft

This comment has been minimized.

Member

dstufft commented Jan 9, 2015

Going to close this since it appears that it was fixed by setuptools 11.2 and 11.3.

@dstufft dstufft closed this Jan 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment