Commit 224f9ad
authored
fix/allow asyncio page splitting in nested event loops (#104)
We're now using asyncio for page split concurrency, but because the
client itself is not async, we need to manage our own event loop. This
complains if your environment already has a running event loop. For
instance, setting `split_pdf_page=True` in a jupyter cell will give you
`RuntimeError: This event loop is already running`.
Turns out there's a simple library to allow for nested event loops. We
just apply the monkeypatch in split_pdf_hook.py and the error goes away.
To verify, you'll need to run `pip install -e .` to install the local
version of the client. Run `make run-jupyter` and open up the sample
notebook in `_jupyter/`. Try making a request with page splitting
enabled and you'll see the above error. Then, check out this branch,
install locally again, restart your jupyter kernel, and the error is
fixed.1 parent d024671 commit 224f9ad
File tree
2 files changed
+4
-0
lines changed- src/unstructured_client/_hooks/custom
2 files changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
0 commit comments