Merge lp:~jameinel/maas/allow-json into lp:~maas-committers/maas/trunk
Status: | Merged |
---|---|
Merged at revision: | 1230 |
Proposed branch: | lp:~jameinel/maas/allow-json |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
245 lines (+138/-5) 5 files modified
src/apiclient/encode_json.py (+32/-0) src/apiclient/maas_client.py (+14/-4) src/apiclient/testing/django.py (+26/-0) src/apiclient/tests/test_encode_json.py (+36/-0) src/apiclient/tests/test_maas_client.py (+30/-1) |
To merge this branch: | bzr merge lp:~jameinel/maas/allow-json |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John A Meinel (community) | Approve | ||
Gavin Panella (community) | Approve | ||
Review via email: mp+128512@code.launchpad.net |
Commit message
Add MAASClient.
Testing shows that if the data being uploaded is large, you can see a big improvement in performance.
Description of the change
This updates MAASClient so that it can take an 'as_json' parameter.
This changes how the data gets POSTed, sending it as JSON encoding, rather than MimeMultipart.
In my testing, this is dramatically faster for the tag processing. (It drops the time to update 10,000 nodes from 45s down to 35s.)
I will be posting a follow up patch that does that code.
The main reason it is still a flag vs the default, is because the API side needs some updates to support this. It seems that most of our API code uses 'request.POST' but this comes in as 'request.data'. Also, multipart comes in as a multidict (mapping each parameter to a list) while if you pass a dict as json you get just a dict on the other side.
It looks like I accidentally included the API changes necessary to support POSTing as json to the tag-related APIs. I'm updating the branch now to remove them, but that change will be present in the next branch I propose.