mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(nodes): create helper function to generate the item ID
This commit is contained in:
parent
7cb8e29726
commit
abdc87d5fc
@ -37,7 +37,7 @@ class ItemStorageEphemeralDisk(ItemStorageABC[T]):
|
||||
|
||||
def set(self, item: T) -> str:
|
||||
self._output_folder.mkdir(parents=True, exist_ok=True)
|
||||
item_id = f"{self._item_class_name}_{uuid_string()}"
|
||||
item_id = self._new_item_id()
|
||||
file_path = self._get_path(item_id)
|
||||
torch.save(item, file_path) # pyright: ignore [reportUnknownMemberType]
|
||||
return item_id
|
||||
@ -49,6 +49,9 @@ class ItemStorageEphemeralDisk(ItemStorageABC[T]):
|
||||
def _get_path(self, item_id: str) -> Path:
|
||||
return self._output_folder / item_id
|
||||
|
||||
def _new_item_id(self) -> str:
|
||||
return f"{self._item_class_name}_{uuid_string()}"
|
||||
|
||||
def _delete_all_items(self) -> None:
|
||||
"""
|
||||
Deletes all pickled items from disk.
|
||||
|
Loading…
Reference in New Issue
Block a user