-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
529f676
commit 0eabae9
Showing
10 changed files
with
30,851 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"python.analysis.typeCheckingMode": "basic", | ||
"mypy.dmypyExecutable": "${workspaceFolder}/.venv/Scripts/dmypy.exe", | ||
"mypy.dmypyExecutable": "${workspaceFolder}/.venv/Scripts/dmypy.exe" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from __future__ import absolute_import #, unicode_literals | ||
import os | ||
from celery import Celery | ||
from celery.schedules import crontab | ||
from django.utils import timezone | ||
|
||
# set the default Django settings module for the 'celery' program. | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'contest.settings') | ||
|
||
app = Celery('contest') | ||
|
||
# Using a string here means the worker doesn't have to serialize | ||
# the configuration object to child processes. | ||
# - namespace='CELERY' means all celery-related configuration keys | ||
# should have a `CELERY_` prefix. | ||
app.config_from_object('django.conf:settings', namespace='CELERY') | ||
|
||
# 解决时区问题,定时任务启动就循环输出 | ||
# app.now = timezone.now() | ||
|
||
# Load task modules from all registered Django app configs. | ||
app.autodiscover_tasks(["contest"], "tasks") | ||
|
||
# import contest.contest.tasks | ||
|
||
app.conf.beat_schedule = { | ||
'clean-specific-time' : { | ||
'task': 'contest.tasks.auto_save_redis_to_database', | ||
'schedule': crontab() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from celery import shared_task | ||
from datetime import datetime | ||
import logging | ||
# Get an instance of a logger | ||
logger = logging.getLogger('django') | ||
|
||
|
||
@shared_task | ||
def auto_save_redis_to_database(): | ||
logger.info("HITTTT") |
Oops, something went wrong.