#!/bin/bash HOME_DIR=/test BIN_DIR=${HOME_DIR}/bin # Use this to conditionally check TF version pip install packaging if [[ $(python -c "import tensorflow as tf; from packaging.version import Version; is_tf27_or_greater = Version(tf.__version__) >= Version('2.7'); print(is_tf27_or_greater)") == 'True' ]]; then LOG_DIR="/logs/plugins/profile" else LOG_DIR="/logs/train/plugins/profile" fi [ -d $LOG_DIR ] && echo "Cleanning existing logs" && rm -rf $LOG_DIR python ${BIN_DIR}/testTensorBoard.py || exit 1 # profiler: tf > 2.* and < 2.2 generates local.trace where as tf > 2.2 generates *.pb if [[ $(python -c "import tensorflow as tf; from packaging.version import Version; is_less_than_tf22 = Version(tf.__version__) < Version('2.2'); print(is_less_than_tf22)") == 'True' ]]; then LOG_RESULT=$(find $LOG_DIR -name "local.trace") else LOG_RESULT=$(find $LOG_DIR -name "*.pb") fi echo "Checking the logs result: $LOG_RESULT" [ -z "$LOG_RESULT" ] && echo "Cannot find Profiler logs!" && exit 1 exit 0