Merge branch 'worktree-agent-ac3c9345edd29a1c6'
# Conflicts: # app/cli.py # app/jobs/sources.py # app/static/app.css # app/static/companies.js # app/web/api.py # tests/test_web.py
This commit is contained in:
commit
c6246af994
21 files changed
+1017
-155
No files matched your search
+29
-11
@@ -87,7 +87,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
discover.add_argument("--add", action="store_true",
|
||||
help="add or update the company: its board when one is readable, "
|
||||
"else the host it runs on")
|
||||
companies_sub.add_parser("check", help="report boards that do not answer")
|
||||
companies_sub.add_parser("check", help="report boards that do not answer, now or in the pull")
|
||||
|
||||
searches = sub.add_parser("searches", help="saved searches on cross-company job boards")
|
||||
searches_sub = searches.add_subparsers(dest="action", required=True)
|
||||
@@ -185,8 +185,17 @@ def run_job(args: argparse.Namespace) -> int:
|
||||
bootstrap=jobs.BOOTSTRAP, bootstrap_arg=str(config.path or ""),
|
||||
tz=config.timezone, schedules=False)
|
||||
if chained or args.kind not in JOBS:
|
||||
task_id = queue.start_task(cascade.chain(args.kind) if chained
|
||||
else TASKS[args.kind]())
|
||||
first = cascade.chain(args.kind) if chained else TASKS[args.kind]()
|
||||
if args.kind == "pull":
|
||||
# The same claim the `pull` job makes, so a pull here and one in
|
||||
# the server's worker cannot both fetch.
|
||||
run = jobs.pull.claim_run(store)
|
||||
if not run:
|
||||
print(json.dumps({"task": "pull", "result": jobs.pull.ALREADY_RUNNING,
|
||||
"running": jobs.pull.running(store)}))
|
||||
return 1
|
||||
first = cascade.pull_chain(run)
|
||||
task_id = queue.start_task(first)
|
||||
queue.drain()
|
||||
started = queue.jobs.of_task(task_id)
|
||||
if not started:
|
||||
@@ -333,19 +342,28 @@ def detach_board(store: Store, key: str) -> int:
|
||||
|
||||
def check_companies(store: Store) -> int:
|
||||
"""`app companies check`: every `ats` board, fetched once. Prints a
|
||||
line per board that did not answer and exits 1 if any did not."""
|
||||
from plugins.ats import fetch_board
|
||||
line per board that did not answer now, answered incompletely, or has
|
||||
been failing in the pull, with what the pull recorded beside the live
|
||||
result, and exits 1 if any did not answer now."""
|
||||
from app import jobs
|
||||
from plugins.ats import failure_reason, fetch_board
|
||||
|
||||
subs = [s for s in store.subscriptions(source="ats") if s.show]
|
||||
dead = []
|
||||
failing = jobs.pull.failing_boards(store)
|
||||
dead = 0
|
||||
for sub in subs:
|
||||
try:
|
||||
fetch_board(sub.target)
|
||||
rows, complete = fetch_board(sub.target)
|
||||
live = f"{len(rows)} roles" + ("" if complete else ", incomplete")
|
||||
except Exception as exc:
|
||||
dead.append((sub.target, sub.label, str(exc)))
|
||||
for target, label, reason in dead:
|
||||
print(f"{target} ({label}): {reason}")
|
||||
print(f"checked {len(subs)} boards, {len(dead)} dead")
|
||||
complete, live = False, f"not answering: {failure_reason(exc)}"
|
||||
dead += 1
|
||||
since, reason = failing.get(sub.target, ("", ""))
|
||||
if complete and not since:
|
||||
continue
|
||||
stored = f"pull: failing since {since[:10]}: {reason}" if since else "pull: answering"
|
||||
print(f"{sub.target} ({sub.label}): now {live}; {stored}")
|
||||
print(f"checked {len(subs)} boards, {dead} dead, {len(failing)} failing in the pull")
|
||||
return 1 if dead else 0
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user