IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25800


Ignore:
Timestamp:
Oct 7, 2009, 4:25:35 PM (17 years ago)
Author:
watersc1
Message:

Updates to various tools to fix errors in cleanup.

Location:
trunk/ippTools
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/share/Makefile.am

    r25793 r25800  
    8989     dettool_toresidimfile.sql \
    9090     dettool_tostacked.sql \
     91     difftool_change_skyfile_data_state.sql \
     92     difftool_change_run_state.sql \
    9193     difftool_completed_runs.sql \
    9294     difftool_definewarpstack_part1.sql \
  • trunk/ippTools/share/difftool_pendingcleanuprun.sql

    r24186 r25800  
    11-- does this result in too many entries (one for each diffInputSkyfile?)
    22-- all of this is just to get the camera used for the diff run
    3 SELECT
    4     diffRun.diff_id,
    5     rawExp.camera,
    6     diffRun.state
    7 FROM diffRun
    8 JOIN diffInputSkyfile
    9     USING(diff_id)
    10 JOIN warpSkyfile
    11     ON  diffInputSkyfile.warp1    = warpSkyfile.warp_id
    12     AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id
    13     AND diffInputSkyfile.tess_id    = warpSkyfile.tess_id
    14 JOIN warpRun
    15     ON warpRun.warp_id = warpSkyfile.warp_id
    16 JOIN fakeRun
    17     USING(fake_id)
    18 JOIN camRun
    19     USING(cam_id)
    20 JOIN chipRun
    21     USING(chip_id)
    22 JOIN rawExp
    23     USING(exp_id)
    24 WHERE
    25     (diffRun.state = 'goto_cleaned' OR diffRun.state = 'goto_scrubbed' OR diffRun.state = 'goto_purged')
     3SELECT DISTINCT * FROM
     4   (SELECT
     5            diffRun.diff_id,
     6            rawExp.camera,
     7            diffRun.state,
     8            diffRun.label
     9        FROM diffRun
     10        JOIN diffInputSkyfile
     11            USING(diff_id)
     12        JOIN warpSkyfile
     13            ON  diffInputSkyfile.warp1    = warpSkyfile.warp_id
     14            AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id
     15            AND diffInputSkyfile.tess_id    = warpSkyfile.tess_id
     16        JOIN warpRun
     17            ON warpRun.warp_id = warpSkyfile.warp_id
     18        JOIN fakeRun
     19            USING(fake_id)
     20        JOIN camRun
     21            USING(cam_id)
     22        JOIN chipRun
     23            USING(chip_id)
     24        JOIN rawExp
     25            USING(exp_id)
     26        WHERE
     27            (diffRun.state = 'goto_cleaned' OR
     28             diffRun.state = 'goto_scrubbed' OR
     29             diffRun.state = 'goto_purged')
     30     UNION
     31     SELECT
     32            diffRun.diff_id,
     33            rawExp.camera,
     34            diffRun.state,
     35            diffRun.label
     36        FROM diffRun
     37        JOIN diffInputSkyfile
     38            USING(diff_id)
     39        JOIN warpSkyfile
     40            ON  diffInputSkyfile.warp2    = warpSkyfile.warp_id
     41            AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id
     42            AND diffInputSkyfile.tess_id    = warpSkyfile.tess_id
     43        JOIN warpRun
     44            ON warpRun.warp_id = warpSkyfile.warp_id
     45        JOIN fakeRun
     46            USING(fake_id)
     47        JOIN camRun
     48            USING(cam_id)
     49        JOIN chipRun
     50            USING(chip_id)
     51        JOIN rawExp
     52            USING(exp_id)
     53        WHERE
     54            (diffRun.state = 'goto_cleaned' OR
     55             diffRun.state = 'goto_scrubbed' OR
     56             diffRun.state = 'goto_purged')
     57     UNION
     58     SELECT
     59            diffRun.diff_id,
     60            rawExp.camera,
     61            diffRun.state,
     62            diffRun.label
     63        FROM diffRun
     64        JOIN diffInputSkyfile
     65            USING(diff_id)
     66        JOIN stackSumSkyfile
     67            ON  diffInputSkyfile.stack1 = stackSumSkyfile.stack_id
     68        JOIN stackInputSkyfile
     69            ON diffInputSkyfile.stack1 = stackInputSkyfile.stack_id
     70        JOIN warpRun
     71            ON warpRun.warp_id = stackInputSkyfile.warp_id
     72        JOIN fakeRun
     73            USING(fake_id)
     74        JOIN camRun
     75            USING(cam_id)
     76        JOIN chipRun
     77            USING(chip_id)
     78        JOIN rawExp
     79            USING(exp_id)
     80        WHERE
     81            (diffRun.state = 'goto_cleaned' OR
     82             diffRun.state = 'goto_scrubbed' OR
     83             diffRun.state = 'goto_purged')
     84     UNION
     85     SELECT
     86            diffRun.diff_id,
     87            rawExp.camera,
     88            diffRun.state,
     89            diffRun.label
     90        FROM diffRun
     91        JOIN diffInputSkyfile
     92            USING(diff_id)
     93        JOIN stackSumSkyfile
     94            ON  diffInputSkyfile.stack2 = stackSumSkyfile.stack_id
     95        JOIN stackInputSkyfile
     96            ON diffInputSkyfile.stack2 = stackInputSkyfile.stack_id
     97        JOIN warpRun
     98            ON warpRun.warp_id = stackInputSkyfile.warp_id
     99        JOIN fakeRun
     100            USING(fake_id)
     101        JOIN camRun
     102            USING(cam_id)
     103        JOIN chipRun
     104            USING(chip_id)
     105        JOIN rawExp
     106            USING(exp_id)
     107        WHERE
     108            (diffRun.state = 'goto_cleaned' OR
     109             diffRun.state = 'goto_scrubbed' OR
     110             diffRun.state = 'goto_purged')
     111        ) as Foo
     112        WHERE 1
  • trunk/ippTools/src/chiptool.c

    r25790 r25800  
    728728    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
    729729    PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
    730     PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
    731 
    732     if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, fault)) {
     730    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, NULL);
     731       
     732    if (!state) {
     733      PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
     734     
     735      if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, fault)) {
    733736        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    734737        return false;
    735     }
    736     psFree(where);
    737 
     738      }
     739      psFree(where);
     740    }
     741    else {
     742      if (!pxchipProcessedImfileSetStateByQuery(config,where,state)) {
     743        psError(PS_ERR_UNKNOWN, false, "failed to set chipProcessedImfile state");
     744        return(false);
     745      }
     746    }
     747
     748     
    738749    return true;
    739750}
  • trunk/ippTools/src/chiptoolConfig.c

    r25777 r25800  
    182182    psMetadataAddStr(updateprocessedimfileArgs,  PS_LIST_TAIL, "-class_id",           0, "search by class ID", NULL);
    183183    psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code (required)", 0);
    184 
     184    psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-set_state", 0,         "set state", NULL);
    185185    // -block
    186186    psMetadata *blockArgs = psMetadataAlloc();
  • trunk/ippTools/src/difftool.c

    r25790 r25800  
    5151
    5252static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state, psS64 magicked);
     53static bool setdiffRunStateByLabel(pxConfig *config, const char* label, const char *state);
     54static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state);
     55static bool tocleanedskyfileMode(pxConfig *config);
     56static bool topurgedskyfileMode(pxConfig *config);
     57static bool toscrubbedskyfileMode(pxConfig *config);
     58
     59
    5360
    5461# define MODECASE(caseName, func) \
     
    8895        MODECASE(DIFFTOOL_MODE_EXPORTRUN,             exportrunMode);
    8996        MODECASE(DIFFTOOL_MODE_IMPORTRUN,             importrunMode);
     97        MODECASE(DIFFTOOL_MODE_TOCLEANEDSKYFILE,   tocleanedskyfileMode);
     98        MODECASE(DIFFTOOL_MODE_TOPURGEDSKYFILE,    topurgedskyfileMode);
     99        MODECASE(DIFFTOOL_MODE_TOSCRUBBEDSKYFILE,  toscrubbedskyfileMode);
     100
    90101        default:
    91102            psAbort("invalid option (this should not happen)");
     
    169180
    170181    // required options
    171     PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false);
     182    PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", false, false);
    172183    PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
    173 
    174     if (state) {
     184    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     185   
     186    // Copy of my hacky work around from stacktool.c
     187    if ((state)&&(diff_id)) {
    175188        // set detRun.state to state
    176189        return setdiffRunState(config, diff_id, state, false);
    177190    }
    178191
    179     return true;
     192    if ((state)&&(label)) {
     193      return setdiffRunStateByLabel(config, label, state);
     194    }
     195
     196    psError(PS_ERR_UNKNOWN, false, "Required options not found.");
     197
     198    return false;
    180199}
    181200
     
    865884    }
    866885
    867     char *query = "UPDATE diffRun SET state = '%s', magicked = %" PRId64 " WHERE diff_id = %"PRId64;
    868 
    869     if (!p_psDBRunQueryF(config->dbh, query, state, magicked, diff_id)) {
     886    if (magicked) {
     887      char *query = "UPDATE diffRun SET state = '%s', magicked = %" PRId64 " WHERE diff_id = %"PRId64;
     888     
     889      if (!p_psDBRunQueryF(config->dbh, query, state, magicked, diff_id)) {
    870890        psError(PS_ERR_UNKNOWN, false,
    871891                "failed to change state for diff_id %"PRId64, diff_id);
    872892        return false;
    873     }
    874 
     893      }
     894    }
     895    else {
     896      char *query = "UPDATE diffRun SET state = '%s' WHERE diff_id = %"PRId64;
     897     
     898      if (!p_psDBRunQueryF(config->dbh, query, state, diff_id)) {
     899        psError(PS_ERR_UNKNOWN, false,
     900                "failed to change state for diff_id %"PRId64, diff_id);
     901        return false;
     902      }
     903    }
     904   
    875905    return true;
     906}
     907
     908
     909static bool setdiffRunStateByLabel(pxConfig *config, const char *label, const char *state) {
     910  PS_ASSERT_PTR_NON_NULL(state,false);
     911
     912  // check that state is a valid string value
     913  if (!pxIsValidState(state)) {
     914    psError(PS_ERR_UNKNOWN, false, "invalid diffRun state: %s", state);
     915    return false;
     916  }
     917
     918  char *query = "UPDATE diffRun SET state = '%s' WHERE label = '%s'";
     919  if (!p_psDBRunQueryF(config->dbh,query,state,label)) {
     920    psError(PS_ERR_UNKNOWN, false,
     921            "failed to change state for label %s", label);
     922    return(false);
     923  }
     924
     925  return true;
    876926}
    877927
     
    17251775
    17261776    psMetadata *where = psMetadataAlloc();
    1727     pxAddLabelSearchArgs (config, where, "-label", "diffRun.label", "==");
     1777    pxAddLabelSearchArgs (config, where, "-label", "label", "==");
    17281778
    17291779    psString query = pxDataGet("difftool_pendingcleanuprun.sql");
     
    17471797    }
    17481798
     1799    //    fprintf(stderr,"%s",query);
    17491800    if (!p_psDBRunQuery(config->dbh, query)) {
    17501801        psError(PS_ERR_UNKNOWN, false, "database error");
     
    19181969
    19191970    return true;
     1971}
     1972
     1973static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state) {
     1974  PS_ASSERT_PTR_NON_NULL(config, false);
     1975
     1976  // diff_id, skycell_id are required
     1977  PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false);
     1978  PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false);
     1979
     1980  psString query = pxDataGet("difftool_change_skyfile_data_state.sql");
     1981
     1982  if (!psDBTransaction(config->dbh)) {
     1983    psError(PS_ERR_UNKNOWN, false, "database error");
     1984    return(false);
     1985  }
     1986
     1987  // Uses the unconstrained (diffRun.state [NEED NOT EQUAL] run_state) version from warptool.c
     1988
     1989  if (!p_psDBRunQueryF(config->dbh, query, data_state, diff_id, skycell_id)) {
     1990    psError(PS_ERR_UNKNOWN, false, "database error");
     1991    // rollback
     1992    if (!psDBRollback(config->dbh)) {
     1993      psError(PS_ERR_UNKNOWN, false, "database error");
     1994    }
     1995    psError(PS_ERR_UNKNOWN, false, "database error");
     1996    return(false);
     1997  }
     1998  psFree(query);
     1999
     2000  query = pxDataGet("difftool_change_run_state.sql");
     2001  if (!p_psDBRunQueryF(config->dbh, query, data_state, diff_id, data_state)) {
     2002    // rollback
     2003    if (!psDBRollback(config->dbh)) {
     2004      psError(PS_ERR_UNKNOWN, false, "database error");
     2005    }
     2006    psError(PS_ERR_UNKNOWN, false, "database error");
     2007    return(false);
     2008  }
     2009
     2010  if (!psDBCommit(config->dbh)) {
     2011    psError(PS_ERR_UNKNOWN, false, "database error");
     2012    return(false);
     2013  }
     2014 
     2015  return(true);
     2016}
     2017
     2018static bool tocleanedskyfileMode(pxConfig *config) {
     2019  return change_skyfile_data_state(config, "cleaned","goto_cleaned");
     2020}
     2021static bool topurgedskyfileMode(pxConfig *config) {
     2022  return change_skyfile_data_state(config, "purged", "goto_purged");
     2023}
     2024static bool toscrubbedskyfileMode(pxConfig *config) {
     2025  return change_skyfile_data_state(config, "scrubbed", "goto_scrubbed");
    19202026}
    19212027
  • trunk/ippTools/src/difftool.h

    r25509 r25800  
    4242    DIFFTOOL_MODE_UPDATEDIFFSKYFILE,
    4343    DIFFTOOL_MODE_EXPORTRUN,
    44     DIFFTOOL_MODE_IMPORTRUN
     44    DIFFTOOL_MODE_IMPORTRUN,
     45    DIFFTOOL_MODE_TOCLEANEDSKYFILE,
     46    DIFFTOOL_MODE_TOPURGEDSKYFILE,
     47    DIFFTOOL_MODE_TOSCRUBBEDSKYFILE
     48   
    4549} difftoolMode;
    4650
  • trunk/ippTools/src/difftoolConfig.c

    r25775 r25800  
    6060    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-diff_id", 0,            "define diff ID (required)", 0);
    6161    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0,            "set state (required)", NULL);
    62 
     62    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0,            "define by label instead of diff ID", 0);
     63   
    6364    // -addinputskyfile
    6465    psMetadata *addinputskyfileArgs = psMetadataAlloc();
     
    258259    psMetadataAddS16(updatediffskyfileArgs, PS_LIST_TAIL, "-fault", 0,         "set fault code (required)", 0);
    259260
     261    // -tocleanedskyfile
     262    psMetadata *tocleanedskyfileArgs = psMetadataAlloc();
     263    psMetadataAddS64(tocleanedskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, "difftool ID to update", 0);
     264    psMetadataAddStr(tocleanedskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL);
     265
     266    // -topurgedskyfile
     267    psMetadata *topurgedskyfileArgs = psMetadataAlloc();
     268    psMetadataAddS64(topurgedskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,    "difftool ID to update", 0);
     269    psMetadataAddStr(topurgedskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL);
     270
     271    // -toscrubbedskyfile
     272    psMetadata *toscrubbedskyfileArgs = psMetadataAlloc();
     273    psMetadataAddS64(toscrubbedskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, "difftool ID to update", 0);
     274    psMetadataAddStr(toscrubbedskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL);
     275
    260276    // -exportrun
    261277    psMetadata *exportrunArgs = psMetadataAlloc();
     
    295311    PXOPT_ADD_MODE("-importrun",            "import run from metadata file",           DIFFTOOL_MODE_IMPORTRUN, importrunArgs);
    296312
     313    PXOPT_ADD_MODE("-tocleanedskyfile", "set skyfile as cleaned", DIFFTOOL_MODE_TOCLEANEDSKYFILE, tocleanedskyfileArgs);
     314    PXOPT_ADD_MODE("-topurgedskyfile", "set skyfile as purged", DIFFTOOL_MODE_TOPURGEDSKYFILE, topurgedskyfileArgs);
     315    PXOPT_ADD_MODE("-toscrubbedskyfile", "set skyfile as scrubbed", DIFFTOOL_MODE_TOSCRUBBEDSKYFILE, toscrubbedskyfileArgs);
     316   
    297317    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
    298318        psError(PS_ERR_UNKNOWN, true, "option parsing failed");
  • trunk/ippTools/src/pxchip.c

    r24866 r25800  
    192192}
    193193
    194 
    195194bool pxchipRunSetLabel(pxConfig *config, psS64 chip_id, const char *label)
    196195{
     
    233232}
    234233
     234bool pxchipProcessedImfileSetStateByQuery(pxConfig *config, psMetadata *where, const char *state)
     235{
     236    PS_ASSERT_PTR_NON_NULL(config, false);
     237    PS_ASSERT_PTR_NON_NULL(state, false);
     238
     239    // check that state is a valid string value
     240    if (!pxIsValidState(state)) {
     241        psError(PS_ERR_UNKNOWN, false, "invalid chipProcessedImfile state: %s", state);
     242        return false;
     243    }
     244
     245/*     if (!strcmp(state, "full")) { */
     246/*         // There are states that need to be met for a run to be set to full that we don't */
     247/*         // check here. */
     248/*         // for example all of the run's Imfiles must have chipProcessedImfile.data_state == "full" */
     249/*         // chipRun.magicked = (SUM(!chipProcessedImfile.magicked) = 0) */
     250/*         // so don't do allow setting the state to full */
     251/*         psError(PS_ERR_UNKNOWN, true, "cannot use -updaterun so set chipRun state to full"); */
     252/*         return false; */
     253/*     } */
     254
     255    psString query = psStringCopy("UPDATE chipProcessedImfile JOIN chipRun USING(chip_id) JOIN rawExp ON chipRun.exp_id = rawExp.exp_id SET state = '%s'");
     256
     257    if (where && psListLength(where->list) > 0) {
     258        psString whereClause = psDBGenerateWhereSQL(where, NULL);
     259        psStringAppend(&query, " %s", whereClause);
     260        psFree(whereClause);
     261    }
     262
     263    if (!p_psDBRunQueryF(config->dbh, query, state)) {
     264        psFree(query);
     265        psError(PS_ERR_UNKNOWN, false, "database error");
     266        return false;
     267    }
     268
     269    psFree(query);
     270
     271    return true;
     272}
    235273
    236274psS64 pxchipQueueByExpTag(pxConfig *config,
  • trunk/ippTools/src/pxchip.h

    r23381 r25800  
    2525#include "pxtools.h"
    2626
     27
     28
    2729bool pxchipRunSetState(pxConfig *config, psS64 chip_id, const char *state, const bool magicked);
    2830bool pxchipRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *state);
    2931bool pxchipRunSetLabel(pxConfig *config, psS64 chip_id, const char *label);
    3032bool pxchipRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *label);
     33
     34bool pxchipProcessedImfileSetStateByQuery(pxConfig *config, psMetadata *where, const char *state);
    3135
    3236psS64 pxchipQueueByExpTag(pxConfig *config,
  • trunk/ippTools/src/stacktool.c

    r25691 r25800  
    4848
    4949static bool setstackRunState(pxConfig *config, psS64 stack_id, const char *state);
     50static bool setstackRunStateByLabel(pxConfig *config, const char *label, const char *state);
    5051
    5152# define MODECASE(caseName, func) \
     
    569570    PS_ASSERT_PTR_NON_NULL(config, false);
    570571
    571     PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", true, false);
     572    PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", false, false);
    572573    PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
    573 
    574     if (state) {
     574    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     575
     576    // Hack-y work around to make stacktool more like the other tools, without breaking other stuff (hopefully).
     577
     578    if ((state)&&(stack_id)) {
    575579        // set detRun.state to state
    576580        return setstackRunState(config, stack_id, state);
    577581    }
    578582
    579     return true;
     583    if ((state)&&(label)) {
     584      return setstackRunStateByLabel(config, label, state);
     585    }
     586
     587    psError(PS_ERR_UNKNOWN, false, "Required options not found.");
     588    return false;
    580589}
    581590
     
    10061015}
    10071016
     1017static bool setstackRunStateByLabel(pxConfig *config, const char *label, const char *state)
     1018{
     1019    PS_ASSERT_PTR_NON_NULL(state, false);
     1020
     1021    // check that state is a valid string value
     1022    if (!pxIsValidState(state)) {
     1023        psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state);
     1024        return false;
     1025    }
     1026
     1027    char *query = "UPDATE stackRun SET state = '%s' WHERE label = '%s'";
     1028    if (!p_psDBRunQueryF(config->dbh, query, state, label)) {
     1029        psError(PS_ERR_UNKNOWN, false,
     1030                "failed to change state for label %s", label);
     1031        return false;
     1032    }
     1033
     1034    return true;
     1035}
     1036
    10081037static bool pendingcleanuprunMode(pxConfig *config)
    10091038{
  • trunk/ippTools/src/stacktoolConfig.c

    r25691 r25800  
    108108    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-stack_id", 0,            "define stack ID (required)", 0);
    109109    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0,            "set state (required)", NULL);
    110 
     110    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0,            "define by label instead of stack ID", 0);
     111   
    111112    // -addinputskyfile
    112113    psMetadata *addinputskyfileArgs = psMetadataAlloc();
  • trunk/ippTools/src/warptool.c

    r25778 r25800  
    17091709    PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false);
    17101710    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    1711 
    1712     psString query = pxDataGet("warptool_updateskyfile.sql");
    1713 
    1714     if (!p_psDBRunQueryF(config->dbh, query, fault, warp_id, skycell_id)) {
    1715         psError(PS_ERR_UNKNOWN, false, "database error");
    1716         return false;
    1717     }
    1718     psFree(query);
     1711    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
     1712
     1713    if (!state) {
     1714      psString query = pxDataGet("warptool_updateskyfile.sql");
     1715     
     1716      if (!p_psDBRunQueryF(config->dbh, query, fault, warp_id, skycell_id)) {
     1717        psError(PS_ERR_UNKNOWN, false, "database error");
     1718        return false;
     1719      }
     1720      psFree(query);
     1721    }
     1722    else {
     1723      if (strcmp(state,"error_cleaned") == 0) {
     1724        change_skyfile_data_state(config,"error_cleaned","goto_cleaned");
     1725      }
     1726      else if (strcmp(state, "error_scrubbed") == 0) {
     1727        change_skyfile_data_state(config,"error_scrubbed","goto_scrubbed");
     1728      }
     1729      else if (strcmp(state, "error_purged") == 0) {
     1730        change_skyfile_data_state(config,"error_purged","goto_purged");
     1731      }
     1732      else {
     1733        psError(PS_ERR_UNKNOWN, false, "unhandled state given");
     1734        return(false);
     1735      }
     1736    }
    17191737
    17201738    return true;
  • trunk/ippTools/src/warptoolConfig.c

    r25775 r25800  
    305305    psMetadataAddStr(updateskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL);
    306306    psMetadataAddS16(updateskyfileArgs, PS_LIST_TAIL, "-fault",  0,      "new fault code", 0);
    307 
     307    psMetadataAddStr(updateskyfileArgs, PS_LIST_TAIL, "-set_state", 0,   "set state", 0);
     308   
    308309    // -exportrun
    309310    psMetadata *exportrunArgs = psMetadataAlloc();
Note: See TracChangeset for help on using the changeset viewer.