Bug 1436981

Summary: [RFE] Add support for asynchronous requests and pipe-lining
Product: [oVirt] ovirt-engine-sdk-python Reporter: Juan Hernández <juan.hernandez>
Component: CoreAssignee: Ondra Machacek <omachace>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hrazdil <rhrazdil>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.3CC: bgraveno, bugs, juan.hernandez, lsvaty, mgoldboi, mperina, stirabos, ykaul
Target Milestone: ovirt-4.1.3Keywords: FutureFeature, Performance
Target Release: 4.1.4Flags: rule-engine: ovirt-4.1+
rule-engine: ovirt-4.2+
mgoldboi: planning_ack+
mperina: devel_ack+
lsvaty: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-ovirt-engine-sdk4-4.1.4 Doc Type: Enhancement
Doc Text:
The Python SDK now support asynchronous requests and HTTP pipe-lining. Users can now send requests asynchronously and wait for the response later in code. This makes it possible to send multiple request using multiple connections or pipelined connections, and wait for the response later, which improves performance when fetching multiple objects from the API.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-06 13:18:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Juan Hernández 2017-03-29 07:55:34 UTC
Currently the Python SDK works always in a synchronous fashion. This RFE is about adding the ability to perform requests in an asynchronous way, without waiting for the responses. That should be combined with the support for multiple simultaneous HTTP connections, and HTTP pipe-lining.

Similar changes have already been done for the Ruby SDK. I believe that the interface should be similar, using the 'future' concept. There is an example of how to use this in the Ruby SDK here:

  https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/asynchronous_inventory.rb

The relevant patch that added that support to the Ruby SDK is this:

  Add support for asynchronous requests
  https://gerrit.ovirt.org/74088

Note that most of the code in the above patch is written in C. I would like to do the same in the Python SDK, but is not really necessary if the 'pycurl' library that that it uses supports well the 'multi' interface of the underlying 'libcurl' library.

Comment 1 Ondra Machacek 2017-05-25 07:37:15 UTC
Here is the description of this RFE:

 https://www.ovirt.org/blog/2017/05/higher-performance-for-python-sdk/

Comment 2 Radim Hrazdil 2017-05-31 14:09:02 UTC
Verified using Machacek's example and example provided by Juan: 
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/asynchronous_inventory.py  

SDK version 4.1.4