File tree 1 file changed +9
-1
lines changed
rdagent/components/coder/data_science/workflow
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ def evaluate(
67
67
# Clean the scores.csv & submission.csv.
68
68
implementation .execute (env = env , entry = f"rm submission.csv scores.csv" )
69
69
70
- stdout = implementation .execute (env = env , entry = f"python main.py" )
70
+ stdout = implementation .execute (env = env , entry = f"python -m coverage run main.py" )
71
71
72
72
# remove EDA part
73
73
stdout = re .sub (r"=== Start of EDA part ===(.*)=== End of EDA part ===" , "" , stdout )
@@ -79,6 +79,14 @@ def evaluate(
79
79
if not score_fp .exists ():
80
80
score_check_text = "[Error] Metrics file (scores.csv) is not generated!"
81
81
score_ret_code = 1
82
+ implementation .execute (env = env , entry = "python -m coverage json -o coverage.json" )
83
+ coverage_report_path = implementation .workspace_path / "coverage.json"
84
+ if coverage_report_path .exists ():
85
+ used_files = set (json .loads (coverage_report_path .read_text ())["files" ].keys ())
86
+ coverage_report_path .unlink ()
87
+ logger .info (f"All used scripts: { used_files } " )
88
+ if len (used_files ) == 1 :
89
+ score_check_text += f"\n [Error] The only used script is { used_files } .\n Please check if you have implemented entry point in 'main.py'."
82
90
else :
83
91
try :
84
92
score_df = pd .read_csv (score_fp , index_col = 0 )
You can’t perform that action at this time.
0 commit comments