Skip to content

Commit

Permalink
fix read_datastore
Browse files Browse the repository at this point in the history
  • Loading branch information
sashhhaka committed Jul 22, 2024
1 parent 4a0c791 commit 2c51b61
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,13 @@ def format_area(value):
print(f"Refactored data saved to {data_path}")


def read_datastore():
with initialize(config_path="../configs", version_base=None):
cfg = compose(config_name="main")

@hydra.main(config_path="../configs", config_name="main", version_base=None)
def read_datastore(cfg: DictConfig):
version = cfg.test_data_version if cfg.test else cfg.index
try:
subprocess.run(["dvc", "fetch"])
subprocess.run(["dvc", "fetch", f"{cfg.dvc_file_path}"])
subprocess.run(["dvc", "pull"], check=True)
subprocess.run(
["git", "checkout", f"v{version}.0", f"{cfg.dvc_file_path}"], check=True)
subprocess.run(["git", "checkout", f"v{version}.0", f"{cfg.dvc_file_path}"], check=True)
subprocess.run(["dvc", "checkout", f"{cfg.dvc_file_path}"], check=True)

sample_path = cfg.sample_path
Expand All @@ -110,8 +107,7 @@ def read_datastore():
return sample
finally:
# Return to the HEAD state
subprocess.run(["git", "checkout", "HEAD",
f"{cfg.dvc_file_path}"], check=True)
subprocess.run(["git", "checkout", "HEAD", f"{cfg.dvc_file_path}"], check=True)
subprocess.run(["dvc", "checkout", f"{cfg.dvc_file_path}"], check=True)


Expand Down

0 comments on commit 2c51b61

Please sign in to comment.