-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
async support #52
Comments
Good idea! I'll have some time to look into it end of the month. |
really looking forward |
Will this enable higher logging frequency with reduced resolution/precision? |
No, this has nothing to do with the precision or resolution of the sensor itself.
I think, we've clarified this via email, right? If not, please open a separate issue 🎉 |
Hi Timo!
You explained this very well!
Thanks,
Ben Velde
…
3. nov. 2019 kl. 15:23 skrev Timo Furrer ***@***.***>:
Will this enable higher logging frequency with reduced resolution/precision?
No, this has nothing to do with the precision or resolution of the sensor itself.
I expected to see 4 times higher frequency.
I think, we've clarified this via email, right? If not, please open a separate issue 🎉
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
It seems like asyncio0 doesn't support asynchronous file I/O (for good reasons)1. One way to still provide an interface which can be consumed by asyncio-based python code would be to execute the blocking read2 in a thread pool. There's support for this in asyncio, using async def raw_sensor_strings_async(self):
try:
with open(self.sensorpath, "r") as f:
with concurrent.futures.ThreadPoolExecutor() as pool:
data = await loop.run_in_executor(pool, f.readlines)
except IOError:
.... In my current code, which uses the W1ThermSensor library, I am wrapping the call to Given that we can't make the file I/O truly asynchronous, does it make sense to provide an async helper such as the one seen above (of course, we would have to make all the calls out to, and including I guess it would be convenient to not have to wrap I could take a stab at a PR if we still want this functionality. |
Would be nice to use the async support in python 3.5/3.6.
The text was updated successfully, but these errors were encountered: