(self, container, replace_if_room=True)
Shut down a container and delete its proxy entry.

        Destroy the container in an orderly fashion. If requested and capacity is remaining, create
        a new one to take its place.
Shut down a container and delete its proxy entry.
Shut down a container and delete its proxy entry .
def release(self, container, replace_if_room=True):
        '''Shut down a container and delete its proxy entry.

        Destroy the container in an orderly fashion. If requested and capacity is remaining, create
        a new one to take its place.'''

        try:
            app_log.info("Releasing container [%s].", container)
            self.started.pop(container.id, None)
            yield [
                self.spawner.shutdown_notebook_server(container.id),
                self._proxy_remove(container.path)
            ]
            app_log.debug("Container [%s] has been released.", container)
        except Exception as e:
            app_log.error("Unable to release container [%s]: %s", container, e)
            return

        if replace_if_room:
            running = yield self.spawner.list_notebook_servers(self.container_name_pattern, all=False)
            if len(running) + 1 <= self.capacity:
                app_log.debug("Launching a replacement container.")
                yield self._launch_container()
            else:
                app_log.info("Declining to launch a new container because [%i] containers are" +
                             " already running, and the capacity is [%i].",
                             len(running), self.capacity)
def release ( self , container , replace_if_room = True ) : try : app_log . info ( "Releasing container [%s]." , container ) self . started . pop ( container . id , None ) yield [ self . spawner . shutdown_notebook_server ( container . id ) , self . _proxy_remove ( container . path ) ] app_log . debug ( "Container [%s] has been released." , container ) except Exception as e : app_log . error ( "Unable to release container [%s]: %s" , container , e ) return if replace_if_room : running = yield self . spawner . list_notebook_servers ( self . container_name_pattern , all = False ) if len ( running ) + 1 <= self . capacity : app_log . debug ( "Launching a replacement container." ) yield self . _launch_container ( ) else : app_log . info ( "Declining to launch a new container because [%i] containers are" + " already running, and the capacity is [%i]." , len ( running ) , self . capacity )