Changeset 28888
- Timestamp:
- Aug 10, 2010, 4:26:38 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/perl/ippToPsps_run.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/perl/ippToPsps_run.pl
r28852 r28888 14 14 use ippToPsps::Gpc1Db; 15 15 use ippToPsps::IppToPspsDb; 16 use ippToPsps::Datastore; 16 17 17 18 # globals … … 103 104 my $gpc1Db = new ippToPsps::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser", $verbose, $save_temps); 104 105 my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps); 106 my $datastore = undef; 107 if ($datastoreProduct) {$datastore = new ippToPsps::Datastore($datastoreProduct, $verbose, $save_temps);} 105 108 106 109 # check we can run programs and get camera config 107 110 my $ippToPsps = can_run('ippToPsps') or (warn "Can't find 'ippToPsps' program" and exit($PS_EXIT_CONFIG_ERROR)); 108 my $dsreg = can_run('dsreg') or (warn "Can't find 'dsreg' program" and exit($PS_EXIT_CONFIG_ERROR));109 111 my $ipprc = PS::IPP::Config->new($camera) or (warn "Can't get camera configuration" and exit($PS_EXIT_CONFIG_ERROR)); 110 112 … … 179 181 if (!$surveyType) {next;} 180 182 181 $batchId = $ippToPspsDb->createNewBatch($expId, $distGroup, $pspsBatchType, $dvoDb, (defined $datastore Product) ? $datastoreProduct : "NONE");183 $batchId = $ippToPspsDb->createNewBatch($expId, $distGroup, $pspsBatchType, $dvoDb, (defined $datastore) ? $datastoreProduct : "NONE"); 182 184 183 185 # TODO quit here if no sensible batch ID … … 202 204 if (!$dontTarNZip) { 203 205 my $tarball = tarAndZipBatch($output, $batch); 204 if ($tarball && $datastoreProduct && publishToDatastore($batch, $output, $tarball)) {$published = 1;} 206 if ($tarball && defined $datastore ) { 207 208 $published = $datastore->register($batch, $output, $tarball, "IPP_PSPS", "tgz"); 209 } 205 210 } 206 211 } … … 421 426 422 427 if (!$foundFits) { print "* Could not find any FITS files for this batch\n"; return 0;} 423 return 1;424 }425 426 #######################################################################################427 #428 # register new job with the datastore429 #430 ########################################################################################431 sub publishToDatastore {432 my ($batch, $path, $tarball) = @_;433 434 my ($tempFile, $tempName) = tempfile( "/tmp/ippToPsps_dsregList.XXXX", UNLINK => !$save_temps);435 436 print $tempFile $tarball . '|||tgz' . "\n";437 438 # build dsreg command command439 my $command = "$dsreg";440 $command .= " --add $batch";441 $command .= " --copy";442 $command .= " --datapath $path";443 $command .= " --type IPP_PSPS";444 $command .= " --product $datastoreProduct";445 $command .= " --list $tempName";446 447 # run command448 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =449 run(command => $command, verbose => $verbose);450 451 if (!$success) { print "* Unable to publish $tarball to datastore\n" and return 0 };452 453 print "* Successfully published $tarball to datastore\n";454 455 close($tempFile);456 457 428 return 1; 458 429 }
Note:
See TracChangeset
for help on using the changeset viewer.
