Files
boilerplate/app/tasks/example_task.py
2025-11-06 02:10:05 -06:00

30 lines
873 B
Python

# tasks/example_task.py
import logging
logger = logging.getLogger(__name__)
from utils.settings import get_settings
# ----------------------
# TASK CONFIG
# ----------------------
TASK_CONFIG = {
"name": "ExampleTask", # Name of the task
"cron": "*/1 * * * *", # Runs every minute (crontab format) (note the day is actually -1 from cron per APschedule docs)
"enabled": True, # If False, task is ignored
"run_when_loaded": True # If True, runs immediately on scheduler start
}
# ----------------------
# TASK LOGIC
# ----------------------
def main():
settings = get_settings()
"""
This is the entry point of the task.
TasksMaster will call this function based on the cron schedule.
"""
logger.info(f"ExampleTask is running! - Setting: {settings.app.name} was found!")
# Your task logic here