R6 class that manages a queue of Missions and executes them within a concurrency limit. Provides full observability via status summaries and stall detection through reconcile().
pending_queueList of Mission objects waiting to run.
runningList of Mission objects currently executing.
completedList of Mission objects that have finished.
max_concurrentMaximum simultaneous missions. Default 3.
global_sessionOptional SharedSession shared across all missions.
global_modelDefault model ID for missions that don't specify one.
async_handleslist of callr::r_bg handles (for run_async).
new()Initialize a new MissionOrchestrator.
MissionOrchestrator$new(max_concurrent = 3, model = NULL, session = NULL)max_concurrentMaximum simultaneous missions. Default 3.
modelOptional default model for all missions.
sessionOptional shared SharedSession.
submit()Submit a Mission to the orchestrator queue.
MissionOrchestrator$submit(mission)missionA Mission object.
Invisible self for chaining.
run_all()Run all submitted missions respecting the concurrency limit.
MissionOrchestrator$run_all(model = NULL)modelOptional model override for all missions in this run.
Missions are executed in batches of max_concurrent. Within each batch, missions run in parallel (via parallel::mclapply on Unix, sequentially on Windows). Completed missions are moved to $completed.
Invisibly returns the list of completed Mission objects.
run_async()Run a single Mission asynchronously in a background process.
MissionOrchestrator$run_async(mission, model = NULL)missionA Mission object.
modelOptional model override.
Uses callr::r_bg to launch the mission in a separate R process. The mission state is serialized to a temp file, executed, and the result is written back. Call $poll_async() to check completion.
A list with $handle (callr process), $mission_id, $checkpoint_path.
poll_async()Poll all async handles and collect completed missions.
MissionOrchestrator$poll_async()Named list with completed (list of Mission objects) and
still_running (integer count).
reconcile()Stall detection: check for missions that appear stuck.
MissionOrchestrator$reconcile(stall_threshold_secs = 600)stall_threshold_secsMissions running longer than this are flagged. Default 600 (10 minutes).
list of stalled mission IDs.
status()Get a status summary of all missions.
MissionOrchestrator$status()A data.frame with id, goal, status, n_steps columns.
clone()The objects of this class are cloneable with this method.
MissionOrchestrator$clone(deep = FALSE)deepWhether to make a deep clone.