IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11981


Ignore:
Timestamp:
Feb 21, 2007, 3:09:18 PM (19 years ago)
Author:
jhoblitt
Message:

remove p4Scfile.exp_tag & .p3_version
change -addwarped to automaticately stop runs when all associated scfiles have been added

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/warptool.c

    r11973 r11981  
    4646static bool setp4RunState(pxConfig *config, const char *p4_id, const char *state);
    4747static bool isValidMode(pxConfig *config, const char *mode);
     48bool p4CompletedRuns(pxConfig *config);
    4849
    4950# define MODECASE(caseName, func) \
     
    611612    psMetadataItem *item = NULL;
    612613    psMetadataIterator *iter = psMetadataIteratorAlloc(skycells, 0, NULL);
    613     if ((item = psMetadataGetAndIncrement(iter))) {
     614    while ((item = psMetadataGetAndIncrement(iter))) {
    614615        if (item->type != PS_DATA_METADATA) {
    615616            psError(PS_ERR_UNKNOWN, false, "mapfile: %s is in the wrong format", mapfile);
     
    761762        "   USING(p4_id)\n"
    762763        " LEFT JOIN p4Scfile\n"
    763         "   USING(p4_id, skycell_id, tess_id, exp_tag, p3_version)\n"
     764        "   USING(p4_id, skycell_id, tess_id)\n"
    764765        " WHERE\n"
    765766        "   p4Run.state = 'run'\n"
     
    767768        "   AND p4Scfile.skycell_id IS NULL\n"
    768769        "   AND p4Scfile.tess_id IS NULL\n"
    769         "   AND p4Scfile.exp_tag IS NULL\n"
    770         "   AND p4Scfile.p3_version IS NULL\n"
    771770    );
    772771
     
    871870    }
    872871
    873     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    874     if (!status) {
    875         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    876         return false;
    877     }
    878     if (!exp_tag) {
    879         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    880         return false;
    881     }
    882 
    883872    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    884873    if (!status) {
     
    891880    }
    892881
    893     // defaults to 0
    894     psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version");
    895     if (!status) {
    896         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");
    897         return false;
    898     }
    899 
    900882    // optional
    901883    psF64 bg = psMetadataLookupF64(&status, config->args, "-bg");
     
    911893    }
    912894
     895    // we don't want to insert the last scfile in a run but then not mark the
     896    // run as 'stop'
     897    if (!psDBTransaction(config->dbh)) {
     898        psError(PS_ERR_UNKNOWN, false, "database error");
     899        return false;
     900    }
    913901
    914902    // XXX need to validate that this coresponds to an p4InputImfile
     
    917905            skycell_id,
    918906            tess_id,
    919             exp_tag,
    920             p3_version,
    921907            uri,
    922908            bg,
     
    927913    }
    928914
    929     return true;
    930 }
    931 
     915    if (!p4CompletedRuns(config)) {
     916        psError(PS_ERR_UNKNOWN, false, "database error");
     917        return false;
     918    }
     919
     920    // point of no return
     921    if (!psDBCommit(config->dbh)) {
     922        psError(PS_ERR_UNKNOWN, false, "database error");
     923        return false;
     924    }
     925
     926    return true;
     927}
     928
     929bool p4CompletedRuns(pxConfig *config)
     930{
     931    PS_ASSERT_PTR_NON_NULL(config, false);
     932
     933    // find
     934    psString query = psStringCopy(
     935        "UPDATE p4Run\n"
     936        "   SET p4Run.state = 'stop'\n"
     937        " WHERE\n"
     938        "   p4Run.p4_id =\n"
     939        "   (SELECT DISTINCT\n"
     940        "       p4_id\n"
     941        "   FROM\n"
     942        "       (SELECT DISTINCT\n"
     943        "           p4Run.p4_id,\n"
     944        "           p4SkyCellMap.p4_id as foo,\n"
     945        "           p4Scfile.p4_id as bar\n"
     946        "       FROM p4Run\n"
     947        "       JOIN p4SkyCellMap\n"
     948        "           USING(p4_id)\n"
     949        "       LEFT JOIN p4Scfile\n"
     950        "           USING(p4_id, skycell_id, tess_id)\n"
     951        "       WHERE\n"
     952        "           p4Run.state = 'run'\n"
     953        "       GROUP BY\n"
     954        "           p4Run.p4_id\n" 
     955        "       HAVING\n"
     956        "       COUNT(p4SkyCellMap.p4_id) = COUNT(p4Scfile.p4_id)\n"
     957        "       ) as Foo\n"
     958        "   )\n"
     959    );
     960
     961    if (!p_psDBRunQuery(config->dbh, query)) {
     962        psError(PS_ERR_UNKNOWN, false, "database error");
     963        psFree(query);
     964        return false;
     965    }
     966
     967    psFree(query);
     968
     969    return true;
     970}
    932971
    933972static bool warpedMode(pxConfig *config)
  • trunk/ippTools/src/warptoolConfig.c

    r11852 r11981  
    151151    psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-tess_id",  0,
    152152            "define tessellation ID (required)", NULL);
    153     psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-exp_tag", 0,
    154             "define exposure tag (required)", NULL);
    155     psMetadataAddS32(addwarpedArgs, PS_LIST_TAIL, "-p3_version", 0,
    156             "define phase 3 version of exposure tag (required)", 0);
    157153    psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-uri", 0,
    158154            "define URI of file (required)", 0);
Note: See TracChangeset for help on using the changeset viewer.