IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33119 for trunk/ippTools/src


Ignore:
Timestamp:
Jan 19, 2012, 3:39:28 PM (15 years ago)
Author:
bills
Message:

Add support for pstampJobs that depend on other jobs. This will be used to implement
working dependency checking for detectability queries

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r32786 r33119  
    704704    PXOPT_LOOKUP_S16(fault,       config->args, "-fault",      false, false);
    705705    PXOPT_LOOKUP_S64(exp_id,      config->args, "-exp_id",     false, false);
    706     PXOPT_LOOKUP_S64(options,     config->args, "-options",     false, false);
     706    PXOPT_LOOKUP_S64(options,     config->args, "-options",    false, false);
    707707    PXOPT_LOOKUP_S64(dep_id,      config->args, "-dep_id",     false, false);
     708    PXOPT_LOOKUP_S64(parent_id,   config->args, "-parent_id",  false, false);
     709    PXOPT_LOOKUP_BOOL(is_parent,  config->args, "-is_parent",  false);
    708710
    709711    // unless the job is being inserted with stop state require outputBase
     
    716718    if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query") || !strcmp(job_type, "none")) {
    717719        stampJob = false;
     720    } else if (!strcmp(job_type, "child")) {
     721        // job_type child's only action is to resolve a dependent
     722        // XXX: IS this necessary?
     723        if (!dep_id) {
     724            psError(PS_ERR_UNKNOWN, true, "dep_id required for child job\n");
     725            return false;
     726        }
     727        if (is_parent) {
     728            psError(PS_ERR_UNKNOWN, true, "job type child can not be a parent job\n");
     729            return false;
     730        }
     731        stampJob = false;
     732    } else if (!strcmp(job_type, "mosaic")) {
     733        stampJob = false;
     734        is_parent = true;
    718735    } else if (!strcmp(job_type, "stamp")) {
    719736        stampJob = true;
     
    723740    }
    724741    if (!pstampJobInsert(config->dbh,
    725             0, // job_id
     742            0,          // job_id
    726743            req_id,
    727744            rownum,
     
    733750            options,
    734751            dep_id,
    735             0   // fault_count
     752            0,          // fault_count
     753            parent_id,
     754            is_parent
    736755            )) {
    737756        psError(PS_ERR_UNKNOWN, false, "database error");
     
    842861
    843862    // use psDBGenerateWhereSQL because the SQL yields an intermediate table
     863    psString whereStr = NULL;
    844864    if (psListLength(where->list)) {
    845865        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    846         psStringAppend(&query, " AND %s", whereClause);
     866        psStringAppend(&whereStr, "\n AND %s", whereClause);
    847867        psFree(whereClause);
     868    } else {
     869        psStringAppend(&whereStr, "%s", "");
    848870    }
    849871    psFree(where);
     
    858880    }
    859881
    860     if (!p_psDBRunQuery(config->dbh, query)) {
    861         psError(PS_ERR_UNKNOWN, false, "database error");
    862         psFree(query);
    863         return false;
    864     }
     882    if (!p_psDBRunQueryF(config->dbh, query, whereStr, whereStr)) {
     883        psError(PS_ERR_UNKNOWN, false, "database error");
     884        psFree(whereStr);
     885        psFree(query);
     886        return false;
     887    }
     888    psFree(whereStr);
    865889    psFree(query);
    866890
     
    956980
    957981    PXOPT_LOOKUP_S32(fault,  config->args, "-set_fault",  true, false);
     982    PXOPT_LOOKUP_STR(state,  config->args, "-set_state",  false, false);
    958983
    959984    psMetadata *where = psMetadataAlloc();
     
    9861011    psFree(where);
    9871012
    988     if (!p_psDBRunQueryF(config->dbh, query, fault, fault)) {
     1013    if (!p_psDBRunQueryF(config->dbh, query, fault, fault, state)) {
    9891014        psError(PS_ERR_UNKNOWN, false, "database error");
    9901015        psFree(query);
  • trunk/ippTools/src/pstamptoolConfig.c

    r32786 r33119  
    144144    psMetadataAddS64(addjobArgs, PS_LIST_TAIL, "-options", 0,          "define options", 0);
    145145    psMetadataAddS64(addjobArgs, PS_LIST_TAIL, "-dep_id", 0,           "define job dep_id", 0);
     146    psMetadataAddS64(addjobArgs, PS_LIST_TAIL, "-parent_id", 0,        "define parent's job_id", 0);
     147    psMetadataAddBool(addjobArgs, PS_LIST_TAIL, "-is_parent", 0,       "define whether job has children", false);
    146148    psMetadataAddS16(addjobArgs, PS_LIST_TAIL, "-fault", 0,            "define job result", 0);
    147149
     
    186188    psMetadataAddS32(stopdependentjobArgs, PS_LIST_TAIL,  "-fault_count", 0,   "select by fault_count (>=)", 0);
    187189    psMetadataAddS16(stopdependentjobArgs, PS_LIST_TAIL,  "-set_fault", 0,    "new fault value for job and dependent (required)", 0);
     190    psMetadataAddStr(stopdependentjobArgs, PS_LIST_TAIL, "-set_state", 0,            "new pstampDependent.state", "new");
    188191    psMetadataAddStr(stopdependentjobArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL);
    189192    psMetadataAddU64(stopdependentjobArgs, PS_LIST_TAIL, "-limit", 0,      "not used", 0);
Note: See TracChangeset for help on using the changeset viewer.