add thin wrapper for getting files

This commit is contained in:
Justus Kuhlmann 2025-11-27 15:25:54 +01:00
commit 0f499f080a
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6
4 changed files with 27 additions and 20 deletions

View file

@ -7,7 +7,7 @@ import json
from typing import Union
from pyerrors import Obs, Corr, dump_object, load_object
from hashlib import sha256
from .tools import cached
from .tools import cached, get_file
import shutil
@ -28,7 +28,7 @@ def write_measurement(path, ensemble, measurement, uuid, code, parameter_file=No
The uuid of the project.
"""
db = os.path.join(path, 'backlogger.db')
dl.get(db, ds=path)
get_file(path, "backlogger.db")
dl.unlock(db, dataset=path)
conn = sqlite3.connect(db)
c = conn.cursor()
@ -168,9 +168,7 @@ def cache_path(path, file, key):
def preload(path: str, file: str):
print("Loading data...")
dl.get(os.path.join(path, file), dataset=path)
print("> downloaded file")
get_file(path, file)
filedict = pj.load_json_dict(os.path.join(path, file))
print("> read file")
return filedict
@ -180,7 +178,7 @@ def drop_record(path: str, meas_path: str):
file_in_archive = meas_path.split("::")[0]
file = os.path.join(path, file_in_archive)
db = os.path.join(path, 'backlogger.db')
dl.get(db, ds=path)
get_file(path, 'backlogger.db')
sub_key = meas_path.split("::")[1]
dl.unlock(db, dataset=path)
conn = sqlite3.connect(db)