![]() ![]() |
![]() |
File: [Development] / JSOC / proj / workflow / checktasks.csh
(download)
/
(as text)
Revision: 1.2, Thu Feb 24 04:31:13 2011 UTC (12 years, 6 months ago) by phil Branch: MAIN CVS Tags: Ver_LATEST, Ver_9-5, Ver_9-41, Ver_9-4, Ver_9-3, Ver_9-2, Ver_9-1, Ver_9-0, Ver_8-8, Ver_8-7, Ver_8-6, Ver_8-5, Ver_8-4, Ver_8-3, Ver_8-2, Ver_8-12, Ver_8-11, Ver_8-10, Ver_8-1, Ver_8-0, Ver_7-1, Ver_7-0, Ver_6-4, Ver_6-3, Ver_6-2, Ver_6-1, Ver_6-0, Ver_5-14, Ver_5-13, HEAD Changes since 1.1: +7 -3 lines misc, and new gatekeeper.restart |
#! /bin/csh -f # see if watch program of check only set keep_watching = 1 set thiscmd = `basename $0` if ($thiscmd == checktasks.csh) set keep_watching = 0 # monitor program, tasks only set noglob if ($#argv >= 1) then set LIST = "*"$1"*" else set LIST = "*" endif echo "$LIST" unset noglob if ($?WORKFLOW_ROOT) then set WFDIR = $WORKFLOW_DATA set WFCODE = $WORKFLOW_ROOT else echo Need WORKFLOW_ROOT variable to be set. exit 1 endif set nonomatch while (1) cd $WFDIR while (-e GATEKEEPERBUSY) echo -n '.' sleep 1 end clear echo " " echo " " echo " " echo " " echo " " echo " " set nowtxt = `date -u +%Y.%m.%d_%H:%M:%S`"_UTC" echo -n "TIME = $nowtxt, LAST_NEWICKET = " cat LAST_NEWTICKET echo " " cd $WFDIR/tasks foreach task ( $LIST ) echo " " cd $WFDIR/tasks/$task set target = `cat target` set gatestatus = `cat $WFDIR/gates/$target/gatestatus` if ($gatestatus == "HOLD") then echo -n "TASK $task, target gate on HOLD, skip" cd .. continue endif set state = `cat state` set taskid = `cat taskid` echo "TASK $task" # DONE cd done set donelist = `/bin/ls -t` set ndone = $#donelist cd .. # ACTIVE cd active set activelist = `/bin/ls` set nactive = $#activelist cd .. # ARCHIVE cd archive set nfailed = `/bin/ls failed | wc -l` set nok = `/bin/ls ok | wc -l` cd .. # Print Summary echo " state=$state, current=$taskid, n_active=$nactive, n_done=$ndone, n_ok=$nok n_failed=$nfailed" if ($ndone > 0) then echo " DONE:" set maxdone = 2 if ($ndone < $maxdone) set maxdone = $ndone foreach donetask ( $donelist[1-$maxdone] ) set tickstatus = `grep STATUS done/$donetask/ticket` set tickname = `grep TICKET done/$donetask/ticket` echo " $donetask, $tickname, $tickstatus" end #donetask if ($ndone > $maxdone) then echo " ..." endif endif if ($nfailed > 0) then echo " FAILED:" set maxfailed = 3 set failedlist = (`/bin/ls archive/failed | tail -$maxfailed`) set nfailedlist = $#failedlist while ($nfailedlist) set failedtask = $failedlist[$nfailedlist] # foreach failedtask ( $failedlist ) set tickstatus = `grep STATUS archive/failed/$failedtask/ticket` set tickname = `grep TICKET archive/failed/$failedtask/ticket` set wantlow = `grep WANTLOW archive/failed/$failedtask/ticket` set wanthigh = `grep WANTHIGH archive/failed/$failedtask/ticket` echo " $failedtask, $tickname, $wantlow, $wanthigh, $tickstatus" @ nfailedlist = $nfailedlist - 1 end #failedtask if ($nfailed > $maxfailed) then echo " ..." endif endif if ($nactive > 0) then echo " ACTIVE:" foreach taskid ($activelist) cd active/$taskid/pending_tickets set pendinglist = `/bin/ls` set pending = $#pendinglist cd ../../.. cd active/$taskid/ticket_return set returnedlist = `/bin/ls` set returned = $#returnedlist cd ../../.. if (-e active/$taskid/ticket) then set tickname = `grep TICKET active/$taskid/ticket` set wantlow = `grep WANTLOW active/$taskid/ticket` set wanthigh = `grep WANTHIGH active/$taskid/ticket` echo -n " $taskid, $tickname, $wantlow, $wanthigh, $pending pending, $returned returned, state = " else echo -n " $taskid done" endif cat active/$taskid/state if ($pending > 0) then echo " PENDING tickets" foreach pend_ticket ($pendinglist) echo " $pend_ticket" end #pending endif # some pending end # taskid endif # some active endif # some done end if ($keep_watching) then sleep 10 else break endif end
Karen Tian |
Powered by ViewCVS 0.9.4 |