Skip to content

Commit 4d147b8

Browse files
committed
Update code and README so that you can run cfbot scripts locally for debugging
1 parent 17bd0e0 commit 4d147b8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ On FreeBSD
4949
## Run cfbot
5050

5151
```bash
52-
./cfbot.py
52+
./cfbot_periodic_minutely.py
5353
```
5454

5555
## Debug a specific patch

cfbot_patch.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,11 @@ def reset_repo_to_good_master_commit(conn, repo_path):
319319
AND status = 'COMPLETED'
320320
ORDER BY created DESC
321321
LIMIT 1""")
322-
(good_commit_id,) = cursor.fetchone()
322+
result = cursor.fetchone()
323+
if result:
324+
(good_commit_id,) = result
325+
else:
326+
good_commit_id = "origin/master"
323327

324328
commit_id = get_commit_id(repo_path)
325329
if commit_id != good_commit_id:
@@ -328,7 +332,8 @@ def reset_repo_to_good_master_commit(conn, repo_path):
328332

329333
reset_commit_id(repo_path, good_commit_id)
330334
commit_id = get_commit_id(repo_path)
331-
assert commit_id == good_commit_id
335+
if good_commit_id != "origin/master":
336+
assert commit_id == good_commit_id
332337

333338
return commit_id
334339

@@ -494,5 +499,4 @@ def maybe_process_one(conn, cf_ids):
494499

495500
if __name__ == "__main__":
496501
with cfbot_util.db() as conn:
497-
template_repo_path = patchburner_ctl("template-repo-path").strip()
498-
print(reset_repo_to_good_master_commit(conn, template_repo_path))
502+
process_submission(conn, int(sys.argv[1]), int(sys.argv[2]))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ pg8000
22
requests
33
scipy
44
ruff
5+
setproctitle

0 commit comments

Comments
 (0)