Skip to content

Commit 0a9c2d6

Browse files
committed
edit branch name
1 parent d28c94e commit 0a9c2d6

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

agent/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def config(
163163
@agent_app.command()
164164
def run(
165165
branch: str = typer.Argument(
166-
...,
166+
None,
167167
help="Branch name of current run",
168168
),
169169
override_previous_changes: bool = typer.Option(

agent/display.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ def __init__(self, total_repos: int):
135135
)
136136
self.layout["info"]["other_info"].split_row(
137137
Layout(name="backend", ratio=1),
138-
Layout(name="log_dir", ratio=1),
138+
Layout(name="branch", ratio=2),
139+
Layout(name="log_dir", ratio=2),
139140
)
140141
self.layout["info"]["agent_info"].split_row(
141142
Layout(name="agent_name", ratio=1),
@@ -151,6 +152,10 @@ def __init__(self, total_repos: int):
151152
self.layout["info"]["other_info"]["backend"].update(
152153
Panel(self.backend_display, title="Backend", border_style="blue")
153154
)
155+
self.branch_display = Text("", justify="center")
156+
self.layout["info"]["other_info"]["branch"].update(
157+
Panel(self.branch_display, title="Branch", border_style="blue")
158+
)
154159
self.log_dir_display = Text("", justify="center")
155160
self.layout["info"]["other_info"]["log_dir"].update(
156161
Panel(self.log_dir_display, title="Log Directory", border_style="blue")
@@ -227,9 +232,16 @@ def update_time_display(self, time_in_seconds: int) -> None:
227232
Panel(self.time_display, title="Time Taken", border_style="blue")
228233
)
229234

235+
def update_branch_display(self, branch: str) -> None:
236+
"""Update the branch display with the given branch."""
237+
self.branch_display = Text(f"{branch}", justify="center")
238+
self.layout["info"]["other_info"]["branch"].update(
239+
Panel(self.branch_display, title="Branch", border_style="blue")
240+
)
241+
230242
def update_backend_display(self, backend: str) -> None:
231243
"""Update the backend display with the given backend."""
232-
self.backend_display = Text(f"Backend Using: {backend}", justify="center")
244+
self.backend_display = Text(f"{backend}", justify="center")
233245
self.layout["info"]["other_info"]["backend"].update(
234246
Panel(self.backend_display, title="Backend", border_style="blue")
235247
)

agent/run_agent.py

Lines changed: 7 additions & 6 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-
branch: Optional[str] = None,
51+
branch: str,
5252
override_previous_changes: bool = False,
5353
backend: str = "modal",
5454
log_dir: str = str(RUN_AGENT_LOG_DIR.resolve()),
@@ -88,10 +88,6 @@ def run_agent_for_repo(
8888
f"{agent_config.agent_name} is not implemented; please add your implementations in baselines/agents.py."
8989
)
9090

91-
# if branch_name is not provided, create a new branch name based on agent_config
92-
if branch is None:
93-
branch = args2string(agent_config)
94-
9591
create_branch(local_repo, branch, example["base_commit"])
9692

9793
# in cases where the latest commit of branch is not commit 0
@@ -173,7 +169,7 @@ def run_agent_for_repo(
173169

174170

175171
def run_agent(
176-
branch: str,
172+
branch: Optional[str],
177173
override_previous_changes: bool,
178174
backend: str,
179175
agent_config_file: str,
@@ -208,6 +204,10 @@ def run_agent(
208204
# if len(filtered_dataset) > 1:
209205
# sys.stdout = open(os.devnull, "w")
210206

207+
# if branch_name is not provided, create a new branch name based on agent_config
208+
if branch is None:
209+
branch = args2string(agent_config)
210+
211211
with TerminalDisplay(len(filtered_dataset)) as display:
212212
not_started_repos = [
213213
cast(RepoInstance, example)["repo"].split("/")[-1]
@@ -231,6 +231,7 @@ def run_agent(
231231
agent_config.use_spec_info,
232232
agent_config.use_lint_info,
233233
)
234+
display.update_branch_display(branch)
234235
with multiprocessing.Manager() as manager:
235236
update_queue = manager.Queue()
236237
with multiprocessing.Pool(processes=max_parallel_repos) as pool:

0 commit comments

Comments
 (0)