summaryrefslogtreecommitdiff
path: root/hosts/vidhar/borg
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-02-17 13:28:50 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-02-17 13:28:50 +0100
commitca4b82507f3624ec0a0af395a58d7b4345f16ec5 (patch)
tree6ed78d8c2ee379da95feecfab0bf956e712ec008 /hosts/vidhar/borg
parent71c455dbbf1ad43d04c51b3ec28cde577ee8585f (diff)
downloadnixos-ca4b82507f3624ec0a0af395a58d7b4345f16ec5.tar
nixos-ca4b82507f3624ec0a0af395a58d7b4345f16ec5.tar.gz
nixos-ca4b82507f3624ec0a0af395a58d7b4345f16ec5.tar.bz2
nixos-ca4b82507f3624ec0a0af395a58d7b4345f16ec5.tar.xz
nixos-ca4b82507f3624ec0a0af395a58d7b4345f16ec5.zip
vidhar: ...
Diffstat (limited to 'hosts/vidhar/borg')
-rwxr-xr-xhosts/vidhar/borg/copy.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index cd63146d..7a83100a 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -43,7 +43,7 @@ halo_args = {
43def read_repo(path): 43def read_repo(path):
44 with Halo(text=f'Listing {path}', **halo_args) as sp: 44 with Halo(text=f'Listing {path}', **halo_args) as sp:
45 res = None 45 res = None
46 with subprocess.Popen(['borg', 'list', '--info', '--lock-wait', '120', '--json', path], stdout=subprocess.PIPE) as proc: 46 with subprocess.Popen(['borg', 'list', '--info', '--lock-wait=600', '--json', path], stdout=subprocess.PIPE) as proc:
47 res = json.load(proc.stdout)['archives'] 47 res = json.load(proc.stdout)['archives']
48 if sp.enabled: 48 if sp.enabled:
49 sp.succeed(f'{len(res)} archives in {path}') 49 sp.succeed(f'{len(res)} archives in {path}')
@@ -74,7 +74,7 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
74 match = re.compile('^(.*)-[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.(checkpoint|recreate)(\.[0-9]+)?)?').fullmatch(entry['name']) 74 match = re.compile('^(.*)-[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.(checkpoint|recreate)(\.[0-9]+)?)?').fullmatch(entry['name'])
75 if match: 75 if match:
76 repo_id = None 76 repo_id = None
77 with subprocess.Popen(['borg', 'info', '--info', '--lock-wait', '120', '--json', src_repo_path], stdout=subprocess.PIPE) as proc: 77 with subprocess.Popen(['borg', 'info', '--info', '--lock-wait=600', '--json', src_repo_path], stdout=subprocess.PIPE) as proc:
78 repo_id = json.load(proc.stdout)['repository']['id'] 78 repo_id = json.load(proc.stdout)['repository']['id']
79 if repo_id: 79 if repo_id:
80 cache_suffix = f'{repo_id}_{match.group(1)}' 80 cache_suffix = f'{repo_id}_{match.group(1)}'
@@ -111,7 +111,7 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
111 with Halo(text=f'Determine size', **halo_args) as sp: 111 with Halo(text=f'Determine size', **halo_args) as sp:
112 total_size = None 112 total_size = None
113 total_files = None 113 total_files = None
114 with subprocess.Popen(['borg', 'info', '--info', '--json', '--lock-wait', '120', f'{src_repo_path}::{entry["name"]}'], stdout=subprocess.PIPE, text=True) as proc: 114 with subprocess.Popen(['borg', 'info', '--info', '--json', '--lock-wait=600', f'{src_repo_path}::{entry["name"]}'], stdout=subprocess.PIPE, text=True) as proc:
115 stats = json.load(proc.stdout)['archives'][0]['stats'] 115 stats = json.load(proc.stdout)['archives'][0]['stats']
116 total_size = stats['original_size'] 116 total_size = stats['original_size']
117 total_files = stats['nfiles'] 117 total_files = stats['nfiles']
@@ -120,7 +120,7 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
120 else: 120 else:
121 print(f'{total_files} files, {naturalsize(total_size, binary=True)}', file=stderr) 121 print(f'{total_files} files, {naturalsize(total_size, binary=True)}', file=stderr)
122 # print(f'Mounting to {dir}', file=stderr) 122 # print(f'Mounting to {dir}', file=stderr)
123 with subprocess.Popen(['borg', 'mount', '--foreground', '--progress', '--lock-wait', '120', f'{src_repo_path}::{entry["name"]}', dir]) as mount_proc: 123 with subprocess.Popen(['borg', 'mount', '--foreground', '--progress', '--lock-wait=600', f'{src_repo_path}::{entry["name"]}', dir]) as mount_proc:
124 with Halo(text='Waiting for mount', **halo_args) as sp: 124 with Halo(text='Waiting for mount', **halo_args) as sp:
125 wait_start = datetime.now() 125 wait_start = datetime.now()
126 while True: 126 while True:
@@ -141,7 +141,7 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
141 env = os.environ.copy() 141 env = os.environ.copy()
142 create_args = ['borg', 142 create_args = ['borg',
143 'create', 143 'create',
144 '--lock-wait=120', 144 '--lock-wait=600',
145 '--one-file-system', 145 '--one-file-system',
146 '--compression=auto,zstd,10', 146 '--compression=auto,zstd,10',
147 '--chunker-params=10,23,16,4095', 147 '--chunker-params=10,23,16,4095',