Commit b6c68976 authored by Mathieu Rodic's avatar Mathieu Rodic

[GIT] removed unnecessary file

parent 8b0d5632
"""This module defines three distinct decorators for scheduling.
"""
def scheduled_now(func):
"""Provides a decorator to execute the task right away.
Mostly useful for debugging purpose.
"""
return func
import threading
def scheduled_thread(func):
"""Provides a decorator to schedule a task as a new thread.
Problem: a shutdown may lose the task forever...
"""
def go(*args, **kwargs):
thread = threading.Thread(target=func, args=args, kwargs=kwargs)
thread.start()
return go
from celery import shared_task
def scheduled_celery(func):
"""Provides a decorator to schedule a task with Celery.
"""
@shared_task
def _func(*args, **kwargs):
func(*args, **kwargs)
def go(*args, **kwargs):
_func.apply_async(args=args, kwargs=kwargs)
return go
from gargantext.settings import DEBUG
if DEBUG == True:
# scheduled = scheduled_now
scheduled = scheduled_thread
else:
scheduled = scheduled_celery
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment