diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2015-01-30 11:39:20 +0100 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2015-01-30 11:39:20 +0100 |
commit | 11568221224bb8d5f46eb45d681d0e51317f1ae3 (patch) | |
tree | 817c0b4fd9406d6d39fa5b973e6054f1e3411b83 | |
parent | 8da13f62bcfdf734e835daf9592f0e1812ddf374 (diff) |
More celery tweak.
* Use redis as result backend instead of mongodb (faster).
* Store results for some operations.
Change-Id: Idc12a26d1ae7ba2bceae7251e9dd068f5ca417f8
-rw-r--r-- | app/taskqueue/celeryconfig.py | 7 | ||||
-rw-r--r-- | app/taskqueue/tasks.py | 21 |
2 files changed, 17 insertions, 11 deletions
diff --git a/app/taskqueue/celeryconfig.py b/app/taskqueue/celeryconfig.py index 0e2fd0e..2c21dba 100644 --- a/app/taskqueue/celeryconfig.py +++ b/app/taskqueue/celeryconfig.py @@ -29,8 +29,5 @@ CELERY_TIMEZONE = "UTC" CELERY_ENABLE_UTC = True CELERY_IGNORE_RESULT = True CELERY_DISABLE_RATE_LIMITS = True -CELERY_RESULT_BACKEND = "mongodb://localhost" -CELERY_MONGODB_BACKEND_SETTINGS = { - "database": "celery-kernelci", - "taskmeta_collection": "celery-results" -} +# Use a different DB than the redis default one. +CELERY_RESULT_BACKEND = "redis://localhost/1" diff --git a/app/taskqueue/tasks.py b/app/taskqueue/tasks.py index 130513e..c3cbf30 100644 --- a/app/taskqueue/tasks.py +++ b/app/taskqueue/tasks.py @@ -74,7 +74,7 @@ def import_boot(json_obj, db_options): utils.bootimport.import_and_save_boot(json_obj, db_options) -@taskc.app.task(name="batch-executor") +@taskc.app.task(name="batch-executor", ignore_result=False) def execute_batch(json_obj, db_options): """Run batch operations based on the passed JSON object. @@ -87,7 +87,7 @@ def execute_batch(json_obj, db_options): return utils.batch.common.execute_batch_operation(json_obj, db_options) -@taskc.app.task(name="boot-bisect") +@taskc.app.task(name="boot-bisect", ignore_result=False) def boot_bisect(doc_id, db_options, fields=None): """Run a boot bisect operation on the passed boot document id. @@ -103,7 +103,7 @@ def boot_bisect(doc_id, db_options, fields=None): return bootb.execute_boot_bisection(doc_id, db_options, fields) -@taskc.app.task(name="boot-bisect-compare-to") +@taskc.app.task(name="boot-bisect-compare-to", ignore_result=False) def boot_bisect_compared_to(doc_id, compare_to, db_options, fields=None): """Run a boot bisect operation compared to the provided tree name. @@ -122,7 +122,7 @@ def boot_bisect_compared_to(doc_id, compare_to, db_options, fields=None): doc_id, compare_to, db_options, fields) -@taskc.app.task(name="defconfig-bisect") +@taskc.app.task(name="defconfig-bisect", ignore_result=False) def defconfig_bisect(doc_id, db_options, fields=None): """Run a defconfig bisect operation on the passed defconfig document id. @@ -138,7 +138,10 @@ def defconfig_bisect(doc_id, db_options, fields=None): return defconfigb.execute_defconfig_bisection(doc_id, db_options, fields) -@taskc.app.task(name="schedule-boot-report", acks_late=True, track_started=True) +@taskc.app.task( + name="schedule-boot-report", + acks_late=True, + track_started=True) def schedule_boot_report(json_obj, db_options, mail_options, countdown): """Schedule a second task to send the boot report. @@ -184,7 +187,11 @@ def schedule_boot_report(json_obj, db_options, mail_options, countdown): "cannot be sent", job, kernel) -@taskc.app.task(name="send-boot-report", acks_late=True, track_started=True) +@taskc.app.task( + name="send-boot-report", + acks_late=True, + track_started=True, + ignore_result=False) def send_boot_report(job, kernel, lab_name, to_addrs, db_options, mail_options): """Create the boot report email and send it. @@ -202,6 +209,7 @@ def send_boot_report(job, kernel, lab_name, to_addrs, db_options, mail_options): :type mail_options: dict """ utils.LOG.info("Preparing boot report email for '%s-%s'", job, kernel) + status = 400 body, subject = utils.report.create_boot_report( job, kernel, lab_name, db_options=db_options) @@ -212,6 +220,7 @@ def send_boot_report(job, kernel, lab_name, to_addrs, db_options, mail_options): to_addrs, subject, body, mail_options) utils.report.save_report( job, kernel, models.BOOT_REPORT, status, errors, db_options) + return status def run_batch_group(batch_op_list, db_options): |