fix_some_errors_when_debug_factor (#84)

* update all code

* update
This commit is contained in:
WinstonLiyt
2024-07-18 15:01:07 +08:00
committed by GitHub
parent 032cf32ce6
commit 9029c4c801
3 changed files with 11 additions and 8 deletions
@@ -14,6 +14,6 @@ class FactorRAGEvoAgent(RAGEvoAgent):
assert len(evo.sub_workspace_list) == len(feedback)
for index in range(len(evo.sub_workspace_list)):
if not feedback[index].final_decision:
if feedback[index] is not None and not feedback[index].final_decision:
evo.sub_workspace_list[index].clear()
return evo
@@ -141,6 +141,7 @@ class FactorFBWorkspace(FBWorkspace):
self.link_data_to_workspace(source_data_path, self.workspace_path)
execution_feedback = self.FB_EXECUTION_SUCCEEDED
execution_success = False
try:
subprocess.check_output(
f"{FACTOR_IMPLEMENT_SETTINGS.python_bin} {code_path}",
@@ -149,6 +150,7 @@ class FactorFBWorkspace(FBWorkspace):
stderr=subprocess.STDOUT,
timeout=FACTOR_IMPLEMENT_SETTINGS.file_based_execution_timeout,
)
execution_success = True
except subprocess.CalledProcessError as e:
import site
@@ -169,18 +171,18 @@ class FactorFBWorkspace(FBWorkspace):
raise RuntimeErrorException(execution_feedback)
workspace_output_file_path = self.workspace_path / "result.h5"
if not workspace_output_file_path.exists():
execution_feedback += self.FB_OUTPUT_FILE_NOT_FOUND
executed_factor_value_dataframe = None
if self.raise_exception:
raise NoOutputException(execution_feedback)
else:
if workspace_output_file_path.exists() and execution_success:
try:
executed_factor_value_dataframe = pd.read_hdf(workspace_output_file_path)
execution_feedback += self.FB_OUTPUT_FILE_FOUND
except Exception as e:
execution_feedback += f"Error found when reading hdf file: {e}"[:1000]
executed_factor_value_dataframe = None
else:
execution_feedback += self.FB_OUTPUT_FILE_NOT_FOUND
executed_factor_value_dataframe = None
if self.raise_exception:
raise NoOutputException(execution_feedback)
if store_result and executed_factor_value_dataframe is not None:
self.executed_factor_value_dataframe = executed_factor_value_dataframe