-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync.py
More file actions
49 lines (42 loc) · 1.12 KB
/
sync.py
File metadata and controls
49 lines (42 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import subprocess
from pathlib import Path
cwd = Path(__file__).parent
srcs = ["edge-matched", "cod", "geoboundaries", "gb-humanitarian"]
exts = ["json", "csv", "xlsx"]
def sync(src, dest):
subprocess.run(
[
"rclone",
"sync",
"--exclude=.*",
"--progress",
"--s3-no-check-bucket",
"--s3-chunk-size=256M",
src,
dest,
],
check=False,
)
def copy(src, dest):
subprocess.run(
[
"rclone",
"copyto",
"--s3-no-check-bucket",
"--s3-chunk-size=256M",
src,
dest,
],
check=False,
)
if __name__ == "__main__":
subprocess.run(["python", "-m", "app.meta"], check=False)
for src in srcs:
sync(cwd / f"outputs/{src}", f"r2://fieldmaps-data/{src}")
for ext in exts:
copy(cwd / f"outputs/{src}.{ext}", f"r2://fieldmaps-data/{src}.{ext}")
for ext in exts:
copy(
cwd / f"outputs/global-pcodes.{ext}",
f"r2://fieldmaps-data/global-pcodes.{ext}",
)