def stop(self) -> None: CONTAINER_CLIENT.stop_container(container_name=self.id, timeout=5) CONTAINER_CLIENT.remove_container(container_name=self.id) try: self.executor_endpoint.shutdown() except Exception as e: LOG.debug( "Error while stopping executor endpoint for lambda %s, error: %s", self.function_version.qualified_arn, e, )
def cmd_stop(): from localstack import config from localstack.utils.docker_utils import DOCKER_CLIENT, NoSuchContainer container_name = config.MAIN_CONTAINER_NAME try: DOCKER_CLIENT.stop_container(container_name) console.print("container stopped: %s" % container_name) except NoSuchContainer: console.print("no such container: %s" % container_name) sys.exit(1)
def do_shutdown(self): try: DOCKER_CLIENT.stop_container(self.container.name) except Exception as e: LOG.info("error cleaning up localstack container %s: %s", self.container.name, e)