Open allynt opened 4 years ago
started writing this code:
import functools from .conf import app_settings def conditional_task(task_fn): @functools.wraps(task_fn) def conditional_task_wrapper(*args, **kwargs): if not app_settings.ASTROSAT_TASKS_ENABLE_CELERY: return None task_fn(*args, **kwargs) return conditional_task_wrapper
But noted that the task still ran, it just didn't do anything if ASTROSAT_TASKS_ENABLE_CELERY was False.
ASTROSAT_TASKS_ENABLE_CELERY
False
Instead I can use a post_save signal on TaskSettings to somehow trigger disabling celery... maybe by re-configuring the celery app?
post_save
TaskSettings
This is too f#@$ng! hard for now. I can just disable periodic tasks explicitly in the db and not run tasks manually via the management command and API.
started writing this code:
But noted that the task still ran, it just didn't do anything if
ASTROSAT_TASKS_ENABLE_CELERY
wasFalse
.Instead I can use a
post_save
signal onTaskSettings
to somehow trigger disabling celery... maybe by re-configuring the celery app?