Error as warning only when falling back to stitching

This commit is contained in:
2024-08-13 15:31:47 -05:00
parent 082ffbb6e4
commit fd90883e79
2 changed files with 15 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
#fi
if [[ '$XSP' = ${theSymbol} ]]; then
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days")
./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days")
if [[ $? -ne 0 ]]; then
systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}"
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days")
@@ -30,7 +30,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
fi
if [[ '$SPX' = ${theSymbol} ]]; then
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} fromDate $(date "+%Y-%m-%d" -d "+40 days") toDate $(date "+%Y-%m-%d" -d "+46 days")
./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol} fromDate $(date "+%Y-%m-%d" -d "+40 days") toDate $(date "+%Y-%m-%d" -d "+46 days")
if [[ $? -ne 0 ]]; then
touch temp/hadErrors.$$.tmp
fi
@@ -38,7 +38,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
fi
#Default behavior - fall back to stitching on error
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol}
./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol}
if [[ $? -ne 0 ]]; then
systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}"
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}

View File

@@ -1,14 +1,22 @@
#!/bin/bash
#set -x
symbol=$1
outDir=data/$(date +%Y-%m-%d)
queryString="?symbol=${symbol}"
mkdir -p "${outDir}"
mkdir -p temp
ErrorLogLevel=err
#Handle additional commandline parameters
if [[ $1 == -* ]]; then
if [[ $1 == "-ErrorAsWarning" ]]; then
ErrorLogLevel=warning
shift
fi
fi
symbol=$1
shift
queryString="?symbol=${symbol}"
while [[ $# -gt 0 ]]; do
queryString="${queryString}&$1=$2"
@@ -25,7 +33,7 @@ jqQuery=".symbol"
symbolCheck=$(jq -r ${jqQuery} < temp/optionChain.${symbol}.tmp.$$.json)
if [[ "${symbol}" != "${symbolCheck}" ]]; then
errMsg="ERROR: THE RESPONSE IS INCORRECT! Symbol: _${symbol}_ Check: _${symbolCheck}_ check file _temp/optionChain.${symbol}.tmp.$$.json_"
systemd-cat -t "`basename $0` $1" -p err <<< ${errMsg}
systemd-cat -t "`basename $0` $1" -p ${ErrorLogLevel} <<< ${errMsg}
>&2 echo "${errMsg}"
exit 2
else