(self)
Completely cleanout all available containers in the pool and immediately
        schedule their replacement. Useful for refilling the pool with a new
        container image while leaving in-use containers untouched. Returns the
        number of containers drained.
Completely cleanout all available containers in the pool and immediately
        schedule their replacement. Useful for refilling the pool with a new
        container image while leaving in-use containers untouched. Returns the
        number of containers drained.
Completely cleanout all available containers in the pool and immediately schedule their replacement . Useful for refilling the pool with a new container image while leaving in - use containers untouched . Returns the number of containers drained .
def drain(self):
        '''
        Completely cleanout all available containers in the pool and immediately
        schedule their replacement. Useful for refilling the pool with a new
        container image while leaving in-use containers untouched. Returns the
        number of containers drained.
        '''
        app_log.info("Draining available containers from pool")
        tasks = []
        while 1:
            try:
                pooled = self.acquire()
                app_log.debug("Releasing container [%s] to drain the pool.", pooled.id)
                tasks.append(self.release(pooled, replace_if_room=False))
            except EmptyPoolError:
                # No more free containers left to acquire
                break
        yield tasks
        raise gen.Return(len(tasks))
def drain ( self ) : app_log . info ( "Draining available containers from pool" ) tasks = [ ] while 1 : try : pooled = self . acquire ( ) app_log . debug ( "Releasing container [%s] to drain the pool." , pooled . id ) tasks . append ( self . release ( pooled , replace_if_room = False ) ) except EmptyPoolError : # No more free containers left to acquire break yield tasks raise gen . Return ( len ( tasks ) )