refactor/data_backend #12

Merged
jkuhl merged 36 commits from refactor/data_backend into develop 2025-12-04 15:47:45 +01:00
Showing only changes of commit 00ec9f7f8a - Show all commits

roll out tracker unlock implementation
Some checks failed
Mypy / mypy (push) Successful in 49s
Pytest / pytest (3.12) (push) Successful in 49s
Pytest / pytest (3.13) (push) Successful in 48s
Pytest / pytest (3.14) (push) Successful in 48s
Ruff / ruff (push) Failing after 33s
Mypy / mypy (pull_request) Successful in 44s
Pytest / pytest (3.12) (pull_request) Successful in 50s
Pytest / pytest (3.13) (pull_request) Successful in 50s
Pytest / pytest (3.14) (pull_request) Successful in 47s
Ruff / ruff (pull_request) Failing after 33s

Justus Kuhlmann 2025-12-04 15:15:24 +01:00
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6

View file

@ -8,7 +8,7 @@ from typing import Union
from pyerrors import Obs, Corr, dump_object, load_object
from hashlib import sha256
from .tools import get_db_file, cache_enabled
from .tracker import get, save
from .tracker import get, save, unlock
import shutil
from typing import Any
@ -32,7 +32,7 @@ def write_measurement(path: str, ensemble: str, measurement: dict[str, dict[str,
db_file = get_db_file(path)
db = os.path.join(path, db_file)
get(path, db_file)
dl.unlock(db, dataset=path)
unlock(path, db_file)
conn = sqlite3.connect(db)
c = conn.cursor()
files = []
@ -45,7 +45,7 @@ def write_measurement(path: str, ensemble: str, measurement: dict[str, dict[str,
os.makedirs(os.path.join(path, '.', 'archive', ensemble, corr))
else:
if os.path.exists(file):
dl.unlock(file, dataset=path)
unlock(path, file_in_archive)
known_meas = pj.load_json_dict(file)
if code == "sfcf":
parameters = sfcf.read_param(path, uuid, parameter_file)
@ -184,7 +184,7 @@ def drop_record(path: str, meas_path: str) -> None:
db = os.path.join(path, db_file)
get(path, db_file)
sub_key = meas_path.split("::")[1]
dl.unlock(db, dataset=path)
unlock(path, db_file)
conn = sqlite3.connect(db)
c = conn.cursor()
if c.execute("SELECT * FROM backlogs WHERE path = ?", (meas_path, )).fetchone() is not None:
@ -196,7 +196,7 @@ def drop_record(path: str, meas_path: str) -> None:
known_meas = pj.load_json_dict(file)
if sub_key in known_meas:
del known_meas[sub_key]
dl.unlock(file, dataset=path)
unlock(path, file_in_archive)
pj.dump_dict_to_json(known_meas, file)
save(path, message="Drop measurements to database", files=[db, file])
return