Skip to content

Commit e32d229

Browse files
authored
feat: add coder check and give more time (#1127)
* feat: introduce max_seconds_multiplier for timeout management across components * avoid using assert in test * hot fix a very small bug * runner multiply twice * revert feedback change * add a switch to longer timeout
1 parent 71440f6 commit e32d229

29 files changed

Lines changed: 102 additions & 83 deletions

File tree

‎rdagent/app/data_science/conf.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ class DataScienceBasePropSetting(KaggleBasePropSetting):
118118
enable_planner: bool = False
119119

120120
model_architecture_suggestion_time_percent: float = 0.75
121+
allow_longer_timeout: bool = False
122+
coder_longer_timeout_multiplier: int = 3
123+
runner_longer_timeout_multiplier: int = 2
121124

122125
#### hypothesis critique and rewrite
123126
enable_hypo_critique_rewrite: bool = True

‎rdagent/components/coder/CoSTEER/__init__.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def __init__(
2828
es: EvolvingStrategy,
2929
evolving_version: int,
3030
*args,
31+
max_seconds: int | None = None,
3132
with_knowledge: bool = True,
3233
with_feedback: bool = True,
3334
knowledge_self_gen: bool = True,
@@ -37,7 +38,7 @@ def __init__(
3738
) -> None:
3839
super().__init__(*args, **kwargs)
3940
self.max_loop = settings.max_loop if max_loop is None else max_loop
40-
self.max_seconds = settings.max_seconds
41+
self.max_seconds = max_seconds
4142
self.knowledge_base_path = (
4243
Path(settings.knowledge_base_path) if settings.knowledge_base_path is not None else None
4344
)
@@ -105,7 +106,7 @@ def develop(self, exp: Experiment) -> Experiment:
105106
logger.log_object(evo_exp.sub_workspace_list, tag="evolving code")
106107
for sw in evo_exp.sub_workspace_list:
107108
logger.info(f"evolving workspace: {sw}")
108-
if (datetime.now() - start_datetime).seconds > self.max_seconds:
109+
if self.max_seconds is not None and (datetime.now() - start_datetime).seconds > self.max_seconds:
109110
logger.info(f"Reached max time limit {self.max_seconds} seconds, stop evolving")
110111
break
111112
if RD_Agent_TIMER_wrapper.timer.started and RD_Agent_TIMER_wrapper.timer.is_timeout():

��rdagent/components/coder/CoSTEER/config.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Config:
3333
new_knowledge_base_path: Union[str, None] = None
3434
"""Path to the new knowledge base"""
3535

36-
max_seconds: int = 10**6
36+
max_seconds_multiplier: int = 10**6
3737

3838

3939
CoSTEER_SETTINGS = CoSTEERSettings()

‎rdagent/components/coder/data_science/conf.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DSCoderCoSTEERSettings(CoSTEERSettings):
1919
class Config:
2020
env_prefix = "DS_Coder_CoSTEER_"
2121

22-
max_seconds: int = DS_RD_SETTING.debug_timeout * 4
22+
max_seconds_multiplier: int = 4
2323
env_type: str = "docker"
2424
# TODO: extract a function for env and conf.
2525

@@ -28,7 +28,7 @@ class Config:
2828
Extra evaluators
2929
3030
The evaluator follows the following assumptions:
31-
- It runs after previous evaluator (So the running results are alreadly there)
31+
- It runs after previous evaluator (So the running results are already there)
3232
3333
It is not a complete feature due to it is only implemented in DS Pipeline & Coder.
3434

‎rdagent/components/coder/data_science/ensemble/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,6 @@ def __init__(
160160
evolving_version=2,
161161
scen=scen,
162162
max_loop=DS_RD_SETTING.coder_max_loop,
163+
max_seconds=scen.real_debug_timeout() * settings.max_seconds_multiplier,
163164
**kwargs,
164165
)

‎rdagent/components/coder/data_science/ensemble/eval.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ def evaluate(
4747
final_decision=False,
4848
)
4949

50-
env = get_ds_env(extra_volumes={self.scen.debug_path: T("scenarios.data_science.share:scen.input_path").r()})
50+
env = get_ds_env(
51+
extra_volumes={self.scen.debug_path: T("scenarios.data_science.share:scen.input_path").r()},
52+
running_timeout_period=self.scen.real_debug_timeout(),
53+
)
5154

5255
fname = "test/ensemble_test.txt"
5356
test_code = (DIRNAME / "eval_tests" / "ensemble_test.txt").read_text()

‎rdagent/components/coder/data_science/feature/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,6 @@ def __init__(
138138
evolving_version=2,
139139
scen=scen,
140140
max_loop=DS_RD_SETTING.coder_max_loop,
141+
max_seconds=scen.real_debug_timeout() * settings.max_seconds_multiplier,
141142
**kwargs,
142143
)

‎rdagent/components/coder/data_science/feature/eval.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def evaluate(
4343
final_decision=False,
4444
)
4545

46-
env = get_ds_env(extra_volumes={self.scen.debug_path: T("scenarios.data_science.share:scen.input_path").r()})
46+
env = get_ds_env(
47+
extra_volumes={self.scen.debug_path: T("scenarios.data_science.share:scen.input_path").r()},
48+
running_timeout_period=self.scen.real_debug_timeout(),
49+
)
4750

4851
# TODO: do we need to clean the generated temporary content?
4952
fname = "test/feature_test.py"

‎rdagent/components/coder/data_science/model/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,6 @@ def __init__(
170170
evolving_version=2,
171171
scen=scen,
172172
max_loop=DS_RD_SETTING.coder_max_loop,
173+
max_seconds=scen.real_debug_timeout() * settings.max_seconds_multiplier,
173174
**kwargs,
174175
)

‎rdagent/components/coder/data_science/model/eval.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ def evaluate(
5757
final_decision=False,
5858
)
5959

60-
env = get_ds_env(extra_volumes={self.scen.debug_path: T("scenarios.data_science.share:scen.input_path").r()})
60+
env = get_ds_env(
61+
extra_volumes={self.scen.debug_path: T("scenarios.data_science.share:scen.input_path").r()},
62+
running_timeout_period=self.scen.real_debug_timeout(),
63+
)
6164

6265
if_model_removed = False
6366

0 commit comments

Comments
 (0)