Generic cron-based recurring-schedule mixin for any module that inherits from ObjData.
Provides create, list, check-due, and cancel operations against a shared def_recurring table. Each consumer module identifies itself via _recurring_module_type (e.g. TICKET, WORKFLOW, CALCULATION) so a single table serves all modules.
from ObjRecurringMixin import ObjRecurringMixin
class MyModule(ObjRecurringMixin, ObjData.ObjData):
_recurring_module_type = "MYMODULE"
def _recurring_execute(self, row: dict):
name = row.get("Name", "")
payload = row.get("Payload", "")
# ... do work ...
return {"status": "ok"}
| Column | Type | Description |
|---|---|---|
| Guid | char(50) | Primary key |
| ModuleType | varchar(50) | Consumer identifier (TICKET, WORKFLOW, etc.) |
| Package | char(255) | Package scope |
| Project | varchar(100) | Optional project scope |
| Name | varchar(255) | Schedule name (template name, workflow name, etc.) |
| CronExpression | varchar(100) | 5-field cron expression |
| NextRunDate | datetime | Next scheduled fire time |
| LastRunDate | datetime | Last execution time |
| RunCounter | int | Total executions |
| Active | char(2) | Y/N |
| Payload | text | JSON or free-text payload for the consumer |
| CreatedBy | varchar(255) | Who created the schedule |
| Method | Description |
|---|---|
recurring_create(name, cron_expression, ...) |
Create a new schedule, returns guid |
recurring_check_due() |
Find and execute all due schedules for this module type |
recurring_list(package) |
List schedules for this module type and package |
recurring_cancel(guid) |
Deactivate a schedule |
Subclasses must implement _recurring_execute(row) which receives the full def_recurring row as a dict and performs the actual work.
_recurring_module_type = "TICKET") — creates tickets from templates_recurring_module_type = "WORKFLOW") — triggers workflow execution via run_direct()