Ejemplo n.º 1
0
def insert_data_to_database(data, queue=None):
    if queue is None:
        queue = settings.USE_QUEUE

    if queue:
        delay(insert_data_to_database, data, queue=False)
    else:
        try:
            Group.objects.from_kwargs(**data)
        except (InvalidInterface, InvalidData), e:
            raise APIError(e)
Ejemplo n.º 2
0
def insert_data_to_database(data):
    delay(really_insert_data, data)
Ejemplo n.º 3
0
            return

        event.group = group

        for view in views:
            group.views.add(view)

        # save the event unless its been sampled
        if not is_sample:
            event.save()

        transaction.commit_unless_managed(using=group._state.db)

        if settings.USE_SEARCH:
            try:
                delay(index_event, event)
            except Exception, e:
                transaction.rollback_unless_managed(using=group._state.db)
                logger.exception(u'Error indexing document: %s', e)

        if is_new:
            try:
                regression_signal.send(sender=self.model, instance=group)
            except Exception, e:
                transaction.rollback_unless_managed(using=group._state.db)
                logger.exception(u'Error sending regression signal: %s', e)

        send_group_processors(group=group, event=event, is_new=is_new, is_sample=is_sample)

        return event