1+ import json
12import datetime
23import logging
34import os
@@ -31,7 +32,10 @@ def load_db_data_from_csvs(data_directory: str):
3132 current_directory = os .getcwd ()
3233 if not os .path .isdir (os .path .join (current_directory , data_directory )):
3334 return tables
34- for filename in os .listdir (os .path .join (current_directory , data_directory )):
35+ for filename in os .listdir (
36+ os .path .join (
37+ current_directory ,
38+ data_directory )):
3539 if filename .endswith (".csv" ):
3640 table_name = filename [:- 4 ]
3741 with open (
@@ -68,10 +72,10 @@ def load_setup_scripts(setup_scripts_directory_path: str):
6872 current_directory , setup_scripts_directory_path , "post_setup.json"
6973 )
7074 if os .path .exists (post_setup_json_path ):
71- import json
7275
7376 with open (post_setup_json_path , "r" ) as f :
74- # Load as list of dicts, then convert back to strings for batch_execute
77+ # Load as list of dicts, then convert back to strings for
78+ # batch_execute
7579 try :
7680 data = json .load (f )
7781 if isinstance (data , list ):
@@ -83,8 +87,9 @@ def load_setup_scripts(setup_scripts_directory_path: str):
8387 else :
8488 post_setup = _load_setup_sql (
8589 os .path .join (
86- current_directory , setup_scripts_directory_path , "post_setup.sql"
87- ),
90+ current_directory ,
91+ setup_scripts_directory_path ,
92+ "post_setup.sql" ),
8893 )
8994 return (pre_setup , setup , post_setup )
9095
@@ -125,40 +130,9 @@ def config_to_df(
125130 }
126131 )
127132 df = pd .DataFrame .from_dict (configs )
128- df [["job_id" , "config" , "value" ]] = df [["job_id" , "config" , "value" ]].astype (
129- "string"
130- )
131- return df
132-
133-
134- def df_to_config (df : pd .DataFrame ) -> dict :
135- import ast
136-
137- original_dict = {}
138-
139- for _ , row in df .iterrows ():
140- key_path = row ["config" ]
141- value_str = row ["value" ]
142-
143- try :
144- if pd .isna (value_str ):
145- value = None
146- else :
147- value = ast .literal_eval (value_str )
148- except (ValueError , SyntaxError , TypeError ):
149- value = value_str
150-
151- keys = key_path .split ("." )
152-
153- current_level = original_dict
154- for key in keys [:- 1 ]:
155- if key not in current_level :
156- current_level [key ] = {}
157- current_level = current_level [key ]
158-
159- current_level [keys [- 1 ]] = value
160-
161- return original_dict
133+ df [["job_id" , "config" , "value" ]] = df [[
134+ "job_id" , "config" , "value" ]].astype ("string" )
135+ return config
162136
163137
164138def update_google3_relative_paths (
@@ -171,7 +145,8 @@ def update_google3_relative_paths(
171145 elif isinstance (value , list ):
172146 values = []
173147 for sub_value in value :
174- if isinstance (sub_value , str ) and sub_value .startswith ("google3/" ):
148+ if isinstance (sub_value ,
149+ str ) and sub_value .startswith ("google3/" ):
175150 values .append (get_google3_relative_path (
176151 sub_value , session_id ))
177152 elif isinstance (sub_value , str ) and sub_value in resource_map :
@@ -208,7 +183,12 @@ def get_google3_relative_path(value, session_id):
208183def set_session_configs (session , experiment_config : dict ):
209184 session ["config" ] = experiment_config
210185 if "dataset_config" in experiment_config and experiment_config ["dataset_config" ]:
211- session ["dataset_config" ] = experiment_config ["dataset_config" ]
186+ # Handle both flat string paths and nested dicts (e.g. BIRD configs)
187+ dc = experiment_config ["dataset_config" ]
188+ if isinstance (dc , dict ) and "prompts_file" in dc :
189+ session ["dataset_config" ] = dc ["prompts_file" ]
190+ else :
191+ session ["dataset_config" ] = dc
212192 if (
213193 "database_configs" in experiment_config
214194 and experiment_config ["database_configs" ]
0 commit comments