Beispiel #1
0
 def queues(self):
     """
     Returns information about the SQS queues used by the indexer.
     """
     sqs = aws.resource('sqs')
     response = {'up': True}
     for queue in config.all_queue_names:
         try:
             queue_instance = sqs.get_queue_by_name(QueueName=queue).attributes
         except ClientError as ex:
             response[queue] = {
                 'up': False,
                 'error': ex.response['Error']['Message']
             }
             response['up'] = False
         else:
             response[queue] = {
                 'up': True,
                 'messages': {
                     'delayed': int(queue_instance['ApproximateNumberOfMessagesDelayed']),
                     'invisible': int(queue_instance['ApproximateNumberOfMessagesNotVisible']),
                     'queued': int(queue_instance['ApproximateNumberOfMessages'])
                 }
             }
     return response
Beispiel #2
0
def clear_cached_manifests():
    s3 = aws.resource('s3')
    bucket = s3.Bucket(config.s3_bucket)
    logger.debug(
        f'deleting bucket contents under {config.s3_bucket}/manifests/')
    bucket.objects.filter(Prefix='manifests/').delete()
    logger.debug('deletion complete')
 def _create_mock_queues(self):
     sqs = aws.resource('sqs')
     for queue_name in config.all_queue_names:
         sqs.create_queue(QueueName=queue_name)
Beispiel #4
0
 def _create_mock_notifications_queue():
     sqs = aws.resource('sqs')
     sqs.create_queue(QueueName=config.notifications_queue_name())
Beispiel #5
0
 def resource(self) -> S3ServiceResource:
     return aws.resource('s3')
Beispiel #6
0
 def sqs(self):
     from azul.deployment import (
         aws, )
     return aws.resource('sqs')
Beispiel #7
0
 def sqs(self):
     return aws.resource('sqs')