-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Using trio with httpx in a basic example works. In a basic locust script it fails with NotImplementedError: unsupported platform
#2965
Comments
NotImplementedError: unsupported platform
NotImplementedError: unsupported platform
I've had success using httpx with more complicated trio applications, so I'm thinking locust must do something very strange. Probably not the same thing as gunicorn though (re your question: gunicorn fails because it removes the primitives we need to wait for files). EDIT: nevermind, locust does use gevent. see https://github.com/locustio/locust/blob/baf007f1c9f243a550621ecc99720d835513e220/docs/changelog.rst#L789-L790 There's no satisfying solution IMO because if trio reaches into gevent's API to pull out the original kqueue, then I think we're blocking the greenlet? Which is obviously not what the user wants IMO. Maybe we should just fall back to gevent's patched version of something? I'm not too familiar with the underlying mechanics of trio to say what. Hopefully someone else has an answer! EDIT 2: Heh, looks like they did some special casing on their end re: gevent w/ trio! See locustio/locust@aedc3b9 |
sounds like something to bring up on their end in that case. Either to re-fix their workaround, or to see if they know how we should work around the patch on our end. |
Is it possible to do |
@CoolCat467 is this something you are asking me to try? I added |
I ran both scripts in debug (pyCharm). TestTrio.pyIt lands on this part of ...
elif TYPE_CHECKING or hasattr(select, "kqueue"):
from ._generated_io_kqueue import *
from ._io_kqueue import (
EventResult as EventResult,
KqueueIOManager as TheIOManager,
_KqueueStatistics as IOStatistics,
)
locustfile.pyI place a break point in
So where did
|
A hacky solution would be to edit The best solution here (IMO) is to use non-async httpx, and use gevent if you need "async" stuff. Unfortunately it looks like locust is built around this. As for fixing this in trio, I'm starting to lean more towards the broken-solution to this where we reach into gevent and pull out |
Actually I thought about this a bit more, and Obviously this is a bad solution but less so than my previous one where you had to patch locust! |
Found this in the locust docs here: testing other systems
|
My intention is to send multiple multiplexed requests for resources through a single connection. |
I'll reiterate that I think you should open an issue in locust and see if they can re-fix their workaround. Getting |
Thanks @jakkdl those are good recommendations. I found a way to achieve what I want useing pycurl in locust, writing a client and user class following the locust docs on testingnother services. I'm satisfied. Thanks again. |
Description:
testTrio.py
) that useshttpx.AsyncClient
withtrio
. This works correctly when I run it.locustfile.py
that also useshttpx.AsyncClient
. It fails withNotImplementedError: unsupported platform
.Working Script
testTrio.py
Output
Non-working
locustfile.py
Output
Environment:
OS: Mac M1
Python: 3.11.4 (venv)
Locust:
httpx:
trio:
Line
2800
oftrio/_core/_run.py
Questions
The text was updated successfully, but these errors were encountered: