Пример #1
0
    def execute(self, results, payload):
        entity_to_retire_keys = [res['key'] for res in results]

        if len(entity_to_retire_keys):
            try:
                EmEntity.bulk_delete({'_key': entity_to_retire_keys})
                self.service.messages.create(
                    'successful-retirement-%s' % time.time(),
                    severity='info',
                    value='Successfully retired %s inactive entities.' %
                    len(entity_to_retire_keys))
            except Exception as e:
                logger.error('failed to retire entities - error: %s' % e)
Пример #2
0
 def handle_bulk_delete(self, request):
     query = self._get_entity_filter_query(request)
     exclusion_list = json.loads(request.query.get('exclusion_list', '[]'))
     EmEntity.bulk_delete(query, exclusion_list=exclusion_list)
Пример #3
0
 def handle_delete(self, request, key):
     query = {'_key': [key]}
     EmEntity.bulk_delete(query)