Closed
Bug 1277218
Opened 8 years ago
Closed 8 years ago
Test failures in test_classify_failures.py under Django 1.9 ("FailureMatch instance isn't saved. Use bulk=False or save the object first.")
Categories
(Tree Management :: Treeherder: Data Ingestion, defect, P2)
Tree Management
Treeherder: Data Ingestion
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: emorley, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
text/plain
|
Details |
Under Django 1.9, there are multiple failures in test_classify_failures.py, all with this exception:
ValueError: <FailureMatch: FailureMatch object> FailureMatch instance isn't saved. Use bulk=False or save the object first.
(see attachment for full output)
This is due to:
https://github.com/django/django/commit/adc0c4fbac98f9cb975e8fa8220323b2de638b46
Which is described in the release notes:
https://docs.djangoproject.com/en/1.9/releases/1.9/#bulk-behavior-of-add-method-of-related-managers
The updated docs now say:
"""
In the example above, in the case of a ForeignKey relationship, QuerySet.update() is used to perform the update. This requires the objects to already be saved.
You can use the bulk=False argument to instead have the related manager perform the update by calling e.save().
"""
(https://docs.djangoproject.com/en/1.9/ref/models/relations/#django.db.models.fields.related.RelatedManager.add)
tl;dr we either need to use `bulk=False` (and switch back to the existing less performant behaviour), or else make sure we save the FailureMatch instance first, here:
https://github.com/mozilla/treeherder/blob/729ca39908e031d67c97074b0637f1c42f60f9dc/treeherder/autoclassify/management/commands/autoclassify.py#L58
James, what would you prefer to do here?
Reporter | ||
Comment 1•8 years ago
|
||
(In reply to Ed Morley [:emorley] from comment #0)
> James, what would you prefer to do here?
Flags: needinfo?(james)
Reporter | ||
Comment 3•8 years ago
|
||
The code here has since been refactored and is no longer affected.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•