Recheck a board's size from the Companies row, the route and app companies size
POST /api/sources/{id}/size sizes the board again, keeps the day and queues a pull; /api/companies returns size and size_checked, and the row shows "999 roles · checked 30 Sep" with Recheck beside Change. app companies size <key> does the same from the CLI, and --missing sizes every board without a size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a0882e9659
commit
6085017943
5 files changed
+209
-5
No files matched your search
+45
-1
@@ -3,7 +3,7 @@
|
||||
app serve [--host H] [--port P] [--reload]
|
||||
app job pull|extract|embed|score [--payload JSON]
|
||||
app worker [--workers http=8,cpu=1] [--until-idle]
|
||||
app companies seed|add|edit|checked|remove|by-hand|set-board|detach|discover|check
|
||||
app companies seed|add|edit|checked|remove|by-hand|set-board|detach|discover|check|size
|
||||
app searches add|list|remove
|
||||
app agents list|prompt
|
||||
app stages [extract|summarise on|off]
|
||||
@@ -32,6 +32,7 @@ from typing import TYPE_CHECKING, Any
|
||||
from app import config as config_mod
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from app.models import Subscription
|
||||
from app.storage import Store
|
||||
|
||||
#: The one plugin this app ships lives outside the `app` package, in
|
||||
@@ -118,6 +119,10 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
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, now or in the pull")
|
||||
size = companies_sub.add_parser(
|
||||
"size", help="size a company's board again, or --missing every board without a size")
|
||||
size.add_argument("key", nargs="?", default="", help="the company key, e.g. infineon")
|
||||
size.add_argument("--missing", action="store_true", help="every board with no size yet")
|
||||
|
||||
searches = sub.add_parser("searches", help="saved searches on cross-company job boards")
|
||||
searches_sub = searches.add_subparsers(dest="action", required=True)
|
||||
@@ -335,6 +340,8 @@ def run_companies(args: argparse.Namespace) -> int:
|
||||
return detach_board(store, args.key)
|
||||
if args.action == "discover":
|
||||
return discover_company(store, args.name, args.domain, add=args.add)
|
||||
if args.action == "size":
|
||||
return size_boards(store, args.key, missing=args.missing)
|
||||
return check_companies(store)
|
||||
|
||||
|
||||
@@ -503,6 +510,43 @@ def detach_board(store: Store, key: str) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def size_boards(store: Store, key: str, *, missing: bool) -> int:
|
||||
"""`app companies size infineon`: size its board again and keep it, as
|
||||
the Companies row's Recheck does, and print the size and what a pull asks
|
||||
the board for. `--missing` sizes every board shown that has no size yet,
|
||||
a line each, and exits 1 if any did not answer. The next pull reads a
|
||||
board so; nothing is queued from here."""
|
||||
from app import jobs
|
||||
|
||||
if bool(key) == missing:
|
||||
print("companies size: name a company key, or --missing", file=sys.stderr)
|
||||
return 2
|
||||
if missing:
|
||||
subs = [s for s in store.subscriptions(source="ats") if s.show]
|
||||
known = jobs.reach.sizes(store, subs)
|
||||
subs = [s for s in subs if s.target not in known]
|
||||
else:
|
||||
sub = store.company_subscription(key)
|
||||
if sub is None or not sub.show:
|
||||
print(f"companies size: {key!r} has no board", file=sys.stderr)
|
||||
return 1
|
||||
subs = [sub]
|
||||
sized: list[tuple[Subscription, int]] = []
|
||||
for sub in subs:
|
||||
try:
|
||||
sized.append((sub, jobs.sources.size_board(store, sub.target)))
|
||||
except ValueError as exc:
|
||||
print(f"companies size: {exc}", file=sys.stderr)
|
||||
plan = jobs.reach.plan(store, [sub for sub, _size in sized])
|
||||
for sub, size in sized:
|
||||
print(json.dumps({"board": sub.target, "size": size,
|
||||
"reach": jobs.reach.line(plan, sub)}))
|
||||
dead = len(subs) - len(sized)
|
||||
if missing:
|
||||
print(f"sized {len(sized)} of {len(subs)} boards without a size")
|
||||
return 1 if dead else 0
|
||||
|
||||
|
||||
def check_companies(store: Store) -> int:
|
||||
"""`app companies check`: every `ats` board, fetched once. Prints a
|
||||
line per board that did not answer now, answered incompletely, or has
|
||||
|
||||
Reference in new issue
Block a user