IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 15, 2011, 9:05:36 AM (15 years ago)
Author:
bills
Message:

various changes to support the distribution of raw images without magic. For distributing detrend images.

File:
1 edited

Legend:

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

    r30551 r30906  
    141141    PXOPT_LOOKUP_BOOL(use_alternate, config->args, "-use_alternate", false);
    142142    PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false);
     143    PXOPT_LOOKUP_BOOL(i_am_sure, config->args, "-i_am_sure", false);
    143144    PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);
    144145    PXOPT_LOOKUP_STR(set_data_group, config->args, "-set_data_group", false, false);
     
    150151    PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
    151152
     153    // select arguments
     154    psMetadata *where = psMetadataAlloc();
     155
     156    PXOPT_COPY_S64(config->args, where, "-target_id", "distTarget.target_id",    "==");
     157    PXOPT_COPY_S64(config->args, where, "-exp_id",    "rawExp.exp_id",           "==");
     158    PXOPT_COPY_S64(config->args, where, "-chip_id",   "chipRun.chip_id",         "==");
     159    PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "==");;
     160    PXOPT_COPY_STR(config->args, where, "-dist_group", "distTarget.dist_group", "==");;
     161
     162    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     163    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", false, false);
     164    PXOPT_LOOKUP_STR(exp_type, config->args, "-exp_type", false, false);
     165    PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", false, false);
     166
     167    // queuing no_magic runs can be quite dangerous. Require confirmation
     168    if (no_magic && !pretend && !i_am_sure) {
     169        psError(PXTOOLS_ERR_SYS, true, "-i_am_sure required to queue no_magic distribution runs");
     170        return false;
     171    }
     172   
    152173    if (use_alternate) {
    153174        if (strcmp(stage, "raw")) {
     
    161182    }
    162183
    163     // select arguments
    164     psMetadata *where = psMetadataAlloc();
    165 
    166     PXOPT_COPY_S64(config->args, where, "-target_id", "distTarget.target_id",    "==");
    167     PXOPT_COPY_S64(config->args, where, "-exp_id",    "rawExp.exp_id",           "==");
    168     PXOPT_COPY_S64(config->args, where, "-chip_id",   "chipRun.chip_id",         "==");
    169 
    170     PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
    171     PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", false, false);
     184    // We want to possible to distribute unmagicked raw exposures for the purpose
     185    // of distributing detrend inputs
     186    // To make it less likely that unmagicked raw stage exposures from being distributed
     187    // accidentally we require that dist_group (to select target and destination with
     188    // an interest)
     189    // and exp_id to be supplied. We could add -exp_type and dateobs cuts to make it easier
     190    if (!strcmp(stage, "raw") && no_magic && !(exp_id && dist_group && exp_type)) {
     191        psError(PXTOOLS_ERR_SYS, true, "exp_id, exp_type, and dist_group are required for raw stage if no_magic");
     192        return false;
     193    }
     194
    172195
    173196    psString query = NULL;
     
    182205            runJoinStr = "camRun.exp_id";
    183206        }
    184         query = pxDataGet("disttool_definebyquery_raw.sql");
     207        if (!no_magic) {
     208            query = pxDataGet("disttool_definebyquery_raw.sql");
     209        } else {
     210            query = pxDataGet("disttool_definebyquery_raw_no_magic.sql");
     211        }
    185212        if (!query) {
    186213            psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     
    189216        }
    190217
    191         // for raw stage we select by camRun.label and dist_group because rawExp doesn't have those columns
    192         if (label) {
    193             psStringAppend(&query, " AND (magicDSRun.label = '%s')", label);
    194         }
    195         if (dist_group) {
    196             psStringAppend(&query, " AND (camRun.dist_group = '%s')", dist_group);
     218        if (!no_magic) {
     219            if (label) {
     220                psStringAppend(&query, " AND (magicDSRun.label = '%s')", label);
     221            }
     222            // for raw stage we select by camRun.label and dist_group because rawExp
     223            // doesn't have those columns
     224            if (dist_group) {
     225                psStringAppend(&query, " AND (camRun.dist_group = '%s')", dist_group);
     226            }
    197227        }
    198228    } else if (!strcmp(stage, "chip")) {
Note: See TracChangeset for help on using the changeset viewer.