IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Initial Version and Version 1 of RunStates


Ignore:
Timestamp:
Feb 8, 2011, 2:56:12 PM (15 years ago)
Author:
bills
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RunStates

    v1 v1  
     1
     2== All about state, data_state, and fault ==
     3
     4
     5
     6The purpose of this page is to document the use of the state, data_state, and fault columns in
     7the various IPP database tables including some proposed changes to solve some problems
     8with the update system and various other issues.
     9
     10
     11== Run State ==
     12
     13Each "stage" of the IPP has a table called a "Run". These objects are added to the database
     14when processing is initiated. The column "state" is used by the ippTools programs to figure
     15out what work there is to do.  When a Run object is inserted into the database state is set to "new".
     16
     17The output data products of a Run are represented by one or more rows in a component table.
     18These objects are inserted when (initial) processing is completed for each component. The inputs
     19for a stage are typically the results from a previous stage. Some stages have specific tables that define
     20the set of inputs. These are created when the run is queued (diff and stack) or after an initial
     21bit of processing (warp and magic).
     22
     23
     24{{{
     25Table 1 The names of the tables for each stage.
     26
     27Run table       Component table         Input component table   
     28---------------------------------------------------------------
     29chipRun         chipProcessedImfile                             
     30cameraRun       cameraExp                                       
     31fakeRun         fakeProcessedImfile                           
     32warpRun         warpSkyfile             warpSkyCellMap       
     33diffRun         diffSkyfile             diffInputSkyfile     
     34stackRun        stackSumSkyfile         stackInputSkyfile   
     35magicRun        magicNodeResult         magicTree         
     36magicDSRun      magicDSFile             
     37distRun         distComponent
     38}}}
     39
     40
     41When a component row is inserted into the database the value for the column data_state is set to 'full'.
     42(The stages camera and stack do not have data state since there is a single component per run. Magic
     43and distribution do not have data_state at this time because no need for them has arisen. distComponent
     44has a 'state' column but it is not currently used for anything. We should probably drop the column
     45ore change it's name to data_state for consistency.)
     46
     47Once all of the components for a run have been successfully processed, the state of the run is
     48changed from 'new' to 'full'.
     49
     50
     51== Faults ==
     52
     53Each component table has a one byte column called fault. This column is used to flag processing errors.
     54Faults are cleared by issuing ippTool "revert" commands. When the run state is "new" the faults are
     55cleared by deleting the faulted row from the table. When the state is update, the rows are preserved
     56and the fault column is updated.
     57
     58Note: We intend to distinguish faults due to transient errors (NFS) and those due to programming errors.
     59Some of the revert tasks only revert faults with fault == PS_EXIT_SYS_ERROR. However some stages (diff
     60for example) do not yet use this code for all transient errors so we revert all fault values.
     61
     62
     63
     64== Cleanup ==
     65
     66The space used by the data products is considerable. For PS1 we do not have enough disk space to
     67keep more than several days fully processed data around. Storage is recovered by the cleanup process.
     68When a run is cleaned the large images are deleted. If the images are subsequently needed they can
     69be recovered by the update process described in the next section.
     70
     71Not all stages are usually cleaned up. In particular the outputs from the camera and stack stages
     72are preserved. (There may be code to manage cleanup and update for these stages but Bill's law applies.)
     73
     74To initiate cleanup the state of the Run is set to "goto_cleaned". Runs in this state are cleaned by
     75a single proceess. As each components is "cleaned" a ippTool command is issued to change the component's
     76data_state is set to "cleaned".
     77
     78
     79{{{
     80    chiptool -tocleanedimfile -chip_id <chip_id> -class_id <chip>
     81    warptool -tocleanedskyfile -warp_id <warp_id> -skycell_id <skycell>
     82    difftool -tocleanedskyfile -diff_id <warp_id> -skycell_id <skycell>
     83    magicdstool -tocleanedfile -magic_ds_id <magic_ds_id> -component <component>
     84}}}
     85
     86   
     87Once all components have been cleaned the Run's state column is set to "cleaned".
     88
     89If an error occurs during the cleanup process the state of the run is set to "error_cleaned" with
     90an ippTool mode
     91
     92 
     93{{{
     94   chiptool -updateprocessedimfile -chip_id <chip_id> -class_id <chip> -set_state error_cleaned
     95    warptool -updateskyfile -warp_id <warp_id> -skycell_id <skycell> -set_state error_cleaned
     96    difftool -updateskyfile -diff_id <warp_id> -skycell_id <skycell> -set_state error_cleaned
     97    magicdstool -updatedestreakedfile -magic_ds_id <magic_ds_id> -component <component> -data_state error_cleaned
     98}}}
     99
     100
     101Currently we do not have tasks that automatically "revert" runs in state error_cleaned.
     102
     103BUG:
     104    1. Some of the arguments are named incorrectly. -set_state argument actually specifies the new data_state,
     105    and for magicdstool -data_state should be -set_data_state.
     106
     107Stages that are routinely cleaned are chip, warp, diff, destreak, and distribution. During cleanup
     108the images are deleted but certain data products (photometry for example) are preserved.
     109
     110
     111== Update ==
     112
     113Images from a run can be regenerated through the update process. Since typically not all components of
     114a run are required, components may be queued for update individually. A specific ippTool mode is used to
     115queue updates for each stage:
     116
     117 
     118{{{
     119   chip        chiptool    -setimfiletoupdate  -chip_id <chip_id> -class_id <chip>
     120    warp        warptool    -setskyfiletoupdate -warp_id <warp_id> -skycell_id <skycell>
     121    diff        difftool    -setskyfiletoupdate -diff_id <diff_id> -skycell_id <skycell>
     122    destreak    magicdstool -setfiletoupdate    -magic_ds_id <magic_ds_id> -component <component>
     123
     124}}}
     125
     126These modes change the state of the run to update (unless it is already equal to update) and change
     127the data_state to update with certain restrictions.
     128
     129    Run.state == 'cleaned' or Run.state == update
     130    Component.data_state == 'cleaned'
     131
     132At chip stage an additional requirement is imposed before an update is queued.
     133If the component has been previously destreaked (magicked != 0) the state change
     134is made only if the magicDSRun with stage_id = chip_id and stage =='chip' has state 'cleaned' or 'update'.
     135
     136During update processing some data products are not regenerated. For example during chip updates
     137photometry is not performed. (This should be true at warp and diff as well, but I'm not sure that
     138it is implemented this way)
     139
     140INCONSISTENCY: When going to update, chip and destreak also set Component.fault = 0.
     141diff and warp should do this as well.  At those stages the fault is cleared by revert. This introduces
     142latency.
     143
     144
     145== Update faults ==
     146
     147Faults can occur during update processing when this happens the -update*file modes listed above are
     148used to set the fault column. Faulted components are not returened by the -pending queries.
     149
     150Faults are reverted with -revert*file modes. These modes set fault to zero.
     151
     152Far too often the system cannot update an individual component even after trying repeatedly.
     153Currently we repeat and retry until someone stops the madness by setting the run to goto_cleaned.
     154
     155{{{
     156ISSUE: We need a way to tell the system to give trying to update a  faulted component.
     157    Possible ways to do this
     158        a) special fault code that revert modes don't revert unless -fault <that_value> is supplied
     159        b) special data_state
     160        c) add a fault count and give up after a certain number of faults. (This is working well for
     161        the postage stamp server but requires schema changes.
     162I like a) since it avoids making data_state handling more complicated and says exactly what it means
     163"This component is bad don't mess with it anymore". Also it does not precude implementing c) in the future
     164to have allo update processing to give up on it's own. For the time being the the postage stamp
     165dependency checking will manage setting the fault code.
     166    Keep in Mind
     167    * To recover the space we need to have cleanup be ready for whatever we do.
     168      Again using special fault code will make this easier. since we can keep the same
     169      data_state transitions
     170    * -set*toupdate will need to know not to set component to update if the fault has the magic value
     171
     172}}}
     173
     174
     175
     176== Destreak Revert ==
     177
     178
     179When components fault during destreak update, the data_state is set to error_cleaned.  We don't know what to revert
     180the state to is the run 'new' or was it 'update'? In practice this is handled based on the label
     181
     182{{{
     183
     184    magicdstool -revertstatefaults -state failed_revert -set_state new -label \%.nightlyscience
     185    magicdstool -revertstatefaults -state failed_revert -set_state update -label ps_ud\%
     186}}}
     187
     188
     189but this should be handled gracefully. Perhaps by using a different state: 'failed_revert' 'failed_revert_up'