-
-
Notifications
You must be signed in to change notification settings - Fork 44
Create async backend for playwright #118
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
Comments
Thanks for sharing your idea. Can you provide a small example of using dataframe_image with And the use case of why use async interface, maybe use it in a async web server or it can significantly increase the performance? |
To use it I have created a function (its basically a copy of the dfi.export function):
Then you could do something like this to run the tasks in parallel:
In my case I didn't really need parallelism in the generation of images (it's already fast enough), but we had other processes (database queries, LLM calls, etc...) that we were executing in async functions, and playwright raised an error because you cannot call the playwright sync api from async functions (for other backends it worked well without having to do these things). |
I forget that limitation. I'll implement this asap. |
Hi, I'm using
dataframe_image
for a project. It was working fine, but since the last week it stopped working with the default backend (I'm pretty sure that is due to an update of Chromium, because the same version of our project was working fine with an older version of Chromium, but it stops working after the update).To fix that, we have been testing the
playwright
backend, but since we use async functions, theplaywright
backend does not work as it is. Playwright has an async API which is required for executing it in async code.I'm not sure if having other class for async backends would be useful to other users of
dataframe_image
or if it's possible to just have a parameter in the Playwright backend to allow the execution ofdataframe_image
(and playwright) in async functions. But since I've written the code to allow this, I want to share it with you.This would be the code for the base class:
This is the code for the Playwright async backend:
There are some minor changes (format and other things) to make it work in our project, but it could be used as a reference to implement this. Right now I cannot implement this and create a PR due to lack of time, but maybe in a few weeks I can do it if you think it's interesting to have it.
The text was updated successfully, but these errors were encountered: