Workers
Scraper orchestrator
Coordinates scraper runs end to end. Spawns scraper jobs, tracks their lifecycle, polls for completion, pulls datasets back, routes rows to the right workspace and skill run. Hosts two workflow classes: ScraperOrchestrator (the master) and PollerWorkflow (the per-run watcher).
Updated today
Overview
At a glance
- Worker
orchestrator- Workflows
- ScraperOrchestrator (master), PollerWorkflow (per-run)
- D1
ultron-scrapes- Reads
- Scrape platform API to spawn runs and pull datasets
- Writes
- scrape_runs, scrape_items, scrape_events
Without an orchestrator, every caller would have to handle actor IDs, dataset polling, webhook payloads, and retry policy themselves. The orchestrator centralises that. A skill that needs lead data calls orchestrator with a brief; the orchestrator picks the actors, spawns them, watches them, and pushes rows back when they finish.
Worker shape
wrangler.toml (key bindings)toml
ScraperOrchestrator
The master workflow.
src/scraper.ts (concept)ts
PollerWorkflow
Per-actor-run watcher with sleep + retry.
src/poller.ts (concept)ts
Note
The webhook from the scraper platform also routes through the scraper-webhook worker, which can signal an early completion event into the orchestrator. The poller is the backstop: it ensures the orchestrator advances even when the webhook is lost.
Input shape
POST /runsjson
Run lifecycle
| State | Meaning |
|---|---|
| queued | Header inserted, child runs not yet spawned |
| spawning | Calling the scraper platform to start each run |
| running | All children spawned, pollers active |
| partial | At least one child failed; others still running |
| succeeded | All children succeeded, dataset rows ingested |
| failed | All children failed |
| timed_out | Backstop poller cap reached without any final status |
File map
cf-workers/orchestrator
wrangler.toml
src
index.ts
scraper.tsScraperOrchestrator class
poller.tsPollerWorkflow class
platform.tsspawnActorRun + readActorRunStatus + readDatasetId
ingest.tsingestDataset into ultron-scrapes
migrations
0001_scrape_runs.sql
0002_scrape_items.sql
0003_scrape_events.sql