first commit
This commit is contained in:
29
app/tasks/example_task.py
Normal file
29
app/tasks/example_task.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user