![]() ![]() |
![]() |
File: [Development] / JSOC / proj / workflow / maketicket.csh
(download)
/
(as text)
Revision: 1.7, Thu Jul 17 21:07:04 2014 UTC (8 years, 10 months ago) by jeneen 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-12, Ver_8-11, Ver_8-10, HEAD Changes since 1.6: +1 -1 lines Changed linux_x86_64 to $JSOC_MACHINE |
#! /bin/csh -f # # maketicket.csh gate low high # call with taskid, gate, wantlow, wanthigh, action, special # # if taskid is absent then create a new taskid for the task associated # with the target gate and make the ticket appear to be from that taskid. if ($?WORKFLOW_ROOT) then set WFDIR = $WORKFLOW_DATA set WFCODE = $WORKFLOW_ROOT else echo Need WORKFLOW_ROOT variable to be set. exit 1 endif # echo $0 $* >> history.tickets set cmdline = ($*) set makeSelfInstance = 0 set taskid="NOT_SPECIFIED" set gate="NOT_SPECIFIED" set wantlow="NOT_SPECIFIED" set wanthigh="NOT_SPECIFIED" set action = 4 set special = NONE set TIME_CONVERT = /home/jsoc/cvs/Development/JSOC/bin/$JSOC_MACHINE/time_convert set now = `date -u +%Y.%m.%d_%H:%M:%S` set nowt = `$TIME_CONVERT time=$now` # @ expiret = $nowt + 86400 # change to 3 days default @ expiret = $nowt + 259200 set expire = `$TIME_CONVERT s=$expiret` while ( $#argv > 0) foreach keyname (taskid gate wantlow wanthigh action special expire) if ($1 =~ $keyname=*) then set $1 break endif end # foreach shift end #while if ($wantlow == NOT_SPECIFIED) then echo MUST provide wantlow=value argument exit 1 endif if ($wanthigh == NOT_SPECIFIED) then echo MUST provide wanthigh=value argument exit 1 endif if ($gate == NOT_SPECIFIED) then echo MUST provide gate=value argument exit 1 endif cd $WFDIR/gates/$gate # Check reasonableness of times # but only if gate key type is time set keytype = `cat type` if ($keytype == time) then set wantlow_t = `$TIME_CONVERT time=$wantlow` set wanthigh_t = `$TIME_CONVERT time=$wanthigh` set project = `cat project` if ( $project == HMI || $project == AIA ) then set oklow = 1996.01.01 else if ( $project == MDI ) then set oklow = 1993.01.02 else if ( $project == WSO ) then set oklow = 1975.05.16 else set oklow = 1601.01.02 endif set oklow_t = `$TIME_CONVERT time=$oklow` if ($wantlow_t < $oklow_t) then echo "*** wantlow $wantlow is not valid for $project" exit 1 endif @ maxhigh = $nowt + 8640000 if ($wanthigh_t > $maxhigh) then echo "*** wanthigh $wanthigh is not allowed to be more than 100 days in future." exit 1 endif endif set ticket = `$WFCODE/bin/GetNextID sequence_number` # create the blank ticket touch $ticket set SELF_TICKET = 0 if ($taskid == NOT_SPECIFIED) then set SELF_TICKET = 1 set task = `cat actiontask` cd $WFDIR/tasks/$task set taskid = $task'-root' # if (-e taskid) then # set taskid = `$WFCODE/bin/GetNextID taskid` # else # set taskid = `$WFCODE/bin/GetNextID taskid $task'-19930101-000'` # endif cd active # mkdir active/$taskid # cd active/$taskid # echo 1 >state if (!(-e $taskid)) then mkdir $taskid echo 1 >$taskid/state mkdir $taskid/pending_tickets mkdir $taskid/ticket_return touch $taskid/ticket endif cd $WFDIR/gates/$gate else set task = `echo $taskid | sed -e 's/-.*//'` endif echo "TICKET=$ticket" >> $ticket echo "GATE=$gate" >> $ticket echo "ACTION=$action" >> $ticket echo "EXPIRES=$expire" >> $ticket echo "SPECIAL=$special" >> $ticket echo "WANTLOW=$wantlow" >> $ticket echo "WANTHIGH=$wanthigh" >> $ticket echo "TASKID=$taskid" >> $ticket if ($SELF_TICKET) then if (!(-e $WFDIR/tasks/$task/active/$taskid/ticket)) then ln $ticket $WFDIR/tasks/$task/active/$taskid/ticket else touch $WFDIR/tasks/$task/active/$taskid/ticket endif endif echo $ticket $cmdline >> $WFDIR/tasks/$task/tickets.history # touch $WFDIR/tasks/$task/active/$taskid/pending_tickets/$ticket # the next step must be the last since the gatekeeper will takeover # ownership of this ticket immediately mv $ticket new_tickets touch $WFDIR/tasks/$task/active/$taskid/pending_tickets/$ticket echo $ticket
Karen Tian |
Powered by ViewCVS 0.9.4 |