Spaces:
Sleeping
Sleeping
Commit ·
a3f69ad
1
Parent(s): 117b286
backup.py
Browse files- backup.py +14 -2
- on_startup.sh +1 -1
backup.py
CHANGED
|
@@ -4,7 +4,7 @@ from datasets import load_dataset
|
|
| 4 |
from huggingface_hub import CommitScheduler
|
| 5 |
from huggingface_hub import HfApi
|
| 6 |
import os
|
| 7 |
-
|
| 8 |
|
| 9 |
dataset_name = "Anuj-Panthri/JupyterLab_Storage"
|
| 10 |
work_dir = os.environ['NOTEBOOK_DIR']
|
|
@@ -34,4 +34,16 @@ def commit_scheduler(minutes=10):
|
|
| 34 |
input("keep scheduler waiting")
|
| 35 |
|
| 36 |
if __name__=="__main__":
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
from huggingface_hub import CommitScheduler
|
| 5 |
from huggingface_hub import HfApi
|
| 6 |
import os
|
| 7 |
+
import argparse
|
| 8 |
|
| 9 |
dataset_name = "Anuj-Panthri/JupyterLab_Storage"
|
| 10 |
work_dir = os.environ['NOTEBOOK_DIR']
|
|
|
|
| 34 |
input("keep scheduler waiting")
|
| 35 |
|
| 36 |
if __name__=="__main__":
|
| 37 |
+
# Initialize parser
|
| 38 |
+
parser = argparse.ArgumentParser()
|
| 39 |
+
parser.add_argument("-p","--push", help="push to hub",action='store_true',default=True)
|
| 40 |
+
parser.add_argument("-s","--schedule", help="push to hub scheduler every n minutes",type=int)
|
| 41 |
+
args = parser.parse_args()
|
| 42 |
+
|
| 43 |
+
if not args.schedule:
|
| 44 |
+
push_to_hub()
|
| 45 |
+
else:
|
| 46 |
+
commit_scheduler(args.schedule)
|
| 47 |
+
|
| 48 |
+
# print(args)
|
| 49 |
+
# commit_scheduler()
|
on_startup.sh
CHANGED
|
@@ -6,5 +6,5 @@
|
|
| 6 |
|
| 7 |
huggingface-cli login --token ${HF_TOKEN}
|
| 8 |
python3 restore.py
|
| 9 |
-
nohup python3 backup.py
|
| 10 |
exec ./start_server.sh
|
|
|
|
| 6 |
|
| 7 |
huggingface-cli login --token ${HF_TOKEN}
|
| 8 |
python3 restore.py
|
| 9 |
+
nohup python3 backup.py -s 2
|
| 10 |
exec ./start_server.sh
|