Skip to content

Commit

Permalink
[CI] add always_yes mode for conda evn creation (#5384)
Browse files Browse the repository at this point in the history
* add always_yes mode for conda evn creation

* Update create_dev_conda_env.sh
  • Loading branch information
Rhett-Ying authored Feb 27, 2023
1 parent a14f69c commit c396942
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions script/create_dev_conda_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ OPTIONS:
-c Create dev environment in CPU mode.
-g Create dev environment in GPU mode with specified CUDA version,
supported: ${CUDA_VERSIONS}.
-s Run silently which indicates always 'yes' for any confirmation.
EOF
}

Expand All @@ -40,14 +41,16 @@ confirm() {
}

# Parse flags.
while getopts "cg:h" flag; do
while getopts "cg:hs" flag; do
if [[ ${flag} == "c" ]]; then
cpu=1
elif [[ ${flag} == "g" ]]; then
gpu=${OPTARG}
elif [[ ${flag} == "h" ]]; then
usage
exit 0
elif [[ ${flag} == "s" ]]; then
always_yes=1
else
usage
exit 1
Expand Down Expand Up @@ -79,15 +82,15 @@ if [[ -n ${gpu} ]]; then
fi

echo "Confirm the installed CUDA version matches the specified one."
confirm
[[ -n "${always_yes}" ]] || confirm

torchversion=${TORCH_VERSION}"+cu"${gpu//[-._]/}
name="dgl-dev-gpu"
fi

echo "Confirm you are excuting the script from your DGL root directory."
echo "Current working directory: ${PWD}"
confirm
[[ -n "${always_yes}" ]] || confirm

# Prepare the conda environment yaml file.
rand=$(echo "${RANDOM}" | md5sum | head -c 20)
Expand All @@ -102,7 +105,7 @@ echo "--------------------------------------------------"
cat /tmp/${rand}/dgl_dev.yml
echo "--------------------------------------------------"
echo "Create a conda enviroment with the config?"
confirm
[[ -n "${always_yes}" ]] || confirm

# Create conda environment.
conda env create -f /tmp/${rand}/dgl_dev.yml
Expand Down

0 comments on commit c396942

Please sign in to comment.