99from watchdog .observers import Observer
1010
1111from src .epu_data_intake .core_http_api_client import SmartEMAPIClient as APIClient
12- from src .epu_data_intake .data_model import EpuAcquisitionSessionStore
12+ from src .epu_data_intake .model . store import InMemoryDataStore , PersistentDataStore
1313from src .epu_data_intake .fs_parser import EpuParser
1414from src .epu_data_intake .fs_watcher import (
1515 DEFAULT_PATTERNS ,
@@ -72,15 +72,22 @@ def parse_callback(verbose: int = shared_verbosity_option):
7272 """Parse group callback to enable verbose flag on parse command"""
7373 pass
7474
75+
7576@parse_cli .command ("dir" )
7677def parse_epu_output_dir (
77- epu_output_dir : str ,
78- verbose : int = shared_verbosity_option ,
78+ epu_output_dir : str ,
79+ verbose : int = shared_verbosity_option ,
7980):
8081 """Parse an entire EPU output directory structure. May contain multiple grids"""
81- datastore = EpuAcquisitionSessionStore (epu_output_dir )
82+ # Rationale here is that parsers don't persist data to API by design - only watch command does that
83+ datastore = InMemoryDataStore (epu_output_dir )
84+
85+ # Initialize the acquisition_rels dict with a set for the acquisition
86+ datastore .acquisition_rels [datastore .acquisition .uuid ] = set ()
87+
88+ # The EpuParser.parse_epu_output_dir would need to be updated to work with the new store
8289 datastore = EpuParser .parse_epu_output_dir (datastore )
83- logging .info (datastore )
90+ False and logging .debug (datastore )
8491
8592
8693@parse_cli .command ("grid" )
@@ -91,12 +98,14 @@ def parse_grid(
9198 is_valid , errors = EpuParser .validate_project_dir (Path (grid_data_dir ))
9299
93100 if not is_valid :
94- logging .info ("Grid data dir dir is structurally invalid. Found the following issues:\n " )
101+ logging .warning ("Grid data dir dir is structurally invalid. Found the following issues:\n " )
95102 for error in errors :
96- logging .info (f"- { error } " )
103+ logging .warning (f"- { error } " )
97104 else :
98- gridstore = EpuParser .parse_grid_dir (grid_data_dir )
99- logging .info (gridstore )
105+ # Rationale here is that parsers don't persist data to API by design - only watch command does that
106+ datastore = InMemoryDataStore (grid_data_dir ) # TODO confirm this is the dir expected here - top-level watch dir or grid root dir?
107+ grid_uuid = EpuParser .parse_grid_dir (grid_data_dir , datastore )
108+ False and logging .debug (datastore )
100109
101110
102111@parse_cli .command ("session" )
0 commit comments