Skip to content

API Reference parrot.scheduler.models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.scheduler.models

View source

Class CodeJobRecord

Process-local record for a @schedule-declared job (replaces the _auto_tasks dict).

Parameter Type Default Description
job_id str
target_name str
method_name str
method Callable[..., Awaitable[Any]]
schedule_type str
schedule_config dict[str, Any]
send_result Optional[dict[str, Any]] None
callbacks list[dict[str, Any]] list()
success_callback Optional[Callable[..., Any]] None
enabled bool True

Fields:

Field Type Default Description
job_id str
target_name str
method_name str
method Callable[..., Awaitable[Any]]
schedule_type str
schedule_config dict[str, Any]
send_result Optional[dict[str, Any]] None
callbacks list[dict[str, Any]] field(default_factory=list)
success_callback Optional[Callable[..., Any]] None
enabled bool True

Method CodeJobRecord.to_definition

Expose the record through the uniform API without serializing its callable.

to_definition() -> JobDefinition

Returns: JobDefinition

Class FireContext

Per-fire context; fire_id = f"{schedule_id}:{scheduled_at.isoformat()}".

Parameter Type Default Description
fire_id str
scheduled_at datetime
run_now bool False

Fields:

Field Type Default Description
fire_id str
scheduled_at datetime
run_now bool False

Method FireContext.for_fire

Build the context using the coordinator claim key's timestamp representation.

for_fire(schedule_id: str, scheduled_at: datetime, *, run_now: bool = False) -> FireContext

Parameter Type Default Description
schedule_id str
scheduled_at datetime
run_now bool False

Returns: FireContext

Attribute JOB_DEFINITION_VERSION

Type: int

Class JobDefinition

Backend-independent, JSON-serializable job definition (spec §2).

Fields:

Field Type Default Description
schedule_id str
backend Literal['db', 'redis', 'code']
target_kind str
target_name str
target_id Optional[str] None
tenant Optional[str] None
prompt Optional[str] None
method_name Optional[str] None
schedule_type str
schedule_config dict[str, Any]
metadata dict[str, Any] {}
send_result dict[str, Any] {}
callbacks list[dict[str, Any]] []
misfire_grace_time Optional[int] None
created_by Optional[int] None
created_email Optional[str] None
created_at Optional[datetime] None

Method JobDefinition.model_post_init

Set the creation timestamp when a caller did not supply one.

model_post_init(__context: Any) -> None

Parameter Type Default Description
__context Any

Class RunState

What every RunStateStore.read() returns (spec §2).

Fields:

Field Type Default Description
schedule_id str
backend str
enabled bool
last_run Optional[datetime] None
next_run Optional[datetime] None
run_count int 0
last_status Optional[str] None
last_error Optional[str] None
last_error_at Optional[datetime] None
last_result Optional[str] None
last_result_at Optional[datetime] None
consecutive_failures int 0
last_delivery_status Optional[str] None
last_delivery_at Optional[datetime] None
last_callbacks list[dict[str, Any]] []

Class ServiceSchedule

asyncdb model for navigator.service_scheduler (backend='db' rows only).

CREATE TABLE IF NOT EXISTS navigator.service_scheduler ( schedule_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), target_kind VARCHAR NOT NULL, -- agent | crew | service target_name VARCHAR NOT NULL, target_id VARCHAR, tenant VARCHAR, -- reserved; enforcement is §8 Q1 prompt TEXT, method_name VARCHAR, schedule_type VARCHAR NOT NULL, schedule_config JSONB NOT NULL, enabled BOOLEAN DEFAULT TRUE, created_by INTEGER, created_email VARCHAR, created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW(), last_run TIMESTAMPTZ, next_run TIMESTAMPTZ, run_count INTEGER DEFAULT 0, last_status VARCHAR, -- success | error | target_missing | lock_unavailable last_error TEXT, last_error_at TIMESTAMPTZ, last_result TEXT, -- _format_result(), truncated to _LAST_RESULT_MAX_CHARS last_result_at TIMESTAMPTZ, consecutive_failures INTEGER DEFAULT 0, last_delivery_status VARCHAR, last_delivery_at TIMESTAMPTZ, last_callbacks JSONB DEFAULT '[]'::JSONB, metadata JSONB DEFAULT '{}'::JSONB, -- call kwargs ONLY send_result JSONB DEFAULT '{}'::JSONB, callbacks JSONB DEFAULT '[]'::JSONB ); CREATE INDEX idx_service_scheduler_enabled ON navigator.service_scheduler(enabled); CREATE INDEX idx_service_scheduler_target ON navigator.service_scheduler(target_kind, target_name);

Attributes:

Attribute Type Description
schedule_id uuid.UUID
target_kind str
target_name str
target_id Optional[str]
tenant Optional[str]
prompt Optional[str]
method_name Optional[str]
schedule_type str
schedule_config dict
enabled bool
created_by Optional[int]
created_email Optional[str]
created_at datetime
updated_at datetime
last_run Optional[datetime]
next_run Optional[datetime]
run_count int
last_status Optional[str]
last_error Optional[str]
last_error_at Optional[datetime]
last_result Optional[str]
last_result_at Optional[datetime]
consecutive_failures int
last_delivery_status Optional[str]
last_delivery_at Optional[datetime]
last_callbacks list
metadata dict
send_result dict
callbacks list

Method ServiceSchedule.to_definition

Map a db row to a JobDefinition(backend='db', misfire_grace_time=300).

to_definition() -> JobDefinition

Returns: JobDefinition

Method ServiceSchedule.from_definition

Build a row from a definition without copying run-state columns.

from_definition(definition: JobDefinition) -> ServiceSchedule

Parameter Type Default Description
definition JobDefinition

Returns: ServiceSchedule

Class ServiceSchedule.Meta

Function schedule_fingerprint

Return the sha256 of the definition fields that affect its scheduled behavior.

schedule_fingerprint(definition: JobDefinition) -> str

Parameter Type Default Description
definition JobDefinition

Returns: str

Function utcnow

Return datetime.now(timezone.utc); the scheduler package's only clock.

utcnow() -> datetime

Returns: datetime

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally