Cloned DMOJ
This commit is contained in:
parent
f623974b58
commit
49dc9ff10c
513 changed files with 132349 additions and 39 deletions
25
judge/tasks/demo.py
Normal file
25
judge/tasks/demo.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import time
|
||||
|
||||
from celery import shared_task
|
||||
|
||||
from judge.utils.celery import Progress
|
||||
|
||||
__all__ = ('success', 'failure', 'progress')
|
||||
|
||||
|
||||
@shared_task
|
||||
def success():
|
||||
pass
|
||||
|
||||
|
||||
@shared_task
|
||||
def failure():
|
||||
raise RuntimeError('This task always fails.')
|
||||
|
||||
|
||||
@shared_task(bind=True)
|
||||
def progress(self, seconds=10):
|
||||
with Progress(self, seconds) as p:
|
||||
for i in range(seconds):
|
||||
time.sleep(1)
|
||||
p.did(1)
|
Loading…
Add table
Add a link
Reference in a new issue