IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35305


Ignore:
Timestamp:
Mar 12, 2013, 2:13:13 PM (13 years ago)
Author:
heather
Message:

fixes leak in addstar.pro which we think causes multiples to be loaded?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/addstar.pro

    r34804 r35305  
    66check.globals
    77
     8
     9if ($?ADDSTAGES:n == 0)       set ADDSTAGES:n = 0
     10
     11
     12
    813book init addPendingExp
    914
     
    1722
    1823macro addstar.on
    19   task addstar.exp.load.stack
    20     active true
    21   end
    22   task addstar.exp.load.cam
    23     active true
    24   end
    25   task addstar.exp.load.staticsky
    26     active true 
    27   end
    28   task addstar.exp.load.skycal
     24  task addstar.exp.load
    2925    active true
    3026  end
     
    3531
    3632macro addstar.off
    37   task addstar.exp.load.stack
    38     active false
    39   end
    40   task addstar.exp.load.cam
    41     active false
    42   end
    43   task addstar.exp.load.staticsky
    44     active false
    45   end
    46   task addstar.exp.load.skycal
     33  task addstar.exp.load
    4734    active false
    4835  end
     
    8370
    8471
     72#addstar stages
     73
     74macro add.addstages
     75  if ($0 != 2)
     76    echo "USAGE: add.addstages (addstages)"
     77    break
     78  end
     79  if ($?ADDSTAGES:n == 0)
     80    list ADDSTAGES -add $1
     81    return
     82  end
     83
     84  local found
     85  $found = 0
     86  for i 0 $ADDSTAGES:n
     87    if ($ADDSTAGES:$i == $1)
     88      $found = 1
     89      echo "$ADDSTAGES:$i set"
     90      last
     91    end
     92  end
     93 
     94  if ($found == 0)
     95    list ADDSTAGES -add $1
     96  end
     97end
     98
     99macro del.addstages
     100  if ($0 != 2)
     101    echo "USAGE: del.addstages (addstages)"
     102    break
     103  end
     104  if ($?ADDSTAGES:n == 0)
     105    return
     106  end
     107
     108  list ADDSTAGES -del $1
     109end
     110
     111macro show.addstages
     112  if ($0 != 1)
     113    echo "USAGE: show.addstages"
     114    break
     115  end
     116  if ($?ADDSTAGES:n == 0)
     117    echo "no addstar stages defined"
     118  end
     119  if ($ADDSTAGES:n == 0)
     120    echo "no addstar stages defined"
     121  end
     122
     123  local i
     124  for i 0 $ADDSTAGES:n
     125    echo $ADDSTAGES:$i
     126  end
     127end
     128
     129macro stuff
     130   echo $LOADEXEC_ADD
     131   echo $LOADPOLL
     132end
     133
    85134# this variable will cycle through the known database names
    86135$addstar_DB = 0
     136$addstar_stages_DB = 0
    87137#this may not work for more databases (addstar) will do that later)
    88138$addstar_revert_DB_C = 0
     
    92142$addstar_revert_DB_SC = 0
    93143
    94 $LOADEXEX_ADD = 300
    95 
     144#$LOADEXEC_ADD = 300
     145$LOADEXEC_ADD = 10
    96146
    97147
     
    99149# new entries are added to addPendingExp
    100150# skip already-present entries
    101 task           addstar.exp.load.stack
     151task           addstar.exp.load
    102152  host         local
    103153
     
    111161
    112162  task.exec
    113    # if ($LABEL:n == 0) break
    114     $run = addtool -pendingexp -stage stack
    115     if ($DB:n == 0)
    116       option DEFAULT
    117     else
    118       # save the DB name for the exit tasks
    119       option $DB:$addstar_DB
    120       $run = $run -dbname $DB:$addstar_DB
    121       $addstar_DB ++
    122       if ($addstar_DB >= $DB:n) set addstar_DB = 0
    123     end
     163    #if no stages defined we can't run
     164    if ($ADDSTAGES:n == 0) echo "what"
     165 #   if ($ADDSTAGES:n == 0) break
     166    $run = addtool -pendingexp
     167   
     168    #option $ADDSTAGES:$addstar_stages_DB
     169    $run = $run -stage $ADDSTAGES:$addstar_stages_DB 
     170    option $DB:$addstar_DB
     171    $run = $run -dbname $DB:$addstar_DB
     172    $addstar_stages_DB ++
     173      if ($addstar_stages_DB >= $ADDSTAGES:n)
     174         set addstar_stages_DB = 0
     175         $addstar_DB ++
     176         if ($addstar_DB >= $DB:n) set addstar_DB = 0
     177         #go to next stage. if run out of stages, go to 0 stage and
     178         #cycle through dbname, if run out of dbnames, go to 0 dbname
     179      end
    124180    add_poll_args run
    125181    add_poll_labels run
     182    echo $run
    126183    command $run
    127184  end
     
    153210  end
    154211end
    155 
    156 task           addstar.exp.load.cam
    157   host         local
    158 
    159   periods      -poll $LOADPOLL
    160   periods      -exec $LOADEXEC_ADD
    161   periods      -timeout 300
    162   npending     1
    163 
    164   stdout NULL
    165   stderr $LOGDIR/addstar.exp.log
    166 
    167   task.exec
    168    # if ($LABEL:n == 0) break
    169     $run = addtool -pendingexp -stage cam
    170     if ($DB:n == 0)
    171       option DEFAULT
    172     else
    173       # save the DB name for the exit tasks
    174       option $DB:$addstar_DB
    175       $run = $run -dbname $DB:$addstar_DB
    176       $addstar_DB ++
    177       if ($addstar_DB >= $DB:n) set addstar_DB = 0
    178     end
    179     add_poll_args run
    180     add_poll_labels run
    181     command $run
    182   end
    183 
    184   # success
    185   task.exit    0
    186     # convert 'stdout' to book format
    187     ipptool2book stdout addPendingExp -key add_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    188     if ($VERBOSE > 2)
    189       book listbook addPendingExp
    190     end
    191 
    192     # delete existing entries in the appropriate pantaskStates
    193     process_cleanup addPendingExp
    194   end
    195 
    196   # default exit status
    197   task.exit    default
    198     showcommand failure
    199   end
    200 
    201   task.exit    crash
    202     showcommand crash
    203   end
    204 
    205   # operation times out?
    206   task.exit    timeout
    207     showcommand timeout
    208   end
    209 end
    210 
    211 task           addstar.exp.load.staticsky
    212   host         local
    213   periods      -poll $LOADPOLL
    214   periods      -exec $LOADEXEC_ADD
    215   periods      -timeout 300
    216   npending     1
    217 
    218   stdout NULL
    219   stderr $LOGDIR/addstar.exp.log
    220 
    221   task.exec
    222    # if ($LABEL:n == 0) break
    223     $run = addtool -pendingexp -stage staticsky
    224     if ($DB:n == 0)
    225       option DEFAULT
    226     else
    227       # save the DB name for the exit tasks
    228       option $DB:$addstar_DB
    229       $run = $run -dbname $DB:$addstar_DB
    230       $addstar_DB ++
    231       if ($addstar_DB >= $DB:n) set addstar_DB = 0
    232     end
    233     add_poll_args run
    234     add_poll_labels run
    235     command $run
    236   end
    237 
    238   # success
    239   task.exit    0
    240     # convert 'stdout' to book format
    241     ipptool2book stdout addPendingExp -key add_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    242     if ($VERBOSE > 2)
    243       book listbook addPendingExp
    244     end
    245 
    246     # delete existing entries in the appropriate pantaskStates
    247     process_cleanup addPendingExp
    248   end
    249 
    250   # default exit status
    251   task.exit    default
    252     showcommand failure
    253   end
    254 
    255   task.exit    crash
    256     showcommand crash
    257   end
    258 
    259   # operation times out?
    260   task.exit    timeout
    261     showcommand timeout
    262   end
    263 end
    264 
    265 task           addstar.exp.load.skycal
    266   host         local
    267   periods      -poll $LOADPOLL
    268   periods      -exec $LOADEXEC_ADD
    269   periods      -timeout 300
    270   npending     1
    271 
    272   stdout NULL
    273   stderr $LOGDIR/addstar.exp.log
    274 
    275   task.exec
    276    # if ($LABEL:n == 0) break                                                                                 
    277     $run = addtool -pendingexp -stage skycal
    278     if ($DB:n == 0)
    279       option DEFAULT
    280     else
    281       # save the DB name for the exit tasks                                                                   
    282       option $DB:$addstar_DB
    283       $run = $run -dbname $DB:$addstar_DB
    284       $addstar_DB ++
    285       if ($addstar_DB >= $DB:n) set addstar_DB = 0
    286     end
    287     add_poll_args run
    288     add_poll_labels run
    289     command $run
    290   end
    291 
    292   # success                                                                                                   
    293   task.exit    0
    294     # convert 'stdout' to book format                                                                         
    295     ipptool2book stdout addPendingExp -key add_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    296     if ($VERBOSE > 2)
    297       book listbook addPendingExp
    298     end
    299 
    300     # delete existing entries in the appropriate pantaskStates                                               
    301     process_cleanup addPendingExp
    302   end
    303 
    304   # default exit status                                                                                       
    305   task.exit    default
    306     showcommand failure
    307   end
    308 
    309   task.exit    crash
    310     showcommand crash
    311   end
    312 
    313   # operation times out?                                                                                     
    314   task.exit    timeout
    315     showcommand timeout
    316   end
    317 end
    318 
    319212
    320213# run the addstar script on pending exposures
Note: See TracChangeset for help on using the changeset viewer.