Files
DjangoVue3Admin/backend/app_crontab/tasks.py
T
2025-03-16 14:25:27 +08:00

28 lines
629 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Time: 2023/11/21 15:37
Author: 公众号【布鲁的Python之旅】,【github】https://github.com/taskPyroer, 【gitee】https://gitee.com/hu_yupeng123/projects
Version: V 0.1
File: tasks
Describe:
"""
from application.celery import app
from celery import shared_task
@app.task(bind=True)
def cron_job_test(self):
print(self.request)
return "cron_job_test running"
@shared_task
def cron_job_add(x, y):
print("cron_job_add running")
return f"cron_job_add running: {x + y}"
@shared_task
def cron_job_mul(x, y):
print("cron_job_mul running")
return f"cron_job_mul running: {x * y}"