diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/handlers/__init__.py | 2 | ||||
-rw-r--r-- | app/handlers/send.py | 8 | ||||
-rw-r--r-- | app/taskqueue/celeryconfig.py | 7 | ||||
-rw-r--r-- | app/taskqueue/tasks.py | 10 | ||||
-rw-r--r-- | app/utils/report.py | 10 |
5 files changed, 28 insertions, 9 deletions
diff --git a/app/handlers/__init__.py b/app/handlers/__init__.py index a8e7208..d4302cd 100644 --- a/app/handlers/__init__.py +++ b/app/handlers/__init__.py @@ -1,2 +1,2 @@ -__version__ = "2015.1.2" +__version__ = "2015.1.3" __versionfull__ = __version__ diff --git a/app/handlers/send.py b/app/handlers/send.py index c6f9bf5..d7cf4b2 100644 --- a/app/handlers/send.py +++ b/app/handlers/send.py @@ -41,6 +41,14 @@ class SendHandler(hbase.BaseHandler): db_options = kwargs["db_options"] mail_options = self.settings["mailoptions"] + self.log.info( + "Email trigger received from IP '%s' for '%s-%s' at %s", + self.request.remote_ip, + json_obj.get("job", None), + json_obj.get("kernel", None), + datetime.datetime.utcnow() + ) + countdown = json_obj.get(models.DELAY_KEY, self.settings["senddelay"]) if countdown is None: countdown = self.settings["senddelay"] diff --git a/app/taskqueue/celeryconfig.py b/app/taskqueue/celeryconfig.py index 9624262..0e2fd0e 100644 --- a/app/taskqueue/celeryconfig.py +++ b/app/taskqueue/celeryconfig.py @@ -17,10 +17,17 @@ BROKER_URL = "redis://localhost" BROKER_POOL_LIMIT = 20 +BROKER_TRANSPORT_OPTIONS = { + "visibility_timeout": 10800, + "fanout_prefix": True, + "fanout_patterns": True +} CELERY_ACCEPT_CONTENT = ["json"] CELERY_RESULT_SERIALIZER = "json" CELERY_TASK_SERIALIZER = "json" +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 = { diff --git a/app/taskqueue/tasks.py b/app/taskqueue/tasks.py index d597ffa..130513e 100644 --- a/app/taskqueue/tasks.py +++ b/app/taskqueue/tasks.py @@ -44,7 +44,7 @@ def send_emails(job_id): pass -@taskc.app.task(name='import-job', ignore_result=True) +@taskc.app.task(name="import-job") def import_job(json_obj, db_options): """Just a wrapper around the real import function. @@ -59,7 +59,7 @@ def import_job(json_obj, db_options): utils.docimport.import_and_save_job(json_obj, db_options) -@taskc.app.task(name='import-boot', ignore_result=True) +@taskc.app.task(name="import-boot") def import_boot(json_obj, db_options): """Just a wrapper around the real boot import function. @@ -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") def execute_batch(json_obj, db_options): """Run batch operations based on the passed JSON object. @@ -138,7 +138,7 @@ 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") +@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 +184,7 @@ def schedule_boot_report(json_obj, db_options, mail_options, countdown): "cannot be sent", job, kernel) -@taskc.app.task(name="send-boot-report") +@taskc.app.task(name="send-boot-report", acks_late=True, track_started=True) def send_boot_report(job, kernel, lab_name, to_addrs, db_options, mail_options): """Create the boot report email and send it. diff --git a/app/utils/report.py b/app/utils/report.py index f21e7a9..781336f 100644 --- a/app/utils/report.py +++ b/app/utils/report.py @@ -142,9 +142,12 @@ def create_boot_report(job, kernel, lab_name, db_options): fields=BUILD_SEARCH_FIELDS) git_data = _parse_job_results(git_results) - git_commit = git_data[models.GIT_COMMIT_KEY] - git_url = git_data[models.GIT_URL_KEY] - git_branch = git_data[models.GIT_BRANCH_KEY] + if git_data: + git_commit = git_data[models.GIT_COMMIT_KEY] + git_url = git_data[models.GIT_URL_KEY] + git_branch = git_data[models.GIT_BRANCH_KEY] + else: + git_commit = git_url = git_branch = "Unknown" spec[models.STATUS_KEY] = models.OFFLINE_STATUS @@ -239,6 +242,7 @@ def create_boot_report(job, kernel, lab_name, db_options): return email_body, subject + def _parse_job_results(results): """Parse the job results from the database creating a new data structure. |