-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
temp: Possible repro branch for DD trace concatenation
- Convert `/heartbeat` view into a celery test - Send Celery tasks to a broker, rather than running in-process - Hardcode a broker URL - Log all celery signals See edx/edx-arch-experiments#692
- Loading branch information
Showing
3 changed files
with
34 additions
and
23 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
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 |
---|---|---|
|
@@ -21,10 +21,34 @@ | |
|
||
# WARNING: Do not refer to this unless you are cms.celery or | ||
# lms.celery. See module docstring! | ||
APP = Celery('proj') | ||
APP = Celery('proj', broker="redis://:[email protected]:6379/10") | ||
|
||
APP.conf.task_protocol = 1 | ||
# Using a string here means the worker will not have to | ||
# pickle the object when using Windows. | ||
APP.config_from_object('django.conf:settings') | ||
APP.autodiscover_tasks() | ||
|
||
|
||
import celery.signals | ||
|
||
CELERY_SIGNAL_NAMES = [ | ||
'before_task_publish', | ||
'after_task_publish', | ||
'task_prerun', | ||
'task_postrun', | ||
'task_retry', | ||
'task_success', | ||
'task_failure', | ||
'task_internal_error', | ||
'task_received', | ||
'task_revoked', | ||
'task_unknown', | ||
'task_rejected', | ||
] | ||
|
||
def log_celery_signal(*args, **kwargs): | ||
print(f"⚠️⚠️⚠️ Celery signal received: {args=} {kwargs=}") | ||
|
||
for signal_name in CELERY_SIGNAL_NAMES: | ||
getattr(celery.signals, signal_name).connect(log_celery_signal, weak=False) |