IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 18, 2009, 10:23:28 AM (17 years ago)
Author:
eugene
Message:

updated vysos branch from trunk

Location:
branches/eam_branches/20090820
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090820

  • branches/eam_branches/20090820/ippTools/src/pxchip.c

    r24866 r25870  
    192192}
    193193
    194 
    195 bool pxchipRunSetLabel(pxConfig *config, psS64 chip_id, const char *label)
     194bool pxchipProcessedImfileSetStateByQuery(pxConfig *config, psMetadata *where, const char *state)
    196195{
    197196    PS_ASSERT_PTR_NON_NULL(config, false);
    198     // note label == NULL should be explicitly allowed
    199 
    200     char *query = "UPDATE chipRun SET label = '%s' WHERE chip_id = %" PRId64;
    201     if (!p_psDBRunQueryF(config->dbh, query, label, chip_id)) {
    202         psError(PS_ERR_UNKNOWN, false,
    203                 "failed to change state for chip_id %" PRId64, chip_id);
    204         return false;
    205     }
    206 
    207     return true;
    208 }
    209 
    210 
    211 bool pxchipRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *label)
    212 {
    213     PS_ASSERT_PTR_NON_NULL(config, false);
    214     // note label == NULL should be explicitly allowed
    215 
    216     psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) SET label = '%s'");
     197    PS_ASSERT_PTR_NON_NULL(state, false);
     198
     199    // check that state is a valid string value
     200    if (!pxIsValidState(state)) {
     201        psError(PS_ERR_UNKNOWN, false, "invalid chipProcessedImfile state: %s", state);
     202        return false;
     203    }
     204
     205/*     if (!strcmp(state, "full")) { */
     206/*         // There are states that need to be met for a run to be set to full that we don't */
     207/*         // check here. */
     208/*         // for example all of the run's Imfiles must have chipProcessedImfile.data_state == "full" */
     209/*         // chipRun.magicked = (SUM(!chipProcessedImfile.magicked) = 0) */
     210/*         // so don't do allow setting the state to full */
     211/*         psError(PS_ERR_UNKNOWN, true, "cannot use -updaterun so set chipRun state to full"); */
     212/*         return false; */
     213/*     } */
     214
     215    psString query = psStringCopy("UPDATE chipProcessedImfile JOIN chipRun USING(chip_id) JOIN rawExp ON chipRun.exp_id = rawExp.exp_id SET state = '%s'");
    217216
    218217    if (where && psListLength(where->list) > 0) {
     
    222221    }
    223222
    224     if (!p_psDBRunQueryF(config->dbh, query, label)) {
     223    if (!p_psDBRunQueryF(config->dbh, query, state)) {
    225224        psFree(query);
    226225        psError(PS_ERR_UNKNOWN, false, "database error");
     
    232231    return true;
    233232}
    234 
    235233
    236234psS64 pxchipQueueByExpTag(pxConfig *config,
     
    238236                         const char *workdir,
    239237                         const char *label,
     238                         const char *data_group,
     239                         const char *dist_group,
    240240                         const char *reduction,
    241241                         const char *expgroup,
    242242                         const char *dvodb,
    243243                         const char *tess_id,
    244                          const char *end_stage)
     244                         const char *end_stage,
     245                         const char *note)
    245246{
    246247    PS_ASSERT_PTR_NON_NULL(config, false);
     
    260261            "dirty",    // workdir_state
    261262            label,
     263            data_group,
     264            dist_group,
    262265            reduction,
    263266            expgroup,
     
    265268            tess_id,
    266269            end_stage,
    267             0           // magicked
     270            0,          // magicked
     271            note
    268272            )
    269273    ) {
Note: See TracChangeset for help on using the changeset viewer.