IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 5, 2010, 12:26:50 PM (16 years ago)
Author:
rhenders
Message:

Changed SQL to query for exposures against data known to be loaded to the provided DVO database

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/perl/ippToPsps_run.pl

    r28842 r28849  
    1818my $camera = 'GPC1';
    1919my $batchType = undef;
    20 my $survey = undef;
    21 my $dvodb = undef;
     20my $dvoPath = undef;
     21my $dvoDb = undef;
     22my $fullDvoPath = undef;
    2223my $verbose = undef;
    2324my $save_temps = undef;
     
    3435        'output|o=s' => \$output,
    3536        'batch|b=s' => \$batchType,
    36         'dvodb|d=s' => \$dvodb,
    37         'survey|s=s' => \$survey,
     37        'dvopath=s' => \$dvoPath,
     38        'dvodb|d=s' => \$dvoDb,
    3839        'expid|e=s' => \$singleExpId,
    3940        'product|p=s' => \$datastoreProduct,
     
    4950print "* \n";
    5051if (@ARGV) {
    51     print "* UNKNKOWN: option                          @ARGV\n"; $quit=1;}
     52    $quit=1;
     53    print "* UNKNKOWN: option                          @ARGV\n";
     54}
    5255if (!defined $output) {
    53     print "* REQUIRED: need to provide an output path  -o <path>\n"; $quit=1;}
     56    $quit=1;
     57    print "* REQUIRED: need to provide an output path  -o <path>\n";
     58}
    5459if (!defined $batchType) {
    55     print "* REQUIRED: need to define a batch type     -b <init|det|diff|stack>\n"; $quit=1;}
    56 if (!defined $dvodb) {
    57     print "* REQUIRED: need to provide a DVO Db path   -d <path>\n"; $quit=1;}
    58 if (!defined $survey and !defined $singleExpId) {
    59     print "* REQUIRED: need to provide a survey type   -s <ThreePi|STS|SAS|M31|MD01|MD02|etc> ***OR***\n";
    60     print "*           an exposure ID                  -e <expID>\n"; $quit=1;}
     60    $quit=1;
     61    print "* REQUIRED: need to define a batch type     -b <init|det|diff|stack>\n";
     62}
     63if (!defined $dvoDb) {
     64    $quit=1;
     65    print "* REQUIRED: need to provide a DVO Db name   -d <name>\n";
     66}
     67if (!defined $dvoPath) {
     68    $dvoPath="/data/ipp037.0/gpc1/catdirs";
     69    print "* OPTIONAL: path to DVO Db                  -dvopath <path>      default = '$dvoPath'\n";
     70}
     71if (!defined $singleExpId) {
     72
     73    print "* OPTIONAL: an single exposure ID           -e <expID>           default = none\n";
     74}
    6175if (!defined $datastoreProduct) {
    62     print "* OPTIONAL: datastore product               -p <product>\n";}
     76
     77    print "* OPTIONAL: datastore product               -p <product>         default = none (i.e. data will not be published)\n";
     78}
    6379if (!defined $verbose) {
    64     print "* OPTIONAL: run in verbose mode             -v\n"; $verbose = 0;}
     80    $verbose = 0;
     81    print "* OPTIONAL: run in verbose mode             -v                   default = $verbose\n";
     82}
    6583if (!defined $save_temps) {
    66     print "* OPTIONAL: keep temp files                 -t\n"; $save_temps = 0;}
     84    $save_temps = 0;
     85    print "* OPTIONAL: keep temp files                 -t                   default = $save_temps\n";
     86}
    6787if (!defined $no_update) {
    68     print "* OPTIONAL: don't update database           -u\n"; $no_update = 0;}
     88    $no_update = 0;
     89    print "* OPTIONAL: don't update database           -u                   default = $no_update\n";
     90}
    6991if (!defined $force) {
    70     print "* OPTIONAL: force if already processed      -f\n"; $force = 0;}
     92    $force = 0;
     93    print "* OPTIONAL: force if already processed      -f                   default = $force\n";
     94}
    7195if (!defined $dontTarNZip) {
    72     print "* OPTIONAL: don't tar and zip output        -z\n"; $dontTarNZip = 0;}
    73     print "*\n*******************************************************************************\n";
     96    $dontTarNZip = 0;
     97    print "* OPTIONAL: don't tar and zip output        -z                   default = $dontTarNZip\n";
     98}
     99print "*\n*******************************************************************************\n";
    74100
    75101if ($quit) { exit; }
     102
     103$fullDvoPath = $dvoPath . "/" . $dvoDb;
    76104
    77105my $gpc1Db = new ippToPsps::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser", $verbose, $save_temps);
     
    85113if ($batchType eq "init") {$initBatch = 1;}
    86114else {$initBatch = 0;}
    87 process();
     115
     116if (!process()) {print "* Finished unsuccessfully\n";}
     117else {print "* Finished successfully\n";}
    88118
    89119#######################################################################################
     
    114144    my ($resultsFile, $resultsFilePath) = tempfile( "/tmp/ippToPsps_results.XXXX", UNLINK => !$save_temps);
    115145    my $lastExpId = $ippToPspsDb->getLastExpId();
    116     my $rows = undef;
     146    my $exposures;
    117147
    118148    my $query;
    119149    if ($initBatch) {
    120    
    121         my @row = (0, 'NULL', 'ThreePi');
    122         @{$rows} = (\@row);
    123     }
    124     elsif ($singleExpId) {$rows = $gpc1Db->getSingleExposureInfo($singleExpId);}
    125     else {$rows = $gpc1Db->getExposureListFromSurvey($survey);}
    126 
    127 # TODO check if there are no exposures and give a warning
     150
     151        my @exposure = (0, 'NULL', 'ThreePi');
     152        @{$exposures} = (\@exposure);
     153    }
     154    # get single exposure
     155    elsif ($singleExpId) {
     156       
     157        if (!$gpc1Db->getSingleExposureFromDvoDb($dvoDb, $singleExpId, \$exposures)) {return 0;}
     158    }
     159    # get all exposures in this DVO Db
     160    else {
     161       
     162        if (!$gpc1Db->getExposureListFromDvoDb($dvoDb, \$exposures)) {return 0;}
     163    }
    128164
    129165    my $batchId = 0;
     
    132168
    133169    #my $batchId = -1;
    134     my $row;
    135     foreach $row ( @{$rows} ) {
    136         my ($expId, $expName, $distGroup) = @{$row};
    137     #        print "JHGHGHGHGH2 $expId, $expName, $distGroup\n";
    138 
    139     # loop round exposures
    140     #while (my @row = $query->fetchrow_array()) {
    141      #   my ($expId, $expName, $distGroup) = @row;
     170    my $exposure;
     171    foreach $exposure ( @{$exposures} ) {
     172        my ($expId, $expName, $distGroup) = @{$exposure};
    142173
    143174        if (!$initBatch && $ippToPspsDb->isExposureAlreadyProcessed($expId)) {
    144                
    145                 if ($force) {print "* Forcing....\n";}
    146                 else {next};
     175
     176            if ($force) {print "* Forcing....\n";}
     177            else {next};
    147178        }
    148179
     
    457488    my ($expId, $expName, $surveyType, $outputPath, $resultsFilePath) = @_;
    458489
    459     my $nebPath = $gpc1Db->getCameraStageSmf($expId);
     490    my $nebPath = $gpc1Db->getCameraStageSmfForThisDvoDb($dvoDb, $expId);
    460491    if (!$nebPath) { return 0; }
    461492
     
    527558    $command .= " -input $input";
    528559    $command .= " -output $output";
    529     $command .= " -D CATDIR $dvodb";
     560    $command .= " -D CATDIR $fullDvoPath";
    530561    $command .= " -config ../config"; # TODO
    531     $command .= " -expid $expid";
     562        $command .= " -expid $expid";
    532563    $command .= " -expname $expName";
    533564    $command .= " -survey $surveyType";
Note: See TracChangeset for help on using the changeset viewer.