Skip to content

Commit 3e1afc8

Browse files
committed
Retry tectonic cache warm up on failures
1 parent dfc65f7 commit 3e1afc8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/tectonic_cache.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import subprocess
22
from pathlib import Path
33
from tempfile import TemporaryDirectory
4+
from time import sleep
5+
from warnings import warn
46

57
HERE = Path(__file__).parent
68
EXAMPLE = HERE.parent / "atest/examples/example.tex"
9+
ATTEMPTS = 3
10+
SLEEP = 5
711

812

913
def tectonic_cache():
@@ -21,7 +25,17 @@ def tectonic_cache():
2125
]
2226
)
2327
)
24-
subprocess.check_call(["tectonic", str(tex)], cwd=td)
28+
for attempt in range(ATTEMPTS):
29+
try:
30+
subprocess.check_call(["tectonic", str(tex)], cwd=td)
31+
break
32+
except subprocess.CalledProcessError as e:
33+
warn(
34+
"Tectonic cache attempt {attempt} failed: {e}, retrying in {time} seconds".format(
35+
e=e, attempt=attempt, time=SLEEP
36+
)
37+
)
38+
sleep(SLEEP)
2539

2640

2741
if __name__ == "__main__":

0 commit comments

Comments
 (0)