start_rank_job: Start a background ranking job for a project

View source: R/async.R

start_rank_jobR Documentation

Start a background ranking job for a project

Description

Spawns a callr::r_bg subprocess that loads the project's records, criteria, and ensemble from disk and runs rank_records(). Returns immediately with a handle the caller can poll or cancel.

Usage

start_rank_job(
  project,
  ensemble = default_ensemble(),
  sample_size = NULL,
  random_sample = TRUE,
  seed = 1L,
  force = FALSE
)

Arguments

project

Project name.

ensemble

A screenllm_ensemble object. Saved into the project directory so the worker can read it.

sample_size

Optional integer. If supplied and less than the number of records, the worker samples sample_size records before ranking. NULL (default) or 0 = all records.

random_sample

If sampling, whether to draw at random (default TRUE) or take the first sample_size rows.

seed

Random seed used when random_sample = TRUE.

force

If TRUE, skip the concurrent-job safety check (which aborts when the project's progress file was updated within the last 60 s, suggesting another rank worker is live). Use when you're sure the previous run is dead – e.g. after a force-quit R session – and want to take over the project.

Details

Optionally sub-samples the records so the worker only ranks n of them. This is the mechanism the Shiny app uses for "quick pilot" runs against a real Ollama backend: same code path as a full rank, just fewer records.

Value

A list with pid (the worker PID) and handle (the callr process object).


screenllm documentation built on Sept. 24, 2026, 5:11 p.m.