THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class Schedule(ISchedule): (source)
Constructor: Schedule(reactor, exception_handler, stores)
Undocumented
| Method | __add |
Add the database or redis jobstore matching the configured driver. |
| Method | __create |
Create and manage an asyncio task with automatic cleanup. |
| Async Method | __graceful |
Execute graceful shutdown of the scheduler without blocking. |
| Async Method | __handle |
Handle exceptions raised in event listeners. |
| Method | __init__ |
Initialize the Schedule instance. |
| Async Method | __load |
Retrieve and cache available command signatures from the reactor. |
| Method | __suppress |
Disable APScheduler logging to prevent log message interference. |
| Async Method | __validate |
Validate and load fluent tasks from the internal registry. |
| Method | _dispatch |
Call the registered global event listener for a scheduler event. |
| Method | _dispatch |
Dispatch registered task event listener for a specific job event. |
| Async Method | _reactor |
Execute a reactor command asynchronously. |
| Async Method | boot |
Boot the scheduler and register all configured tasks. |
| Method | command |
Add a command for fluent configuration. |
| Async Method | info |
Retrieve information about all loaded fluent tasks. |
| Method | is |
Determine if the scheduler is currently paused. |
| Method | is |
Determine if the scheduler is currently running. |
| Method | is |
Determine if the scheduler is currently stopped. |
| Method | on |
Register a listener for a scheduler event. |
| Method | pause |
Pause the scheduler if it is running. |
| Method | pause |
Pause a running task by its signature. |
| Method | remove |
Remove all tasks from the scheduler. |
| Method | remove |
Remove a task from the scheduler by its signature. |
| Method | resume |
Resume the scheduler if it is paused. |
| Method | resume |
Resume a paused task by its signature. |
| Method | shutdown |
Shut down the task scheduler safely without waiting for running tasks. |
| Method | state |
Return the current scheduler state as a string. |
| Async Method | wait |
Wait for the scheduler shutdown to complete. |
| Constant | _SCHEDULER |
Undocumented |
| Instance Variable | __available |
Undocumented |
| Instance Variable | __config |
Undocumented |
| Instance Variable | __exception |
Undocumented |
| Instance Variable | __fluent |
Undocumented |
| Instance Variable | __job |
Undocumented |
| Instance Variable | __paused |
Undocumented |
| Instance Variable | __pending |
Undocumented |
| Instance Variable | __reactor |
Undocumented |
| Instance Variable | __removed |
Undocumented |
| Instance Variable | __running |
Undocumented |
| Instance Variable | __scheduler |
Undocumented |
| Instance Variable | __scheduler |
Undocumented |
| Instance Variable | __shutdown |
Undocumented |
| Instance Variable | __state |
Undocumented |
| Instance Variable | __stores |
Undocumented |
| Instance Variable | __tasks |
Undocumented |
| Instance Variable | __tasks |
Undocumented |
| Instance Variable | __wait |
Undocumented |
Add the database or redis jobstore matching the configured driver.
stores.database/stores.redis default to None when not declared
in config, so this validates explicitly instead of letting an
AttributeError leak out of the config object when the selected
driver's dedicated section was never configured.
| Returns | |
None | This method does not return a value. It registers the corresponding jobstore on the running scheduler, if applicable. |
| Raises | |
RuntimeError | If the selected store is "database" or "redis" but its dedicated configuration section is missing. |
Execute graceful shutdown of the scheduler without blocking.
This method runs the scheduler shutdown in a thread executor to avoid blocking the event loop, then sets the shutdown event to notify any waiting tasks that shutdown is complete.
| Returns | |
None | This method does not return a value. |
IReactor, exception_handler: ICatch, stores: IScheduleStore):
(source)
¶
Initialize the Schedule instance.
| Parameters | |
reactor:IReactor | Reactor instance for command execution. |
exceptionICatch | Exception handler for managing errors. |
stores:IScheduleStore | Schedule store for managing job stores. |
| Returns | |
None | This constructor does not return a value. |
Retrieve and cache available command signatures from the reactor.
Queries the reactor for all available jobs/commands and stores their signatures in the internal set for quick lookup.
| Returns | |
None | This method does not return any value. It updates the internal set of available command signatures. |
Disable APScheduler logging to prevent log message interference.
Set APScheduler component loggers to CRITICAL level and disable message propagation to prevent internal scheduler logs from appearing in the application's logging output.
| Returns | |
None | Modifies APScheduler logging configuration in place. |
Validate and load fluent tasks from the internal registry.
Ensures that all fluent tasks have signatures available in the reactor. Populates the internal tasks dictionary with validated task entities.
| Returns | |
None | This method updates the internal tasks dictionary in place. |
Call the registered global event listener for a scheduler event.
| Parameters | |
event:APSchedulerEvent | The scheduler event that occurred. |
| Returns | |
None | This method does not return a value. It triggers the appropriate listener for the event. |
Dispatch registered task event listener for a specific job event.
| Parameters | |
event:APJobEvent | The job event that occurred. |
| Returns | |
None | This method does not return a value. It triggers the appropriate listener for the event. |
Execute a reactor command asynchronously.
Notes
This method wraps the reactor call for task execution.
| Parameters | |
signature:str | The command signature to execute. |
args:list of str, optional | Arguments to pass to the command. Defaults to an empty list. |
| Returns | |
int | The result of the reactor call, typically an exit code or status. |
Boot the scheduler and register all configured tasks.
Load available command signatures, validate and load fluent tasks, initialize the scheduler, register event listeners, and add all jobs to the scheduler.
| Returns | |
None | This method does not return a value but initializes the scheduler. |
str, args: list[ str] | None = None, purpose: str | None = None) -> ITask:
(source)
¶
Add a command for fluent configuration.
| Parameters | |
signature:str | Unique signature of the command to schedule. |
args:list[str] | None, optional | Arguments for the command. Defaults to None. |
purpose:str | None, optional | Description of the command's purpose. |
| Returns | |
ITask | Task instance for further configuration. |
| Raises | |
RuntimeError | If the scheduler has already been started. |
TypeError | If the signature is not a non-empty string or arguments are invalid. |
Determine if the scheduler is currently paused.
| Returns | |
bool | True if the scheduler state is "PAUSED", otherwise False. |
Determine if the scheduler is currently running.
| Returns | |
bool | True if the scheduler state is "RUNNING", otherwise False. |
Determine if the scheduler is currently stopped.
| Returns | |
bool | True if the scheduler state is "STOPPED", otherwise False. |
Register a listener for a scheduler event.
| Parameters | |
event:SchedulerEvent | The scheduler event to listen for. |
listener:Callable | The callable to invoke when the event occurs. |
| Returns | |
Self | The Schedule instance for method chaining. |
| Raises | |
RuntimeError | If the scheduler has already been booted. |
TypeError | If event is not a SchedulerEvent or listener is not callable. |
Pause the scheduler if it is running.
| Parameters | |
self:Schedule | The Schedule instance. |
| Returns | |
bool | True if the scheduler was successfully paused. |
| Raises | |
RuntimeError | If the scheduler is not started or not running. |
Pause a running task by its signature.
Notes
This method pauses a running task in the scheduler.
| Parameters | |
signature:str | Unique identifier of the task to pause. |
| Returns | |
bool | True if the task was successfully paused, otherwise raises an exception. |
| Raises | |
RuntimeError | If the scheduler has not been started or the task is not running. |
ValueError | If the specified task does not exist. |
Remove all tasks from the scheduler.
Notes
This method removes all tasks from the scheduler and updates internal state.
| Returns | |
bool | True if all tasks were successfully removed, otherwise raises an exception. |
| Raises | |
RuntimeError | If the scheduler has not been started or an error occurs during removal. |
Remove a task from the scheduler by its signature.
Notes
This method removes a task from the scheduler and updates internal state.
| Parameters | |
signature:str | Unique identifier of the task to remove. |
| Returns | |
bool | True if the task was successfully removed, otherwise raises an exception. |
| Raises | |
RuntimeError | If the scheduler has not been started or the task is not found. |
ValueError | If the specified task does not exist. |
Resume the scheduler if it is paused.
| Parameters | |
self:Schedule | The Schedule instance. |
| Returns | |
bool | True if the scheduler was successfully resumed. |
| Raises | |
RuntimeError | If the scheduler is not started or not paused. |
Resume a paused task by its signature.
Notes
This method resumes a paused task in the scheduler.
| Parameters | |
signature:str | Unique identifier of the task to resume. |
| Returns | |
bool | True if the task was successfully resumed, otherwise raises an exception. |
| Raises | |
RuntimeError | If the scheduler has not been started or the task is not paused. |
ValueError | If the specified task does not exist. |
Shut down the task scheduler safely without waiting for running tasks.
This method terminates the scheduler execution safely. It does not wait for currently executing tasks to complete, but prevents new tasks from starting and cleans up scheduler resources. Ideal for console environments where the process stops immediately after calling this method.
| Parameters | |
wait:int | None, optional | Time in seconds to wait before completing shutdown. Defaults to None, which keeps the previously configured grace period instead of collapsing it to zero. |
| Returns | |
None | This method does not return a value. It initiates graceful shutdown. |
| Raises | |
TypeError | If wait is neither None nor a non-negative integer (bool is
explicitly rejected even though it is technically an int subtype). |
Return the current scheduler state as a string.
| Returns | |
str | The current state of the scheduler, e.g., "RUNNING", "PAUSED", or "STOPPED". |
Wait for the scheduler shutdown to complete.
This method blocks until the shutdown process initiated by the shutdown() method has finished. It provides a way to synchronize with the graceful shutdown process.
| Returns | |
None | This method does not return a value but blocks until shutdown completes. |