From Ondra Machacek <omachace(a)redhat.com>:
Ondra Machacek has submitted this change and it was merged.
Change subject: Add support for asynchronous requests
......................................................................
Add support for asynchronous requests
This patch modifies the SDK so that it uses the 'multi' interface of the
'pycurl' library. This interface supports several advanced HTTP
capabilities, like multiple connections and pipelining.
The interface of the SDK is preserved, for backwards compatibility. The
only new addition is a new 'wait' parameter, for all operations. The
default value is 'true'. When the values is 'false' the operation is
performed asynchronously, and a 'future' object is returned that can be
used to retrieve the result later. For example:
# Find the virtual machine and the service that manages it:
vm = vms_service.list(search='name=myvm')[0]
vm_service = vms_service.vm_service(vm.id)
# Find the disk attachments, asynchronously:
attachments_service = vm_service.disk_attachments_service
attachments_future = attachments_service.list(wait=False)
# Do some other tasks, for example sending some more asynchronous
# requests, so that they are queued and potentially pipelined.
# Later, wait for the result:
attachments = attachments_future.wait()
# Print the details:
for attachment in attachments:
print(attachment.disk.id)
Change-Id: I106ccc52b58cd0aca23548e21cc21beac152e9e5
Bug-Url:
https://bugzilla.redhat.com/1436981
Signed-off-by: Ondra Machacek <omachace(a)redhat.com>
(cherry picked from commit 9db60cb3a2498ecce94eb424f92ff1685b2abece)
---
M generator/src/main/java/org/ovirt/sdk/python/ServicesGenerator.java
A sdk/examples/asynchronous_inventory.py
M sdk/lib/ovirtsdk4/__init__.py
M sdk/lib/ovirtsdk4/service.py
4 files changed, 420 insertions(+), 97 deletions(-)
Approvals:
Ondra Machacek: Verified; Looks good to me, approved
Jenkins CI: Passed CI tests
--
To view, visit
https://gerrit.ovirt.org/76462
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I106ccc52b58cd0aca23548e21cc21beac152e9e5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: sdk_4.1
Gerrit-Owner: Ondra Machacek <omachace(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondra Machacek <omachace(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>