30#include "reusex/core/stages.hpp"
31#include "reusex/pipeline/stages.hpp"
192 const std::filesystem::path &
project() const noexcept;
212 std::optional<JobRecord>
job(std::string_view
id)
const;
218 std::vector<JobRecord>
jobs()
const;
259 std::unique_ptr<Impl> impl_;
size_t queued_count() const
Number of jobs still waiting to start.
std::string submit(JobStage stage, std::string parameters={})
Enqueue a stage run.
bool is_busy() const
True while a job is executing.
size_t add_listener(JobListener listener)
Register a listener. Returns a token for remove_listener().
void wait_idle()
Block until the queue is empty and no job is running.
JobRunner(const JobRunner &)=delete
JobRunner(std::filesystem::path project, StageExecutor executor, JobRunnerOptions options)
As above, with an explicit job-store policy.
const std::filesystem::path & project() const noexcept
The project every job of this runner targets.
~JobRunner()
Requests cancellation of anything in flight and joins the worker.
std::vector< JobRecord > jobs() const
Snapshot of every retained job, most recently submitted first.
void remove_listener(size_t token)
Unregister a listener. Safe to call with an unknown token.
JobRunner(std::filesystem::path project, StageExecutor executor=default_stage_executor())
WriterLease try_acquire_writer(std::chrono::milliseconds timeout)
Try to take the project's exclusive writer lock, giving up after timeout.
bool cancel(std::string_view id)
Request cancellation.
std::optional< JobRecord > job(std::string_view id) const
Snapshot of one job, or nullopt if the id is unknown or evicted.
JobRunner & operator=(const JobRunner &)=delete
std::function< void(const JobEvent &)> JobListener
Listener callback.
std::optional< JobStatus > parse_job_status(std::string_view name)
Parse a canonical status name. Returns nullopt for an unknown name.
std::string_view to_string(JobStatus status)
Canonical lower-case status name used on the wire.
JobStage
A pipeline stage that can be executed as a job.
@ clouds
back-project sensor frames into "cloud" + "normals"
StageExecutor default_stage_executor()
The executor that actually runs the pipeline (a thin wrap of run_stage).
std::function< StageResult(const StageContext &)> StageExecutor
Stage execution strategy.
std::string iso8601_utc_now()
UTC timestamp in ISO-8601 form (e.g. "2026-09-08T11:22:33Z").
JobStatus
Lifecycle of a submitted job.
std::unique_lock< std::timed_mutex > WriterLease
Exclusive right to write to a runner's project.
bool is_terminal(JobStatus status)
True for statuses a job can never leave.
One notification about a job.
std::string timestamp
ISO-8601 UTC.
uint64_t sequence
Monotonic emission order, starting at 1.
@ started
Picked up by the worker.
@ progress
Progress counters changed (throttled).
@ submitted
Accepted onto the queue.
@ finished
Reached a terminal status.
A job as reported by the runner. Snapshot; never a live view.
std::string submitted_at
ISO-8601 UTC.
size_t progress_total
0 = indeterminate.
std::string started_at
ISO-8601 UTC; empty while queued.
std::string error
Failure reason; empty unless status == failed.
std::string parameters
JSON object as submitted ("" = defaults).
core::Stage progress_stage
Live progress, mirrored from the stage's core::ProgressObserver.
std::vector< StageArtifact > result_outputs
std::string finished_at
ISO-8601 UTC; empty until terminal.
std::string result_summary
The stage's own summary of what it produced, and the artifacts it wrote.
std::string id
Opaque server-generated identifier (GUID).
Tuning knobs for the job store.
size_t max_terminal_jobs
Terminal (succeeded/failed/cancelled) jobs retained before the oldest are dropped.