Skip to content

Commit

Permalink
Handle ChunkedEncodingError on check_solvability_write_deps() (#398)
Browse files Browse the repository at this point in the history
* Fix [issue #381](#381)
  • Loading branch information
withsmilo authored and dcrankshaw committed Feb 5, 2018
1 parent 42fd27e commit 498ac6a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion clipper_admin/clipper_admin/deployers/check_and_write_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from conda.api import get_index
from conda.base.context import context
from conda.exceptions import UnsatisfiableError, NoPackagesFoundError
from requests.exceptions import ChunkedEncodingError
import conda.resolve
import conda_env.specs as specs
import sys
Expand Down Expand Up @@ -66,7 +67,15 @@ def check_solvability_write_deps(env_path, directory, platform,
on the container os. Otherwise returns False.
"""

index = get_index(platform=platform)
def get_packages_index(tries=5):
for n in range(tries):
try:
return get_index(platform=platform)
except ChunkedEncodingError as e:
if n == tries - 1:
raise e

index = get_packages_index()
r = conda.resolve.Resolve(index)
spec = specs.detect(filename=env_path)
env = spec.environment
Expand Down

0 comments on commit 498ac6a

Please sign in to comment.