Read big boards within the agents' reach: countries and remote from the enabled agents, Europe for favourites, filtered at the source by six hosts
app/jobs/reach.py derives each board's reach once per pull and the pull hands it to the runner through the batch payload. SmartRecruiters, Eightfold and SuccessFactors filter one country a request, Phenom a list, Workday and Oracle by host ids from facets. Remote beside countries is a series of its own, since two facets intersect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3adafd8950
commit
3462a4abe7
17 files changed
+1324
-116
No files matched your search
+19
-8
@@ -17,8 +17,8 @@ cap) stores what it read and closes nothing; a paged board over the page cap
|
||||
is swept across pulls and closes once the sweep reached its end (see
|
||||
`plugins/readers/_runner.py`).
|
||||
|
||||
A board read with a filter (`ats:filtered:<target>`, from its subscription's
|
||||
`params`) lists only the roles in reach, so its close keeps open the roles a
|
||||
A board read with a filter (`ats:filtered:<target>`, from the agents' reach,
|
||||
`app.jobs.reach`, or its subscription's `params`) lists only the roles in reach, so its close keeps open the roles a
|
||||
person acted on: those with a vote or an application (`_close_unlisted`). A
|
||||
filtered read, or one of a reader that declares `empty="suspect"`, that lists
|
||||
under a tenth of what the same read listed last time is recorded by the
|
||||
@@ -51,6 +51,7 @@ from typing import Any
|
||||
from pipeline import NULL, RunContext, Tally, Task, job
|
||||
|
||||
from app.config import Config
|
||||
from app.jobs.reach import reaches
|
||||
from app.models import company_key
|
||||
from app.storage import Store
|
||||
|
||||
@@ -131,8 +132,8 @@ def _boards(config: Config, store: Store, run: str = "") -> list[dict[str, Any]]
|
||||
its own, and queues nothing when another run is in flight. A run with
|
||||
nothing to read is settled here, since no settle will see a batch of it."""
|
||||
seed_searches(config, store)
|
||||
targets = [(source, [s.target for s in store.subscriptions(source=source, fetchable=True)])
|
||||
for source in SOURCES]
|
||||
subs = {source: store.subscriptions(source=source, fetchable=True) for source in SOURCES}
|
||||
targets = [(source, [s.target for s in subs[source]]) for source in SOURCES]
|
||||
if not any(found for _, found in targets):
|
||||
if run:
|
||||
release_run(store, run)
|
||||
@@ -142,13 +143,20 @@ def _boards(config: Config, store: Store, run: str = "") -> list[dict[str, Any]]
|
||||
log.warning("pull: %s since %s; this one reads nothing", ALREADY_RUNNING,
|
||||
running(store))
|
||||
return []
|
||||
return [{"targets": found[i:i + BATCH_SIZE], "source": source, "run": run}
|
||||
for source, found in targets for i in range(0, len(found), BATCH_SIZE)]
|
||||
# The agents' reach, once per run, each board's in its batch (`app.jobs.reach`).
|
||||
reach_of = reaches(store, subs["ats"])
|
||||
batches = [{"targets": found[i:i + BATCH_SIZE], "source": source, "run": run}
|
||||
for source, found in targets for i in range(0, len(found), BATCH_SIZE)]
|
||||
for batch in batches:
|
||||
if batch["source"] == "ats":
|
||||
batch["reach"] = {t: reach_of[t] for t in batch["targets"] if t in reach_of}
|
||||
return batches
|
||||
|
||||
|
||||
@job("pull_batch", "Reading boards", resource="http")
|
||||
def run_batch(config: Config, store: Store, *, targets: list[str], source: str = "ats",
|
||||
run: str = "", context: RunContext = NULL) -> dict[str, Any]:
|
||||
run: str = "", reach: dict[str, Any] | None = None,
|
||||
context: RunContext = NULL) -> dict[str, Any]:
|
||||
"""Fetch this batch's boards or searches and `upsert_role` every item
|
||||
they list.
|
||||
|
||||
@@ -163,7 +171,9 @@ def run_batch(config: Config, store: Store, *, targets: list[str], source: str =
|
||||
|
||||
`run` is the marker of the run that queued this batch, handed to the
|
||||
plugin as its `run` option, so its stamps belong to that run whatever the
|
||||
stored marker says by the time the batch runs.
|
||||
stored marker says by the time the batch runs. `reach` is `target ->` the
|
||||
reach the run computed for a board (`app.jobs.reach`), handed to the
|
||||
plugin as its `reach` option.
|
||||
"""
|
||||
from plugins.ats import ATSSource
|
||||
from plugins.search import SearchSource
|
||||
@@ -189,6 +199,7 @@ def run_batch(config: Config, store: Store, *, targets: list[str], source: str =
|
||||
options["boards"] = [{"url": target, "label": sub.company or sub.label,
|
||||
"params": sub.params}]
|
||||
options["keys"] = dict(config.sources.get("search") or {})
|
||||
options["reach"] = (reach or {}).get(target)
|
||||
plugin = ATSSource(options)
|
||||
plugin.state = store.state
|
||||
for item in plugin.fetch():
|
||||
|
||||
Reference in new issue
Block a user