IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40137


Ignore:
Timestamp:
Sep 14, 2017, 3:14:36 PM (9 years ago)
Author:
eugene
Message:

add option to specify the last good fileset (downloads will proceed from there)

Location:
tags/ipp-20170121/ippTools/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20170121/ippTools/src/pzgetexp.c

    r31038 r40137  
    7777    PXOPT_LOOKUP_S32(timeout, config->args, "-timeout", false, false);
    7878    PXOPT_LOOKUP_BOOL(all, config->args, "-all", false);
    79 
     79    PXOPT_LOOKUP_STR(myLastFileSet, config->args, "-last-fileset", false, false);
     80   
    8081    // find last fileset/exp_name (if we have one)
    8182    bool haveLastFileSet = false;
    8283    psString lastFileSet = NULL;
    8384
     85    // fprintf (stderr, "myLastFileSet %s.. (%d)\n", myLastFileSet, myLastFileSet[0]);
     86    // if -last-fileset is not supplied, myLastFileSet is NOT NULL, but myLastFileSet[0] = 0
     87
    8488    // -all means "request all known filesets"
    85     if (!all) {
    86         char *query = "SELECT * from summitExp WHERE camera = \"%s\" and TELESCOPE = \"%s\" ORDER BY dateobs DESC LIMIT 1";
     89    if (!all && !myLastFileSet[0]) {
     90        char *query = "SELECT * from summitExp WHERE camera = \"%s\" and TELESCOPE = \"%s\" ORDER BY dateobs DESC LIMIT 10";
    8791        if (!p_psDBRunQueryF(config->dbh, query, camera, telescope)) {
    8892            psError(PS_ERR_UNKNOWN, false, "database error");
     
    102106            haveLastFileSet = true;
    103107            bool status = false;
    104             lastFileSet = psStringCopy(psMetadataLookupStr(&status, output->data[0], "exp_name"));
     108            long Nlast = psArrayLength(output);
     109            lastFileSet = psStringCopy(psMetadataLookupStr(&status, output->data[Nlast - 1], "exp_name"));
    105110            psFree(output);
    106111        }
     112    }
     113
     114    if (myLastFileSet && myLastFileSet[0]) {
     115      haveLastFileSet = true;
     116      lastFileSet = psStringCopy(myLastFileSet);
    107117    }
    108118
     
    121131    }
    122132
     133    // fprintf (stderr, "pzgetexp: cmd is: %s\n", cmd);
    123134    psTrace("pzgetexp", PS_LOG_INFO, "cmd is: %s\n", cmd);
    124135
     
    145156        return true;
    146157    }
     158
     159    // fprintf (stderr, "Number of newSummitExps: %d\n", (int) psArrayLength(newSummitExps));
    147160
    148161    // start a transaction so it's all rows or nothing
  • tags/ipp-20170121/ippTools/src/pzgetexpConfig.c

    r18919 r40137  
    4545
    4646    psMetadata *args = psMetadataAlloc();
    47     psMetadataAddStr(args , PS_LIST_TAIL, "-uri", 0,
    48         "DataStore product URI (required)", "");
    49     psMetadataAddStr(args , PS_LIST_TAIL, "-inst", 0,
    50         "camera name (required)", "");
    51     psMetadataAddStr(args , PS_LIST_TAIL, "-telescope",  0,
    52         "telescope name (required)", "");
    53     psMetadataAddS32(args, PS_LIST_TAIL, "-timeout",  0,
    54         "HTTP timeout", 0);
    55     psMetadataAddBool(args, PS_LIST_TAIL, "-all",  0,
    56         "download ALL filesets", 0);
    57 
     47    psMetadataAddStr(args , PS_LIST_TAIL, "-uri",          0, "DataStore product URI (required)", "");
     48    psMetadataAddStr(args , PS_LIST_TAIL, "-inst",         0, "camera name (required)", "");
     49    psMetadataAddStr(args , PS_LIST_TAIL, "-telescope",    0, "telescope name (required)", "");
     50    psMetadataAddS32(args, PS_LIST_TAIL, "-timeout",       0, "HTTP timeout", 0);
     51    psMetadataAddBool(args, PS_LIST_TAIL, "-all",          0, "download ALL filesets", 0);
     52    psMetadataAddStr(args , PS_LIST_TAIL, "-last-fileset", 0, "Manually supply the last fileset (alternate starting point)", "");
    5853
    5954    bool status = false;
Note: See TracChangeset for help on using the changeset viewer.