MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.26k stars 21.43k forks source link

CNTK Wheel file has expired #11673

Closed Jack1007533560 closed 6 years ago

Jack1007533560 commented 6 years ago

I am new to HDinsight and I found the CNTK wheel file in the Bash URL provided in this page has expired, I changed other versions and that works. The script is as below and hope can help people like me:

! /bin/bash

Install CNTK on every node. Skip if CNTK latest version is already installed

CNTK_VER="2.0" CNTK_BASE_URL="https://cntk.ai/PythonWheel/CPU-Only" CNTK_PY27_WHEEL="cntk-$CNTK_VER-cp27-cp27mu-linux_x86_64.whl" CNTK_PY35_WHEEL="cntk-$CNTK_VER-cp35-cp35m-linux_x86_64.whl" ANACONDA_BASEPATH="/usr/bin/anaconda"

Install prerequisites

sudo apt-get install -y openmpi-bin

check_version_and_install() { CNTK_WHEEL=$1 FIND_PKG=$(pip freeze | grep cntk) if [[ $FIND_PKG == "cntk" ]]; then if [[ $FIND_PKG == "$CNTK_VER" ]]; then echo "CNTK latest version is already installed. Skipping..." else echo "Updating CNTK..." pip install --upgrade --no-deps "$CNTK_BASE_URL/$CNTK_WHEEL" fi else echo "Installing CNTK..." pip install "$CNTK_BASE_URL/$CNTK_WHEEL" fi }

Install CNTK in Python 2.7

source "$ANACONDA_BASEPATH/bin/activate" check_version_and_install $CNTK_PY27_WHEEL

Install CNTK in Python 3.5

source "$ANACONDA_BASEPATH/bin/activate" py35 check_version_and_install $CNTK_PY35_WHEEL

source "$ANACONDA_BASEPATH/bin/deactivate"

Check if script action is running on head node. Exit otehrwise.

function get_headnodes { hdfssitepath=/etc/hadoop/conf/hdfs-site.xml nn1=$(sed -n '/<name>dfs.namenode.http-address.mycluster.nn1/,/<\/value>/p' $hdfssitepath) nn2=$(sed -n '/<name>dfs.namenode.http-address.mycluster.nn2/,/<\/value>/p' $hdfssitepath)

nn1host=$(sed -n -e 's/.*&lt;value&gt;\(.*\)&lt;\/value&gt;.*/\1/p' &lt;&lt;&lt; $nn1 | cut -d ':' -f 1)
nn2host=$(sed -n -e 's/.*&lt;value&gt;\(.*\)&lt;\/value&gt;.*/\1/p' &lt;&lt;&lt; $nn2 | cut -d ':' -f 1)

nn1hostnumber=$(sed -n -e 's/hn\(.*\)-.*/\1/p' &lt;&lt;&lt; $nn1host)
nn2hostnumber=$(sed -n -e 's/hn\(.*\)-.*/\1/p' &lt;&lt;&lt; $nn2host)

#only if both headnode hostnames could be retrieved, hostnames will be returned
#else nothing is returned
if [[ ! -z $nn1host && ! -z $nn2host ]]
then
    if (( $nn1hostnumber &lt; $nn2hostnumber )); then
                    echo "$nn1host,$nn2host"
    else
                    echo "$nn2host,$nn1host"
    fi
fi

}

function get_primary_headnode { headnodes=get_headnodes echo "(echo $headnodes | cut -d ',' -f 1)" }

PRIMARYHEADNODE=get_primary_headnode fullHostName=$(hostname -f) if [ "${fullHostName,,}" != "${PRIMARYHEADNODE,,}" ]; then echo "$fullHostName is not primary headnode. Skipping ambari config..." exit 0 fi

Constants needed for changing ambari configs

ACTIVEAMBARIHOST=headnodehost PORT=8080 USERID=$(echo -e "import hdinsight_common.Constants as Constants\nprint Constants.AMBARI_WATCHDOG_USERNAME" | python) PASSWD=$(echo -e "import hdinsight_common.ClusterManifestParser as ClusterManifestParser\nimport hdinsight_common.Constants as Constants\nimport base64\nbase64pwd = ClusterManifestParser.parse_local_manifest().ambari_users.usersmap[Constants.AMBARI_WATCHDOG_USERNAME].password\nprint base64.b64decode(base64pwd)" | python) CLUSTERNAME=$(echo -e "import hdinsight_common.ClusterManifestParser as ClusterManifestParser\nprint ClusterManifestParser.parse_local_manifest().deployment.cluster_name" | python)

Stop and restart affected services

stopServiceViaRest() { if [ -z "$1" ]; then echo "Need service name to stop service" exit 136 fi SERVICENAME=$1 echo "Stopping $SERVICENAME" curl -u "$USERID:$PASSWD" -i -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo": {"context" :"Stopping Service '"$SERVICENAME"' to install cntk"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' "http://$ACTIVEAMBARIHOST:$PORT/api/v1/clusters/$CLUSTERNAME/services/$SERVICENAME" }

startServiceViaRest() { if [ -z "$1" ]; then echo "Need service name to start service" exit 136 fi sleep 2 SERVICENAME="$1" echo "Starting $SERVICENAME" startResult="$(curl -u $USERID:$PASSWD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Starting Service '"$SERVICENAME"' with cntk"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://$ACTIVEAMBARIHOST:$PORT/api/v1/clusters/$CLUSTERNAME/services/$SERVICENAME)" if [[ "$startResult" == "500 Server Error" || "$startResult" == "internal system exception occurred" ]]; then sleep 60 echo "Retry starting $SERVICENAME" startResult="$(curl -u "$USERID:$PASSWD" -i -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo": {"context" :"Starting Service '"$SERVICENAME"' with cntk"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://$ACTIVEAMBARIHOST:$PORT/api/v1/clusters/$CLUSTERNAME/services/$SERVICENAME)" fi echo "$startResult" }

Stop affected services service

stopServiceViaRest LIVY stopServiceViaRest JUPYTER

Start affected services

startServiceViaRest LIVY startServiceViaRest JUPYTER


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Jack1007533560 commented 6 years ago

cntk2.0.txt

vasivara-MSFT commented 6 years ago

@Jack1007533560 Thanks for the feedback! I have assigned the issue to the content author to evaluate and update as appropriate.

JasonWHowell commented 6 years ago

@Blackmist Could you please check if you can update line 4 in the file

https://raw.githubusercontent.com/Azure-Samples/hdinsight-pyspark-cntk-integration/master/cntk-install.sh

# Install CNTK on every node. Skip if CNTK latest version is already installed
CNTK_VER="2.0"

Link: Azure-Samples/hdinsight-pyspark-cntk-integration#4

Thanks, Jason

JasonWHowell commented 6 years ago

@Jack1007533560 thanks for sharing the solution. I saw only line 4 has changed where it says CNTK_VER="2.0", but let me know if I missed something. We'll update the file as soon as we can.

Thanks, Jason

JasonWHowell commented 6 years ago

in-progress

Jack1007533560 commented 6 years ago

Yea, only line 4 I think, it is the only code has something to do with the cntk version, and it seem '2.0.beta12.0' does not exist now.

JasonWHowell commented 6 years ago

@Jack1007533560 Thanks! We'll update it shortly. ~Jason

Blackmist commented 6 years ago

@JasonWHowell This isn't a repo I have admin to. I'll start a mail thread internally to find who the current owners are and CC you.

JasonWHowell commented 6 years ago

The sample code has been updated. Thanks, Jason

please-close

vasivara-MSFT commented 6 years ago

@Jack1007533560 We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.