Skip to content

Commit

Permalink
feat: auto submit result after one kaggle RDLoop (#345)
Browse files Browse the repository at this point in the history
* auto submit when a loop end

* fix CI
  • Loading branch information
XianBW authored Sep 26, 2024
1 parent a288e39 commit ab55d70
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rdagent/app/kaggle/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ class Config:

if_using_feature_selection: bool = False

auto_submit: bool = True


KAGGLE_IMPLEMENT_SETTING = KaggleBasePropSetting()
21 changes: 21 additions & 0 deletions rdagent/app/kaggle/loop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import subprocess
from collections import defaultdict
from typing import Any

Expand Down Expand Up @@ -79,6 +80,26 @@ def running(self, prev_out: dict[str, Any]):
else:
exp = self.model_runner.develop(prev_out["coding"])
logger.log_object(exp, tag="runner result")

if KAGGLE_IMPLEMENT_SETTING.auto_submit:
csv_path = exp.experiment_workspace.workspace_path / "submission.csv"
try:
subprocess.run(
[
"kaggle",
"competitions",
"submit",
"-f",
str(csv_path.absolute()),
"-m",
str(csv_path.parent.absolute()),
KAGGLE_IMPLEMENT_SETTING.competition,
],
check=True,
)
except subprocess.CalledProcessError as e:
logger.error(f"Auto submission failed: \n{e}")

return exp

skip_loop_error = (ModelEmptyError, FactorEmptyError)
Expand Down

0 comments on commit ab55d70

Please sign in to comment.