Closed Bug 1181879 Opened 9 years ago Closed 9 years ago

Update to Django v1.8

Categories

(Tree Management :: Treeherder, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: mdoglio)

References

Details

Attachments

(2 files)

Depends on: 1182697
Running the tests locally with Django 1.8.3 actually passes all tests but one, I was expecting this to be worse :-)

tests/model/sql/test_models.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

/usr/lib/python2.7/contextlib.py:17: in __enter__
    return self.gen.next()
tests/model/sql/test_models.py:32: in assert_num_queries
    _old_debug_cursor = connection.use_debug_cursor
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


self = <django.db.DefaultConnectionProxy object at 0xb6b59fec>, item = 'use_debug_cursor'

    def __getattr__(self, item):
>       return getattr(connections[DEFAULT_DB_ALIAS], item)
E       AttributeError: 'DatabaseWrapper' object has no attribute 'use_debug_cursor'
No longer depends on: 1182697
Django 1.8's new UUIDField would be nice to use with Perfherder once we use the ORM for that (bug 1192976), as it would allow us to use the signature's uuid as a primary key. 
https://github.com/mozilla/treeherder/pull/870#discussion-diff-36965310R554

(there are probably other places in the Treeherder reference schema where it would be good to do this)

I wouldn't say this "blocks" bug 1192976, but maybe we should just do this now, since we no doubt will want to upgrade eventually and it might not be that much work.
(In reply to Ed Morley [:emorley] from comment #1)
> Running the tests locally with Django 1.8.3 actually passes all tests but
> one, I was expecting this to be worse :-)
> 
> tests/model/sql/test_models.py:59:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> 
> /usr/lib/python2.7/contextlib.py:17: in __enter__
>     return self.gen.next()
> tests/model/sql/test_models.py:32: in assert_num_queries
>     _old_debug_cursor = connection.use_debug_cursor
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> 
> 
> self = <django.db.DefaultConnectionProxy object at 0xb6b59fec>, item =
> 'use_debug_cursor'
> 
>     def __getattr__(self, item):
> >       return getattr(connections[DEFAULT_DB_ALIAS], item)
> E       AttributeError: 'DatabaseWrapper' object has no attribute
> 'use_debug_cursor'

Apparently use_debug_cursor has been changed to force_debug_cursor in 1.8. Changing that causes these tests to pass.

However, I noticed some additional issues:

* Some weird problems in test_buildapi, looks like some kind of weird interaction between new relic and our unit testing environment. Probably not that hard to fix.
* Problems creating initial database on vagrant up (possibly fixable by using actual migrations to create the reference data, which I believe :mdoglio is working on)
Just posting this in case someone finds it helpful.
(In reply to William Lachance (:wlach) from comment #3)
> * Some weird problems in test_buildapi, looks like some kind of weird
> interaction between new relic and our unit testing environment. Probably not
> that hard to fix.

Do you have some log output for this? Happy to take a glance at it.
Was it similar to https://pastebin.mozilla.org/8843129 ? If so, this isn't Django 1.8 specific, but some strange interaction between New Relic and some of our tests, that is only seen when people re-provision after New Relic was added to requirements/common.txt.
(In reply to Ed Morley [:emorley] from comment #6)
> Was it similar to https://pastebin.mozilla.org/8843129 ? If so, this isn't
> Django 1.8 specific, but some strange interaction between New Relic and some
> of our tests, that is only seen when people re-provision after New Relic was
> added to requirements/common.txt.

Yes, it was similar to that IIRC. :)
I'm pretty sure we also need to check that are custom django commands are still working (see https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/#custom-commands-options)
Attached file PR 886
Attachment #8649850 - Flags: review?(wlachance)
Comment on attachment 8649850 [details] [review]
PR 886

lgtm, I assume you've tested the management commands, vagrant provisioning, etc?
Attachment #8649850 - Flags: review?(wlachance) → review+
I actually found some issues with migrations that (for reasons I ignore) didn't show up in my previous tests. I'm digging into it
All the issues solved, the branch has been sitting on staging for 1/2 hour now, I'm merging into master
Assignee: nobody → mdoglio
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
I just tried to rollback a prod push (something broke that was working on stage; though unrelated to this bug) and it looks like downgrading is not possible:
http://treeherderadm.private.scl3.mozilla.com/chief/treeherder.prod/logs/66ee095257552ba2c7b830eba408cb474094cd7b.1440102141

How would one work around this for future reference?
I'd always thought it was possible to downgrade - if not, updating django is more risky than I thought.
Depends on: 1196998
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: