| | 1 | |
| | 2 | == All about state, data_state, and fault == |
| | 3 | |
| | 4 | |
| | 5 | |
| | 6 | The purpose of this page is to document the use of the state, data_state, and fault columns in |
| | 7 | the various IPP database tables including some proposed changes to solve some problems |
| | 8 | with the update system and various other issues. |
| | 9 | |
| | 10 | |
| | 11 | == Run State == |
| | 12 | |
| | 13 | Each "stage" of the IPP has a table called a "Run". These objects are added to the database |
| | 14 | when processing is initiated. The column "state" is used by the ippTools programs to figure |
| | 15 | out what work there is to do. When a Run object is inserted into the database state is set to "new". |
| | 16 | |
| | 17 | The output data products of a Run are represented by one or more rows in a component table. |
| | 18 | These objects are inserted when (initial) processing is completed for each component. The inputs |
| | 19 | for a stage are typically the results from a previous stage. Some stages have specific tables that define |
| | 20 | the set of inputs. These are created when the run is queued (diff and stack) or after an initial |
| | 21 | bit of processing (warp and magic). |
| | 22 | |
| | 23 | |
| | 24 | {{{ |
| | 25 | Table 1 The names of the tables for each stage. |
| | 26 | |
| | 27 | Run table Component table Input component table |
| | 28 | --------------------------------------------------------------- |
| | 29 | chipRun chipProcessedImfile |
| | 30 | cameraRun cameraExp |
| | 31 | fakeRun fakeProcessedImfile |
| | 32 | warpRun warpSkyfile warpSkyCellMap |
| | 33 | diffRun diffSkyfile diffInputSkyfile |
| | 34 | stackRun stackSumSkyfile stackInputSkyfile |
| | 35 | magicRun magicNodeResult magicTree |
| | 36 | magicDSRun magicDSFile |
| | 37 | distRun distComponent |
| | 38 | }}} |
| | 39 | |
| | 40 | |
| | 41 | When 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 |
| | 43 | and distribution do not have data_state at this time because no need for them has arisen. distComponent |
| | 44 | has a 'state' column but it is not currently used for anything. We should probably drop the column |
| | 45 | ore change it's name to data_state for consistency.) |
| | 46 | |
| | 47 | Once all of the components for a run have been successfully processed, the state of the run is |
| | 48 | changed from 'new' to 'full'. |
| | 49 | |
| | 50 | |
| | 51 | == Faults == |
| | 52 | |
| | 53 | Each component table has a one byte column called fault. This column is used to flag processing errors. |
| | 54 | Faults are cleared by issuing ippTool "revert" commands. When the run state is "new" the faults are |
| | 55 | cleared by deleting the faulted row from the table. When the state is update, the rows are preserved |
| | 56 | and the fault column is updated. |
| | 57 | |
| | 58 | Note: We intend to distinguish faults due to transient errors (NFS) and those due to programming errors. |
| | 59 | Some of the revert tasks only revert faults with fault == PS_EXIT_SYS_ERROR. However some stages (diff |
| | 60 | for example) do not yet use this code for all transient errors so we revert all fault values. |
| | 61 | |
| | 62 | |
| | 63 | |
| | 64 | == Cleanup == |
| | 65 | |
| | 66 | The space used by the data products is considerable. For PS1 we do not have enough disk space to |
| | 67 | keep more than several days fully processed data around. Storage is recovered by the cleanup process. |
| | 68 | When a run is cleaned the large images are deleted. If the images are subsequently needed they can |
| | 69 | be recovered by the update process described in the next section. |
| | 70 | |
| | 71 | Not all stages are usually cleaned up. In particular the outputs from the camera and stack stages |
| | 72 | are preserved. (There may be code to manage cleanup and update for these stages but Bill's law applies.) |
| | 73 | |
| | 74 | To initiate cleanup the state of the Run is set to "goto_cleaned". Runs in this state are cleaned by |
| | 75 | a single proceess. As each components is "cleaned" a ippTool command is issued to change the component's |
| | 76 | data_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 | |
| | 87 | Once all components have been cleaned the Run's state column is set to "cleaned". |
| | 88 | |
| | 89 | If an error occurs during the cleanup process the state of the run is set to "error_cleaned" with |
| | 90 | an 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 | |
| | 101 | Currently we do not have tasks that automatically "revert" runs in state error_cleaned. |
| | 102 | |
| | 103 | BUG: |
| | 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 | |
| | 107 | Stages that are routinely cleaned are chip, warp, diff, destreak, and distribution. During cleanup |
| | 108 | the images are deleted but certain data products (photometry for example) are preserved. |
| | 109 | |
| | 110 | |
| | 111 | == Update == |
| | 112 | |
| | 113 | Images from a run can be regenerated through the update process. Since typically not all components of |
| | 114 | a run are required, components may be queued for update individually. A specific ippTool mode is used to |
| | 115 | queue 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 | |
| | 126 | These modes change the state of the run to update (unless it is already equal to update) and change |
| | 127 | the data_state to update with certain restrictions. |
| | 128 | |
| | 129 | Run.state == 'cleaned' or Run.state == update |
| | 130 | Component.data_state == 'cleaned' |
| | 131 | |
| | 132 | At chip stage an additional requirement is imposed before an update is queued. |
| | 133 | If the component has been previously destreaked (magicked != 0) the state change |
| | 134 | is made only if the magicDSRun with stage_id = chip_id and stage =='chip' has state 'cleaned' or 'update'. |
| | 135 | |
| | 136 | During update processing some data products are not regenerated. For example during chip updates |
| | 137 | photometry is not performed. (This should be true at warp and diff as well, but I'm not sure that |
| | 138 | it is implemented this way) |
| | 139 | |
| | 140 | INCONSISTENCY: When going to update, chip and destreak also set Component.fault = 0. |
| | 141 | diff and warp should do this as well. At those stages the fault is cleared by revert. This introduces |
| | 142 | latency. |
| | 143 | |
| | 144 | |
| | 145 | == Update faults == |
| | 146 | |
| | 147 | Faults can occur during update processing when this happens the -update*file modes listed above are |
| | 148 | used to set the fault column. Faulted components are not returened by the -pending queries. |
| | 149 | |
| | 150 | Faults are reverted with -revert*file modes. These modes set fault to zero. |
| | 151 | |
| | 152 | Far too often the system cannot update an individual component even after trying repeatedly. |
| | 153 | Currently we repeat and retry until someone stops the madness by setting the run to goto_cleaned. |
| | 154 | |
| | 155 | {{{ |
| | 156 | ISSUE: 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. |
| | 162 | I 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 |
| | 164 | to have allo update processing to give up on it's own. For the time being the the postage stamp |
| | 165 | dependency 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 | |
| | 179 | When components fault during destreak update, the data_state is set to error_cleaned. We don't know what to revert |
| | 180 | the 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 | |
| | 189 | but this should be handled gracefully. Perhaps by using a different state: 'failed_revert' 'failed_revert_up' |