forked from uncloud/uncloud
Fix the config task
This commit is contained in:
parent
8f83679c48
commit
689375a2fe
2 changed files with 10 additions and 5 deletions
|
|
@ -3,11 +3,16 @@ from celery.result import AsyncResult
|
|||
|
||||
from .models import UncloudTask
|
||||
|
||||
@shared_task
|
||||
def cleanup_tasks():
|
||||
print("Cleanup time")
|
||||
@shared_task(bind=True)
|
||||
def cleanup_tasks(self):
|
||||
print(f"Cleanup time from {self}: {self.request.id}")
|
||||
for task in UncloudTask.objects.all():
|
||||
print(f"Pruning {task}...")
|
||||
|
||||
if str(task.task_id) == str(self.request.id):
|
||||
print("Skipping myself")
|
||||
continue
|
||||
|
||||
res = AsyncResult(id=str(task.task_id))
|
||||
if res.ready():
|
||||
print(res.get())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue