Skip to content

Commit 910e5c5

Browse files
committed
change experiment name to branch
1 parent 4999830 commit 910e5c5

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

agent/cli.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ def config(
166166

167167
@agent_app.command()
168168
def run(
169-
experiment_name: str = typer.Argument(
169+
branch: str = typer.Argument(
170170
...,
171-
help="Experiment name of current run",
171+
help="Branch name of current run",
172172
),
173173
override_previous_changes: bool = typer.Option(
174174
False,
175-
help="If override the previous agent changes on `experiment_name` or run the agent continuously on the new changes",
175+
help="If override the previous agent changes on `branch` or run the agent continuously on the new changes",
176176
),
177177
backend: str = typer.Option(
178178
"modal",
@@ -197,7 +197,7 @@ def run(
197197
) -> None:
198198
"""Run the agent on the repository."""
199199
run_agent(
200-
experiment_name,
200+
branch,
201201
override_previous_changes,
202202
backend,
203203
agent_config_file,
@@ -209,13 +209,13 @@ def run(
209209

210210
@agent_app.command()
211211
def run_test_no_rich(
212-
experiment_name: str = typer.Argument(
212+
branch: str = typer.Argument(
213213
...,
214-
help="Experiment name of current run",
214+
help="Branch name of current run",
215215
),
216216
override_previous_changes: bool = typer.Option(
217217
False,
218-
help="If override the previous agent changes on `experiment_name` or run the agent continuously on the new changes",
218+
help="If override the previous agent changes on `branch` or run the agent continuously on the new changes",
219219
),
220220
backend: str = typer.Option(
221221
"modal",
@@ -236,7 +236,7 @@ def run_test_no_rich(
236236
) -> None:
237237
"""Run the agent on the repository."""
238238
run_agent_no_rich(
239-
experiment_name,
239+
branch,
240240
override_previous_changes,
241241
backend,
242242
agent_config_file,

agent/run_agent.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def run_agent_for_repo(
4848
agent_config: AgentConfig,
4949
example: RepoInstance,
5050
update_queue: multiprocessing.Queue,
51-
experiment_name: Optional[str] = None,
51+
branch: Optional[str] = None,
5252
override_previous_changes: bool = False,
5353
backend: str = "modal",
5454
log_dir: str = str(RUN_AIDER_LOG_DIR.resolve()),
@@ -87,22 +87,22 @@ def run_agent_for_repo(
8787
)
8888

8989
# if branch_name is not provided, create a new branch name based on agent_config
90-
if experiment_name is None:
91-
experiment_name = args2string(agent_config)
90+
if branch is None:
91+
branch = args2string(agent_config)
9292

93-
create_branch(local_repo, experiment_name, example["base_commit"])
93+
create_branch(local_repo, branch, example["base_commit"])
9494

9595
# in cases where the latest commit of branch is not commit 0
9696
# set it back to commit 0
97-
latest_commit = local_repo.commit(experiment_name)
97+
latest_commit = local_repo.commit(branch)
9898
if latest_commit.hexsha != example["base_commit"] and override_previous_changes:
9999
local_repo.git.reset("--hard", example["base_commit"])
100100

101101
# prepare the log dir
102102
experiment_log_dir = (
103103
Path(log_dir)
104104
/ repo_name
105-
/ experiment_name
105+
/ branch
106106
/ datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
107107
)
108108
experiment_log_dir.mkdir(parents=True, exist_ok=True)
@@ -132,7 +132,7 @@ def run_agent_for_repo(
132132
# when unit test feedback is available, iterate over test files
133133
for test_file in test_files:
134134
update_queue.put(("set_current_file", (repo_name, test_file)))
135-
test_cmd = f"python -m commit0 test {repo_path} {test_file} --branch {experiment_name} --backend {backend} --commit0_dot_file_path {commit0_dot_file_path}"
135+
test_cmd = f"python -m commit0 test {repo_path} {test_file} --branch {branch} --backend {backend} --commit0_dot_file_path {commit0_dot_file_path}"
136136
test_file_name = test_file.replace(".py", "").replace("/", "__")
137137
test_log_dir = experiment_log_dir / test_file_name
138138
lint_cmd = get_lint_cmd(repo_name, agent_config.use_lint_info)
@@ -176,7 +176,7 @@ def run_agent_for_repo(
176176

177177

178178
def run_agent(
179-
experiment_name: str,
179+
branch: str,
180180
override_previous_changes: bool,
181181
backend: str,
182182
agent_config_file: str,
@@ -248,7 +248,7 @@ def run_agent(
248248
agent_config,
249249
cast(RepoInstance, example),
250250
update_queue,
251-
experiment_name,
251+
branch,
252252
override_previous_changes,
253253
backend,
254254
log_dir,

agent/run_agent_no_rich.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def run_agent_for_repo(
4545
repo_base_dir: str,
4646
agent_config: AgentConfig,
4747
example: RepoInstance,
48-
experiment_name: Optional[str] = None,
48+
branch: Optional[str] = None,
4949
override_previous_changes: bool = False,
5050
backend: str = "modal",
5151
log_dir: str = str(RUN_AIDER_LOG_DIR.resolve()),
@@ -77,22 +77,22 @@ def run_agent_for_repo(
7777
)
7878

7979
# if branch_name is not provided, create a new branch name based on agent_config
80-
if experiment_name is None:
81-
experiment_name = args2string(agent_config)
80+
if branch is None:
81+
branch = args2string(agent_config)
8282

83-
create_branch(local_repo, experiment_name, example["base_commit"])
83+
create_branch(local_repo, branch, example["base_commit"])
8484

8585
# in cases where the latest commit of branch is not commit 0
8686
# set it back to commit 0
87-
latest_commit = local_repo.commit(experiment_name)
87+
latest_commit = local_repo.commit(branch)
8888
if latest_commit.hexsha != example["base_commit"] and override_previous_changes:
8989
local_repo.git.reset("--hard", example["base_commit"])
9090

9191
# prepare the log dir
9292
experiment_log_dir = (
9393
Path(log_dir)
9494
/ repo_name
95-
/ experiment_name
95+
/ branch
9696
/ datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
9797
)
9898
experiment_log_dir.mkdir(parents=True, exist_ok=True)
@@ -119,7 +119,7 @@ def run_agent_for_repo(
119119

120120
# when unit test feedback is available, iterate over test files
121121
for test_file in test_files:
122-
test_cmd = f"python -m commit0 test {repo_path} {test_file} --branch {experiment_name} --backend {backend} --commit0_dot_file_path {commit0_dot_file_path}"
122+
test_cmd = f"python -m commit0 test {repo_path} {test_file} --branch {branch} --backend {backend} --commit0_dot_file_path {commit0_dot_file_path}"
123123
test_file_name = test_file.replace(".py", "").replace("/", "__")
124124
test_log_dir = experiment_log_dir / test_file_name
125125
lint_cmd = get_lint_cmd(repo_name, agent_config.use_lint_info)
@@ -146,7 +146,7 @@ def run_agent_for_repo(
146146

147147

148148
def run_agent(
149-
experiment_name: str,
149+
branch: str,
150150
override_previous_changes: bool,
151151
backend: str,
152152
agent_config_file: str,
@@ -197,7 +197,7 @@ def run_agent(
197197
commit0_config["base_dir"],
198198
agent_config,
199199
cast(RepoInstance, example),
200-
experiment_name,
200+
branch,
201201
override_previous_changes,
202202
backend,
203203
log_dir,

0 commit comments

Comments
 (0)