IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 21, 2008, 2:13:38 PM (18 years ago)
Author:
eugene
Message:

move site-specific macros to site.manoa.pro, site.mhpcc.pro; improve automate.pro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/automate.pro

    r16492 r16570  
    2626  end
    2727  queueload tmp -x "cat $MODULES:0/$1"
    28   ipptool2book tmp automate -key name -uniq -setword pantaskState INIT
     28  ipptool2book tmp automate -key name -uniq -setword pantaskState INIT.BLOCK
    2929  queuedelete tmp
    3030end
    3131
    32 $automate_Ncheck = 0
    33 
    34 task automate.check
     32$automate_Nblock = -1
     33task automate.block
    3534  host         local
    3635
    3736  periods      -poll 1
    38   periods      -exec 10
     37  periods      -exec 5
    3938  periods      -timeout 30
    4039  active       true
     
    4241
    4342  task.exec
    44     local N Npage pageName
     43    local Npage pageName
    4544
    4645    # how many pages are waiting to be started?
    47     book npages automate -var N -key pantaskState INIT
    48     if ($N == 0) break
    49 
    50     # total number of pages in book
    51     book npages automate -var Npage
    52 
    53     $automate_Ncheck ++
    54     if ($automate_Ncheck >= $Npage) set automate_Ncheck = 0
    55 
    56     # search the automate book for an entry which is unstarted (state INIT)
    57     book getpage automate $automate_Ncheck -var pageName -key pantaskState INIT
    58     if ("$pageName" == "NULL") break
     46    book npages automate -var Npage -key pantaskState INIT.BLOCK
     47    if ($Npage == 0)
     48      echo "no entries in INIT.BLOCK state"
     49      break
     50    end
     51
     52    # cycle over the number of INIT.BLOCK pages: no point to loop over the others
     53    $automate_Nblock ++
     54    if ($automate_Nblock >= $Npage) set automate_Nblock = 0
     55    echo "automate.block $automate_Nblock"
     56
     57    # search the automate book for an entry which is unstarted (state INIT.BLOCK)
     58    book getpage automate $automate_Nblock -var pageName -key pantaskState INIT.BLOCK
     59    if ("$pageName" == "NULL")
     60      echo "entry $automate_Nblock not in INIT.BLOCK state"
     61      break
     62    end
    5963 
    60     book getword automate $pageName check -var checkCommand
    61     if (("$checkCommand" == "NULL") || ("$checkCommand" == "NONE"))
    62       # if there is no check needed, we can immediate progress to READY
    63       book setword automate $pageName pantaskState READY
    64       break
    65     end
    66 
    67     book setword automate $pageName pantaskState CHECK
     64    book getword automate $pageName block -var blockCommand
     65    if (("$blockCommand" == "NULL") || ("$blockCommand" == "NONE"))
     66      # if there is no block needed, we can immediate progress to the next stage (INIT.CHECK)
     67      book setword automate $pageName pantaskState INIT.CHECK
     68      echo "$pageName is ready : INIT.CHECK"
     69      break
     70    end
     71
     72    book setword automate $pageName pantaskState RUN.BLOCK
    6873
    6974    if ($VERBOSE >= 1)
    70       echo "starting automate check for $pageName"
    71       echo "command $checkCommand"
     75      echo "starting automate block for $pageName"
     76      echo "command $blockCommand"
    7277    end
    7378
    7479    options $pageName
    75     command $checkCommand
     80    command $blockCommand
    7681  end
    7782
     
    8085
    8186    $pageName = $options:0
     87
     88    echo "complete $pageName test, checking results"
    8289
    8390    # convert 'stdout' to book format
     
    8895    end
    8996
     97    # if the block test returns any valid pages (valid results), the block is set, don't move to check
    9098    book npages detExp -var Npage
    91     if ($Npage == 0) break
    92 
    93     # we should have launched only a single detRun
    94     book setword automate $pageName pantaskState READY
     99    if ($Npage == 0)
     100      echo "$pageName is not blocked, ready for CHECK"
     101      book setword automate $pageName pantaskState INIT.CHECK
     102    else
     103      echo "$pageName is blocked, not ready for CHECK"
     104      book setword automate $pageName pantaskState INIT.BLOCK
     105    end
    95106
    96107    # drop the detExt book after we've grabbed the state
    97108    book delete detExp
    98109  end
    99 end
    100 
    101 $automate_Nlaunch = 0
    102 
    103 task automate.launch
     110
     111  # all failures here (what state?)
     112  task.exit    default
     113    showcommand failure
     114  end
     115
     116  # operation times out?
     117  task.exit    timeout
     118    showcommand timeout
     119  end
     120end
     121
     122$automate_Ncheck = -1
     123task automate.check
    104124  host         local
    105125
    106126  periods      -poll 1
    107   periods      -exec 10
     127  periods      -exec 5
    108128  periods      -timeout 30
    109129  active       true
     
    111131
    112132  task.exec
    113     local N Npage pageName
     133    local Npage pageName
    114134
    115135    # how many pages are waiting to be started?
    116     book npages automate -var N -key pantaskState READY
    117     if ($N == 0) break
    118 
    119     # total number of pages in book
    120     book npages automate -var Npage
    121 
     136    book npages automate -var Npage -key pantaskState INIT.CHECK
     137    if ($Npage == 0)
     138      echo "no entries in INIT.CHECK state"
     139      break
     140    end
     141
     142    # cycle over the number of INIT.CHECK pages: no point to loop over the others
     143    $automate_Ncheck ++
     144    if ($automate_Ncheck >= $Npage) set automate_Ncheck = 0
     145    echo "automate.check $automate_Ncheck"
     146
     147    # search the automate book for an entry which is unstarted (state INIT.CHECK)
     148    book getpage automate $automate_Ncheck -var pageName -key pantaskState INIT.CHECK
     149    if ("$pageName" == "NULL")
     150      echo "entry $automate_Ncheck not in INIT.CHECK state"
     151      break
     152    end
     153 
     154    book getword automate $pageName check -var checkCommand
     155    if (("$checkCommand" == "NULL") || ("$checkCommand" == "NONE"))
     156      # if there is no check needed, we can immediate progress to the next stage (INIT.LAUNCH)
     157      book setword automate $pageName pantaskState INIT.LAUNCH
     158      echo "$pageName is ready : INIT.LAUNCH"
     159      break
     160    end
     161
     162    book setword automate $pageName pantaskState RUN.CHECK
     163
     164    if ($VERBOSE >= 1)
     165      echo "starting automate check for $pageName"
     166      echo "command $checkCommand"
     167    end
     168
     169    options $pageName
     170    command $checkCommand
     171  end
     172
     173  task.exit $EXIT_SUCCESS
     174    local pageName Npage
     175
     176    $pageName = $options:0
     177
     178    echo "complete $pageName test, checking results"
     179
     180    # convert 'stdout' to book format
     181    # XXX to use other tests, we'll need to modify this
     182    ipptool2book stdout detExp -key det_id -uniq
     183    if ($VERBOSE > 2)
     184      book listbook detExp
     185    end
     186
     187    book npages detExp -var Npage
     188    if ($Npage == 0)
     189      echo "$pageName not ready for LAUNCH"
     190      book setword automate $pageName pantaskState INIT.CHECK
     191    else
     192      echo "$pageName is ready for LAUNCH"
     193      book setword automate $pageName pantaskState INIT.LAUNCH
     194    end
     195
     196    # drop the detExt book after we've grabbed the state
     197    book delete detExp
     198  end
     199
     200  # all failures here (what state?)
     201  task.exit    default
     202    showcommand failure
     203  end
     204
     205  # operation times out?
     206  task.exit    timeout
     207    showcommand timeout
     208  end
     209end
     210
     211$automate_Nlaunch = 0
     212task automate.launch
     213  host         local
     214
     215  periods      -poll 1
     216  periods      -exec 5
     217  periods      -timeout 30
     218  active       true
     219  npending     1
     220
     221  task.exec
     222    local Npage pageName
     223
     224    # how many pages are waiting to be started?
     225    book npages automate -var Npage -key pantaskState INIT.LAUNCH
     226    if ($Npage == 0)
     227      echo "no entries in INIT.LAUNCH state"
     228      break
     229    end
     230
     231    # cycle over the number of INIT.LAUNCH pages: no point to loop over the others
    122232    $automate_Nlaunch ++
    123233    if ($automate_Nlaunch >= $Npage) set automate_Nlaunch = 0
    124 
    125     # search the automate book for an entry which is ready (state READY)
    126     book getpage automate $automate_Nlaunch -var pageName -key pantaskState READY
    127     if ("$pageName" == "NULL") break
     234    echo "automate.launch $automate_Nlaunch"
     235
     236    # search the automate book for an entry which is unstarted (state INIT.LAUNCH)
     237    book getpage automate $automate_Nlaunch -var pageName -key pantaskState INIT.LAUNCH
     238    if ("$pageName" == "NULL")
     239      echo "entry $automate_Nlaunch not in INIT.LAUNCH state"
     240      break
     241    end
    128242 
    129243    book getword automate $pageName launch -var launchCommand
    130244    if (("$launchCommand" == "NULL") || ("$launchCommand" == "NONE"))
    131       # if there is no launch needed, we can immediate progress to READY
    132       book setword automate $pageName pantaskState DONE
    133       break
    134     end
    135 
    136     book setword automate $pageName pantaskState LAUNCH
     245      # if there is no launch needed, we can immediate progress to the next stage (INIT.LAUNCH)
     246      book setword automate $pageName pantaskState INIT.LAUNCH
     247      echo "$pageName is ready : INIT.LAUNCH"
     248      break
     249    end
     250
     251    book setword automate $pageName pantaskState RUN.LAUNCH
    137252
    138253    if ($VERBOSE >= 1)
     
    146261
    147262  task.exit $EXIT_SUCCESS
    148     local pageName
     263    local pageName Npage
    149264
    150265    $pageName = $options:0
    151266
    152     # we should have launched only a single detRun
    153     book setword automate $pageName pantaskState DONE
    154   end
    155 end
     267    echo "completed $pageName launch"
     268    book setword automate $pageName pantaskState DONE.LAUNCH
     269  end
     270
     271  # all failures here (what state?)
     272  task.exit    default
     273    showcommand failure
     274  end
     275
     276  # operation times out?
     277  task.exit    timeout
     278    showcommand timeout
     279  end
     280end
     281
Note: See TracChangeset for help on using the changeset viewer.