1212class MigrationState (TypedDict ):
1313 """State for the migration graph execution."""
1414 input_dir : str
15+ latest_dir : str
1516 raw : Dict [str , Any ]
1617 cleaned_raw : Dict [str , Any ]
1718 count : Dict [str , Any ]
@@ -33,6 +34,7 @@ def input_node(state: MigrationState) -> MigrationState:
3334 output_dirs .append ((run_dt , res ))
3435
3536 _ , latest = max (output_dirs , key = lambda x : x [0 ])
37+ state ["latest_dir" ] = latest
3638 ## Get translation results and evaluation notes
3739 raw = {"translation_results" : [], "evaluation" : []}
3840 for name in os .listdir (latest ):
@@ -142,6 +144,7 @@ def run(self, input_path: str) -> Dict[str, Any]:
142144 try :
143145 initial_state : MigrationState = {
144146 "input_dir" : input_path ,
147+ "latest_dir" : None ,
145148 "raw" : [],
146149 "count" : None ,
147150 "json_report" : None ,
@@ -151,7 +154,8 @@ def run(self, input_path: str) -> Dict[str, Any]:
151154 final_state = self .compiled_graph .invoke (initial_state )
152155 report = final_state ["md_report" ] or {}
153156 json_report = final_state ["json_report" ] or {}
154- return report [0 ], json_report
157+ latest_dir = final_state ["latest_dir" ] or {}
158+ return report [0 ], json_report , latest_dir
155159
156160 except Exception as e :
157161 raise
0 commit comments