IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17148


Ignore:
Timestamp:
Mar 25, 2008, 4:43:13 PM (18 years ago)
Author:
jhoblitt
Message:

add chiptool -updaterun

Location:
trunk/ippTools/src
Files:
5 edited

Legend:

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

    r16725 r17148  
    3535
    3636static bool queueMode(pxConfig *config);
     37static bool updaterunMode(pxConfig *config);
    3738static bool pendingimfileMode(pxConfig *config);
    3839static bool addprocessedimfileMode(pxConfig *config);
     
    6566    switch (config->mode) {
    6667        MODECASE(CHIPTOOL_MODE_QUEUE,                   queueMode);
     68        MODECASE(CHIPTOOL_MODE_UPDATERUN,               updaterunMode);
    6769        MODECASE(CHIPTOOL_MODE_PENDINGIMFILE,           pendingimfileMode);
    6870        MODECASE(CHIPTOOL_MODE_ADDPROCESSEDIMFILE,      addprocessedimfileMode);
     
    247249}
    248250
     251
     252static bool updaterunMode(pxConfig *config)
     253{
     254    PS_ASSERT_PTR_NON_NULL(config, NULL);
     255
     256    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", true, false);
     257    PXOPT_LOOKUP_STR(state, config->args, "-state", false, false);
     258    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     259
     260    if ((!state) && (!label)) {
     261        psError(PXTOOLS_ERR_DATA, false, "parameters are required");
     262        return false;
     263    }
     264
     265    if (state) {
     266        // set chipRun.state to state
     267        if (!pxchipRunSetState(config, (psS64)atoll(chip_id), state)) {
     268            return false;
     269        }
     270    }
     271
     272    if (label) {
     273        // set chipRun.label to label
     274        if (!pxchipRunSetLabel(config, (psS64)atoll(chip_id), label)) {
     275            return false;
     276        }
     277    }
     278
     279    return true;
     280}
     281
     282
    249283static bool pendingimfileMode(pxConfig *config)
    250284{
  • trunk/ippTools/src/chiptool.h

    r16613 r17148  
    2626    CHIPTOOL_MODE_NONE      = 0x0,
    2727    CHIPTOOL_MODE_QUEUE,
     28    CHIPTOOL_MODE_UPDATERUN,
    2829    CHIPTOOL_MODE_PENDINGIMFILE,
    2930    CHIPTOOL_MODE_ADDPROCESSEDIMFILE,
  • trunk/ippTools/src/chiptoolConfig.c

    r16667 r17148  
    139139    psMetadataAddBool(queueArgs, PS_LIST_TAIL, "-pretend",  0,
    140140            "do not actually modify the database", false);
     141
     142
     143    // -updaterun
     144    psMetadata *updaterunArgs = psMetadataAlloc();
     145    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-chip_id", 0,
     146            "define stack ID (required)", NULL);
     147    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0,
     148            "set state", NULL);
     149    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0,
     150            "set label", NULL);
    141151
    142152
     
    299309
    300310    PXOPT_ADD_MODE("-queue",                 "", CHIPTOOL_MODE_QUEUE,          queueArgs);
     311    PXOPT_ADD_MODE("-updaterun",             "", CHIPTOOL_MODE_UPDATERUN, updaterunArgs);
    301312    PXOPT_ADD_MODE("-pendingimfile",         "", CHIPTOOL_MODE_PENDINGIMFILE,  pendingimfileArgs);
    302313    PXOPT_ADD_MODE("-addprocessedimfile",    "", CHIPTOOL_MODE_ADDPROCESSEDIMFILE,addprocessedimfileArgs);
  • trunk/ippTools/src/pxchip.c

    r16170 r17148  
    3131bool pxchipRunSetState(pxConfig *config, psS64 chip_id, const char *state)
    3232{
     33    PS_ASSERT_PTR_NON_NULL(config, false);
    3334    PS_ASSERT_PTR_NON_NULL(state, false);
    3435
     
    4748    char *query = "UPDATE chipRun SET state = '%s' WHERE chip_id = %" PRId64;
    4849    if (!p_psDBRunQuery(config->dbh, query, state, chip_id)) {
     50        psError(PS_ERR_UNKNOWN, false,
     51                "failed to change state for chip_id %" PRId64, chip_id);
     52        return false;
     53    }
     54
     55    return true;
     56}
     57
     58
     59bool pxchipRunSetLabel(pxConfig *config, psS64 chip_id, const char *label)
     60{
     61    PS_ASSERT_PTR_NON_NULL(config, false);
     62    // note label == NULL should be explicitly allowed
     63 
     64    char *query = "UPDATE chipRun SET label = '%s' WHERE chip_id = %" PRId64;
     65    if (!p_psDBRunQuery(config->dbh, query, label, chip_id)) {
    4966        psError(PS_ERR_UNKNOWN, false,
    5067                "failed to change state for chip_id %" PRId64, chip_id);
  • trunk/ippTools/src/pxchip.h

    r16170 r17148  
    2626
    2727bool pxchipRunSetState(pxConfig *config, psS64 chip_id, const char *state);
     28bool pxchipRunSetLabel(pxConfig *config, psS64 chip_id, const char *label);
    2829
    2930psS64 pxchipQueueByExpTag(pxConfig *config,
Note: See TracChangeset for help on using the changeset viewer.