Commit Graph

25 Commits

Author SHA1 Message Date
psychedelicious
be971617e3 Revert "feat(batches): defer ges *and* batch session creation until execution time"
This reverts commit 1652143671.
2023-08-22 01:23:39 +10:00
psychedelicious
1652143671 feat(batches): defer ges *and* batch session creation until execution time 2023-08-22 00:54:17 +10:00
psychedelicious
88ae19a768 feat(batches): defer ges creation until execution
This improves the overall responsiveness of the system substantially, but does make each iteration *slightly* slower, distributing the up-front cost across the batch.

Two main changes:

1. Create BatchSessions immediately, but do not create a whole graph execution state until the batch is executed.
BatchSessions are created with a `session_id` that does not exist in sessions database.
The default state is changed to `"uninitialized"` to better represent this.

Results: Time to create 5000 batches reduced from over 30s to 2.5s

2. Use `executemany()` to retrieve lists of created sessions.
Results: time to create 5000 batches reduced from 2.5s to under 0.5s

Other changes:

- set BatchSession state to `"in_progress"` just before `invoke()` is called
- rename a few methods to accomodate the new behaviour
- remove unused `BatchProcessStorage.get_created_sessions()` method
2023-08-21 22:22:19 +10:00
Brandon Rising
137fbacb92 Fix flake8 2023-08-18 15:47:27 -04:00
Brandon Rising
3e26214b83 Add a few more endpoints for managing batches 2023-08-18 15:38:16 -04:00
Brandon Rising
0282f46c71 Add runs field for running the same batch multiple times 2023-08-18 13:41:07 -04:00
psychedelicious
e62d5478fd fix(backend): fix sqlite cannot commit - no transaction is active
The `commit()` was called even if we hadn't executed anything
2023-08-17 13:55:38 +10:00
psychedelicious
67cf594bb3 feat(backend): add missing types to batch_manager_storage.py 2023-08-17 13:29:19 +10:00
psychedelicious
e16b5f7cdc feat(backend): deserialize batch session directly
If the values from the `session_dict` are invalid, the model instantiation will fail, or if we end up with an invalid `batch_id`, the app will not run. So I think just parsing the dict directly is equivalent.

Also the LSP analyser is pleased now - no red squigglies.
2023-08-17 12:37:03 +10:00
psychedelicious
1f355d5810 feat(backend): update batch_manager_storage.py docstrings 2023-08-17 12:31:51 +10:00
psychedelicious
df7370f9d9 chore(backend): remove unused code 2023-08-17 12:16:34 +10:00
psychedelicious
c91621b46c fix(backend): BatchProcess.batch_id is required
Providing a `default_factory` is enough for pydantic to know to create the attribute on instantiation if it's not already provided. We can then make make the typing just `str`.
2023-08-17 11:58:29 +10:00
Brandon Rising
f7277a8b21 Run python black 2023-08-16 15:44:52 -04:00
Brandon Rising
796ff34c8a Testing out Spencer's batch data structure 2023-08-16 15:21:11 -04:00
Brandon Rising
d6a5c2dbe3 Fix tests 2023-08-16 14:35:49 -04:00
Brandon Rising
abf09fc8fa Switch sqlite clients to only use one connection 2023-08-15 21:46:24 -04:00
Brandon Rising
15e7ca1baa Break apart create/start logic 2023-08-15 16:28:47 -04:00
Brandon Rising
faa4574970 Turn off WAL mode 2023-08-15 15:59:42 -04:00
Brandon
cc5755d5b1
Update invokeai/app/services/batch_manager_storage.py
Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
2023-08-15 15:54:57 -04:00
Brandon
85105fc070
Update invokeai/app/services/batch_manager_storage.py
Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
2023-08-15 15:54:17 -04:00
Brandon Rising
f8d8b16267 Run python black 2023-08-14 11:01:31 -04:00
Brandon Rising
1debc31e3d Allow cancel of running batch 2023-08-11 15:52:49 -04:00
Brandon Rising
280ac15da2 Go back to 1 lock per table 2023-08-10 14:26:22 -04:00
Brandon Rising
e751f7d815 More testing 2023-08-10 14:09:00 -04:00
Brandon Rising
e26e4740b3 Testing sqlite issues with batch_manager 2023-08-10 11:38:28 -04:00