Skip to content

Commit 6c4db40

Browse files
authored
workflow entrypoint check (#748)
1 parent c8014f4 commit 6c4db40

File tree

1 file changed

+9
-1
lines changed
  • rdagent/components/coder/data_science/workflow

1 file changed

+9
-1
lines changed

rdagent/components/coder/data_science/workflow/eval.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def evaluate(
6767
# Clean the scores.csv & submission.csv.
6868
implementation.execute(env=env, entry=f"rm submission.csv scores.csv")
6969

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")
7171

7272
# remove EDA part
7373
stdout = re.sub(r"=== Start of EDA part ===(.*)=== End of EDA part ===", "", stdout)
@@ -79,6 +79,14 @@ def evaluate(
7979
if not score_fp.exists():
8080
score_check_text = "[Error] Metrics file (scores.csv) is not generated!"
8181
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}.\nPlease check if you have implemented entry point in 'main.py'."
8290
else:
8391
try:
8492
score_df = pd.read_csv(score_fp, index_col=0)

0 commit comments

Comments
 (0)