ores.scheduler.scheduling_operations

Table of Contents

The scheduler's two operational reads, both served to the scheduler monitor view: the execution history across every job, and the live status of every job the scheduler holds.

Both are computed views rather than stored rows, which is why they are operations and not entity verbs. The instance list is a join: a stored job_instance row carries only its definition's identifier, and the view adds the job's own name and action type so a caller can render the row without a second round trip. The status view is computed twice over: it folds each definition together with its most recent instance, and it derives the next fire time by asking the cron expression. Neither shape is a row a caller addresses by key, so neither is derived from an entity.

The handlers that serve them stay hand-written beside this model, because the instance read joins two repositories and the status read evaluates cron expressions. An operation model generates no service handler.

1. Physical space

The shell commands are switched off, and the reason is the component rather than this operation: the scheduler has no part under projects/ores.shell, so a generated unit has nowhere to land. The hand-written scheduler menu answers these subjects today. Adding the shell part and then enabling the facet is the next unit of the scheduler clean-up.

2. Includes

#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <vector>

3. Messages

3.1. get_job_instances_request

/**
 * @brief Asks for a page of job executions, newest first.
 *
 * Every job the caller's tenant owns is included, so the view answers
 * "what has the scheduler been running" without naming a job first.
 */

3.1.1. offset

3.1.2. limit

3.2. job_instance_summary

/**
 * @brief One execution, with its job's display fields folded in.
 *
 * The definition identifier is the link to the job; the name and action type
 * come from the definition row so the caller does not look it up.
 */

3.2.1. id

/**
 * @brief The execution's storage key.
 */

3.2.2. job_definition_id

/**
 * @brief The job that was executed.
 */

3.2.3. job_name

/**
 * @brief The job's name, read from the definition.
 */

3.2.4. action_type

/**
 * @brief How the job was executed: =execute_sql= or =nats_publish=.
 */

3.2.5. status

/**
 * @brief The lifecycle state: =starting=, =succeeded= or =failed=.
 */

3.2.6. triggered_at

/**
 * @brief When the cron expression fired, in ISO-8601 UTC.
 */

3.2.7. started_at

/**
 * @brief When execution began, in ISO-8601 UTC.
 */

3.2.8. completed_at

/**
 * @brief When execution ended, if it has ended.
 */

3.2.9. duration_ms

/**
 * @brief How long execution took in milliseconds, if it has ended.
 */

3.2.10. error_message

/**
 * @brief Why execution failed, when it failed.
 */

3.3. get_job_instances_response

/**
 * @brief The page of executions.
 */

3.3.1. success

3.3.2. message

3.3.3. instances

3.3.4. total_available_count

3.4. get_scheduler_status_request

/**
 * @brief Asks for the live status of every job the caller can see.
 *
 * It carries no fields, because the caller's session decides the scope and
 * the scheduler holds the rest.
 */

3.5. job_schedule_status

/**
 * @brief One job's schedule and its last run, as the monitor renders it.
 */

3.5.1. job_definition_id

3.5.2. job_name

3.5.3. description

3.5.4. schedule_expression

/**
 * @brief The cron expression, as the job stores it.
 */

3.5.5. is_active

3.5.6. last_run_at

/**
 * @brief When the job last started, in ISO-8601 UTC, if it ever has.
 */

3.5.7. last_run_status

/**
 * @brief The last run's state: =starting=, =succeeded= or =failed=.
 */

3.5.8. next_fire_at

/**
 * @brief When the expression next fires, in ISO-8601 UTC.
 *
 * Absent for a paused job, and absent for an expression the evaluator
 * cannot advance.
 */

3.5.9. running_count

/**
 * @brief Executions of this job that are still starting.
 */

3.6. get_scheduler_status_response

/**
 * @brief The status of every job, with the totals the monitor shows.
 */

3.6.1. success

3.6.2. message

3.6.3. jobs

3.6.4. total_running

3.6.5. total_active

4. See also

Emacs 29.3 (Org mode 9.6.15)