mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
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.
This commit is contained in:
parent
1f355d5810
commit
e16b5f7cdc
@ -481,17 +481,7 @@ class SqliteBatchProcessStorage(BatchProcessStorageBase):
|
||||
def _deserialize_batch_session(self, session_dict: dict) -> BatchSession:
|
||||
"""Deserializes a batch session."""
|
||||
|
||||
# Retrieve all the values, setting "reasonable" defaults if they are not present.
|
||||
|
||||
batch_id = session_dict.get("batch_id", "unknown")
|
||||
session_id = session_dict.get("session_id", "unknown")
|
||||
state = session_dict.get("state", "unknown")
|
||||
|
||||
return BatchSession(
|
||||
batch_id=batch_id,
|
||||
session_id=session_id,
|
||||
state=state,
|
||||
)
|
||||
return BatchSession.parse_obj(session_dict)
|
||||
|
||||
def get_created_session(self, batch_id: str) -> BatchSession:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user