Skip to content

Commit

Permalink
Merge pull request #3 from rlcee/update_230404
Browse files Browse the repository at this point in the history
Update 230528
  • Loading branch information
rlcee authored Jun 29, 2023
2 parents 95f2884 + b6a2698 commit 9aee594
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 26 deletions.
6 changes: 3 additions & 3 deletions Campaigns/CRVWB/reco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tee_date "args are: $@"

setup mu2e
setup CRVTeststand $MOO_CRVTESTSTAND
muse setup Offline v10_20_00
muse setup Offline v10_22_01
setup -B mu2etools
setup -B mu2efiletools
setup -B sam_web_client
Expand Down Expand Up @@ -89,8 +89,8 @@ do
parserCrv $SEQ
RCT=$((RCT+$?))

tee_date "Running calibCrv $SEQ"
calibCrv $SEQ
tee_date "Running calibCrv -a -0.13 $SEQ"
calibCrv -a -0.13 $SEQ
RCT=$((RCT+$?))

FLAG=""
Expand Down
17 changes: 9 additions & 8 deletions Campaigns/Demo/reco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ RCT=0
source /cvmfs/mu2e.opensciencegrid.org/bin/OfflineOps/functions.sh
RCT=$((RCT+$?))

tee_date "Starting Demo reco.sh"

if [ ! "$OFFLINEOPS_DIR" ]; then
echo "ERROR - OFFLINEOPS_DIR needs to be defined before this script runs"
RCT=$((RCT+$?))
Expand Down Expand Up @@ -41,7 +39,7 @@ else
LOCTXT=scratch
fi

control_summary exe
control_summary start

get_next_SAM_file
RCT=$((RCT+$?))
Expand All @@ -67,12 +65,9 @@ if [[ $RCT -eq 0 && -n "$MOO_INPUT" ]]; then
echo "services.DbService.version : $DBV" >> local.fcl
echo "services.DbService.verbose : $DBE" >> local.fcl


NEVARG=""
[ "$MOO_FAKE" == "true" ] && NEVARG="-n 5"

tee_date "processing $MOO_INPUT"

mu2e $NEVARG -s $MOO_INPUT -o $RAFN -c local.fcl
RC=$?

Expand Down Expand Up @@ -100,7 +95,9 @@ if [ $RCT -ne 0 ]; then
tee_date "removing data files from output list"
rm output.txt
fi
echo "$LOCTXT $LGFN none" >> output.txt
if [ "$LGFN" ]; then
echo "$LOCTXT $LGFN none" >> output.txt
fi

tee_date "Final ls"
ls -l
Expand All @@ -112,7 +109,11 @@ control_summary final
if [ "$MOO_LOCAL" ]; then
RCP=0
else
pushOutput output.txt
if [ -a output.txt ]; then
pushOutput output.txt
else
tee_date "skipping pushOutput, no files to move"
fi
RCP=$?
fi

Expand Down
65 changes: 53 additions & 12 deletions Util/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ node_summary() {
echo "pwd: $PWD"

if [ $VERBOSE -gt 0 ]; then
echo "df on system:"
df -h
if [ $VERBOSE -gt 1 ]; then
echo "df on system:"
df -h
else
echo "df on system (skipping cvmfs partitions):"
df -h | grep -v cvmfs
fi

echo "ulimit:"
ulimit -a
Expand Down Expand Up @@ -224,6 +229,12 @@ create_config() {
#
get_next_SAM_file() {

[ $MOO_VERBOSE -ge 1 ] && tee_date "starting get-next-file"

[ $MOO_VERBOSE -ge 2 ] && printenv | grep SAM

export MOO_INPUT=""

if [ -n "$MOO_LOCAL_INPUT" ]; then
export MOO_INPUT=""

Expand All @@ -240,27 +251,57 @@ get_next_SAM_file() {
fi

if ! command -v samweb > /dev/null 2>&1 ; then
echo "ERROR - get_next_SAM_file called without samweb available"
tee_date "ERROR - get_next_SAM_file called without samweb available"
return 1
fi
if [[ -z "$SAM_PROJECT" || -z "$SAM_CONSUMER_ID" ]]; then
echo "ERROR - get_next_SAM_file called without SAM consumer environmentals"
tee_date "ERROR - get_next_SAM_file called without SAM consumer environmentals"
return 1
fi
local TEMP=$(samweb get-next-file $SAM_PROJECT $SAM_CONSUMER_ID 2>&1 )

local TMPS=$(mktemp)
local TMPE=$(mktemp)

samweb get-next-file $SAM_PROJECT $SAM_CONSUMER_ID 1>$TMPS 2>$TMPE
local TT=$?

if [[ $TT -eq 0 ]]; then
export MOO_INPUT="$TEMP"
if [ -n "$TEMP" ]; then
export MOO_INPUT_LIST=${MOO_INPUT_LIST:+$MOO_INPUT_LIST,}$MOO_INPUT
local STDO=$(cat $TMPS)
local STDE=$(cat $TMPE)
rm -f $TMPS $TMPE

# if command timeout, TT=0 but output contains Traceback
local RC=0
if [ $TT -eq 0 ]; then
if [[ "$STDE" =~ "Traceback" ]]; then
# case of final timeout
RC=1
else
# case of a file delivered
# case of no more files (STDO="")
RC=0
fi
else
export MOO_INPUT=""
[ $MOO_VERBOSE -ge 1 ] && echo "get-next-file output: $TEMP"
RC=1
fi

return $TT
if [[ $MOO_VERBOSE -ge 2 || $RC -ne 0 || -n "$STDE" ]]; then
echo "[$(date)] get-next-file returned:"
echo "stdout=$STDO"
echo "stderr=$STDE"
echo "command rc=$TT"
fi

if [ $RC -eq 0 ]; then
# blank STDO might just mean end of input files
export MOO_INPUT="$STDO"
if [ -n "$MOO_INPUT" ]; then
export MOO_INPUT_LIST=${MOO_INPUT_LIST:+$MOO_INPUT_LIST,}$MOO_INPUT
fi
fi

[ $MOO_VERBOSE -ge 1 ] && tee_date "returning get-next-file RC=$RC MOO_INPUT=$MOO_INPUT"

return $RC

}

Expand Down
6 changes: 3 additions & 3 deletions Util/wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ fi
#
# create a config string out of POMS, cfg and input versions
#
if [[ -z "$MOO_CAMPAIGN" && -n "$POMS4_CAMPAIGN_NAME" ]]; then
if [ -n "$POMS4_CAMPAIGN_NAME" ]; then
export MOO_CAMPAIGN="$POMS4_CAMPAIGN_NAME"
fi
if [[ -z "MOO_CAMPAIGN_STAGE" && -n "POMS4_CAMPAIGN_STAGE_NAME" ]]; then
if [ -n "POMS4_CAMPAIGN_STAGE_NAME" ]; then
export MOO_CAMPAIGN_STAGE=$POMS4_CAMPAIGN_STAGE_NAME
fi

Expand All @@ -101,7 +101,7 @@ save_environment wrapper_end
# run the executable script
#

tee_date start script $OFFLINEOPS_DIR/Campaigns/$MOO_SCRIPT
tee_date "************ start script $OFFLINEOPS_DIR/Campaigns/$MOO_SCRIPT"
$OFFLINEOPS_DIR/Campaigns/$MOO_SCRIPT
RC=$?
tee_date OfflineOps/wrapper exiting with RC=$RC
Expand Down

0 comments on commit 9aee594

Please sign in to comment.