-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (25 loc) · 960 Bytes
/
main.py
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
import os
from src.data_manager import DataManagerSubprocess
from src.repo_manger import RepoMangerFS
from src.models import Meta
from src.github_repo_manager import RepoMangerGithub
data_manager = DataManagerSubprocess()
# repo_manager = RepoMangerFS("data/repo-fs")
repo_manager = RepoMangerGithub("personal_access_token_here")
chunk_dir = "data/chunked-data"
download_dir = "data/downloaded-data"
meta_dir = "data/meta-data"
meta_file = os.path.join(meta_dir, "rick-roll.json")
# chunk the file
meta_data = data_manager.chunk_file(
"data/rick-roll.mp4", chunk_dir=chunk_dir, chunk_size_mb=5)
# upload chunks
repo_manager.upload(meta_data, chunk_dir=chunk_dir)
# save meta data
meta_data.save(meta_file)
# load meta data from file
meta_data = Meta(infile=meta_file)
# download chunks in different location
repo_manager.download(meta_data, download_dir=download_dir)
# rechunk the data
data_manager.rechunk_file(meta_data, chunk_dir=download_dir)