-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to process parallel requests over the same session #150
Comments
Just to provide an example with logs. Starting two parallel jobs using the same pyeAPI session: one that applies a configuration change by creating a new configuration session, the other one invokes the
The first one continues as normal, while the other one raises |
Hi @mirceaulinic, Is this being done with parallel threads or processes that are both using the same session and simultaneously sending commands? I believe the requests package used for the session in pyeapi is blocking until a requests entire response has been downloaded. More info here |
Hi @mharista - thanks for looking into this issue. |
I am also a bit confused you mentioned the |
@mirceaulinic My mistake. I assumed pyeapi was using the requests module because of other libraries we maintain that do use it, but pyeapi actually uses httplib. Sorry for causing unnecessary confusion. The error you are hitting is similar to what I mentioned previously. The second thread is likely making another request on the session before the original thread has made a call to getresponse(). I believe this is intended by design in python's httplib module and inherited by pyeapi. |
Thanks for confirming @mharista. AFAIK using |
@mirceaulinic from the small amount I've looked into this, the library recommended for asynchronous requests is grequests. The link I provided previously mentions this. Blocking Or Non-Blocking? If you are concerned about the use of blocking IO, there are lots of projects out there that combine Requests with one of Python's asynchronicity frameworks. Two excellent examples are grequests and requests-futures. As for a PR to support handling of async requests, I am open to that as long as all the existing functionality is maintained and none of the existing unit/system tests are broken. |
I understand your reasoning and your concerns - makes sense.
Just to clarify about the blocking behaviour: at the time being if there
are two parallel requests, the second one is not waiting for the first one
to finish, but it is dropped immediately. I would rather qualify this as a
bug, or improper design -- this is basically in direct contradiction with
the HA and concurrency principles. Is this one of the goals?
…On Fri, Sep 1, 2017, 18:15 mharista ***@***.***> wrote:
@mirceaulinic <https://github.com/mirceaulinic> from the small amount
I've looked into this, the library recommended for asynchronous requests is
grequests. The link I provided previously mentions this.
Blocking Or Non-Blocking?
With the default Transport Adapter in place, Requests does not provide any
kind of non-blocking IO. The Response.content property will block until the
entire response has been downloaded. If you require more granularity, the
streaming features of the library (see Streaming Requests) allow you to
retrieve smaller quantities of the response at a time. However, these calls
will still block.
If you are concerned about the use of blocking IO, there are lots of
projects out there that combine Requests with one of Python's
asynchronicity frameworks. Two excellent examples are grequests and
requests-futures.
As for a PR to support handling of async requests, I am open to that as
long as all the existing functionality is maintained and none of the
existing unit/system tests are broken.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AP69lwho7J88-kMHR9drayLQmDvzLpgHks5seDu2gaJpZM4PGJyD>
.
|
@mirceaulinic is the question relating to the requests module, httplib or pyeapi? Pyeapi uses httplib which by design doesn't support async requests at the moment. |
Hi @mharista - my question is related to pyeapi: choosing httplib in favour of other solutions is a design choice. |
@mirceaulinic Could you please contact me via email? [email protected] |
Hi @mirceaulinic, Is this still an issue you would like to discuss? |
When issuing two concomitant requests over the same eAPI session I can get the following errors:
or
For the moment I would only like to understand if this is known, desired or should be corrected.
Thanks!
The text was updated successfully, but these errors were encountered: