Bug 8364 - Upgrade Toaster to use Django 1.8
Summary: Upgrade Toaster to use Django 1.8
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 2.1
Hardware: x86 Multiple
: High normal
Target Milestone: 2.1 M1
Assignee: Ed Bartosh
QA Contact: Alexandru Roman
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-09-21 10:24 UTC by Michael Wood
Modified: 2016-01-04 14:26 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Yes (doc changes required)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Wood 2015-09-21 10:24:46 UTC
Upgrade Django to 1.8 (This will be the LTS release once it's released in Dec) 2015, this will be skipping 1.7 and getting off the currently unsupported 1.6 release we're on now.
Comment 1 Michael Wood 2015-09-21 10:31:00 UTC
'verify_prereq' in bitbake/bin/toaster will also need fixing to reflect any version change. It would be good if this function checked the dependencies from the requirements.txt rather than hardcoding the values.
Comment 2 Elliot Smith 2015-11-18 09:41:39 UTC
I sent an RFC about this to the mailing list:https://lists.yoctoproject.org/pipermail/toaster/2015-November/003347.html
Comment 3 Elliot Smith 2015-12-02 10:18:34 UTC
Assigned to Ed, as he's bisected changes to Django and identified the culprit commit which is causing the issue.
Comment 4 brian avery 2015-12-04 06:42:05 UTC
2 comments/questions:
1) Why did we choose Django 1.8.6? Should we do a toaster-requirements like Django < 1.9?  that way we would get the most up to date 1.8 available

2) On ed's branch: ed/toaster/django_upgrade-8364  I had 170 errors like WARNING database is locked, model: <class 'orm.models.Task'>, args: (), kwargs: {'using': 'default', 'force_insert': True} from the final save attempt.  If I used the patch Ed had suggested we try applied to 1.8.6 + this branch I had 0 errors.

My diff against the standard 1.8.6:
(t-Django-1.8)bavery@whisper:~/src/intel/yocto-builds/TOASTER/myBugs/t-Django-1.8-ED_FIX$ diff ./lib/python2.7/site-packages/django/db/models/query.py ../t-Django-1.8/./lib/python2.7/site-packages/django/db/models/query.py
348,349c348
<         with transaction.atomic(using=self.db):
<             obj.save(force_insert=True, using=self.db)
---
>         obj.save(force_insert=True, using=self.db)
439c438,439
<             obj = self.create(**params)
---
>             with transaction.atomic(using=self.db):
>                 obj = self.create(**params)

-- So, Basically, from my testing we need more of the original fix in the create calls...
Comment 5 brian avery 2015-12-04 07:29:49 UTC
the build that i used as a test case was core-sato-image-dev in my previous comment.
Comment 6 Ed Bartosh 2015-12-04 10:51:34 UTC
Brian, thank you for the review and testing! I'll try to fix what you pointed out.

As for the locking issue, I based my fix on the Elliot's feedback. He wasn't able to reproduce the issue with only this patch applied: https://gist.github.com/bartosh/8c188444e349a76cc1b9

Looks like monkey patching didn't work properly or I missed something.


Ellioth, can you confirm that the issue was gone in your setup with the above patch applied?
Comment 7 Elliot Smith 2015-12-04 10:54:13 UTC
Yes, the issue is gone with that patch.
Comment 8 brian avery 2015-12-07 15:35:25 UTC
I tested poky-contrib/ed/toaster/django_upgrade-8364

In 3 different settings:
1) as is
2) with the monkeypatch reverted (revert 6b997fd0cb9d913ef734659386cc97985e428119)
3) additionally with the retry patch reverted (revert d27cdb20eebe14f532ec726e769cad399ccdedf5)

Results:
1) - worked flawlessly for me under 1.8.7 & 1.8.6.
2) had over 100 "database is locked" errors in first 10%, no additional for most of the build and another 255 at the end (last 5%? ) of the build.  Additionally, because the retry is a .2 second loop, it would periodically make the ui unresponsive and I'd get an error page briefly if I repeatedly hit "all builds" while it was doing this.
3) had ~ 100 "database is locked" errors.  From what I can tell, though I didn't verify this, when we have a database is locked error we lose data (namely the task we were storing).

Since #1 works, I'd like to put it in early and see if the monkey's generate problems for anyone over the course of 2.1 testing. #2 hurts the UI and I'm pretty sure #3 loses info...

Furthermore, it would be nice/good to submit the monkeypatch to Django to get the django people to comment on it. I seriously doubt they'd accept it but their comments may very well be illuminating.
Comment 9 Ed Bartosh 2015-12-10 12:25:46 UTC
The patchset is under review by upstream: http://lists.openembedded.org/pipermail/bitbake-devel/2015-December/006751.html
Comment 10 Ed Bartosh 2015-12-15 10:40:23 UTC
both patchset have been accepted upstream: http://cgit.openembedded.org/bitbake/commit/?id=49976eca4a6e37e7653814c569badcd3e0fb719a
Comment 11 Alexandru Roman 2016-01-04 14:26:07 UTC
Verified on master.