forked from stacklok/codegate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
22 lines (20 loc) · 707 Bytes
/
utils.py
File metadata and controls
22 lines (20 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import weaviate
from weaviate.embedded import EmbeddedOptions
def restore_storage_backup(backup_path: str, backup_name: str):
client = weaviate.WeaviateClient(
embedded_options=EmbeddedOptions(
persistence_data_path="./weaviate_data",
grpc_port=50052,
additional_env_vars={
"ENABLE_MODULES": "backup-filesystem",
"BACKUP_FILESYSTEM_PATH": backup_path,
},
)
)
client.connect()
try:
client.backup.restore(backup_id=backup_name, backend="filesystem", wait_for_completion=True)
except Exception as e:
print(f"Failed to restore backup: {e}")
finally:
client.close()