Skip to content

Commit 4cedc34

Browse files
committed
minor update
1 parent 3a5321b commit 4cedc34

File tree

4 files changed

+36
-57
lines changed

4 files changed

+36
-57
lines changed

agent/agents.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,19 @@ def run(
111111
coder.stream = True
112112

113113
# Run the agent
114-
# coder.run(message)
115-
116-
#### TMP
117-
import time
118-
import random
119-
120-
time.sleep(random.random() * 5)
121-
n = random.random() / 10
122-
with open(log_file, "a") as f:
123-
f.write(
124-
f"> Tokens: 33k sent, 1.3k received. Cost: $0.12 message, ${n} session. \n"
125-
)
126-
#### TMP
114+
coder.run(message)
115+
116+
# #### TMP
117+
# import time
118+
# import random
119+
120+
# time.sleep(random.random() * 5)
121+
# n = random.random() / 10
122+
# with open(log_file, "a") as f:
123+
# f.write(
124+
# f"> Tokens: 33k sent, 1.3k received. Cost: $0.12 message, ${n} session. \n"
125+
# )
126+
# #### TMP
127127

128128
# Close redirected stdout and stderr
129129
sys.stdout.close()

agent/cli.py

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ def run(
190190
1,
191191
help="Maximum number of repositories for agent to run in parallel",
192192
),
193+
display_repo_progress_num: int = typer.Option(
194+
5,
195+
help="Display the agent progress",
196+
),
193197
) -> None:
194198
"""Run the agent on the repository."""
195199
run_agent(
@@ -199,6 +203,7 @@ def run(
199203
agent_config_file,
200204
log_dir,
201205
max_parallel_repos,
206+
display_repo_progress_num,
202207
)
203208

204209

@@ -238,41 +243,3 @@ def run_test_no_rich(
238243
log_dir,
239244
max_parallel_repos,
240245
)
241-
242-
243-
@agent_app.command()
244-
def run_test(
245-
experiment_name: str = typer.Argument(
246-
...,
247-
help="Experiment name of current run",
248-
),
249-
override_previous_changes: bool = typer.Option(
250-
False,
251-
help="If override the previous agent changes on `experiment_name` or run the agent continuously on the new changes",
252-
),
253-
backend: str = typer.Option(
254-
"modal",
255-
help="Test backend to run the agent on, ignore this option if you are not adding `test` option to agent",
256-
),
257-
agent_config_file: str = typer.Option(
258-
".agent.yaml",
259-
help="Path to the agent config file",
260-
),
261-
log_dir: str = typer.Option(
262-
str(RUN_AIDER_LOG_DIR.resolve()),
263-
help="Log directory to store the logs",
264-
),
265-
max_parallel_repos: int = typer.Option(
266-
1,
267-
help="Maximum number of repositories for agent to run in parallel",
268-
),
269-
) -> None:
270-
"""Run the agent on the repository."""
271-
run_agent(
272-
experiment_name,
273-
override_previous_changes,
274-
backend,
275-
agent_config_file,
276-
log_dir,
277-
max_parallel_repos,
278-
)

agent/display.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def __init__(self, total_repos: int):
8181
self.finished_files = {}
8282
self.total_files_per_repo = {}
8383
self.repo_money_spent = {}
84+
self.display_repo_progress_num = 5
8485

8586
self.overall_progress = Progress(
8687
SpinnerColumn(),
@@ -157,6 +158,10 @@ def __init__(self, total_repos: int):
157158
Panel(Layout(name="ongoing"), title="Ongoing", border_style="yellow")
158159
)
159160

161+
def update_repo_progress_num(self, display_repo_progress_num: int) -> None:
162+
"""Update the number of repositories to display in the ongoing section."""
163+
self.display_repo_progress_num = display_repo_progress_num
164+
160165
def update_agent_display(
161166
self,
162167
agent_name: str,
@@ -262,15 +267,20 @@ def update(self) -> None:
262267

263268
if ongoing_panels:
264269
ongoing_layout = Layout()
265-
for i, panel in enumerate(ongoing_panels[:5]):
270+
for i, panel in enumerate(ongoing_panels[: self.display_repo_progress_num]):
266271
ongoing_layout.add_split(Layout(panel, name=f"repo_{i}"))
267-
ongoing_layout.split_row(
268-
*[ongoing_layout[f"repo_{i}"] for i in range(len(ongoing_panels[:5]))]
272+
ongoing_layout.split_column(
273+
*[
274+
ongoing_layout[f"repo_{i}"]
275+
for i in range(
276+
len(ongoing_panels[: self.display_repo_progress_num])
277+
)
278+
]
269279
)
270280
self.layout["main"]["right"].update(
271281
Panel(
272282
ongoing_layout,
273-
title="Ongoing(Only first 5 shown if more than 5)",
283+
title=f"Ongoing(only show at most {self.display_repo_progress_num} repos, set with `--display_repo_progress_num` flag)",
274284
border_style="yellow",
275285
)
276286
)

agent/run_agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def run_agent(
178178
agent_config_file: str,
179179
log_dir: str,
180180
max_parallel_repos: int,
181+
display_repo_progress_num: int,
181182
) -> None:
182183
"""Main function to run Aider for a given repository."""
183184
config = read_yaml_config(agent_config_file)
@@ -208,10 +209,12 @@ def run_agent(
208209

209210
with TerminalDisplay(len(filtered_dataset)) as display:
210211
not_started_repos = [
211-
getattr(example, "repo", "").split("/")[-1] for example in filtered_dataset
212+
cast(RepoInstance, example)["repo"].split("/")[-1]
213+
for example in filtered_dataset
212214
]
213215
display.set_not_started_repos(not_started_repos)
214216

217+
display.update_repo_progress_num(display_repo_progress_num)
215218
display.update_backend_display(backend)
216219
display.update_log_dir_display(log_dir)
217220
display.update_agent_display(
@@ -223,7 +226,6 @@ def run_agent(
223226
agent_config.use_spec_info,
224227
agent_config.use_lint_info,
225228
)
226-
227229
with multiprocessing.Manager() as manager:
228230
update_queue = manager.Queue()
229231
with multiprocessing.Pool(processes=max_parallel_repos) as pool:

0 commit comments

Comments
 (0)