Skip to content

Commit

Permalink
Merge pull request #4209 from stuartarchibald/wip/network_tolerant_co…
Browse files Browse the repository at this point in the history
…nda_again

Revert previous network tol patch and try with conda config
  • Loading branch information
seibert committed Jun 25, 2019
2 parents 742fea1 + a525380 commit b33d7c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
10 changes: 10 additions & 0 deletions buildscripts/incremental/setup_conda_environment.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
@rem first configure conda to have more tolerance of network problems, these
@rem numbers are not scientifically chosen, just merely larger than defaults
set CONDA_CONFIG=cmd /C conda config
%CONDA_CONFIG% --write-default
%CONDA_CONFIG% --set remote_connect_timeout_secs 30.15
%CONDA_CONFIG% --set remote_max_retries 10
%CONDA_CONFIG% --set remote_read_timeout_secs 120.2
cmd /C conda info
%CONDA_CONFIG% --show

@rem The cmd /C hack circumvents a regression where conda installs a conda.bat
@rem script in non-root environments.
set CONDA_INSTALL=cmd /C conda install -q -y
Expand Down
39 changes: 11 additions & 28 deletions buildscripts/incremental/setup_conda_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,16 @@

set -v -e

network_tolerant_conda() {
local cmd=$1
shift
local attempts=$1
shift
for i in `seq $(($attempts + 1))`; do
conda $cmd -q -y $*
if [ $? == 0 ]; then
break;
else
if [ $i != $(($attempts + 1)) ]; then
echo "Connection/conda problem... retrying (attempt $i/$attempts)"
else
msg="Unresolved connection/conda problem...
exiting after $attempts additional attempts"
echo $msg
exit 1
fi
fi
done
}
# first configure conda to have more tolerance of network problems, these
# numbers are not scientifically chosen, just merely larger than defaults
conda config --write-default
conda config --set remote_connect_timeout_secs 30.15
conda config --set remote_max_retries 10
conda config --set remote_read_timeout_secs 120.2
conda info
conda config --show

CONDA_INSTALL="network_tolerant_conda install 3"
CONDA_CREATE="network_tolerant_conda create 3"
CONDA_REMOVE="network_tolerant_conda remove 3"
CONDA_EXPORT="network_tolerant_conda export 3"
CONDA_INSTALL="conda install -q -y"
PIP_INSTALL="pip install -q"


Expand All @@ -39,20 +23,19 @@ fi

# Deactivate any environment
source deactivate

# Display root environment (for debugging)
conda list
# Clean up any left-over from a previous build
# (note workaround for https://github.com/conda/conda/issues/2679:
# `conda env remove` issue)
$CONDA_REMOVE --all -n $CONDA_ENV
conda remove --all -q -y -n $CONDA_ENV

# If VANILLA_INSTALL is yes, then only Python, NumPy and pip are installed, this
# is to catch tests/code paths that require an optional package and are not
# guarding against the possibility that it does not exist in the environment.
# Create a base env first and then add to it...

$CONDA_CREATE -n $CONDA_ENV ${EXTRA_CHANNELS} python=$PYTHON numpy=$NUMPY pip
conda create -n $CONDA_ENV -q -y ${EXTRA_CHANNELS} python=$PYTHON numpy=$NUMPY pip

# Activate first
set +v
Expand Down

0 comments on commit b33d7c4

Please sign in to comment.