def wait_for_logs(self, stdout=None, stderr=None): # Return instantly if we don't have to fetch any logs if not stdout and not stderr: return if not self.is_created(): raise RuntimeError("Container does not exist. Cannot get logs for this container") real_container = self.docker_client.containers.get(self.id) # Fetch both stdout and stderr streams from Docker as a single iterator. logs_itr = attach(self.docker_client, container=real_container, stdout=True, stderr=True, logs=True) self._write_container_output(logs_itr, stdout=stdout, stderr=stderr)
def wait_for_logs(self, stdout=None, stderr=None): # Return instantly if we don't have to fetch any logs if not stdout and not stderr: return if not self.is_created(): raise RuntimeError("Container does not exist. Cannot get logs for this container") real_container = self.docker_client.containers.get(self.id) # Fetch both stdout and stderr streams from Docker as a single iterator. logs_itr = attach(self.docker_client, container=real_container, stdout=True, stderr=True, logs=True) self._write_container_output(logs_itr, stdout=stdout, stderr=stderr)