(self)
return to_fetch
Check the queue for completed files and set them to be
        downloaded.
Check the queue for completed files and set them to be
        downloaded.
Check the queue for completed files and set them to be downloaded .
def check_queue(self):
        """
        Check the queue for completed files and set them to be
        downloaded.
        """
        queue = self.queue
        to_fetch = []

        for msg in queue.receive_messages(WaitTimeSeconds=self.poll_interval):
            body = json.loads(msg.body)
            message = body.get('Message', '{}')
            outputs = json.loads(message).get('outputs', [])

            if not len(outputs):
                print("Saw no output in {0}".format(body))
                continue

            key = outputs[0].get('key')

            if not key:
                print("Saw no key in outputs in {0}".format(body))
                continue

            to_fetch.append(key)
            print("Completed {0}".format(key))
            msg.delete()

        return to_fetch
def check_queue ( self ) : queue = self . queue to_fetch = [ ] for msg in queue . receive_messages ( WaitTimeSeconds = self . poll_interval ) : body = json . loads ( msg . body ) message = body . get ( 'Message' , '{}' ) outputs = json . loads ( message ) . get ( 'outputs' , [ ] ) if not len ( outputs ) : print ( "Saw no output in {0}" . format ( body ) ) continue key = outputs [ 0 ] . get ( 'key' ) if not key : print ( "Saw no key in outputs in {0}" . format ( body ) ) continue to_fetch . append ( key ) print ( "Completed {0}" . format ( key ) ) msg . delete ( ) return to_fetch