automated file archiving to git
This commit is contained in:
13
coronavis.py
13
coronavis.py
@@ -9,6 +9,7 @@ import numpy as np
|
|||||||
import sys
|
import sys
|
||||||
import importlib
|
import importlib
|
||||||
import time
|
import time
|
||||||
|
import subprocess
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
#### config
|
#### config
|
||||||
@@ -86,6 +87,18 @@ def get_data():
|
|||||||
|
|
||||||
with open(datafile, "wb") as f:
|
with open(datafile, "wb") as f:
|
||||||
f.write(r.content)
|
f.write(r.content)
|
||||||
|
|
||||||
|
## file archiving: include error log just in case…
|
||||||
|
try:
|
||||||
|
subprocess.run(["/usr/bin/cp", f"../{date}-full-data.csv", "data.csv"], cwd="/srv/http/dukun.de/corona/data/git")
|
||||||
|
subprocess.run(["/usr/bin/git", "commit", "-a", f"-m'{date}'"], cwd="/srv/http/dukun.de/corona/data/git")
|
||||||
|
subprocess.run(["/usr/bin/git", "push"], cwd="/srv/http/dukun.de/corona/data/git")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"File archiving failed with {e} - need for debugging here…")
|
||||||
|
print(e.with_traceback)
|
||||||
|
print("\n\n\ncontinuing…\n")
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(f"file found: {datafile}")
|
print(f"file found: {datafile}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user