IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16242 for trunk/ippTools/src


Ignore:
Timestamp:
Jan 25, 2008, 2:41:18 PM (18 years ago)
Author:
jhoblitt
Message:

add pxwarpQueueByCamID()
modify camtool so that it can auto-start warp runs

Location:
trunk/ippTools/src
Files:
2 added
3 edited

Legend:

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

    r15783 r16242  
    3131        pxtools.h \
    3232        pxtoolsErrorCodes.h \
    33         pxtree.h
     33        pxtree.h \
     34        pxwarp.h
    3435
    3536noinst_HEADERS = \
     
    5657libpxtools_la_LDFLAGS   = -release $(PACKAGE_VERSION)
    5758libpxtools_la_SOURCES   = \
     59        pxcam.c \
     60        pxchip.c \
     61        pxconfig.c \
     62        pxdata.c \
     63        pxerrors.c \
     64        pxfault.c \
     65        pxio.c \
     66        pxregister.c \
     67        pxtables.c \
     68        pxtag.c \
    5869        pxtoolsErrorCodes.c \
    59         pxerrors.c \
    60         pxconfig.c \
    61         pxfault.c \
    62         pxtables.c \
    63         pxdata.c \
    64         pxio.c \
    65         pxtag.c \
    66         pxregister.c \
    67         pxchip.c \
    6870        pxtree.c \
    69         pxcam.c
     71        pxwarp.c
    7072
    7173# for pxtools.h
  • trunk/ippTools/src/camtool.c

    r16170 r16242  
    2727
    2828#include "pxtools.h"
     29#include "pxwarp.h"
    2930#include "camtool.h"
    3031
     
    485486        code
    486487    );
    487     psFree(pendingRow);
    488488
    489489    if (!camProcessedExpInsertObject(config->dbh, row)) {
     
    494494        psError(PS_ERR_UNKNOWN, false, "database error");
    495495        psFree(row);
     496        psFree(pendingRow);
    496497        return false;
    497498    }
     
    501502        psError(PS_ERR_UNKNOWN, false, "failed to change camRun.state for cam_id: %" PRId64, row->cam_id);
    502503        psFree(row);
    503         return false;
    504     }
    505 
     504        psFree(pendingRow);
     505        return false;
     506    }
     507
     508    // should we stop here or proceed on to the warp stage?
     509    // NULL for end_stage means go as far as possible
     510    // we can't start a warp run unlesss tess_id is defined
     511    if ((pendingRow->end_stage && psStrcasestr(pendingRow->end_stage, "cam"))
     512        || pendingRow->tess_id == NULL) {
     513        psFree(row);
     514        psFree(pendingRow);
     515        if (!psDBCommit(config->dbh)) {
     516            psError(PS_ERR_UNKNOWN, false, "database error");
     517            return false;
     518        }
     519
     520        return true;
     521    }
    506522    psFree(row);
     523    // else continue on...
     524
     525    if (!pxwarpQueueByCamID(config,
     526            pendingRow->cam_id,
     527            pendingRow->workdir,
     528            pendingRow->dvodb,
     529            pendingRow->tess_id,
     530            pendingRow->end_stage
     531    )) {
     532        // rollback
     533        if (!psDBRollback(config->dbh)) {
     534            psError(PS_ERR_UNKNOWN, false, "database error");
     535        }
     536        psError(PS_ERR_UNKNOWN, false, "failed to queue new warpRun");
     537        psFree(pendingRow);
     538        return false;
     539    }
     540    psFree(pendingRow);
    507541
    508542    if (!psDBCommit(config->dbh)) {
  • trunk/ippTools/src/warptool.c

    r16170 r16242  
    3030#include "pxtools.h"
    3131#include "warptool.h"
     32#include "pxwarp.h"
    3233
    3334static psS64 definerunMode(pxConfig *config);
     
    4647
    4748static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile);
    48 static bool setwarpRunState(pxConfig *config, psS64 warp_id, const char *state);
    4949static bool isValidMode(pxConfig *config, const char *mode);
    5050bool warpCompletedRuns(pxConfig *config);
     
    200200        return false;
    201201    }
    202     if (!setwarpRunState(config, warp_id, "run")) {
     202    if (!pxwarpRunSetState(config, warp_id, "run")) {
    203203        // rollback
    204204        if (!psDBRollback(config->dbh)) {
     
    227227    if (state) {
    228228        // set detRun.state to state
    229         return setwarpRunState(config, (psS64)atoll(warp_id), state);
     229        return pxwarpRunSetState(config, (psS64)atoll(warp_id), state);
    230230    }
    231231
     
    999999
    10001000
    1001 static bool setwarpRunState(pxConfig *config, psS64 warp_id, const char *state)
    1002 {
    1003     PS_ASSERT_PTR_NON_NULL(state, false);
    1004 
    1005     // check that state is a valid string value
    1006     if (!(
    1007             (strncmp(state, "run", 4) == 0)
    1008             || (strncmp(state, "stop", 5) == 0)
    1009             || (strncmp(state, "reg", 4) == 0)
    1010         )
    1011     ) {
    1012         psError(PS_ERR_UNKNOWN, false,
    1013                 "invalid warpRun state: %s", state);
    1014         return false;
    1015     }
    1016 
    1017     char *query = "UPDATE warpRun SET state = '%s' WHERE warp_id = %" PRId64;
    1018     if (!p_psDBRunQuery(config->dbh, query, state, warp_id)) {
    1019         psError(PS_ERR_UNKNOWN, false,
    1020                 "failed to change state for warp_id %" PRId64, warp_id);
    1021         return false;
    1022     }
    1023 
    1024     return true;
    1025 }
    1026 
    1027 
    10281001static bool isValidMode(pxConfig *config, const char *mode)
    10291002{
Note: See TracChangeset for help on using the changeset viewer.