sh $CTIDGLocalPath/bin/GreenZoneCheck.sh STATUSGZ="${?}" if [ "$STATUSGZ" -ne "0" ] then echo "Error ocurred while running GreenZoneCheck" exit ${STATUSGZ} fi START=$(date +%s) applicationName=$1 processingDate=$2 processName="Ingestion" if [ -z "$applicationName" ] then echo "Argument Required: Application Name" exit 2 else if [[ $applicationName =~ ^[0-9]+$ ]] then echo "Application Name: Give the correct application name, Given Application name: $applicationName" exit 2 fi fi FILE_NAME=$CTIDGLocalPath/resources/CTIDGConfig_$ExecutionENV.properties if [ ! -f "$FILE_NAME" ] then echo "File not available : $FILE_NAME" exit 2 fi prop_value="" getProperty() { prop_key=$1 prop_value=`cat ${FILE_NAME} | grep ${prop_key} | cut -d'=' -f2` echo ${prop_value} } auditDatabaseName=$(getProperty "application.database.name") dbUsername=$(getProperty "application.database.user") logDir=$CTIDGLocalPath/logs logProperties=$CTIDGLocalPath/resources/log4j2.properties libPath=$CTIDGLocalPath/lib jarPath=$CTIDGLocalPath/jar/com.citi.dg-0.0.1-SNAPSHOT.jar resourcePath=$CTIDGHDFSPath/resources executionMode=$(getProperty "executionMode") generateRunIdExecutionMode=$(getProperty "generateRunIdExecutionMode") queueName=$(getProperty "queueName") app=${applicationName}_startIngestionProcess libPathHDFS=hdfs://$HDFSName/data/`whoami`/libHDFS/ stagingDir=/data/`whoami`/ RUNID=`java -cp $libPath/*:$jarPath com.citi.dg.util.GenerateRunId $FILE_NAME` java -cp $libPath/*:$jarPath com.citi.dg.util.SyncNextExecutionDate $FILE_NAME $applicationName "$processName" "$RUNID" STATUSND="${?}" if [ "${STATUSND}" -ne "0" ] then exit ${STATUSND} fi #implemented for Application : snow_fuji_audit $CTIDGLocalPath/bin/DynamicQueryBuilder.sh $applicationName exit_code=$? if [ "${exit_code}" -ne "0" ] then exit ${exit_code} fi app=${applicationName}_startIngestionProcess_${RUNID} if [ "$executionMode" == "yarn" ] then executionModeDetails=" --master ${executionMode} --deploy-mode cluster --queue ${queueName} " else executionModeDetails=" --master ${executionMode} " fi #if [ "$applicationName" == "HMC_AIX" ] #then # executionModeDetails="--master local[4]" #fi if [ -z "$processingDate" ] then spark3-submit --class com.citi.dg.IngestionRuleEngineProcess $executionModeDetails --name ${app} --driver-java-options "-Dlog_dir='$logDir' -Drun_id='$RUNID' -DCTIDGConfig_fileName='CTIDGConfig_$ExecutionENV.properties' -Dlog4j.debug=false -Dlog4j.configuration=file:log4j.properties" --conf "spark.hadoop.dfs.namenode.acls.enabled=false" --conf spark.yarn.stagingDir="${stagingDir}" --conf spark.port.maxRetries=500 --driver-memory 20g --executor-memory 18g --conf spark.driver.memoryOverhead=5000 --conf spark.executor.memoryOverhead=5000 --conf spark.sql.storeAssignmentPolicy=LEGACY --conf "spark.executor.extraJavaOptions= -Dlog4j.debug=false -Dlog4j.configuration=file:log4j.properties" --files ${logProperties} --jars $(ls -l $libPath/ | awk -v libPathHDFS="${libPathHDFS}" '{print libPathHDFS$9}'| tr 'n' ',' | cut -d ',' -f 2- ) $jarPath $resourcePath $applicationName 2> >(grep -v -e "SLF4J:" -e "^WARNING: User-defined SPARK_HOME" -e "^WARNING: Running spark-class from user-defined location" >&2) else spark3-submit --class com.citi.dg.IngestionRuleEngineProcess $executionModeDetails --name ${app} --driver-java-options "-Dlog_dir='$logDir' -Drun_id='$RUNID' -DCTIDGConfig_fileName='CTIDGConfig_$ExecutionENV.properties' -Dlog4j.debug=false -Dlog4j.configuration=file:log4j.properties" --conf "spark.hadoop.dfs.namenode.acls.enabled=false" --conf spark.yarn.stagingDir="${stagingDir}" --conf spark.port.maxRetries=500 --driver-memory 20g --executor-memory 18g --conf spark.driver.memoryOverhead=5000 --conf spark.executor.memoryOverhead=5000 --conf spark.sql.storeAssignmentPolicy=LEGACY --conf "spark.executor.extraJavaOptions= -Dlog4j.debug=false -Dlog4j.configuration=file:log4j.properties" --files ${logProperties} --jars $(ls -l $libPath/ | awk -v libPathHDFS="${libPathHDFS}" '{print libPathHDFS$9}'| tr 'n' ',' | cut -d ',' -f 2- ) $jarPath $resourcePath $applicationName $processingDate 2> >(grep -v -e "SLF4J:" -e "^WARNING: User-defined SPARK_HOME" -e "^WARNING: Running spark-class from user-defined location" >&2) fi STATUS="${?}" ##Call to Monitor Program java -cp $libPath/*:$jarPath com.citi.dg.util.SparkStatusCheck "$processName" "$RUNID" "$applicationName" "$FILE_NAME" "$STATUS" STATUS="${?}" hdfsSendEmailFilePath=$(getProperty "mail.sendmail.fileAlert.scriptpath")SendFileAlert_${applicationName}.sh hdfs dfs -test -e ${hdfsSendEmailFilePath} if [ $? -eq 0 ] ; then echo "Send File Alert script present, triggering sendMail script.." hdfs dfs -cat ${hdfsSendEmailFilePath} | exec sh hdfs dfs -rm -r -skipTrash ${hdfsSendEmailFilePath} else echo "Send File Alert script not exists on hdfs." fi echo "Start variance mail script" hdfsSendEmailFilePath_array=$(getProperty "mail.sendmail.recordCount.scriptPath")sendRecordCountVarianceEmailAlert_${applicationName}*.sh hdfs dfs -touch $(getProperty "mail.sendmail.recordCount.scriptPath")sendRecordCountVarianceEmailAlert_${application_name}_variance.sh #echo $hdfsSendEmailFilePath for i in "${hdfsSendEmailFilePath_array[@]}" do hdfs dfs -test -e $i if [ $? -eq 0 ] ; then echo "Send record count variance Alert script present, triggering sendMail script.." hdfs dfs -cat $i | exec sh hdfs dfs -rm -r -skipTrash $i else echo "Send File Alert script not exists on hdfs." fi done END=$(date +%s) DIFF=$(( $END - $START )) echo "Shell Script Time Required: $DIFF seconds" exit ${STATUS}
Syntax Highlighting:
none/plain text
Expiration:
1h
🔗 Copy URL