Download scripts/backup_state.py from Leon4gr45/openweb: direct link, hf CLI and curl.
- Browser
- Download file 746 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openweb/resolve/main/scripts/backup_state.py
- Command line
-
hf download hf://spaces/Leon4gr45/openweb/scripts/backup_state.py
-
curl -L -o backup_state.py https://huggingface.co/spaces/Leon4gr45/openweb/resolve/main/scripts/backup_state.py
746 Bytes
| """Checkpoint the GitHub-configured state. Offline only: stop all app writers first. | |
| The running application uses its protected trigger and shared snapshot lock. | |
| """ | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| import sys | |
| import tempfile | |
| sys.path.insert(0,str(Path(__file__).resolve().parent.parent)) | |
| from vrag.backup.service import engine,roots | |
| if __name__=='__main__': | |
| parser=argparse.ArgumentParser();parser.add_argument('--offline-writers-stopped',action='store_true',required=True) | |
| parser.parse_args() | |
| backup=engine();_,data,state=roots() | |
| with tempfile.TemporaryDirectory(prefix='vm-offline-capture-') as temp: | |
| stage=Path(temp);backup.capture(data,state,stage) | |
| print(json.dumps(backup.backup(stage))) | |