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/stacktool.c

    r25766 r25870  
    109109
    110110    // required options
    111     PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false);
    112     PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
    113     PXOPT_LOOKUP_STR(reduction, config->args, "-reduction", false, false);
    114     PXOPT_LOOKUP_STR(dvodb, config->args, "-dvodb", false, false);
     111    PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", true, false);
     112
     113    // optional
     114    PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
     115    PXOPT_LOOKUP_STR(data_group, config->args, "-set_data_group", false, false);
     116    PXOPT_LOOKUP_STR(dist_group, config->args, "-set_dist_group", false, false);
     117    PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false);
     118    PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false);
     119    PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false);
     120    PXOPT_LOOKUP_TIME(registered, config->args, "-set_registered", false, false);
    115121
    116122    psMetadata *where = psMetadataAlloc();
     
    160166    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    161167    PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
    162     PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false);
    163 
    164     if (!psListLength(where->list) &&
    165         !psMetadataLookupBool(NULL, config->args, "-all")) {
     168
     169    if (!psListLength(where->list)) {
    166170        psFree(where);
    167171        psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
     
    345349            workdir,
    346350            label,
     351            data_group ? data_group : label,
     352            dist_group,
    347353            reduction,
    348354            dvodb,
     
    350356            skycell_id,
    351357            tess_id,
    352             filter);
     358            filter,
     359            note);
    353360
    354361        if (!stackRunInsertObject(config->dbh, run)) {
     
    468475
    469476    // required options
    470     PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false);
     477    PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", true, false);
    471478    PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false);
    472479    PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false);
     
    475482    // default
    476483    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    477     PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false);
     484    PXOPT_LOOKUP_TIME(registered, config->args, "-set_registered", false, false);
    478485
    479486    // options
    480     PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
    481     PXOPT_LOOKUP_STR(reduction, config->args, "-reduction", false, false);
    482     PXOPT_LOOKUP_STR(dvodb, config->args, "-dvodb", false, false);
     487    PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
     488    PXOPT_LOOKUP_STR(data_group, config->args, "-set_data_group", false, false);
     489    PXOPT_LOOKUP_STR(dist_group, config->args, "-set_dist_group", false, false);
     490    PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false);
     491    PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false);
     492    PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false);
    483493
    484494    // we have to support multipe exp_ids
     
    495505        workdir,
    496506        label,
     507        data_group ? data_group : label,
     508        dist_group,
    497509        reduction,
    498510        dvodb,
     
    500512        skycell_id,
    501513        tess_id,
    502         filter);
     514        filter,
     515        note);
    503516
    504517    if (!run) {
     
    569582    PS_ASSERT_PTR_NON_NULL(config, false);
    570583
    571     PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", true, false);
     584#ifdef notdef
     585    PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", false, false);
    572586    PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
    573 
    574     if (state) {
     587    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     588#endif
     589    psMetadata *where = psMetadataAlloc();
     590    PXOPT_COPY_S64(config->args, where, "-stack_id",  "stack_id",   "==");
     591    PXOPT_COPY_STR(config->args, where, "-label",     "label",     "==");
     592    PXOPT_COPY_STR(config->args, where, "-state",     "state",     "==");
     593    if (!psListLength(where->list)) {
     594        psFree(where);
     595        psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
     596        return false;
     597    }
     598
     599    psString query = psStringCopy("UPDATE stackRun");
     600
     601    // pxUpdateRun gets parameters from config->args and updates
     602    bool result = pxUpdateRun(config, where, &query, "stackRun", true);
     603
     604    psFree(query);
     605    psFree(where);
     606
     607    return result;
     608
     609#ifdef notdef
     610    // Hack-y work around to make stacktool more like the other tools, without breaking other stuff (hopefully).
     611
     612    if ((state)&&(stack_id)) {
    575613        // set detRun.state to state
    576614        return setstackRunState(config, stack_id, state);
    577615    }
    578616
    579     return true;
     617    if ((state)&&(label)) {
     618      return setstackRunStateByLabel(config, label, state);
     619    }
     620
     621    psError(PS_ERR_UNKNOWN, false, "Required options not found.");
     622    return false;
     623#endif
    580624}
    581625
     
    10061050}
    10071051
     1052#ifdef notdef
     1053static bool setstackRunStateByLabel(pxConfig *config, const char *label, const char *state)
     1054{
     1055    PS_ASSERT_PTR_NON_NULL(state, false);
     1056
     1057    // check that state is a valid string value
     1058    if (!pxIsValidState(state)) {
     1059        psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state);
     1060        return false;
     1061    }
     1062
     1063    char *query = "UPDATE stackRun SET state = '%s' WHERE label = '%s'";
     1064    if (!p_psDBRunQueryF(config->dbh, query, state, label)) {
     1065        psError(PS_ERR_UNKNOWN, false,
     1066                "failed to change state for label %s", label);
     1067        return false;
     1068    }
     1069
     1070    return true;
     1071}
     1072#endif
     1073
    10081074static bool pendingcleanuprunMode(pxConfig *config)
    10091075{
     
    12311297  }
    12321298
     1299  if (!pxExportVersion(config, f)) {
     1300    psError(PS_ERR_UNKNOWN, false, "failed to write dbversion output file");
     1301    return false;
     1302  }
    12331303  psMetadata *where = psMetadataAlloc();
    12341304  PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "==");
     
    13171387  psMetadata *input = psMetadataConfigRead (NULL, &nFail, infile, false);
    13181388
    1319   fprintf (stdout, "---- input ----\n");
     1389#ifdef notdef
     1390  fprintf (stderr, "---- input ----\n");
    13201391  psMetadataPrint (stderr, input, 1);
    1321 
     1392#endif
     1393
     1394  if (!pxCheckImportVersion(config, input)) {
     1395      psError(PS_ERR_UNKNOWN, false, "pxCheckImportVersion failed");
     1396      return false;
     1397  }
    13221398  psMetadataItem *item = psMetadataLookup (input, "stackRun");
    13231399  psAssert (item, "entry not in input?");
Note: See TracChangeset for help on using the changeset viewer.