[yocto] [layerindex-web][PATCH v2] Asynchronous email notifications, task execution

Paul Eggleton paul.eggleton at linux.intel.com
Thu Aug 24 15:36:25 PDT 2017


Hi Diana,

On Thursday, 24 August 2017 12:58:38 PM NZST Diana Thayer wrote:
> This patch adds asynchronous task execution using a Celery backend
> and RabbitMQ task queue.
> 
> It updates the README to reflect the installation and configuration
> of a basic RabbitMQ setup, adds a 'tasks.py' file to contain task
> definitions, updates the 'edit_layer_view' function to send
> emails to administrators about new and updated layers asynchronously,
> and modifies the 'settings.py' to include a default configuration
> for a RabbitMQ connection.

This summarises what the patch does, which is useful, but it misses out the
most important bit - why we're making this change, i.e. to allow layer
submission process to proceed even in the event that sending the notification
email fails, and establishing an asynchronous execution mechanism that we can
use in future e.g. for triggering parse operations from the web UI. If you
could also include a reference to the bug in the form [YOCTO #11197] that
would be great.

Please also add your Signed-off-by which is missing.

One other comment below.

>....
> --- a/layerindex/views.py
> +++ b/layerindex/views.py
> @@ -19,7 +19,6 @@ from layerindex.forms import EditLayerForm, LayerMaintainerFormSet, EditNoteForm
>  from django.db import transaction
>  from django.contrib.auth.models import User, Permission
>  from django.db.models import Q, Count, Sum
> -from django.core.mail import EmailMessage
>  from django.template.loader import get_template
>  from django.template import Context
>  from django.utils.decorators import method_decorator
> @@ -28,6 +27,7 @@ from django.contrib import messages
>  from reversion.models import Revision
>  from . import utils
>  from . import simplesearch
> +from . import tasks
>  import settings
>  from django.dispatch import receiver
>  import reversion
> @@ -163,7 +163,7 @@ def edit_layer_view(request, template_name, branch='master', slug=None):
>                      # Send email
>                      plaintext = get_template('layerindex/submitemail.txt')
>                      perm = Permission.objects.get(codename='publish_layer')
> -                    users = User.objects.filter(Q(groups__permissions=perm) | Q(user_permissions=perm) ).distinct()
> +                    users = User.objects.filter(Q(groups__permissions=perm) | Q(user_permissions=perm) | Q(is_superuser=True)).distinct()

I forgot to mention this earlier - can you make this a separate patch? It's not
directly related. (It was mostly intentional, but I can see that it's a permission
and therefore it can be argued that a superuser should logically have it, so
I'm OK with it.)

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the yocto mailing list