ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
cron_scheduler Class Referencefinal

Coordinator for OreStudio in-process job scheduling. More...

#include <cron_scheduler.hpp>

Collaboration diagram for cron_scheduler:
Collaboration graph

Public Types

using context = ores::database::context
 

Public Member Functions

 cron_scheduler (context ctx)
 
domain::job_definition schedule (domain::job_definition def, const std::string &change_reason_code, const std::string &change_commentary)
 Persist a job definition and mark it as active.
 
void unschedule (const boost::uuids::uuid &job_definition_id, const std::string &modified_by, const std::string &change_reason_code, const std::string &change_commentary)
 Mark a job as inactive (paused).
 
std::vector< domain::job_definitionget_all_definitions ()
 All job definitions visible to the current tenant+party context.
 
std::vector< domain::job_instanceget_job_history (const boost::uuids::uuid &job_definition_id, std::size_t limit=100)
 Execution history for a specific job, newest-first.
 

Detailed Description

Coordinator for OreStudio in-process job scheduling.

Provides CRUD operations for job definitions and access to job execution history. The actual scheduling is performed by scheduler_loop; this class handles the management plane only.

Lifecycle:

  1. Registration — schedule() persists the job_definition with is_active=true.
  2. Execution — scheduler_loop fires jobs independently.
  3. Observation — get_all_definitions() / get_job_history() query our tables.

Thread safety: not thread-safe. Each request should create its own instance (or use a per-request database context).

Member Function Documentation

◆ schedule()

domain::job_definition schedule ( domain::job_definition  def,
const std::string &  change_reason_code,
const std::string &  change_commentary 
)

Persist a job definition and mark it as active.

Writes the job_definition to ores_scheduler_job_definitions_tbl with is_active=true. The in-process scheduler_loop will pick it up on the next reload.

◆ unschedule()

void unschedule ( const boost::uuids::uuid &  job_definition_id,
const std::string &  modified_by,
const std::string &  change_reason_code,
const std::string &  change_commentary 
)

Mark a job as inactive (paused).

Sets is_active=false on the current active record. The scheduler_loop will skip the job after the next reload.

◆ get_job_history()

std::vector< domain::job_instance > get_job_history ( const boost::uuids::uuid &  job_definition_id,
std::size_t  limit = 100 
)

Execution history for a specific job, newest-first.

Parameters
limitMaximum number of instances returned (default: 100).