Exemplo n.º 1
0
 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,
         )
Exemplo n.º 2
0
def rm_docker_container(container_name_or_id,
                        check_existence=False,
                        safe=False):
    # TODO: remove method / move to docker module
    if not container_name_or_id:
        return
    if check_existence and container_name_or_id not in DOCKER_CLIENT.get_running_container_names(
    ):
        # TODO: check names as well as container IDs!
        return
    try:
        DOCKER_CLIENT.remove_container(container_name_or_id)
    except Exception:
        if not safe:
            raise