Merge pull request #1963 from shin-/1923-catch-timeout

Exit gracefully when requests encounter a ReadTimeout exception.
This commit is contained in:
Aanand Prasad 2015-09-04 16:14:32 -07:00
commit 10cb0c921a
5 changed files with 27 additions and 5 deletions

View file

@ -10,11 +10,13 @@ from operator import attrgetter
import dockerpty
from docker.errors import APIError
from requests.exceptions import ReadTimeout
from .. import __version__
from .. import legacy
from ..config import parse_environment
from ..const import DEFAULT_TIMEOUT
from ..const import HTTP_TIMEOUT
from ..progress_stream import StreamOutputError
from ..project import ConfigurationError
from ..project import NoSuchService
@ -66,6 +68,12 @@ def main():
except NeedsBuildError as e:
log.error("Service '%s' needs to be built, but --no-build was passed." % e.service.name)
sys.exit(1)
except ReadTimeout as e:
log.error(
"An HTTP request took too long to complete. Retry with --verbose to obtain debug information.\n"
"If you encounter this issue regularly because of slow network conditions, consider setting "
"COMPOSE_HTTP_TIMEOUT to a higher value (current value: %s)." % HTTP_TIMEOUT
)
def setup_logging():