66set -o pipefail
77
88# version consts
9- DOCKER_CE_VERSION_DEBIAN=19.03.5
10- DOCKER_CE_VERSION_CENTOS=19.03.5
9+ DOCKER_CE_VERSION_DEBIAN=20.10.8
10+ DOCKER_CE_VERSION_CENTOS=20.10.8
1111DOCKER_CE_VERSION_SLES=17.09.1
12- GLUSTER_VERSION_DEBIAN=7
13- GLUSTER_VERSION_CENTOS=6
14- BLOBFUSE_VERSION=1.3.6
12+ GLUSTER_VERSION_DEBIAN=9
13+ GLUSTER_VERSION_CENTOS=9
14+ BLOBFUSE_VERSION=1.4.1
1515IMDS_VERSION=2021-01-01
1616
1717# consts
@@ -30,6 +30,7 @@ UCX_IB_PKEY_FILE=$AZ_BATCH_TASK_WORKING_DIR/UCX_IB_PKEY
3030MCR_REPO=mcr.microsoft.com
3131BLOBXFER_IMAGE_PREFIX=${MCR_REPO} /blobxfer
3232SHIPYARD_IMAGE_PREFIX=${MCR_REPO} /azure-batch/shipyard
33+ SINGULARITY_IMAGE_PREFIX=${SHIPYARD_IMAGE_PREFIX}
3334
3435# status file consts
3536lisinstalled=${VOLATILE_PATH} /.batch_shipyard_lis_installed
@@ -50,6 +51,7 @@ if [ -e /etc/os-release ]; then
5051 . /etc/os-release
5152 DISTRIB_ID=$ID
5253 DISTRIB_RELEASE=$VERSION_ID
54+ DISTRIB_LIKE=$ID_LIKE
5355 DISTRIB_CODENAME=$VERSION_CODENAME
5456 if [ -z " $DISTRIB_CODENAME " ]; then
5557 if [ " $DISTRIB_ID " == " debian" ] && [ " $DISTRIB_RELEASE " == " 10" ]; then
@@ -70,14 +72,13 @@ if [ -z "${DISTRIB_CODENAME}" ]; then
7072fi
7173DISTRIB_ID=${DISTRIB_ID,,}
7274DISTRIB_RELEASE=${DISTRIB_RELEASE,,}
75+ DISTRIB_LIKE=${DISTRIB_LIKE,,}
7376DISTRIB_CODENAME=${DISTRIB_CODENAME,,}
7477
7578# set distribution specific vars
7679PACKAGER=
7780SYSTEMD_PATH=/lib/systemd/system
78- if [ " $DISTRIB_ID " == " ubuntu" ]; then
79- PACKAGER=apt
80- elif [ " $DISTRIB_ID " == " debian" ]; then
81+ if [ " $DISTRIB_ID " == " ubuntu" ] || [ " $DISTRIB_ID " == " debian" ] || [ " $DISTRIB_LIKE " == " debian" ]; then
8182 PACKAGER=apt
8283elif [[ $DISTRIB_ID == centos* ]] || [ " $DISTRIB_ID " == " rhel" ]; then
8384 PACKAGER=yum
@@ -89,6 +90,15 @@ if [ "$PACKAGER" == "apt" ]; then
8990 export DEBIAN_FRONTEND=noninteractive
9091fi
9192
93+ # set python and pip
94+ if command -v python3 > /dev/null 2>&1 ; then
95+ PYTHON=python3
96+ PIP=pip3
97+ else
98+ PYTHON=python
99+ PIP=pip
100+ fi
101+
92102# globals
93103azureblob=0
94104azurefile=0
@@ -249,6 +259,14 @@ if [ -z "$blobxferversion" ]; then
249259 exit 1
250260fi
251261
262+ get_current_timestamp () {
263+ if [ $PYTHON == " python3" ]; then
264+ $PYTHON -c ' import datetime;print(datetime.datetime.utcnow().timestamp())'
265+ else
266+ $PYTHON -c ' import datetime;import time;print(time.mktime(datetime.datetime.utcnow().timetuple()))'
267+ fi
268+ }
269+
252270save_startup_to_volatile () {
253271 set +e
254272 touch " ${VOLATILE_PATH} " /startup/.save
@@ -383,7 +401,7 @@ get_vm_size_from_imds() {
383401 return
384402 fi
385403 curl -fSsL -H Metadata:true --noproxy " *" " http://169.254.169.254/metadata/instance?api-version=${IMDS_VERSION} " > imd.json
386- vm_size=$( python -c " import json;f=open('imd.json','r');a=json.load(f);print(a['compute']['vmSize']).lower()" )
404+ vm_size=$( ${PYTHON} -c " import json;f=open('imd.json','r');a=json.load(f);print(a['compute']['vmSize']).lower()" )
387405 if [[ " $vm_size " =~ ^standard_(( (hb| hc)[0 - 9 ]+ m? rs? (_v[1 - 9 ])? )| (nc[0 - 9 ]+ rs_v3 )| (nd[0 - 9 ]+ rs_v2 )) $ ]]; then
388406 # SR-IOV RDMA
389407 vm_rdma_type=1
@@ -1069,7 +1087,7 @@ install_singularity() {
10691087 fi
10701088 install_packages squashfs-tools $cryptpkg
10711089 # fetch docker image for singularity bits
1072- local di=" ${SHIPYARD_IMAGE_PREFIX } :${singularityversion} -${disuffix} "
1090+ local di=" ${SINGULARITY_IMAGE_PREFIX } :${singularityversion} -${disuffix} "
10731091 log DEBUG " Image=${di} basedir=${singularity_basedir} "
10741092 docker_pull_image " $di "
10751093 mkdir -p /opt/singularity
@@ -1852,14 +1870,15 @@ install_and_start_batch_insights() {
18521870log INFO " Prep start"
18531871echo " Configuration:"
18541872echo " --------------"
1873+ echo " Batch Shipyard version: $shipyardversion "
1874+ echo " OS Distribution: $DISTRIB_ID $DISTRIB_RELEASE "
1875+ echo " Python=$PYTHON pip=$PIP "
1876+ echo " User mountpoint: $USER_MOUNTPOINT "
1877+ echo " Mount path: $MOUNTS_PATH "
18551878echo " Custom image: $custom_image "
18561879echo " Native mode: $native_mode "
1857- echo " OS Distribution: $DISTRIB_ID $DISTRIB_RELEASE "
1858- echo " Batch Shipyard version: $shipyardversion "
18591880echo " Blobxfer version: $blobxferversion "
18601881echo " Singularity version: $singularityversion "
1861- echo " User mountpoint: $USER_MOUNTPOINT "
1862- echo " Mount path: $MOUNTS_PATH "
18631882echo " Batch Insights: $batch_insights "
18641883echo " Prometheus: NE=$PROM_NODE_EXPORTER_PORT ,$PROM_NODE_EXPORTER_OPTIONS CA=$PROM_CADVISOR_PORT ,$PROM_CADVISOR_OPTIONS "
18651884echo " Network optimization: $networkopt "
@@ -1896,11 +1915,7 @@ localectl
18961915set -e
18971916
18981917# store node prep start
1899- if command -v python3 > /dev/null 2>&1 ; then
1900- npstart=$( python3 -c ' import datetime;print(datetime.datetime.utcnow().timestamp())' )
1901- else
1902- npstart=$( python -c ' import datetime;import time;print(time.mktime(datetime.datetime.utcnow().timetuple()))' )
1903- fi
1918+ npstart=$( get_current_timestamp)
19041919
19051920# get ephemeral device/disk
19061921get_ephemeral_device
0 commit comments