[Feature]: Provide insight in the current schedules in Metadata
Contact Details
No response
What should we build?
For more information contact @wouter1975
Summary
Providing more details whether or not a schedule is made per workflow or task would be a good addition. The current implementation is that schedules are defined in the schedules folder in core or (surf/deployment) specific.
@scheduler(name="Validate NSO service models against subscriptions", time_unit="day", at="04:30")
def validate_nso_against_subscriptions() -> None:
if not ProcessTable.query.filter(
ProcessTable.workflow_name == "task_validate_nso_against_subscriptions",
ProcessTable.last_status not in ["completed", "aborted"],
).count():
start_process("task_validate_nso_against_subscriptions")
The information is not easily extractable from code, as the relevant task is specified by start_process("xxx"). The schedule frequency is defined by the decorator, by the keys, time_unit, at, period. This would translate to something like:
every period time_unit, like every 6 hours or based on specific time:
at at every time_unit, like at 0:10 every day
QUESTIONs:
- Can we get this information easily from the code and present this to the user in the FE, or should we consider changing this to a DB table with the bonus that adding/removing schedules is now also possible?
- Should we allow more flexibility, like 1 time only schedules?
Relevant pseudo code
Proposal from brainstorm Hans and Mark: replace schedule library with apscheduler with SQLAlchemyJobStore as data store on the postgres backend. This would require changing the programmatic interface to defining a schedule for a task, and changing scheduler.py to run apscheduler.
The benefits would be:
- Having scheduler jobs in the datastore can be accessed from the API
- It becomes possible to schedule a "one-off" task from the UI. For instance if you want to run a task at 19:00 in the evening.
- Change/disable schedules defined in the core
Scope for now:
- able to support current schedules
- store schedules in db
- make schedules available through api read-only