Changeset 29515
- Timestamp:
- Oct 21, 2010, 2:45:13 PM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100823
- Files:
-
- 2 deleted
- 131 edited
- 30 copied
-
DataStore/lib/DataStore/Utils.pm (modified) (1 diff)
-
DataStore/scripts/dsgetfileset (modified) (4 diffs)
-
DataStoreServer/scripts/dsreg (modified) (24 diffs)
-
Nebulous/bin/neb-replicate (modified) (1 diff)
-
Ohana/src/addstar/include/addstar.h (modified) (1 diff)
-
Ohana/src/addstar/src/GetZeroPointExposure.c (modified) (8 diffs)
-
Ohana/src/addstar/src/ReadImageHeader.c (modified) (3 diffs)
-
Ohana/src/dvomerge/src/merge_catalogs_old.c (modified) (2 diffs)
-
Ohana/src/libdvo/src/dvo_photcode_ops.c (modified) (1 diff)
-
Ohana/src/libdvo/src/skyregion_ops.c (modified) (1 diff)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (17 diffs)
-
dbconfig/background.md (modified) (2 diffs)
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/config.md (modified) (1 diff)
-
dbconfig/magic.md (modified) (1 diff)
-
dbconfig/pstamp.md (modified) (2 diffs)
-
dbconfig/stack.md (modified) (1 diff)
-
extlibs/cfitsio3250.tar.gz (copied) (copied from trunk/extlibs/cfitsio3250.tar.gz )
-
ippMonitor/Makefile.in (modified) (2 diffs)
-
ippMonitor/def/autocode.php (modified) (2 diffs)
-
ippMonitor/def/exposureStatus.d (copied) (copied from trunk/ippMonitor/def/exposureStatus.d )
-
ippMonitor/def/gpc1MysqlProcessList.d (copied) (copied from trunk/ippMonitor/def/gpc1MysqlProcessList.d )
-
ippMonitor/def/mopsStatus.d (copied) (copied from trunk/ippMonitor/def/mopsStatus.d )
-
ippMonitor/raw/czartool_getplot.php (modified) (2 diffs)
-
ippMonitor/raw/czartool_labels.php (modified) (14 diffs)
-
ippMonitor/raw/ipp.imfiles.dat (modified) (1 diff)
-
ippMonitor/scripts/czartool_serverstoprun.pl (copied) (copied from trunk/ippMonitor/scripts/czartool_serverstoprun.pl )
-
ippMonitor/scripts/generate (modified) (2 diffs)
-
ippScripts/scripts/automate_stacks.pl (modified) (11 diffs)
-
ippScripts/scripts/ipp_apply_burntool.pl (modified) (2 diffs)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (8 diffs)
-
ippScripts/scripts/magic_destreak.pl (modified) (9 diffs)
-
ippScripts/scripts/magic_process.pl (modified) (15 diffs)
-
ippScripts/scripts/magic_tree.pl (modified) (1 diff)
-
ippTasks/Makefile.am (modified) (1 diff)
-
ippTasks/destreak.cleanup.pro (copied) (copied from trunk/ippTasks/destreak.cleanup.pro )
-
ippTasks/destreak.pro (modified) (11 diffs)
-
ippTasks/diskbalance.pro (copied) (copied from trunk/ippTasks/diskbalance.pro )
-
ippTasks/dist.pro (modified) (3 diffs)
-
ippTasks/magic.pro (modified) (3 diffs)
-
ippTasks/nightly_stacks.pro (modified) (7 diffs)
-
ippTasks/pstamp.pro (modified) (5 diffs)
-
ippTasks/publish.pro (modified) (1 diff)
-
ippTasks/replicate.pro (modified) (2 diffs)
-
ippTasks/science.cleanup.pro (modified) (6 diffs)
-
ippToPsps/config/stack/cmfExtensions.txt (copied) (copied from trunk/ippToPsps/config/stack/cmfExtensions.txt )
-
ippToPsps/config/stack/map.xml (copied) (copied from trunk/ippToPsps/config/stack/map.xml )
-
ippToPsps/config/stack/tables.xml (modified) (4 diffs)
-
ippToPsps/perl/checkOdmStatus.pl (modified) (13 diffs)
-
ippToPsps/perl/getSmfForThisBatch.pl (modified) (3 diffs)
-
ippToPsps/perl/ippToPsps/Batch.pm (copied) (copied from trunk/ippToPsps/perl/ippToPsps/Batch.pm )
-
ippToPsps/perl/ippToPsps/BatchManager.pm (deleted)
-
ippToPsps/perl/ippToPsps/Datastore.pm (modified) (2 diffs)
-
ippToPsps/perl/ippToPsps/DetectionBatch.pm (copied) (copied from trunk/ippToPsps/perl/ippToPsps/DetectionBatch.pm )
-
ippToPsps/perl/ippToPsps/Gpc1Db.pm (modified) (4 diffs)
-
ippToPsps/perl/ippToPsps/InitBatch.pm (copied) (copied from trunk/ippToPsps/perl/ippToPsps/InitBatch.pm )
-
ippToPsps/perl/ippToPsps/IppToPsps.pm (deleted)
-
ippToPsps/perl/ippToPsps/IppToPspsDb.pm (modified) (14 diffs)
-
ippToPsps/perl/ippToPsps/MySQLDb.pm (modified) (3 diffs)
-
ippToPsps/perl/ippToPsps/StackBatch.pm (copied) (copied from trunk/ippToPsps/perl/ippToPsps/StackBatch.pm )
-
ippToPsps/perl/makeDetections.pl (copied) (copied from trunk/ippToPsps/perl/makeDetections.pl )
-
ippToPsps/perl/makeInit.pl (copied) (copied from trunk/ippToPsps/perl/makeInit.pl )
-
ippToPsps/perl/makeStacks.pl (copied) (copied from trunk/ippToPsps/perl/makeStacks.pl )
-
ippToPsps/perl/pspsSchema2xml.pl (modified) (6 diffs)
-
ippToPsps/src/ippToPsps.c (modified) (12 diffs)
-
ippToPsps/src/ippToPsps.h (modified) (3 diffs)
-
ippToPsps/src/ippToPspsBatchDetection.c (modified) (8 diffs)
-
ippToPsps/src/ippToPspsBatchStack.c (modified) (2 diffs)
-
ippToPsps/src/ippToPspsBatchTest.c (modified) (3 diffs)
-
ippToPsps/src/ippToPspsConfig.c (modified) (3 diffs)
-
ippToPsps/src/ippToPspsConfig.h (modified) (1 diff)
-
ippToPsps/src/ippToPspsStackEnums.h (modified) (2 diffs)
-
ippTools/configure.ac (modified) (2 diffs)
-
ippTools/share/Makefile.am (modified) (4 diffs)
-
ippTools/share/addtool_find_cam_id.sql (modified) (3 diffs)
-
ippTools/share/addtool_find_cam_id_dvo.sql (modified) (1 diff)
-
ippTools/share/chiptool_listrun.sql (modified) (1 diff)
-
ippTools/share/chiptool_processedimfile.sql (modified) (1 diff)
-
ippTools/share/chiptool_revertcleanup.sql (copied) (copied from trunk/ippTools/share/chiptool_revertcleanup.sql )
-
ippTools/share/difftool_listrun.sql (modified) (3 diffs)
-
ippTools/share/difftool_listssrun.sql (copied) (copied from trunk/ippTools/share/difftool_listssrun.sql )
-
ippTools/share/difftool_revertcleanup.sql (copied) (copied from trunk/ippTools/share/difftool_revertcleanup.sql )
-
ippTools/share/difftool_todiffskyfile.sql (modified) (4 diffs)
-
ippTools/share/disttool_pending_camera.sql (modified) (1 diff)
-
ippTools/share/magicdstool_completed_runs.sql (modified) (6 diffs)
-
ippTools/share/magicdstool_todestreak_camera.sql (modified) (4 diffs)
-
ippTools/share/magicdstool_todestreak_chip.sql (modified) (4 diffs)
-
ippTools/share/magicdstool_todestreak_diff.sql (modified) (8 diffs)
-
ippTools/share/magicdstool_todestreak_raw.sql (modified) (2 diffs)
-
ippTools/share/magicdstool_todestreak_warp.sql (modified) (4 diffs)
-
ippTools/share/magictool_definebyquery_select.sql (modified) (2 diffs)
-
ippTools/share/magictool_revertnode.sql (modified) (1 diff)
-
ippTools/share/magictool_toprocess_inputs.sql (modified) (1 diff)
-
ippTools/share/magictool_toprocess_tree.sql (modified) (2 diffs)
-
ippTools/share/magictool_totree.sql (modified) (1 diff)
-
ippTools/share/pstamptool_revertdependent.sql (modified) (1 diff)
-
ippTools/share/pstamptool_revertjob.sql (modified) (1 diff)
-
ippTools/share/pstamptool_stopdependentjob.sql (copied) (copied from trunk/ippTools/share/pstamptool_stopdependentjob.sql )
-
ippTools/share/pstamptool_updatejob.sql (modified) (1 diff)
-
ippTools/share/pubtool_revert.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (4 diffs)
-
ippTools/share/stacktool_tosum.sql (modified) (1 diff)
-
ippTools/share/warptool_revertcleanup.sql (copied) (copied from trunk/ippTools/share/warptool_revertcleanup.sql )
-
ippTools/share/warptool_scmap.sql (modified) (2 diffs)
-
ippTools/share/warptool_towarped.sql (modified) (1 diff)
-
ippTools/src/addtool.c (modified) (1 diff)
-
ippTools/src/bgtool.c (modified) (2 diffs)
-
ippTools/src/chiptool.c (modified) (4 diffs)
-
ippTools/src/chiptool.h (modified) (1 diff)
-
ippTools/src/chiptoolConfig.c (modified) (2 diffs)
-
ippTools/src/difftool.c (modified) (14 diffs)
-
ippTools/src/difftool.h (modified) (2 diffs)
-
ippTools/src/difftoolConfig.c (modified) (9 diffs)
-
ippTools/src/magicdstool.c (modified) (4 diffs)
-
ippTools/src/magictool.c (modified) (8 diffs)
-
ippTools/src/magictoolConfig.c (modified) (2 diffs)
-
ippTools/src/pstamptool.c (modified) (16 diffs)
-
ippTools/src/pstamptool.h (modified) (1 diff)
-
ippTools/src/pstamptoolConfig.c (modified) (4 diffs)
-
ippTools/src/pubtool.c (modified) (1 diff)
-
ippTools/src/stacktool.c (modified) (5 diffs)
-
ippTools/src/stacktoolConfig.c (modified) (4 diffs)
-
ippTools/src/warptool.c (modified) (3 diffs)
-
ippTools/src/warptool.h (modified) (1 diff)
-
ippTools/src/warptoolConfig.c (modified) (2 diffs)
-
magic/remove/src/streaksio.c (modified) (1 diff)
-
pstamp/scripts/Makefile.am (modified) (1 diff)
-
pstamp/scripts/detect_query_create (modified) (4 diffs)
-
pstamp/scripts/detect_query_read (modified) (7 diffs)
-
pstamp/scripts/detectability_respond.pl (modified) (7 diffs)
-
pstamp/scripts/psmkreq (modified) (2 diffs)
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (2 diffs)
-
pstamp/scripts/pstamp_finish.pl (modified) (2 diffs)
-
pstamp/scripts/pstamp_insert_request.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (1 diff)
-
pstamp/scripts/pstamp_server_status (modified) (5 diffs)
-
pstamp/scripts/pstamp_webrequest.pl (modified) (3 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (3 diffs)
-
pstamp/scripts/pstampstopfaulted (copied) (copied from trunk/pstamp/scripts/pstampstopfaulted )
-
pstamp/src/ppstamp.c (modified) (1 diff)
-
pstamp/src/ppstamp.h (modified) (1 diff)
-
pstamp/src/ppstampArguments.c (modified) (1 diff)
-
pstamp/src/ppstampMakeStamp.c (modified) (3 diffs)
-
pstamp/src/ppstampOptions.h (modified) (1 diff)
-
pstamp/src/ppstampParseCamera.c (modified) (3 diffs)
-
pswarp/src/pswarpTransformTile.c (modified) (1 diff)
-
tools/checkexp (modified) (2 diffs)
-
tools/czarclean.pl (modified) (3 diffs)
-
tools/czarplot.pl (modified) (6 diffs)
-
tools/czarpoll.pl (copied) (copied from trunk/tools/czarpoll.pl )
-
tools/czartool/Burntool.pm (modified) (1 diff)
-
tools/czartool/CzarDb.pm (modified) (30 diffs)
-
tools/czartool/MySQLDb.pm (modified) (3 diffs)
-
tools/czartool/Plotter.pm (modified) (8 diffs)
-
tools/definetargets (modified) (1 diff)
-
tools/makedistdest (copied) (copied from trunk/tools/makedistdest )
-
tools/roboczar.pl (modified) (1 diff)
-
tools/runcameraexp.pl (copied) (copied from trunk/tools/runcameraexp.pl )
-
tools/rundiffskycell.pl (copied) (copied from trunk/tools/rundiffskycell.pl )
-
tools/runstackskycell.pl (copied) (copied from trunk/tools/runstackskycell.pl )
-
tools/runwarpskycell.pl (copied) (copied from trunk/tools/runwarpskycell.pl )
-
tools/shuffle_otas.pl (copied) (copied from trunk/tools/shuffle_otas.pl )
-
tools/who_uses_the_cluster/who_uses_the_cluster_analyze.sh.record (copied) (copied from trunk/tools/who_uses_the_cluster/who_uses_the_cluster_analyze.sh.record )
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823/DataStore/lib/DataStore/Utils.pm
r28273 r29515 42 42 $BYTE_FIELD = qr/^\d+$/; 43 43 $MD5_FIELD = qr/^[0-9a-f]{32}$/; 44 %KNOWN_FILE_TYPES = map { $_ => 1 } qw( chip psrequest psresults pstamp chipproc warp stack diff ipp-mops table text xml tgz fits );44 %KNOWN_FILE_TYPES = map { $_ => 1 } qw( chip psrequest psresults pstamp chipproc warp stack diff ipp-mops table text xml tgz fits IPP-MOPS ); 45 45 %KNOWN_FILESET_TYPES = map { $_ => 1 } qw( OBJECT BIAS DARK SKYFLAT DOMEFLAT OOF SHACKHARTMANN PSREQUEST PSRESULTS IPP-MOPS XRAY FOCUS MOPS_DETECTABILITY_QUERY MOPS_DETECTABILITY_RESPONSE MOPS_TRANSIENT_DETECTIONS LED notset IPP_PSPS IPP-DIST); 46 46 %KNOWN_PRODUCT_TYPES = map { $_ => 1 } qw( image dump psrequest psresults table ipp-dist ipp-misc dqresults); -
branches/eam_branches/ipp-20100823/DataStore/scripts/dsgetfileset
r27905 r29515 17 17 use File::Basename qw( basename ); 18 18 19 my ($uri, $outdir, $timeout, $skip_checks, $unpack, $ no_proxy, $verbose);19 my ($uri, $outdir, $timeout, $skip_checks, $unpack, $first_file, $no_proxy, $verbose); 20 20 21 21 GetOptions( … … 25 25 'skip-checks' => \$skip_checks, 26 26 'unpack' => \$unpack, 27 'first-file=s' => \$first_file, 27 28 'no-proxy' => \$no_proxy, 28 29 'verbose|v' => \$verbose, … … 75 76 } 76 77 78 if ($first_file) { 79 next if $fs->fileid ne $first_file; 80 $first_file = undef; 81 } 77 82 my $uri = $fs->uri; 78 83 my $base = basename($uri); … … 153 158 =item * --unpack 154 159 155 Uncompress fits files if compressed 160 Uncompress fits files if compressed. 161 162 =item * --first-file <fileid> 163 164 Skip files in fileset list prior to the given fileid. 156 165 157 166 Optional. -
branches/eam_branches/ipp-20100823/DataStoreServer/scripts/dsreg
r28800 r29515 42 42 43 43 my $dbname; # Database name 44 my $dbserver; # Database host 44 45 my $dsroot; # root directory of the data store 45 46 … … 82 83 'ps7=s' => \$ps7, 83 84 'dbname=s' => \$dbname, 85 'dbserver=s' => \$dbserver, 86 'ds_dbname=s' => \$dbname, # some scripts use these names 87 'ds_dbserver=s' => \$dbserver, 84 88 'dsroot=s' => \$dsroot, 85 89 'verbose' => \$verbose, 86 90 ) or pod2usage(2); 87 91 92 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 93 94 # collect all command line argument errors and only fail once below. 88 95 my $err = ""; 89 96 … … 121 128 $dsroot = metadataLookupStr($ipprc->{_siteConfig}, 'DATA_STORE_ROOT'); 122 129 if (!$dsroot) { 123 die("Data Store root directory not set"); 124 } 125 } 126 130 &my_die("Data Store root directory not set", $PS_EXIT_CONFIG_ERROR); 131 } 132 } 127 133 128 134 if (!stat("$dsroot/index.txt")) { … … 131 137 132 138 # bail if any errors above 133 show_usage($err) 134 if ($err); 135 136 show_usage("Invalid product '$product'.") 139 show_usage($err) if ($err); 140 141 show_usage("Invalid data store product '$product'.") 137 142 unless defined stat("$dsroot/$product/index.txt"); 138 143 139 144 $dbname = metadataLookupStr($siteConfig, 'DS_DBNAME') unless defined $dbname; 140 my $dbserver = metadataLookupStr($siteConfig, 'DS_DBSERVER');145 $dbserver = metadataLookupStr($siteConfig, 'DS_DBSERVER') unless defined $dbserver; 141 146 my $dbuser = metadataLookupStr($siteConfig, 'DS_DBUSER'); 142 147 my $dbpass = metadataLookupStr($siteConfig, 'DS_DBPASSWORD'); … … 148 153 149 154 my $dbh = DBI->connect_cached($dsn, $dbuser, $dbpass, \%conn_attrs) 150 or die "Cannot connect to DB server\n";155 or &my_die("Cannot connect to DB server\n", $PS_EXIT_SYS_ERROR); 151 156 152 157 print STDERR "dbh: $dbh\n" if $verbose; … … 161 166 162 167 my $stmt = $dbh->prepare("SELECT prod_id, last_fs FROM dsProduct WHERE prod_name = ?"); 163 $stmt->execute($product); 168 my $execute_status = $stmt->execute($product); 169 if (!$execute_status) { 170 print STDERR "failed to execute product lookup\n"; 171 exit 2; 172 } 164 173 165 174 my $prod_row = $stmt->fetchrow_hashref(); … … 228 237 my $rc; 229 238 if (($rc = system "rm -r $fileset_dir")) { 230 die("failed to remove $fileset_dir error code: $rc");239 &my_die("failed to remove $fileset_dir error code: $rc", $PS_EXIT_UNKNOWN_ERROR); 231 240 } 232 241 } else { … … 252 261 253 262 if (!$prod_id) { 254 die("product $product not found");263 &my_die("product $product not found", $PS_EXIT_UNKNOWN_ERROR); 255 264 } 256 265 my $count = $dbh->do("SELECT fileset_id FROM dsFileset WHERE fileset_name = ?" . … … 268 277 if (! -e $fileset_dir) { 269 278 if (!mkdir $fileset_dir) { 270 die("failed trying to create fileset directory $fileset_dir");279 &my_die("failed trying to create fileset directory $fileset_dir", $PS_EXIT_SYS_ERROR); 271 280 } 272 281 if (! -d $fileset_dir ) { 273 die("cannot access just created fileset directory $fileset_dir");282 &my_die("cannot access just created fileset directory $fileset_dir", $PS_EXIT_SYS_ERROR); 274 283 } 275 284 } … … 281 290 $in = *STDIN; 282 291 } else { 283 open $in, "<$filelist" or die "cannot open filelist file $filelist\n";292 open $in, "<$filelist" or &my_die("cannot open filelist file $filelist\n", $PS_EXIT_UNKNOWN_ERROR); 284 293 } 285 294 … … 296 305 my @fields = split /\|/; 297 306 if (@fields < 4) { 298 die "malformed input line at $filelist line $lineno: $_\n";307 &my_die("malformed input line at $filelist line $lineno: $_\n", $PS_EXIT_PROG_ERROR); 299 308 } 300 309 $filename = shift @fields; … … 320 329 } 321 330 322 die("empty filelist\n") if (@files == 0);331 &my_die("empty filelist\n", $PS_EXIT_PROG_ERROR) if (@files == 0); 323 332 324 333 # Prepare the fileset directory … … 350 359 } else { 351 360 if (!copy($src, $dest)) { 352 die("copy($src, $dest) failed");361 &my_die("copy($src, $dest) failed", $PS_EXIT_UNKNOWN_ERROR); 353 362 } 354 363 } … … 359 368 360 369 if (!$no_cleanup && system "rm -r $fileset_dir") { 361 die("failed to remove $fileset_dir");370 &my_die("failed to remove $fileset_dir", $PS_EXIT_UNKNOWN_ERROR); 362 371 } 363 372 exit $PS_EXIT_UNKNOWN_ERROR; … … 370 379 my $path = "$fileset_dir/$filename"; 371 380 if (! -e $path ) { 372 die "file $path not found";381 &my_die("file $path not found", , $PS_EXIT_UNKNOWN_ERROR); 373 382 } 374 383 # get the size of the file 375 384 my @finfo = stat($path); 376 385 unless (@finfo) { 377 die ("can't stat $path");386 &my_die ("can't stat $path", $PS_EXIT_UNKNOWN_ERROR); 378 387 } 379 388 # if size was supplied make sure that it matches the actual … … 382 391 my $current_size = $finfo[7]; 383 392 if ($file->{bytes} != $current_size) { 384 die"size on disk: $current_size does not match supplied"385 . " size: $file->{bytes} for $path" ;393 &my_die("size on disk: $current_size does not match supplied" 394 . " size: $file->{bytes} for $path", $PS_EXIT_PROG_ERROR); 386 395 } 387 396 } else { … … 391 400 # Get MD5 sum 392 401 $file->{md5sum} = file_md5_hex($path); 393 die("failed to compute valid md5sum for $path") if !$file->{md5sum};402 &my_die("failed to compute valid md5sum for $path", $PS_EXIT_UNKNOWN_ERROR) if !$file->{md5sum}; 394 403 } 395 404 } … … 401 410 $dbh->disconnect(); 402 411 $dbh = DBI->connect_cached($dsn, $dbuser, $dbpass, \%conn_attrs) 403 or die "Cannot connect to server\n";412 or &my_die("Cannot connect to server\n", $PS_EXIT_SYS_ERROR); 404 413 print STDERR "ping failed new dbh: $dbh\n" if $verbose; 405 414 } … … 415 424 $ps0, $ps1, $ps2, $ps3, $ps4, $ps5, $ps6, $ps7)); 416 425 417 die("failed to insert $fileset") if (!defined($count) or ($count == 0E0));426 &my_die("failed to insert $fileset", $PS_EXIT_UNKNOWN_ERROR) if (!defined($count) or ($count == 0E0)); 418 427 419 428 # I don't use last_insert_id() because I've seen some problems with it and … … 423 432 my $nfs = @fsids; 424 433 if (!$nfs) { 425 die("fileset '$fileset' missing even though we just added it");434 &my_die("fileset '$fileset' missing even though we just added it", $PS_EXIT_UNKNOWN_ERROR); 426 435 } elsif ($nfs > 1) { 427 die("Fileset '$fileset' already exists under $product.");436 &my_die("Fileset '$fileset' already exists under $product.", $PS_EXIT_PROG_ERROR); 428 437 } 429 438 my $fileset_id = $fsids[0]; … … 443 452 444 453 if ($count == 0E0) { 445 die("failed to insert $filename into $fileset");454 &my_die("failed to insert $filename into $fileset", $PS_EXIT_UNKNOWN_ERROR); 446 455 } 447 456 } … … 450 459 . " WHERE prod_id = $prod_id"); 451 460 if ($count == 0E0) { 452 die("failed to update dsProduct $prod_id");461 &my_die("failed to update dsProduct $prod_id", $PS_EXIT_UNKNOWN_ERROR); 453 462 } 454 463 … … 457 466 # create the cgi script index.txt by making a copy of its parent's 458 467 if (!copy("$dsroot/$product/index.txt", $index_script_name)) { 459 die("failed to copy index script to file set");468 &my_die("failed to copy index script to file set", $PS_EXIT_UNKNOWN_ERROR); 460 469 } 461 470 }; … … 531 540 } 532 541 } 542 543 sub my_die { 544 my $msg = shift; 545 my $fault = shift; 546 carp $msg; 547 exit $fault; 548 } -
branches/eam_branches/ipp-20100823/Nebulous/bin/neb-replicate
r24463 r29515 64 64 65 65 if ($set_copies) { 66 $neb->setxattr($key, "user.copies", $ copies, "replace")66 $neb->setxattr($key, "user.copies", $set_copies, "replace") 67 67 or die $neb->err; 68 68 } -
branches/eam_branches/ipp-20100823/Ohana/src/addstar/include/addstar.h
r29412 r29515 121 121 char ZERO_POINT_OPTION[64]; 122 122 float ZERO_POINT_OFFSET; 123 float ZERO_POINT_ERROR; 124 float ZPT_OBS_PHU; 125 float ZPT_ERR_PHU; 123 126 124 127 // carries the mosaic into gstars -
branches/eam_branches/ipp-20100823/Ohana/src/addstar/src/GetZeroPointExposure.c
r27435 r29515 17 17 18 18 // PHU_HEADER: in this case, the zero point measured for the entire exposure and reported in 19 // the PHU header is used to set the zero point offset for each chip. Note that in this case, 20 // ZERO_POINT_OFFSET in this funciton is actually set to the zero point, and adjusted to an 21 // offset in ReadImageHeader based on the per-chip zero points in the photcode database 19 // the PHU header is used to set the zero point offset for each chip. 20 // Here set ZPT_OBS_PHU and ZPT_ERR_PHU to the observed values from the header. 21 // ZERO_POINT_OFFSET is calculated in ReadImageHeader based on the per-chip zero points in the 22 // photcode database. 22 23 23 24 int GetZeroPointExposure (Header **headers, HeaderSet *headerSets, off_t Nimages) { … … 26 27 if (!strcasecmp(ZERO_POINT_OPTION, "NOMINAL")) { 27 28 ZERO_POINT_OFFSET = 0.0; 29 ZERO_POINT_ERROR = NAN; 28 30 return (TRUE); 29 31 } … … 32 34 if (!strcasecmp(ZERO_POINT_OPTION, "CHIP_HEADER")) { 33 35 ZERO_POINT_OFFSET = 0.0; 36 ZERO_POINT_ERROR = NAN; 34 37 return (TRUE); 35 38 } … … 39 42 40 43 int i, Nzpt, Nmid, Nhead; 41 float *zpt, ZPT_OBS ;44 float *zpt, ZPT_OBS, ZPT_ERR; 42 45 PhotCode *photcode; 43 46 char photname[80]; … … 53 56 fprintf (stderr, "zero point not supplied in header\n"); 54 57 continue; 58 } 59 60 if (!gfits_scan (headers[Nhead], "ZPT_ERR", "%f", 1, &ZPT_ERR)) { 61 // XXX should we emit this message? We currently aren't using this value so no 62 // fprintf (stderr, "zero point not supplied in header\n"); 63 // continue; 64 ZPT_ERR = NAN; 55 65 } 56 66 … … 78 88 fprintf (stderr, "WARNING: zero point is not measured, no valid entries in headers\n"); 79 89 ZERO_POINT_OFFSET = 0.0; 90 ZERO_POINT_ERROR = NAN; 80 91 free (zpt); 81 92 return (FALSE); … … 86 97 ZERO_POINT_OFFSET = (Nzpt % 2) ? zpt[Nmid] : 0.5*(zpt[Nmid] + zpt[Nmid-1]); 87 98 free (zpt); 99 // XXX: TODO calculate someting for ZERO_POINT_ERROR 100 ZERO_POINT_ERROR = NAN; 88 101 return (TRUE); 89 102 } … … 92 105 if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) { 93 106 int i, Nhead; 94 float ZPT_OBS;95 107 96 108 ZERO_POINT_OFFSET = 0.0; 109 ZERO_POINT_ERROR = NAN; 97 110 for (i = 0; i < Nimages; i++) { 98 111 if (strcmp(headerSets[i].exthead, "PHU")) continue; 99 112 Nhead = headerSets[i].extnum_head; 100 113 114 float ZPT_OBS, ZPT_ERR; 101 115 if (!gfits_scan (headers[Nhead], "ZPT_OBS", "%f", 1, &ZPT_OBS)) { 102 116 fprintf (stderr, "WARNING: zero point is not measured, no valid entries in headers\n"); 103 117 return (FALSE); 104 118 } 105 ZERO_POINT_OFFSET = ZPT_OBS; 119 if (!gfits_scan (headers[Nhead], "ZPT_ERR", "%f", 1, &ZPT_ERR)) { 120 fprintf (stderr, "WARNING: zero point error is not measured\n"); 121 // XXX: Do we want to require ZPT_ERR? for now just set it to zero and proceed. 122 // return (FALSE); 123 ZPT_ERR = NAN; 124 } 125 ZPT_OBS_PHU = ZPT_OBS; 126 ZPT_ERR_PHU = ZPT_ERR; 106 127 return (TRUE); 107 128 } -
branches/eam_branches/ipp-20100823/Ohana/src/addstar/src/ReadImageHeader.c
r28214 r29515 220 220 fprintf (stderr, "zero point not supplied in header\n"); 221 221 ZERO_POINT_OFFSET = 0.0; 222 ZERO_POINT_ERROR = NAN; 222 223 } else { 223 224 ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS; 225 float ZPT_ERR; 226 if (!gfits_scan (header, "ZPT_ERR", "%f", 1, &ZPT_ERR)) { 227 // XXX: do we want to print this message? 228 fprintf (stderr, "zero point error not supplied in header\n"); 229 ZPT_ERR = NAN; 230 } 231 ZERO_POINT_ERROR = ZPT_ERR; 224 232 } 225 233 } … … 230 238 fprintf (stderr, "photcode data not supplied for this chip\n"); 231 239 ZERO_POINT_OFFSET = 0.0; 240 ZERO_POINT_ERROR = NAN; 232 241 } else { 233 ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET; 242 ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS_PHU; 243 ZERO_POINT_ERROR = ZPT_ERR_PHU; 234 244 } 235 245 } … … 237 247 /* secz is in units milli-airmass */ 238 248 image[0].Mcal = ZERO_POINT_OFFSET; 249 image[0].dMcal = ZERO_POINT_ERROR; 239 250 image[0].Xm = NAN_S_SHORT; 240 251 image[0].flags = 0; -
branches/eam_branches/ipp-20100823/Ohana/src/dvomerge/src/merge_catalogs_old.c
r28855 r29515 317 317 objID ++; 318 318 319 for (j = 0; j < NsecfiltOut; j++) { 320 int outputIndex = (Nave * NsecfiltOut) + j; 321 output[0].secfilt[outputIndex].M = NAN; 322 output[0].secfilt[outputIndex].dM = NAN; 323 output[0].secfilt[outputIndex].Xm = NAN_S_SHORT; 324 output[0].secfilt[outputIndex].M_20 = NAN_S_SHORT; 325 output[0].secfilt[outputIndex].M_80 = NAN_S_SHORT; 326 output[0].secfilt[outputIndex].Ncode = 0; 327 output[0].secfilt[outputIndex].Nused = 0; 328 } 329 319 330 for (j = 0; j < NsecfiltIn; j++) { 320 331 int outputIndex; … … 333 344 output[0].secfilt[outputIndex].Ncode = input[0].secfilt[N*NsecfiltIn+j].Ncode; 334 345 output[0].secfilt[outputIndex].Nused = input[0].secfilt[N*NsecfiltIn+j].Nused; 335 } else {336 output[0].secfilt[outputIndex].M = NAN;337 output[0].secfilt[outputIndex].dM = NAN;338 output[0].secfilt[outputIndex].Xm = NAN_S_SHORT;339 output[0].secfilt[outputIndex].M_20 = NAN_S_SHORT;340 output[0].secfilt[outputIndex].M_80 = NAN_S_SHORT;341 output[0].secfilt[outputIndex].Ncode = 0;342 output[0].secfilt[outputIndex].Nused = 0;343 346 } 344 347 } -
branches/eam_branches/ipp-20100823/Ohana/src/libdvo/src/dvo_photcode_ops.c
r28855 r29515 539 539 // Create a map between the secfilt values from one photcode table to another 540 540 int *GetSecFiltMap(PhotCodeData *output, PhotCodeData *input) { 541 int i ;541 int i, j; 542 542 int NsecfiltIn = input[0].Nsecfilt; 543 int NsecfiltOut = output[0].Nsecfilt; 543 544 int *map; 544 545 ALLOCATE(map, int, NsecfiltIn); 545 546 546 // loop over entries 547 // loop over entries in the input table 547 548 for (i = 0; i < NsecfiltIn; i++) { 548 549 int code = input[0].codeNsec[i]; 549 int entry = output[0].hashcode[code]; 550 int entry = -1; 551 // find the matching entry in the output table 552 for (j = 0; j < NsecfiltOut; j++) { 553 int outcode = output[0].codeNsec[j]; 554 if (code == outcode) { 555 entry = j; 556 break; 557 } 558 } 550 559 if (entry == -1) { 551 // entry is missing 560 // entry is missing fail (no printfs in this file) 552 561 free(map); 553 562 return(FALSE); -
branches/eam_branches/ipp-20100823/Ohana/src/libdvo/src/skyregion_ops.c
r27435 r29515 195 195 Dmin = MIN (Dmin, d); 196 196 Dmax = MAX (Dmax, d); 197 } 198 199 if( Rmax > (Rmin+180.)) { 200 201 double temp = Rmax; 202 Rmax = Rmin; 203 Rmin = temp; 197 204 } 198 205 -
branches/eam_branches/ipp-20100823/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r29124 r29515 100 100 my $x = $row->{CENTER_X}; 101 101 my $y = $row->{CENTER_Y}; 102 my $results = lookup_bycoord($ipprc, $rowList, $imagedb, $img_type, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $ verbose);102 my $results = lookup_bycoord($ipprc, $rowList, $imagedb, $img_type, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 103 103 return $results; 104 104 } … … 164 164 165 165 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $img_type, $id, $tess_id, $component, 166 $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $ verbose);166 $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 167 167 168 168 return $results; … … 187 187 my $data_group = shift; 188 188 my $option_mask = shift; 189 my $mjd_min = shift; 190 my $mjd_max = shift; 189 191 my $verbose = shift; 190 192 … … 287 289 $choose_components = 1; 288 290 } 291 $command .= " -template" if $inverse; 289 292 $id_opt = $use_imfile_id ? "-diff_skyfile_id" : "-diff_id"; 290 293 $image_name = "PPSUB.OUTPUT"; … … 347 350 $command .= " -dateobs_begin $dateobs_begin" if $dateobs_begin; 348 351 $command .= " -dateobs_end $dateobs_end" if $dateobs_end; 352 } else { 353 $command .= " -mjd_obs_begin $mjd_min" if $mjd_min; 354 $command .= " -mjd_obs_end $mjd_max" if $mjd_max; 349 355 } 350 356 … … 361 367 # The image selectors are such that multiple runs my have be returned for the same exposure. 362 368 # Return only the latest one. 363 $images = filterRuns($stage, $need_magic, $images, $ verbose);369 $images = filterRuns($stage, $need_magic, $images, $inverse, $verbose); 364 370 } 365 371 if ($choose_components) { … … 379 385 380 386 next if $image->{fault}; 381 next if ($stage ne "raw") and $image->{quality}; 387 if (($stage ne "raw") and $image->{quality}) { 388 print STDERR "Selected $stage image has bad quality. Skipping.\n"; 389 next; 390 } 382 391 383 392 if ($base_name) { … … 479 488 my $listrun = 0; 480 489 if ($byid) { 481 if ($skycell_id ) {490 if ($skycell_id and ($skycell_id ne 'all')) { 482 491 $command .= " -diffskyfile -diff_id $id -skycell_id $skycell_id"; 483 492 } else { … … 634 643 my $data_group = shift; 635 644 my $option_mask = shift; 645 my $mjd_min = shift; 646 my $mjd_max = shift; 636 647 my $verbose = shift; 637 648 … … 649 660 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $img_type, $chip->{id}, 650 661 $tess_id, $chip->{component}, $need_magic, 651 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $ verbose);662 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 652 663 653 664 next if !$these_results; … … 669 680 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $img_type, undef, 670 681 $skycell->{tess_id}, $skycell->{component}, $need_magic, 671 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $ verbose);682 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 672 683 673 684 next if !$these_results; … … 740 751 my $astrom_resolved = $ipprc->file_resolve($astrom); 741 752 next if !$astrom_resolved; 753 if (! -e $astrom_resolved) { 754 print "$astrom_resolved not found skipping\n"; 755 next; 756 } 742 757 743 758 my $start_dvo = gettimeofday(); … … 1001 1016 1002 1017 my $ticks = ($mjd - 40587.0) * 86400; 1018 1019 # CONVERT from TAI to UTC 1020 # XXX: do this correctly 1021 if ($mjd >= 54832) { 1022 $ticks += -34; 1023 } else { 1024 $ticks += -33; 1025 } 1003 1026 1004 1027 my ($sec, $min, $hr, $day, $mon, $year) = gmtime($ticks); … … 1202 1225 my $images = runToolAndParse($command, $verbose); 1203 1226 if (!defined $images) { 1204 print "No components containing coordinates found for ${stage}_id $stage_id\n"; 1205 foreach my $row (@$rowList) { 1206 # XXX: This doesn't seem like the correct error code? 1207 $row->{error_code} = $PSTAMP_NO_OVERLAP; 1208 } 1227 print "No $c found for $stage ${stage}_id $stage_id\n"; 1209 1228 next; 1210 1229 } … … 1235 1254 my $need_magic = shift; 1236 1255 my $inputs = shift; 1256 my $inverse = shift; 1237 1257 my $verbose = shift; 1238 1258 … … 1254 1274 my $printed = 0; 1255 1275 foreach my $input (@$inputs) { 1256 my $exp_id = $input->{exp_id}; 1276 my $exp_id; 1277 if ($stage ne "diff") { 1278 $exp_id = $input->{exp_id}; 1279 } elsif (!$inverse) { 1280 $exp_id = $input->{exp_id_1}; 1281 $input->{exp_id} = $exp_id; 1282 } else { 1283 $exp_id = $input->{exp_id_2}; 1284 $input->{exp_id} = $exp_id; 1285 } 1257 1286 my $run_id = $input->{$id_name}; 1258 1287 my $magicked = $input->{magicked}; # this will be either stageRun.magicked or stage%file.magicked … … 1260 1289 1261 1290 # can't process run in these states 1291 # XXX: also goto_purged or goto_scrubbed or drop 1262 1292 if (($state eq 'new') or ($state eq 'purged') or ($state eq 'scrubbed')) { 1263 1293 print "skipping ${stage}Run $run_id for exp_id $exp_id in state $state\n"; -
branches/eam_branches/ipp-20100823/dbconfig/background.md
r28486 r29515 21 21 class_id STR 64 22 22 path_base STR 255 23 data_state STR 64 23 24 magicked S64 0 24 25 dtime_script F32 0.0 … … 57 58 skycell_id STR 64 58 59 path_base STR 255 60 data_state STR 64 59 61 magicked S64 0 60 62 dtime_script F32 0.0 -
branches/eam_branches/ipp-20100823/dbconfig/changes.txt
r28873 r29515 1945 1945 ALTER TABLE diffSummary DROP PRIMARY KEY, ADD PRIMARY KEY (diff_id, projection_cell); 1946 1946 ALTER TABLE stackSummary DROP PRIMARY KEY, ADD PRIMARY KEY (sass_id, projection_cell); 1947 1948 ALTER TABLE stackSumSkyfile ADD COLUMN mjd_obs double AFTER good_frac; 1949 1950 -- Version 1.1.65 1951 -- changes to support cleanup of the background preserved images 1952 ALTER TABLE chipBackgroundImfile ADD COLUMN data_state VARCHAR(64) AFTER path_base; 1953 ALTER TABLE chipBackgroundImfile ADD KEY(data_state); 1954 ALTER TABLE warpBackgroundSkyfile ADD COLUMN data_state VARCHAR(64) AFTER path_base; 1955 ALTER TABLE warpBackgroundSkyfile ADD KEY(data_state); 1956 1957 ALTER TABLE magicMask ADD COLUMN path_base VARCHAR(255) AFTER uri; 1958 1959 -- diff_id was removed from magicInputSkyfile ages ago, but 1960 -- pxadmin_create_tables.sql still had it this command didn't work due to 1961 -- a mysql error. 1962 -- ALTER TABLE magicInputSkyfile DROP COLUMN diff_id; 1963 UPDATE dbversion set schema_version = '1.1.65', updated= CURRENT_TIMESTAMP(); 1964 1965 -- Version 1.1.66 1966 -
branches/eam_branches/ipp-20100823/dbconfig/config.md
r26519 r29515 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 1.1.6 34 pkg_version STR 1.1.65 5 5 END -
branches/eam_branches/ipp-20100823/dbconfig/magic.md
r27450 r29515 42 42 magic_id S64 0 # Primary Key fkey(magic_id) ref magicRun(magic_id) 43 43 uri STR 255 44 path_base STR 255 44 45 streaks S32 0 45 46 fault S16 0 # Key -
branches/eam_branches/ipp-20100823/dbconfig/pstamp.md
r28294 r29515 46 46 options S64 64 47 47 dep_id S64 0 48 fault_count S32 0 48 49 END 49 50 … … 59 60 outdir STR 255 60 61 fault S16 0 62 fault_count S32 0 61 63 END 62 64 -
branches/eam_branches/ipp-20100823/dbconfig/stack.md
r28375 r29515 49 49 hostname STR 64 50 50 good_frac F32 0.0 # Key 51 mjd_obs F64 0.0 51 52 fault S16 0 # Key 52 53 software_ver STR 16 -
branches/eam_branches/ipp-20100823/ippMonitor/Makefile.in
r29124 r29515 16 16 $(DESTBIN)/czartool_getServerStatus.pl \ 17 17 $(DESTBIN)/czartool_revert.pl \ 18 $(DESTBIN)/czartool_serverstoprun.pl \ 18 19 $(DESTBIN)/build_histogram.dvo \ 19 20 $(DESTBIN)/helpers.dvo \ … … 205 206 $(DESTWWW)/scatterCpiBgReMaImage.php \ 206 207 $(DESTWWW)/scatterCpiBgReMpImage.php \ 207 $(DESTWWW)/scatterCpiBgReSaImage.php 208 $(DESTWWW)/scatterCpiBgReSaImage.php \ 209 $(DESTWWW)/exposureStatus.php \ 210 $(DESTWWW)/mopsStatus.php \ 211 $(DESTWWW)/gpc1MysqlProcessList.php 208 212 209 213 PICTURES = \ -
branches/eam_branches/ipp-20100823/ippMonitor/def/autocode.php
r26456 r29515 25 25 $restricted = 0; 26 26 27 // define restrictio snto the queries27 // define restrictions to the queries 28 28 // ** TABLE RESTRICTIONS ** 29 29 … … 33 33 } 34 34 } 35 36 // Add GROUP BY statements if any 37 // ** GROUP RESTRICTIONS ** 35 38 36 39 // get the result table count -
branches/eam_branches/ipp-20100823/ippMonitor/raw/czartool_getplot.php
r28861 r29515 15 15 $label = $_GET[label]; 16 16 $stage = $_GET[stage]; 17 $plottype = $_GET[plottype]; 17 18 18 19 if ($type=="t") 19 $filePath = "/tmp/czarplot_".$ label."_".$stage."_".$type.".png";20 $filePath = "/tmp/czarplot_".$plottype."_".$label."_".$stage."_".$type.".png"; 20 21 else if ($type=="h") 21 $filePath = "/tmp/czarplot_".$ label."_all_stages_".$type.".png";22 $filePath = "/tmp/czarplot_".$plottype."_".$label."_all_stages_".$type.".png"; 22 23 else if ($type=="s") 23 24 $filePath = "/tmp/czarplot_hosts_space.png"; … … 29 30 } 30 31 32 31 33 exit(); 32 34 -
branches/eam_branches/ipp-20100823/ippMonitor/raw/czartool_labels.php
r29124 r29515 25 25 26 26 menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']); 27 28 $pass = $ID['pass'];29 $proj = $ID['proj'];30 $menu = $ID['menu'];31 32 $selectedStage = $_GET[stage];33 $selectedLabel = $_GET[label];34 $selectedServer = $_GET[server];35 $selectedRevertStage = $_GET[revertstage];36 $selectedRevertMode = $_GET[revertmode];37 38 if ($selectedLabel == "") { $selectedLabel = "all_stdscience_labels"; }39 if ($selectedStage == "") { $selectedStage = "all_stages"; }40 41 $nsStatus = getNightlyScienceStatus($czardb);42 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus</p>";43 44 45 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later46 if ($selectedRevertStage != "" && $selectedRevertMode != "") {47 48 exec("czartool_revert.pl -t $selectedRevertStage -o $selectedRevertMode", $response, $status);49 $currentRevertMode;50 if ($response[0] == "off") $currentRevertMode = 0;51 else if ($response[0] == "on") $currentRevertMode = 1;52 53 setRevertStatus($czardb, $selectedRevertStage, $currentRevertMode);54 }55 $debug = 0;56 57 $stdsLabels = getLabels($czardb, "stdscience");58 $distLabels = getLabels($czardb, "distribution");59 $pubLabels = getLabels($czardb, "publishing");60 $updateLabels = getLabels($czardb, "update");61 62 if ($debug) {63 echo "prog returned $status, and output:<br>";64 for ($i = 0; $i < count($distLabels); $i++) {65 echo "$distLabels[$i]<br>";66 }67 }68 27 69 28 $states=array("full","new","drop","wait"); … … 82 41 "summitcopy"); 83 42 43 $pass = $ID['pass']; 44 $proj = $ID['proj']; 45 $menu = $ID['menu']; 46 47 $selectedStage = $_GET[stage]; 48 $selectedLabel = $_GET[label]; 49 $selectedServer = $_GET[server]; 50 $selectedRevertStage = $_GET[revertstage]; 51 $selectedRevertMode = $_GET[revertmode]; 52 $plotType = $_GET[plottype]; 53 $serverCmd = $_GET[servercmd]; 54 $allServerCmd = $_GET[allservercmd]; 55 56 if ($selectedLabel == "") { $selectedLabel = "all_stdscience_labels"; } 57 if ($selectedStage == "") { $selectedStage = "all_stages"; } 58 if ($plotType == "") { $plotType = "linear"; } 59 60 $nsStatus = getNightlyScienceStatus($czardb); 61 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 62 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 63 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus<br>Use <a href=\"$link\"> $plotTypeLink</a> plots </p>"; 64 65 66 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later 67 if ($selectedRevertStage && $selectedRevertMode) turnRevertsOnOff($czardb, $selectedRevertStage, $selectedRevertMode); 68 69 // tell selected server to stop or run 70 if ($selectedServer && $serverCmd) serverStopRun($czardb, $selectedServer, $serverCmd); 71 72 // tell all servers to stop or run 73 if ($allServerCmd) { 74 75 foreach ($servers as &$server) serverStopRun($czardb, $server, $allServerCmd); 76 } 77 78 79 $debug = 0; 80 81 $stdsLabels = getLabels($czardb, "stdscience"); 82 $distLabels = getLabels($czardb, "distribution"); 83 $pubLabels = getLabels($czardb, "publishing"); 84 $updateLabels = getLabels($czardb, "update"); 85 86 if ($debug) { 87 echo "prog returned $status, and output:<br>"; 88 for ($i = 0; $i < count($distLabels); $i++) { 89 echo "$distLabels[$i]<br>"; 90 } 91 } 92 93 84 94 // set up the form 85 95 echo "<form action=\"czartool_labels.php\" method=\"POST\">\n"; … … 91 101 92 102 echo "<table>\n"; 93 echo "<tr>\n";94 echo "<td>\n";95 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage\"><br>";96 echo "</td>\n";97 98 echo "<td> \n";99 createLabelsTable($pass, $proj, $czardb, "stdscience", $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage);100 echo "</td>\n";101 echo "</tr>\n";102 103 echo "<tr>\n";104 echo "<td>\n";105 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage\"><br>";106 echo "</td>\n";107 108 echo "<td> \n";109 createLabelsTable($pass, $proj, $czardb, "update", $updateLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage);110 echo "</td>\n";111 echo "</tr>\n";112 113 echo "<tr>\n";114 echo "<table>\n";115 echo "<tr valign=top>\n";116 echo "<td> \n";117 echo "<img src=\"czartool_getplot.php?type=s\"><br>";118 echo "</td>\n";119 echo "<td>\n";120 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage);121 echo "</td>\n";122 123 echo "<td> \n";124 $today = date("Y-m-d");125 showSummitData($gpc1db, $today);126 echo "</td>\n";127 echo "</tr>\n";128 echo "</table>\n";129 130 echo "<table>\n";131 echo "<tr valign=top>\n";132 echo "<td> \n";133 echo "</td>\n";134 echo "<td>\n";135 if ($selectedServer) showServerStatus($selectedServer);136 echo "</td>\n";137 echo "</tr>\n";138 echo "</table>\n";139 echo "</tr>\n";103 echo "<tr>\n"; 104 echo "<td>\n"; 105 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage&plottype=$plotType\"><br>"; 106 echo "</td>\n"; 107 108 echo "<td> \n"; 109 createLabelsTable($pass, $proj, $czardb, "stdscience", $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage, $plotType); 110 echo "</td>\n"; 111 echo "</tr>\n"; 112 113 echo "<tr>\n"; 114 echo "<td>\n"; 115 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>"; 116 echo "</td>\n"; 117 118 echo "<td> \n"; 119 createLabelsTable($pass, $proj, $czardb, "update", $updateLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage, $plotType); 120 echo "</td>\n"; 121 echo "</tr>\n"; 122 123 echo "<tr>\n"; 124 echo "<table>\n"; 125 echo "<tr valign=top>\n"; 126 echo "<td> \n"; 127 echo "<img src=\"czartool_getplot.php?type=s\"><br>"; 128 echo "</td>\n"; 129 echo "<td>\n"; 130 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 131 echo "</td>\n"; 132 133 echo "<td> \n"; 134 $today = date("Y-m-d"); 135 showSummitData($gpc1db, $today); 136 echo "</td>\n"; 137 echo "</tr>\n"; 138 echo "</table>\n"; 139 140 echo "<table>\n"; 141 echo "<tr valign=top>\n"; 142 echo "<td> \n"; 143 echo "</td>\n"; 144 echo "<td>\n"; 145 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer); 146 echo "</td>\n"; 147 echo "</tr>\n"; 148 echo "</table>\n"; 149 echo "</tr>\n"; 140 150 echo "</table>\n"; 141 151 … … 225 235 # 226 236 ########################################################################### 227 function createLabelsTable($pass, $proj, $db, $server, $labels, $distLabels, $pubLabels, $stages, $states, $selectedState, $selectedLabel, $selectedStage) { 237 function createLabelsTable( 238 $pass, 239 $proj, 240 $db, 241 $server, 242 $labels, 243 $distLabels, 244 $pubLabels, 245 $stages, 246 $states, 247 $selectedState, 248 $selectedLabel, $selectedStage, $plotType) { 228 249 229 250 // set up table columns … … 241 262 if ($stage == "burntool") continue; 242 263 $reverting = getRevertStatus($db, $stage); 243 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&revertmode="; 264 $link = 265 "czartool_labels.php?pass=".$pass 266 ."&proj=".$proj 267 ."&label=".$selectedLabel 268 ."&stage=".$selectedStage 269 ."&plottype=".$plotType 270 ."&revertstage=".$stage 271 ."&revertmode="; 272 244 273 if(!$reverting) {$label = "Start";$link = $link . "on";} 245 274 if($reverting) {$label = "Stop";$link = $link . "off";} … … 254 283 write_header_cell($class, "Label (in order of priority)"); 255 284 foreach ($stages as &$stage) { 256 285 257 286 if ($stage == $selectedStage) $link = ""; 258 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $stage; 287 else $link = 288 "czartool_labels.php?pass=".$pass 289 ."&proj=".$proj 290 ."&label=".$selectedLabel 291 ."&stage=".$stage 292 ."&plottype=".$plotType; 293 259 294 write_table_cell($class, '%s', $link, $stage); 260 295 } 261 296 262 297 if ($selectedStage=="all_stages") $link = ""; 263 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=all_stages"; 298 else $link = 299 "czartool_labels.php?pass=".$pass 300 ."&proj=".$proj 301 ."&label=".$selectedLabel 302 ."&stage=all_stages" 303 ."&plottype=".$plotType; 304 264 305 write_table_cell($class, '%s', $link, "All stages"); 265 306 … … 267 308 echo "<tr><td></td>\n"; 268 309 269 $defaultlink = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj; 310 $defaultlink = 311 "czartool_labels.php?pass=".$pass 312 ."&proj=".$proj 313 ."&label=".$selectedLabel 314 ."&stage=".$selectedStage 315 ."&plottype=".$plotType; 270 316 271 317 // write rows … … 285 331 // create link to label summary page for each label 286 332 if ($thisLabel == $selectedLabel) $link = ""; 287 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $thisLabel . "&stage=" . $selectedStage; 333 else $link = 334 "czartool_labels.php?pass=".$pass 335 ."&proj=".$proj 336 ."&label=".$thisLabel 337 ."&stage=".$selectedStage 338 ."&plottype=".$plotType; 288 339 289 340 echo "<tr><td></td>\n"; … … 342 393 343 394 if ($selectedLabel == "all_".$server."_labels") $link = ""; 344 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage ;395 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage."&plottype=".$plotType; 345 396 346 397 echo "<tr><td></td>\n"; … … 385 436 ########################################################################### 386 437 # 438 # Turns reverts on or off for a given task 439 # 440 ########################################################################### 441 function turnRevertsOnOff($db, $stage, $mode) { 442 443 exec("czartool_revert.pl -t $stage -o $mode", $response, $status); 444 $currentRevertMode; 445 if ($response[0] == "off") $currentRevertMode = 0; 446 else if ($response[0] == "on") $currentRevertMode = 1; 447 448 setRevertStatus($db, $stage, $currentRevertMode); 449 } 450 451 ########################################################################### 452 # 387 453 # Returns whether this stage is reverting or not 388 454 # … … 420 486 $faults = $row[1]; 421 487 422 $str = "$pending"; 488 if ($pending == 0) 489 $str = ""; 490 else 491 $str = "$pending"; 423 492 424 493 if ($state == "new") { … … 437 506 # 438 507 ########################################################################### 439 function createServersTable($pass, $proj, $db, $servers, $selectedLabel, $selectedStage ) {508 function createServersTable($pass, $proj, $db, $servers, $selectedLabel, $selectedStage, $plotType) { 440 509 441 510 // set up table columns … … 445 514 write_header_cell($class, "Server"); 446 515 write_header_cell($class, "Alive?"); 447 write_header_cell($class, "Scheduler running?"); 516 $link = "czartool_labels.php?pass=".$pass 517 ."&proj=".$proj 518 ."&label=".$selectedLabel 519 ."&stage=".$selectedStage 520 ."&plottype=".$plotType 521 ."&allservercmd=stop"; 522 523 write_table_cell($class, '%s', $link, "Stop all"); 524 $link = "czartool_labels.php?pass=".$pass 525 ."&proj=".$proj 526 ."&label=".$selectedLabel 527 ."&stage=".$selectedStage 528 ."&plottype=".$plotType 529 ."&allservercmd=run"; 530 531 write_table_cell($class, '%s', $link, "Run all"); 448 532 echo "</tr>\n"; 449 533 450 534 foreach ($servers as &$server) { 451 535 452 $link = "czartool_labels.php?pass=".$pass."&proj=".$proj."&server=".$server."&label=".$selectedLabel."&stage=".$selectedStage;453 // $link = "";454 455 536 getServerStatus($db, $server, $alive, $running); 456 537 457 538 echo "<tr><td></td>\n"; 539 $link = "czartool_labels.php?pass=".$pass 540 ."&proj=".$proj 541 ."&server=".$server 542 ."&label=".$selectedLabel 543 ."&stage=".$selectedStage 544 ."&plottype=".$plotType; 545 458 546 write_table_cell($class, '%s', $link, $server); 459 547 write_table_cell($class, '%s', "", $alive ? "yes" : "NO"); 460 write_table_cell($class, '%s', "", $running ? "yes" : "NO"); 548 549 if ($alive) { 550 551 $link = "czartool_labels.php?pass=".$pass 552 ."&proj=".$proj 553 ."&label=".$selectedLabel 554 ."&stage=".$selectedStage 555 ."&plottype=".$plotType 556 ."&server=".$server 557 ."&servercmd="; 558 559 if ($running) { 560 561 $link = $link . "stop"; 562 write_table_cell($class, '%s', $link, "stop"); 563 write_table_cell($class, '%s', "", ""); 564 } 565 else { 566 567 $link = $link . "run"; 568 write_table_cell($class, '%s', "", ""); 569 write_table_cell($class, '%s', $link, "run"); 570 } 571 } 572 else { 573 574 write_table_cell($class, '%s', "", ""); 575 write_table_cell($class, '%s', "", ""); 576 } 461 577 echo "</tr>\n"; 462 578 } … … 464 580 echo "</table>\n"; 465 581 } 582 583 ########################################################################### 584 # 585 # Commands a server to stop or run 586 # 587 ########################################################################### 588 function serverStopRun($db, $server, $cmd) { 589 590 exec("czartool_serverstoprun.pl -s $server -c $cmd", $response, $status); 591 $alive = 0; 592 $running = 0; 593 if ($response[0] == "running") {$alive = 1; $running = 1;} 594 else if ($response[0] == "stopped") {$alive = 1; $running = 0;} 595 else if ($response[0] == "dead") {$alive = 0; $running = 0;} 596 setServerStatus($db, $server, $alive, $running); 597 } 598 599 ########################################################################### 600 # 601 # Sets server status 602 # 603 ########################################################################### 604 function setServerStatus($db, $server, $alive, $running) { 605 606 $sql = "INSERT INTO servers (server, alive, running) VALUES ('$server', $alive, $running)"; 607 608 if ($debug) {echo "$sql<br>";} 609 610 $qry = $db->query($sql); 611 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 612 } 613 466 614 467 615 ########################################################################### -
branches/eam_branches/ipp-20100823/ippMonitor/raw/ipp.imfiles.dat
r29124 r29515 39 39 menulink | menuselect | link | Clean /tmp directory | cleanTmpDirectory.php 40 40 menutop | menutop | link | disk usage | diskUsage.php 41 42 menutop | menutop | plain | | 43 menulink | menuselect | link | Exposures Status | exposureStatus.php 44 menulink | menuselect | link | MOPS Exposures Status | mopsStatus.php 45 menulink | menuselect | link | GPC1 MySql ProcessList | gpc1MysqlProcessList.php -
branches/eam_branches/ipp-20100823/ippMonitor/scripts/generate
r28969 r29515 227 227 } 228 228 229 # fill in GROUP BY 230 if ($line =~ m|// \*\* GROUP RESTRICTIONS \*\*|) { 231 &write_group_by; 232 } 233 229 234 # fill in table restricts 230 235 if ($line =~ m|// \*\* BUTTON RESTRICTIONS \*\*|) { … … 331 336 print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'max', 1.0);\n"; 332 337 } 338 # print FILE "\$WHERE = check_ordering ('$GROUPS', \$WHERE);\n"; 339 } 340 341 # Generate GROUP BY statement if any 342 sub write_group_by { 333 343 print FILE "\$WHERE = check_ordering ('$GROUPS', \$WHERE);\n"; 334 344 } -
branches/eam_branches/ipp-20100823/ippScripts/scripts/automate_stacks.pl
r29124 r29515 124 124 defined $check_chips or defined $check_stacks or $check_sweetspot or $check_detrends or $check_dqstats or 125 125 defined $test_mode or defined $clean_old or defined $check_mode or 126 defined $confirm_stacks ;126 defined $confirm_stacks or defined $burntool_stats; 127 127 128 128 # Configurable parameters from our config file. 129 129 my @target_list = (); 130 130 my @filter_list = (); 131 my %distribution_list = (); 131 132 my %tessID_list = (); 132 133 my %obsmode_list = (); … … 135 136 my %cleanmods_list = (); 136 137 my %stackable_list = (); 138 my %extra_processing = (); 137 139 my %reduction_class = (); 138 140 my %macro_formats = (); … … 206 208 $this_target = ${ $tentry }{value}; 207 209 push @target_list, $this_target; 210 $distribution_list{$this_target} = $this_target; 211 } 212 elsif (${ $tentry }{name} eq 'DISTRIBUTION') { 213 $distribution_list{$this_target} = ${ $tentry }{value}; 208 214 } 209 215 elsif (${ $tentry }{name} eq 'TESS') { … … 222 228 $stackable_list{$this_target} = ${ $tentry }{value}; 223 229 } 230 elsif (${ $tentry }{name} eq 'EXTRA_PROCESSING') { 231 $extra_processing{$this_target} = ${ $tentry }{value}; 232 } 224 233 elsif (${ $tentry }{name} eq 'REDUCTION') { 225 234 $reduction_class{$this_target} = ${ $tentry }{value}; … … 726 735 my ($Nexposures,$Nimfiles,$Nburntooled,$Nalready) = pre_chip_queue($date,$target); 727 736 if (defined($burntool_stats)) { 728 print " $Nexposures $Nimfiles $Nburntooled $Nalready\n";737 print "BTSTATS: $date $target $Nexposures $Nimfiles $Nburntooled $Nalready\n"; 729 738 } 730 739 731 740 if ($Nexposures == 0) { 732 741 print STDERR "execute_chips: Target $target on $date had no exposures.\n"; 733 #next;742 next; 734 743 } 735 744 if ($Nalready != 0) { 736 745 print STDERR "execute_chips: Not queueing $target on $date due to already existing exposures.\n"; 737 #next;746 next; 738 747 } 739 748 if ($Nimfiles != $Nburntooled) { … … 1183 1192 &my_die("Unable to perform stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1184 1193 } 1194 1195 1185 1196 return(0); 1186 1197 } … … 1190 1201 my $pretend = shift; 1191 1202 foreach my $target (@target_list) { 1192 if ($stackable_list{$target} == 1) { 1193 foreach my $filter (@filter_list) { 1203 foreach my $filter (@filter_list) { 1204 if (exists($extra_processing{$target})) { 1205 do_extra_processing($date,$target,$filter,$pretend); 1206 } 1207 if ($stackable_list{$target} == 1) { 1194 1208 my ($Nexposures,$NprocChips,$NprocWarps,$Nalready) = pre_stack_queue($date,$target,$filter); 1195 1209 if ((!defined($force_stack_count))&&($NprocChips != $NprocWarps)) { # This makes me sad. :( … … 1231 1245 } 1232 1246 } 1247 else { 1248 # print STDERR "execute_stacks: Target $target is not auto-stackable.\n"; 1249 } 1233 1250 } 1234 else { 1235 # print STDERR "execute_stacks: Target $target is not auto-stackable.\n"; 1236 } 1237 } 1238 1251 } 1239 1252 } 1240 1253 … … 1291 1304 1292 1305 # 1306 # Extra processing 1307 ################################################################################ 1308 1309 sub do_extra_processing { 1310 my $date = shift; 1311 my $target = shift; 1312 my $filter = shift; 1313 my $pretend = shift; 1314 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 1315 1316 if ($target eq 'OSS') { 1317 my $db = init_gpc_db(); 1318 1319 my $obj_sth = "select DISTINCT rawExp.object from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) "; 1320 $obj_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' ORDER BY rawExp.object"; 1321 print STDERR "$obj_sth\n"; 1322 my $object_ref = $db->selectall_arrayref( $obj_sth ); 1323 1324 foreach my $object_row (@{ $object_ref }) { 1325 my $this_object = shift @{ $object_row }; 1326 my $input_sth = "select exp_id,warp_id,dateobs from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) "; 1327 $input_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' "; 1328 $input_sth .= " ORDER BY dateobs "; 1329 1330 my $warps = $db->selectall_arrayref( $input_sth ); 1331 1332 if (($#{ $warps } + 1) % 2 != 0) { 1333 print STDERR "Number of input warps to make OSS diffs is not even! $#{ $warps }\n"; 1334 die; 1335 } 1336 1337 while ($#{ $warps } > -1) { 1338 my $input_warp = shift @{ $warps }; 1339 my $template_warp = shift @{ $warps }; 1340 my $input_exp_id = ${ $input_warp }[0]; 1341 my $template_exp_id = ${ $template_warp }[0]; 1342 1343 my $cmd = "$difftool -dbname $dbname -definewarpwarp "; 1344 $cmd .= "-input_label $label -template_label $label "; 1345 $cmd .= "-backwards "; # Needed because difftool assumes a different date sorting. 1346 $cmd .= "-set_workdir $workdir -set_dist_group $dist_group -set_data_group $data_group "; 1347 $cmd .= " -simple -set_label $label -exp_id $input_exp_id -template_exp_id $template_exp_id "; 1348 # $cmd .= " -pretend "; 1349 if (defined($pretend)) { 1350 $cmd .= ' -pretend '; 1351 } 1352 if ($debug == 1) { 1353 $cmd .= ' -pretend '; 1354 } 1355 print STDERR "EXTRA_PROCESSING: $cmd\n"; 1356 if (($debug == 0)&&(!defined($pretend))) { 1357 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1358 run ( command => $cmd, verbose => $verbose ); 1359 unless ($success) { 1360 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1361 &my_die("Unable to perform difftool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1362 } 1363 } 1364 } 1365 } 1366 } 1367 } 1368 1369 1370 1371 1372 # 1293 1373 # Auto-Clean 1294 1374 ################################################################################ … … 1380 1460 my $object = $object_list{$target}; 1381 1461 my $comment = $comment_list{$target}; 1382 my $dist_group = $ target;1462 my $dist_group = $distribution_list{$target}; 1383 1463 my $data_group = "${target}.${trunc_date}"; 1384 1464 my $tess_id = $tessID_list{$target}; … … 1427 1507 my $N = $metadata_out{N_MACROS}; 1428 1508 $metadata_out{"ns${N}Macro"} = $macro_formats{$proc_mode}; 1429 print STDERR "WORKING ON A MACRO: ns${N}Macro $proc_mode $macro_formats{$proc_mode}\n";1509 # print STDERR "WORKING ON A MACRO: ns${N}Macro $proc_mode $macro_formats{$proc_mode}\n"; 1430 1510 if (defined($date)&&(defined($target))) { 1431 1511 -
branches/eam_branches/ipp-20100823/ippScripts/scripts/ipp_apply_burntool.pl
r27299 r29515 55 55 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 56 56 my $nebXattr = can_run('neb-xattr') or (warn "Can't find neb-xattr" and $missing_tools = 1); 57 my $nebreplicate = can_run('neb-replicate') or (warn "Can't find neb-replicate" and $missing_tools = 1); 57 58 #my $fpack = can_run('fpack') or (warn "Can't find fpack" and $missing_tools = 1); 58 59 if ($missing_tools) { … … 214 215 215 216 $status = vsystem ("$nebXattr --write $outTable user.copies:2",$REALRUN); 217 $status = vsystem ("$nebreplicate --set_copies 2 $outTable",$REALRUN); 216 218 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state $outState", $REALRUN); 217 219 if ($status) { -
branches/eam_branches/ipp-20100823/ippScripts/scripts/ipp_cleanup.pl
r27959 r29515 53 53 } 54 54 55 # set this to 1 to enable checking for files on dead nodes 56 # it is off for now because the implementation is a hack 57 # See comments below. 58 my $check_for_gone = 0; 59 55 60 my $error_state; 56 if ($mode eq "goto_cleaned") { $error_state = "error_cleaned"; } 57 if ($mode eq "goto_scrubbed") { $error_state = "error_scrubbed"; } 58 if ($mode eq "goto_purged") { $error_state = "error_purged"; } 61 my $done_state; 62 if ($mode eq "goto_cleaned") { $error_state = "error_cleaned"; $done_state = "cleaned"; } 63 if ($mode eq "goto_scrubbed") { $error_state = "error_scrubbed"; $done_state = "scrubbed";} 64 if ($mode eq "goto_purged") { $error_state = "error_purged"; $done_state = "purged";} 59 65 60 66 … … 92 98 } 93 99 94 # if there are no chipProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new' 95 # XXX Why? This could just mean there's nothing to cleanup, or that we're trying to rerun an errored run. 100 # if there are no chipProcessedImfiles (@$stdout_buf == 0) then assume that we're done 101 # it could be that there are no chipProcessedImfiles at all if say if a run was changed from drop to goto_cleaned 102 # or of a run was set to update and then back to goto_cleaned before any images were processed 96 103 if (@$stdout_buf == 0) { 97 my $command = "$chiptool -chip_id $stage_id -updaterun -set_state $ error_state";104 my $command = "$chiptool -chip_id $stage_id -updaterun -set_state $done_state"; 98 105 $command .= " -dbname $dbname" if defined $dbname; 99 106 … … 126 133 127 134 unless ($ipprc->file_exists($config_file)) { 128 print STDERR "skipping cleanup for chipRun $stage_id $class_id " 129 . " because config file ($config_file) is missing\n"; 130 $status = 0; 135 if (file_gone($config_file)) { 136 print STDERR "forcing cleanup for chipRun $stage_id $class_id " 137 . " because config file ($config_file) is gone\n"; 138 } else { 139 print STDERR "skipping cleanup for chipRun $stage_id $class_id " 140 . " because config file ($config_file) is missing\n"; 141 $status = 0; 142 } 131 143 } 132 144 } … … 354 366 355 367 if (@$stdout_buf == 0) { 356 # No skycells were found for some reason. 357 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 358 my $command = "$warptool -updaterun -warp_id $stage_id -set_state $error_state"; 368 # No skycells were found for some reason. 369 # it could be that there are no warpSkyfiles at all if say if a run was changed from drop to goto_cleaned 370 # or of a run was cleaned, set to update, and then back to goto_cleaned before any images were successfully 371 # updated 372 my $command = "$warptool -updaterun -warp_id $stage_id -set_state $done_state"; 359 373 $command .= " -dbname $dbname" if defined $dbname; 360 374 … … 384 398 385 399 unless ($ipprc->file_exists($config_file)) { 386 print STDERR "skipping cleanup for warpRun $stage_id $skycell_id" . 387 " because config file is missing\n"; 388 $status = 0; 400 if (file_gone($config_file)) { 401 print STDERR "forcing cleanup for warpRun $stage_id $skycell_id" . 402 " because config file is gone\n"; 403 } else { 404 print STDERR "skipping cleanup for warpRun $stage_id $skycell_id" . 405 " because config file is missing\n"; 406 $status = 0; 407 } 389 408 } 390 409 } … … 624 643 625 644 if (@$stdout_buf == 0) { 626 # No skycells were found for some reason. 627 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 628 my $command = "$difftool -updaterun -diff_id $stage_id -set_state $error_state"; 645 # No skycells were found for some reason. 646 # it could be that there are no warpSkyfiles at all if say if a run was changed from drop to goto_cleaned 647 # or of a run was cleaned, set to update, and then back to goto_cleaned before any images were successfully 648 my $command = "$difftool -updaterun -diff_id $stage_id -set_state $done_state"; 629 649 $command .= " -dbname $dbname" if defined $dbname; 630 650 … … 658 678 659 679 unless ($ipprc->file_exists($config_file)) { 660 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 661 " because config file ($config_file) is missing\n"; 662 $status = 0; 680 if (file_gone($config_file)) { 681 print STDERR "forcing cleanup for diffRun $stage_id $skycell_id" . 682 " because config file ($config_file) is gone\n"; 683 } else { 684 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 685 " because config file ($config_file) is missing\n"; 686 $status = 0; 687 } 663 688 } 664 689 } … … 1665 1690 } 1666 1691 1692 my $whichnode; 1693 sub file_gone 1694 { 1695 # if $check_for_gone check whether the only instance of file is on a lost volumen 1696 # XXX: we don't have a proper interface for this. 1697 # For now try to use Bill's hack the script 'whichnode' 1698 return 0 if !$check_for_gone; 1699 1700 my $file = shift; 1701 1702 if (!$whichnode) { 1703 $whichnode = can_run('whichnode') or 1704 &my_die("Can't find whichnode", "chip", $stage_id, $PS_EXIT_CONFIG_ERROR); 1705 } 1706 1707 my $command = "$whichnode $file"; 1708 1709 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1710 run(command => $command, verbose => $verbose); 1711 unless ($success) { 1712 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1713 &my_die("Unable to perform whichnode: $error_code", "chip", $stage_id, $error_code); 1714 } 1715 1716 my @lines = split "\n", (join "", @$stdout_buf); 1717 my $numGone = 0; 1718 my $numNotGone = 0; 1719 foreach my $line (@lines) { 1720 chomp $line; 1721 1722 # output lines are either 1723 # "volume available" 1724 # or 1725 # "volume not available" 1726 1727 my ($volume, $answer, undef) = split " ", $line; 1728 # our hack is if the volume has an X in the name it's gone 1729 if ($volume =~ /X/) { 1730 print STDERR "$file is on $volume which is gone\n"; 1731 $numGone++; 1732 } elsif ($answer eq 'not') { 1733 print STDERR "$file is on $volume which is not available\n"; 1734 $numNotGone++; 1735 } else { 1736 print STDERR "unexpected output from whichnode: $line\n"; 1737 } 1738 } 1739 # if there are any instances that are not on a gone node return 0 1740 if ($numNotGone == 0 and $numGone > 0) { 1741 return 1; 1742 } else { 1743 return 0; 1744 } 1745 } 1746 1667 1747 sub addFilename 1668 1748 { -
branches/eam_branches/ipp-20100823/ippScripts/scripts/magic_destreak.pl
r28931 r29515 42 42 # Parse the command-line arguments 43 43 my ($magic_ds_id, $camera, $streaks, $inv_streaks, $exp_id, $stage, $stage_id, $component, $uri, $path_base, $cam_path_base, $cam_reduction); 44 my ($streaks_path_base, $inv_streaks_path_base); 44 45 my ($outroot, $recoveryroot, $magicked); 45 46 my ($replace, $release); … … 49 50 'magic_ds_id=s' => \$magic_ds_id,# Magic destreak run identifier 50 51 'camera=s' => \$camera, # camera for evaluating file rules 52 'streaks_path_base=s' => \$streaks_path_base, # path_base for streaks data 53 'inv_streaks_path_base=s' => \$inv_streaks_path_base, #path_base for streaks from inverse diff 54 'inv_streaks=s' => \$inv_streaks,# file containing the list of streaks from the inverse diff 51 55 'streaks=s' => \$streaks, # file containing the list of streaks 52 56 'inv_streaks=s' => \$inv_streaks,# file containing the list of streaks from the inverse diff … … 78 82 defined $camera and 79 83 defined $streaks and 84 defined $streaks_path_base and 80 85 defined $stage and 81 86 defined $stage_id and … … 108 113 &my_die("Invalid value for stage: $stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 109 114 } 115 $inv_streaks_path_base = undef if defined($inv_streaks_path_base) and ($inv_streaks_path_base eq "NULL"); 110 116 $inv_streaks = undef if defined($inv_streaks) and ($inv_streaks eq "NULL"); 111 117 … … 240 246 my ($allstreaks_fh, $allstreaks_name); 241 247 248 # Set name of streaks files from their path_base. Note. ne 'NULL' test is for backward compatability 249 # with runs that don't have path_base set yet 250 if ($streaks_path_base ne 'NULL') { 251 $streaks = "$streaks_path_base.streaks"; 252 } 253 if ($inv_streaks_path_base and ($inv_streaks_path_base ne 'NULL')) { 254 $inv_streaks = "$inv_streaks_path_base.streaks"; 255 } 256 257 my $streaks_resolved = $ipprc->file_resolve($streaks) or &my_die("failed to resolve streaks file $streaks", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR); 258 my $inv_streaks_resolved; 259 if ($inv_streaks) { 260 $inv_streaks_resolved = $ipprc->file_resolve($inv_streaks) or &my_die("failed to resolve inverse streaks file $inv_streaks", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR); 261 } 262 263 242 264 if ($stage eq "raw") { 243 265 $image = $uri; … … 301 323 $sources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $path_base); 302 324 303 if ($inv_streaks ) {325 if ($inv_streaks_resolved) { 304 326 # create a temporary file containing the contents of the 305 327 # two streaks files … … 307 329 UNLINK => !$save_temps); 308 330 309 combine_streaks($allstreaks_fh, $streaks , $inv_streaks);331 combine_streaks($allstreaks_fh, $streaks_resolved, $inv_streaks_resolved); 310 332 311 333 # apply the combined streaks to both the forward and inverse diffs 312 $streaks = $allstreaks_name;334 $streaks_resolved = $allstreaks_name; 313 335 } 314 336 } 315 337 316 338 { 317 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image";339 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks_resolved -image $image"; 318 340 319 341 $command .= " -stats $statsFile"; … … 340 362 } 341 363 } 342 if (($stage eq "diff") and $inv_streaks ) {364 if (($stage eq "diff") and $inv_streaks_resolved) { 343 365 $image = $ipprc->filename("PPSUB.INVERSE", $path_base); 344 366 $mask = $ipprc->filename("PPSUB.INVERSE.MASK", $path_base); … … 349 371 my $invStatsFile = "$outroot/$exp_id.mds.$magic_ds_id.$stage_id.$component.inv.stats"; 350 372 351 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image";373 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks_resolved -image $image"; 352 374 $command .= " -stats $invStatsFile"; 353 375 -
branches/eam_branches/ipp-20100823/ippScripts/scripts/magic_process.pl
r28137 r29515 17 17 use IPC::Cmd 0.36 qw( can_run run ); 18 18 use File::Temp qw( tempfile ); 19 use File::Copy; 19 20 use PS::IPP::Metadata::Config; 20 21 use PS::IPP::Metadata::List qw( parse_md_list ); … … 41 42 42 43 # Parse the command-line arguments 43 my ($magic_id, $node, $camera, $dbname, $baseroot, $save_temps, $verbose, $no_update, $no_op, $logfile );44 my ($magic_id, $node, $camera, $dbname, $baseroot, $save_temps, $verbose, $no_update, $no_op, $logfile, $final_outroot); 44 45 45 46 GetOptions( … … 49 50 'dbname=s' => \$dbname, # Database name 50 51 'baseroot=s' => \$baseroot, # Output root name 52 'final-outroot=s' => \$final_outroot, # location for final outputs 51 53 'save-temps' => \$save_temps, # Save temporary files? 52 54 'verbose' => \$verbose, # Print stuff? … … 86 88 87 89 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 90 91 # list of VerifyStreaks input and output files to copy to nebulous 92 my @verify_outputs = qw( 93 clusterPos.txt 94 duplicate.png 95 mask.png 96 original.png 97 original.fits 98 residual.png 99 residual.fits 100 clusters.list 101 ); 88 102 89 103 ### Get a list of inputs … … 311 325 } 312 326 313 314 327 ### Input result into database 315 328 { … … 334 347 335 348 if ($node eq "root") { 349 # XXXX: Since we just added the result above, all of these my_dies are going to fail 350 # with a duplicate row error. 351 # see more comments below 336 352 my $streaks_file = "$outroot.streaks"; 337 353 my $resolved = $ipprc->file_resolve($streaks_file); … … 349 365 } 350 366 351 &run_verifystreaks($baseroot);352 367 353 368 my $exp_id; # Exposure identifier … … 366 381 } 367 382 383 &run_verifystreaks($baseroot, $exp_id); 384 368 385 { 369 386 my $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path); # Astrometry file … … 383 400 } 384 401 402 my $output_streaks = $final_outroot . ".streaks"; 403 if ($output_streaks and ($output_streaks ne $streaks_file)) { 404 copy_to_nebulous($ipprc, $streaks_file, $output_streaks, 1); 405 foreach my $f (@verify_outputs) { 406 my $src = "$baseroot.verify/${exp_id}_$f"; 407 my $dest = "$final_outroot.${f}"; 408 copy_to_nebulous($ipprc, $src, $dest, 1); 409 } 410 } else { 411 $output_streaks = $streaks_file; 412 } 385 413 386 414 { 387 415 my $command = "$magictool -addmask"; 388 416 $command .= " -magic_id $magic_id"; 389 $command .= " - uri $streaks_file";417 $command .= " -path_base $final_outroot"; 390 418 $command .= " -streaks $num_streaks"; 391 419 $command .= " -dbname $dbname" if defined $dbname; … … 397 425 unless ($success) { 398 426 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 399 # This isn't going to work because our result was already entered. 427 # XXX: This my_die isn't going to work because the result for the root node was already 428 # added to the database up above. 429 # There is a magicMask has a fault column. Maybe we should 430 # use that and add a new revert mode that deletes the magicMask and the magicNodeResult 431 # for the root node. 400 432 &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code); 401 433 } … … 406 438 } 407 439 440 408 441 ### Pau. 409 442 … … 411 444 412 445 my $baseroot = shift; 446 my $exp_id = shift; 413 447 414 448 unless ($VerifyStreaks) { … … 431 465 my @files = <$baseroot.*.clusters>; 432 466 433 unless (open ($FILE, ">$outdir/clusters.list")) { 434 print "failed to create cluster file $outdir/clusters.list\n"; 467 my $clusters_list = "$outdir/${exp_id}_clusters.list"; 468 unless (open ($FILE, ">$clusters_list")) { 469 print "failed to create cluster file $clusters_list\n"; 435 470 return 1; 436 471 } … … 441 476 close ($FILE); 442 477 if ($status) { 443 print "failed to create cluster file $ outdir/clusters.list\n";478 print "failed to create cluster file $clusters_list\n"; 444 479 return 1; 445 480 } 446 481 447 my $command = "$VerifyStreaks --out $outdir --clusters $ outdir/clusters.list $baseroot.root.streakMap";482 my $command = "$VerifyStreaks --out $outdir --clusters $clusters_list $baseroot.root.streakMap"; 448 483 449 484 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 513 548 } 514 549 550 # Copy a file to nebulous and optionally replicate it 551 # We should consider making this an ipprc function. For now try it here so we can print 552 # the right error messages 553 sub copy_to_nebulous { 554 my $ipprc = shift; 555 my $src = shift; 556 my $dest = shift; 557 my $replicate = shift; 558 559 print "copying $src to $dest\n"; 560 561 $ipprc->file_exists($src) or 562 &my_die("expected output file does not exist: $src", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 563 564 # copy the file to it's final destination - which is presumably in nebulous 565 # we delete it so that all instances are deleted in case it has been replicated 566 if ($ipprc->file_exists($dest)) { 567 $ipprc->file_delete($dest) or 568 &my_die("failed to delete existing file: $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 569 } 570 my $dest_resolved = $ipprc->file_resolve($dest, 'create'); 571 &my_die("failed to resolve $dest", $PS_EXIT_UNKNOWN_ERROR) if !$dest_resolved; 572 573 copy ($src, $dest_resolved) or 574 &my_die("failed to copy $src to $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 575 576 if ($replicate and (file_scheme($dest) eq 'neb')) { 577 my $neb = $ipprc->nebulous(); 578 $neb->setxattr($dest, 'user.copies', 2, 'create') or 579 &my_die("failed to set user.copies for $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 580 581 $neb->replicate($dest) or 582 &my_die("failed to replicate $dest", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 583 } 584 } 585 515 586 sub my_die 516 587 { -
branches/eam_branches/ipp-20100823/ippScripts/scripts/magic_tree.pl
r27718 r29515 83 83 unless ($success) { 84 84 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 85 &my_die("Unable to perform magictool -inputfile: $error_code", $magic_id, $error_code); 86 } 87 88 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 85 &my_die("Unable to perform magictool -inputskyfile: $error_code", $magic_id, $error_code); 86 } 87 88 my $magictool_output = join "", @$stdout_buf; 89 # if there is no output from magictool that means that there are no 90 # diffSkyfiles with non-zero quality. Set fault to a special value so 91 # that these magicRuns can be recognized and dropped. 92 &my_die("magictool -inputskyfile returned no output. Inputs are probably all bad quality.", $magic_id, 42) 93 if !$magictool_output; 94 my $metadata = $mdcParser->parse($magictool_output) or 89 95 &my_die("Unable to parse metadata config doc", $magic_id, $PS_EXIT_PROG_ERROR); 90 96 -
branches/eam_branches/ipp-20100823/ippTasks/Makefile.am
r28632 r29515 18 18 magic.pro \ 19 19 destreak.pro \ 20 destreak.cleanup.pro \ 20 21 diff.pro \ 21 22 stack.pro \ -
branches/eam_branches/ipp-20100823/ippTasks/destreak.pro
r29124 r29515 10 10 book init magicToDS 11 11 book init magicDSToRevert 12 book init magicDSToCleanup13 12 14 13 ### indexes into Database lists … … 30 29 $magicDSRevertStage = 0 31 30 31 macro destreak.show.stages 32 echo $DS_STAGE:n stages enabled for destreak processing 33 for i 0 $DS_STAGE:n 34 echo $i $DS_STAGE:$i 35 end 36 echo current magicDSStage = $magicDSStage 37 echo current magicDSRevertStage = $magicDSRevertStage 38 end 39 32 40 ### Check status of tasks 33 41 macro destreak.status 34 # since echo and listbook output go to different files these do not come in order35 echo magicToDS36 42 book listbook magicToDS 37 echo magicDSToRevert38 43 book listbook magicDSToRevert 39 echo magicDSToCleanup40 book listbook magicDSToCleanup41 44 end 42 45 … … 45 48 book init magicToDS 46 49 book init magicDSToRevert 47 book init magicDSToCleanup48 50 end 49 51 … … 73 75 end 74 76 75 macro destreak.cleanup.on76 task destreak.cleanup.load77 active true78 end79 task destreak.cleanup.run80 active true81 end82 end83 84 77 ### Turn tasks off 85 78 macro destreak.off … … 106 99 end 107 100 end 108 macro destreak.cleanup.off109 task destreak.cleanup.load110 active false111 end112 task destreak.cleanup.run113 active false114 end115 end116 117 101 118 102 task destreak.load … … 203 187 book getword magicToDS $pageName camera -var CAMERA 204 188 book getword magicToDS $pageName streaks_uri -var STREAKS 189 book getword magicToDS $pageName streaks_path_base -var STREAKS_PATH_BASE 205 190 book getword magicToDS $pageName inv_streaks_uri -var INV_STREAKS 191 book getword magicToDS $pageName inv_streaks_path_base -var INV_STREAKS_PATH_BASE 206 192 book getword magicToDS $pageName stage -var STAGE 207 193 book getword magicToDS $pageName stage_id -var STAGE_ID … … 229 215 # TODO: do not add recoveryroot or replace if they are null or zero 230 216 231 $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --exp_id $EXP_ID --streaks $STREAKS --inv_streaks $INV_STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --cam_reduction $CAM_REDUCTION --outroot $OUTROOT --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE --magicked $MAGICKED217 $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --exp_id $EXP_ID --streaks_path_base $STREAKS_PATH_BASE --inv_streaks_path_base $INV_STREAKS_PATH_BASE --streaks $STREAKS --inv_streaks $INV_STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --cam_reduction $CAM_REDUCTION --outroot $OUTROOT --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE --magicked $MAGICKED 232 218 233 219 add_standard_args run … … 274 260 275 261 periods -poll $LOADPOLL 276 #periods -exec $LOADEXEC277 262 periods -exec 30 278 periods -timeout 60263 periods -timeout 300 279 264 npending 1 280 265 … … 293 278 add_poll_args run 294 279 add_poll_labels run 280 # since this command can be expensive, reduce the limit 281 $run = $run -limit 24 295 282 command $run 296 283 end … … 317 304 task destreak.revert.load 318 305 host local 319 320 periods -poll $LOADPOLL 321 periods -exec $LOADEXEC 322 periods -timeout 20 306 periods -poll 60.0 307 periods -exec 120. 308 periods -timeout 120 323 309 npending 1 324 310 active false … … 518 504 end 519 505 520 task destreak.cleanup.load521 host local522 523 periods -poll $LOADPOLL524 periods -exec $LOADEXEC525 periods -timeout 20526 npending 1527 active false528 529 stdout NULL530 stderr $LOGSUBDIR/destreak.cleanup.load.log531 532 task.exec533 $run = magicdstool -tocleanup534 if ($DB:n == 0)535 option DEFAULT536 else537 538 # save the DB name for the exit tasks539 option $DB:$magicDSToCleanup_DB540 $run = $run -dbname $DB:$magicDSToCleanup_DB541 542 # only bump database number after we have gone through all of the stages543 $magicDSToCleanup_DB ++544 if ($magicDSToCleanup_DB >= $DB:n) set magicDSToCleanup_DB = 0545 end546 add_poll_args run547 add_poll_labels run548 command $run549 end550 551 # success552 task.exit 0553 # convert 'stdout' to book format554 ipptool2book stdout magicDSToCleanup -key magic_ds_id -uniq -setword dbname $options:0 -setword pantaskState INIT555 if ($VERBOSE > 2)556 book listbook magicDSToCleanup557 end558 559 # delete existing entries in the appropriate pantaskStates560 process_cleanup magicDSToCleanup561 end562 563 # locked list564 task.exit default565 showcommand failure566 end567 568 task.exit crash569 showcommand crash570 end571 572 # operation times out?573 task.exit timeout574 showcommand timeout575 end576 end577 578 task destreak.cleanup.run579 periods -poll $RUNPOLL580 periods -exec $RUNEXEC581 periods -timeout 60582 active false583 584 task.exec585 stdout $LOGSUBDIR/destreak.cleanup.run.log586 stderr $LOGSUBDIR/destreak.cleanup.run.log587 588 # if we are unable to run the 'exec', use a long retry time589 periods -exec $RUNEXEC590 591 book npages magicDSToCleanup -var N592 if ($N == 0) break593 if ($NETWORK == 0) break594 595 # look for new images (pantaskState == INIT)596 book getpage magicDSToCleanup 0 -var pageName -key pantaskState INIT597 if ("$pageName" == "NULL") break598 599 book setword magicDSToCleanup $pageName pantaskState RUN600 book getword magicDSToCleanup $pageName magic_ds_id -var MAGIC_DS_ID601 book getword magicDSToCleanup $pageName camera -var CAMERA602 book getword magicDSToCleanup $pageName stage -var STAGE603 book getword magicDSToCleanup $pageName outroot -var OUTROOT604 book getword magicDSToCleanup $pageName dbname -var DBNAME605 606 sprintf logfile "%s/mds.%s.cleanup.log" $OUTROOT $MAGIC_DS_ID607 608 host anyhost609 610 $run = magic_destreak_cleanup.pl --magic_ds_id $MAGIC_DS_ID --stage $STAGE --camera $CAMERA --logfile $logfile611 612 add_standard_args run613 614 # save the pageName for future reference below615 options $pageName616 617 # create the command line618 if ($VERBOSE > 1)619 echo command $run620 end621 # if we are ready to run, drop the retry timeout low so we fill up the queue622 periods -exec 0.05623 command $run624 end625 626 # default exit status627 task.exit 0628 process_exit magicDSToCleanup $options:0 $JOB_STATUS629 end630 631 # locked list632 task.exit default633 showcommand failure634 process_exit magicDSToCleanup $options:0 $JOB_STATUS635 end636 637 task.exit crash638 showcommand crash639 book setword magicDSToCleanup $options:0 pantaskState CRASH640 end641 642 # operation timed out?643 task.exit timeout644 showcommand timeout645 book setword magicDSToCleanup $options:0 pantaskState TIMEOUT646 end647 end648 -
branches/eam_branches/ipp-20100823/ippTasks/dist.pro
r29124 r29515 176 176 host local 177 177 178 periods -poll $LOADPOLL178 periods -poll 20 179 179 periods -exec $LOADEXEC 180 periods -timeout 30 180 periods -timeout 300 181 181 npending 1 182 182 … … 338 338 339 339 periods -poll $LOADPOLL 340 periods -exec $LOADEXEC341 periods -timeout 30 340 periods -exec 30 341 periods -timeout 3000 342 342 npending 1 343 343 … … 479 479 end 480 480 add_poll_labels run 481 echo $run482 481 command $run 483 482 end -
branches/eam_branches/ipp-20100823/ippTasks/magic.pro
r27620 r29515 288 288 book getword magicToProcess $pageName camera -var CAMERA 289 289 book getword magicToProcess $pageName workdir -var WORKDIR_TEMPLATE 290 book getword magicToProcess $pageName raw_workdir -var RAW_TEMPLATE 291 book getword magicToProcess $pageName exp_name -var EXP_NAME 290 292 book getword magicToProcess $pageName dbname -var DBNAME 291 293 … … 308 310 sprintf baseroot "%s/%s/%s.mgc.%s" $WORKDIR $EXP_ID $EXP_ID $MAGIC_ID 309 311 312 if ("$NODE" == "root") 313 # This is the root node, put the streaks file into the rawExps workdir 314 # which is presumably in nebulous and thus will be replicatable 315 set.workdir.by.camera $CAMERA FPA $RAW_TEMPLATE $default_host RAW_WORKDIR 316 sprintf final_outroot "%s/%s.%s/%s.%s.mgc.%s" $RAW_WORKDIR $EXP_NAME $EXP_ID $EXP_NAME $EXP_ID $MAGIC_ID 317 318 $EXTRA_ARGS = --final-outroot $final_outroot 319 else 320 $EXTRA_ARGS = "" 321 end 322 310 323 $logfile = $baseroot.$NODE.log 311 324 if ("$logfile" == "") … … 319 332 mkdir $outpath 320 333 321 $run = magic_process.pl --magic_id $MAGIC_ID --camera $CAMERA --node $NODE --baseroot $baseroot --logfile $logfile 334 $run = magic_process.pl --magic_id $MAGIC_ID --camera $CAMERA --node $NODE --baseroot $baseroot --logfile $logfile $EXTRA_ARGS 322 335 add_standard_args run 323 336 -
branches/eam_branches/ipp-20100823/ippTasks/nightly_stacks.pro
r28982 r29515 436 436 437 437 book getword nsData $options:0 nsNmacros -var ns_Nmacros 438 for i 0 $ns_Nmacros 439 sprintf macroName "ns%dMacro" $i 440 book getword nsData $options:0 $macroName -var macroCmd 441 $macroCmd 438 if ("$ns_Nmacros" != "NULL") 439 for i 0 $ns_Nmacros 440 sprintf macroName "ns%dMacro" $i 441 book getword nsData $options:0 $macroName -var macroCmd 442 $macroCmd 443 end 442 444 end 443 445 … … 498 500 499 501 book getword nsData $options:0 nsNmacros -var ns_Nmacros 500 for i 0 $ns_Nmacros 501 sprintf macroName "ns%dMacro" $i 502 book getword nsData $options:0 $macroName -var macroCmd 503 $macroCmd 502 if ("$ns_Nmacros" != "NULL") 503 for i 0 $ns_Nmacros 504 sprintf macroName "ns%dMacro" $i 505 book getword nsData $options:0 $macroName -var macroCmd 506 $macroCmd 507 end 504 508 end 505 509 … … 560 564 561 565 book getword nsData $options:0 nsNmacros -var ns_Nmacros 562 for i 0 $ns_Nmacros 563 sprintf macroName "ns%dMacro" $i 564 book getword nsData $options:0 $macroName -var macroCmd 565 $macroCmd 566 if ("$ns_Nmacros" != "NULL") 567 for i 0 $ns_Nmacros 568 sprintf macroName "ns%dMacro" $i 569 book getword nsData $options:0 $macroName -var macroCmd 570 $macroCmd 571 end 566 572 end 567 573 … … 623 629 624 630 book getword nsData $options:0 nsNmacros -var ns_Nmacros 625 for i 0 $ns_Nmacros 626 sprintf macroName "ns%dMacro" $i 627 book getword nsData $options:0 $macroName -var macroCmd 628 $macroCmd 631 if ("$ns_Nmacros" != "NULL") 632 for i 0 $ns_Nmacros 633 sprintf macroName "ns%dMacro" $i 634 book getword nsData $options:0 $macroName -var macroCmd 635 $macroCmd 636 end 629 637 end 630 638 … … 684 692 685 693 book getword nsData $options:0 nsNmacros -var ns_Nmacros 686 for i 0 $ns_Nmacros 687 sprintf macroName "ns%dMacro" $i 688 book getword nsData $options:0 $macroName -var macroCmd 689 $macroCmd 694 if ("$ns_Nmacros" != "NULL") 695 for i 0 $ns_Nmacros 696 sprintf macroName "ns%dMacro" $i 697 book getword nsData $options:0 $macroName -var macroCmd 698 $macroCmd 699 end 690 700 end 691 701 … … 747 757 748 758 book getword nsData $options:0 nsNmacros -var ns_Nmacros 749 for i 0 $ns_Nmacros 750 sprintf macroName "ns%dMacro" $i 751 book getword nsData $options:0 $macroName -var macroCmd 752 $macroCmd 759 if ("$ns_Nmacros" != "NULL") 760 for i 0 $ns_Nmacros 761 sprintf macroName "ns%dMacro" $i 762 book getword nsData $options:0 $macroName -var macroCmd 763 $macroCmd 764 end 753 765 end 754 766 … … 870 882 871 883 book getword nsData $options:0 nsNmacros -var ns_Nmacros 872 for i 0 $ns_Nmacros 873 sprintf macroName "ns%dMacro" $i 874 book getword nsData $options:0 $macroName -var macroCmd 875 $macroCmd 884 if ("$ns_Nmacros" != "NULL") 885 for i 0 $ns_Nmacros 886 sprintf macroName "ns%dMacro" $i 887 book getword nsData $options:0 $macroName -var macroCmd 888 $macroCmd 889 end 876 890 end 877 891 -
branches/eam_branches/ipp-20100823/ippTasks/pstamp.pro
r28779 r29515 14 14 $pstampRev_DB = 0 15 15 $pstampDep_DB = 0 16 $pstampRevDep_DB = 0 16 17 $pstampCleanup_DB = 0 18 $pstampStopFaulted_DB = 0 17 19 18 20 # set PS_DBSERVER if postage stamp database host is not the same as the value for DBSERVER in site.config … … 89 91 active false 90 92 end 91 task pstamp.job.revert92 active false93 end94 93 task pstamp.dependent.load 95 94 active false … … 104 103 active true 105 104 end 105 task pstamp.dependent.revert 106 active true 107 end 108 task pstamp.stopfaulted 109 active true 110 end 106 111 end 107 112 macro pstamp.revert.off 108 113 task pstamp.job.revert 114 active false 115 end 116 task pstamp.dependent.revert 117 active false 118 end 119 task pstamp.stopfaulted 109 120 active false 110 121 end … … 513 524 stdout NULL 514 525 stderr $LOGSUBDIR/pstamp.job.revert.log 515 $run = pstamptool -revertjob -all526 $run = pstamptool -revertjob 516 527 if ($DB:n == 0) 517 528 option DEFAULT … … 798 809 end 799 810 811 task pstamp.dependent.revert 812 host local 813 814 periods -poll $LOADPOLL 815 periods -exec 900 816 periods -timeout 300 817 npending 1 818 819 task.exec 820 stdout NULL 821 stderr $LOGSUBDIR/pstamp.dependent.revert.log 822 $run = pstamptool -revertdependent 823 if ($DB:n == 0) 824 option DEFAULT 825 else 826 $run = $run $PS_DBSERVER -dbname $DB:$pstampRevDep_DB 827 $pstampRevDep_DB ++ 828 if ($pstampRevDep_DB >= $DB:n) set pstampRevDep_DB = 0 829 end 830 add_poll_args run 831 add_poll_labels run 832 command $run 833 end 834 835 task.exit $EXIT_SUCCESS 836 # nothing to do 837 end 838 839 task.exit default 840 showcommand failure 841 end 842 843 task.exit crash 844 showcommand crash 845 end 846 847 task.exit timeout 848 showcommand timeout 849 end 850 end 851 852 task pstamp.stopfaulted 853 host local 854 855 periods -poll $LOADPOLL 856 periods -exec 30 857 periods -timeout 300 858 npending 1 859 860 task.exec 861 stderr $LOGSUBDIR/pstamp.stopfaulted.log 862 stderr $LOGSUBDIR/pstamp.stopfaulted.log 863 $run = pstampstopfaulted 864 if ($DB:n == 0) 865 option DEFAULT 866 else 867 $run = $run $PS_DBSERVER -dbname $DB:$pstampStopFaulted_DB 868 $pstampStopFaulted_DB ++ 869 if ($pstampStopFaulted_DB >= $DB:n) set pstampStopFaulted_DB = 0 870 end 871 add_poll_args run 872 add_poll_labels run 873 command $run 874 end 875 876 task.exit $EXIT_SUCCESS 877 # nothing to do 878 end 879 880 task.exit default 881 showcommand failure 882 end 883 884 task.exit crash 885 showcommand crash 886 end 887 888 task.exit timeout 889 showcommand timeout 890 end 891 end -
branches/eam_branches/ipp-20100823/ippTasks/publish.pro
r27074 r29515 75 75 76 76 task.exec 77 if ($LABEL:n == 0) break 78 #otherwise everything will be queued when there is no label. 77 79 $run = pubtool -definerun 78 80 if ($DB:n == 0) -
branches/eam_branches/ipp-20100823/ippTasks/replicate.pro
r24847 r29515 173 173 book getword replicatePending $pageName volume_name -var VOLUME_NAME 174 174 book getword replicatePending $pageName volume_host -var VOLUME_HOST 175 book getword replicatePending $pageName command -var COMMAND 175 176 176 177 set.host.for.replicate $VOLUME_HOST … … 180 181 181 182 # these operations do not require a database to be specified 182 $run = neb-replicate --copies $NEED_COPIES$KEY183 $run = $COMMAND $KEY 183 184 184 185 # save the pageName for future reference below -
branches/eam_branches/ipp-20100823/ippTasks/science.cleanup.pro
r24595 r29515 113 113 task.exec 114 114 book npages chipPendingCleanup -var N 115 if ($N == 0) break 115 if ($N == 0) 116 periods -exec $RUNEXEC 117 break 118 end 116 119 if ($NETWORK == 0) break 117 120 … … 143 146 echo command $run 144 147 end 148 periods -exec 0.05 145 149 command $run 146 150 end … … 569 573 task.exec 570 574 book npages warpPendingCleanup -var N 571 if ($N == 0) break 575 if ($N == 0) 576 periods -exec $RUNEXEC 577 break 578 end 572 579 if ($NETWORK == 0) break 573 580 … … 599 606 echo command $run 600 607 end 608 periods -exec 0.05 601 609 command $run 602 610 end … … 721 729 task.exec 722 730 book npages diffCleanup -var N 723 if ($N == 0) break 731 if ($N == 0) 732 periods -exec $RUNEXEC 733 break 734 end 724 735 if ($NETWORK == 0) break 725 736 … … 751 762 echo command $run 752 763 end 764 periods -exec 0.05 753 765 command $run 754 766 end -
branches/eam_branches/ipp-20100823/ippToPsps/config/stack/tables.xml
r27361 r29515 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 3 <tableDescriptions type=" ST">3 <tableDescriptions type="stack"> 4 4 <table name="StackMeta"> 5 5 <column name="stackMetaID" type="TLONGLONG" default="0" comment="stack identifier"></column> … … 30 30 <column name="ctype1" type="TSTRING" default=" " comment="name of astrometric projection in RA"></column> 31 31 <column name="ctype2" type="TSTRING" default=" " comment="name of astrometric projection in DEC"></column> 32 <column name="crval1" type="TFLOAT" default="-999" comment="RA corresponding to reference pixel"></column> 33 <column name="crval2" type="TFLOAT" default="-999" comment="DEC corresponding to reference pixel"></column> 34 <column name="crpix1" type="TFLOAT" default="-999" comment="reference pixel value for RA"></column> 35 <column name="crpix2" type="TFLOAT" default="-999" comment="reference pixel value for DEC"></column> 36 <column name="pc001001" type="TFLOAT" default="-999" comment="elements of rotation/Dcale matrix"></column> 37 <column name="pc001002" type="TFLOAT" default="-999" comment="elements of rotation/Dcale matrix"></column> 38 <column name="pc002001" type="TFLOAT" default="-999" comment="elements of rotation/Dcale matrix"></column> 39 <column name="pc002002" type="TFLOAT" default="-999" comment="elements of rotation/Dcale matrix"></column> 32 <column name="crval1" type="TDOUBLE" default="-999" comment="RA corresponding to reference pixel"></column> 33 <column name="crval2" type="TDOUBLE" default="-999" comment="DEC corresponding to reference pixel"></column> 34 <column name="crpix1" type="TDOUBLE" default="-999" comment="reference pixel value for RA"></column> 35 <column name="crpix2" type="TDOUBLE" default="-999" comment="reference pixel value for DEC"></column> 36 <column name="cdelt1" type="TDOUBLE" default="-999" comment="scale factor for RA"></column> 37 <column name="cdelt2" type="TDOUBLE" default="-999" comment="scale factor for DEC"></column> 38 <column name="pc001001" type="TDOUBLE" default="-999" comment="elements of rotation/Dcale matrix"></column> 39 <column name="pc001002" type="TDOUBLE" default="-999" comment="elements of rotation/Dcale matrix"></column> 40 <column name="pc002001" type="TDOUBLE" default="-999" comment="elements of rotation/Dcale matrix"></column> 41 <column name="pc002002" type="TDOUBLE" default="-999" comment="elements of rotation/Dcale matrix"></column> 40 42 <column name="polyOrder" type="TBYTE" default="255" comment="polynomial order of astrometry fit"></column> 41 <column name="pca1x3y0" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>42 <column name="pca1x2y1" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>43 <column name="pca1x1y2" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>44 <column name="pca1x0y3" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>45 <column name="pca1x2y0" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>46 <column name="pca1x1y1" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>47 <column name="pca1x0y2" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>48 <column name="pca2x3y0" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>49 <column name="pca2x2y1" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>50 <column name="pca2x1y2" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>51 <column name="pca2x0y3" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>52 <column name="pca2x2y0" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>53 <column name="pca2x1y1" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>54 <column name="pca2x0y2" type="T FLOAT" default="-999" comment="polynomial coefficients for the astrometric fit"></column>43 <column name="pca1x3y0" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 44 <column name="pca1x2y1" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 45 <column name="pca1x1y2" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 46 <column name="pca1x0y3" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 47 <column name="pca1x2y0" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 48 <column name="pca1x1y1" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 49 <column name="pca1x0y2" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 50 <column name="pca2x3y0" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 51 <column name="pca2x2y1" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 52 <column name="pca2x1y2" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 53 <column name="pca2x0y3" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 54 <column name="pca2x2y0" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 55 <column name="pca2x1y1" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 56 <column name="pca2x0y2" type="TDOUBLE" default="-999" comment="polynomial coefficients for the astrometric fit"></column> 55 57 <column name="calibModNum" type="TSHORT" default="0" comment="calibration modification number"></column> 56 58 <column name="dataRelease" type="TBYTE" default="0" comment="Data release"></column> … … 69 71 <column name="projectionCellID" type="TLONG" default="-999" comment="projection cell identifier"></column> 70 72 <column name="stackVer" type="TSHORT" default="-999" comment="version number of this stack"></column> 71 <column name="obsTime" type="T FLOAT" default="-999" comment=" Time of mid observation (unit = day)"></column>73 <column name="obsTime" type="TDOUBLE" default="-999" comment=" Time of mid observation (unit = day)"></column> 72 74 <column name="xPos" type="TFLOAT" default="-999" comment="measured x on CCD from PSF fit"></column> 73 75 <column name="yPos" type="TFLOAT" default="-999" comment="measured y on CCD from PSF fit"></column> … … 103 105 <column name="dataRelease" type="TBYTE" default="0" comment="Data release when this detection was originally taken."></column> 104 106 </table> 105 <table name="SkinnyObject"> 106 <column name="objID" type="TLONGLONG" default="0" comment="ODM object identifier index"></column> 107 <column name="ippObjID" type="TLONGLONG" default="0" comment="IPP object number"></column> 108 <column name="projectionCellID" type="TLONG" default="-999" comment="projection cell identifier at discovery time"></column> 109 <column name="dataRelease" type="TBYTE" default="0" comment="Data release to propagate to the object"></column> 110 </table> 111 <table name="StackOrphan"> 112 <column name="partitionKey" type="TLONGLONG" default="0" comment="partitioning key"></column> 113 <column name="stackDetectID" type="TLONGLONG" default="0" comment="detection identifier"></column> 107 <table name="StackApFlx"> 108 <column name="objID" type="TLONGLONG" default="0" comment="ODM object identifier"></column> 109 <column name="stackDetectID" type="TLONGLONG" default="0" comment="ODM detection identifier"></column> 110 <column name="ippObjID" type="TLONGLONG" default="0" comment="IPP object identifier"></column> 114 111 <column name="ippDetectID" type="TLONGLONG" default="0" comment="detection ID generated by IPP"></column> 115 112 <column name="filterID" type="TBYTE" default="0" comment="filter identifier"></column> 116 113 <column name="stackTypeID" type="TBYTE" default="0" comment="stack type identifier"></column> 117 <column name="surveyID" type="TBYTE" default="0" comment="survey identifier"></column>114 <column name="surveyID" type="TBYTE" default="0" comment="survey flag identifier"></column> 118 115 <column name="primaryF" type="TBYTE" default="255" comment="identifies best stack detection for Stacks overlapping the same region of the sky."></column> 119 116 <column name="stackMetaID" type="TLONGLONG" default="0" comment="stack identifier"></column> 120 <column name="skyCellID" type="TLONG" default="-999" comment="skycell identifier"></column> 121 <column name="stackVer" type="TSHORT" default="-999" comment="version number of this stack"></column> 122 <column name="xPos" type="TFLOAT" default="-999" comment="measured x on CCD from PSF fit"></column> 123 <column name="yPos" type="TFLOAT" default="-999" comment="measured y on CCD from PSF fit"></column> 124 <column name="xPosErr" type="TFLOAT" default="-999" comment="estimated error in x"></column> 125 <column name="yPosErr" type="TFLOAT" default="-999" comment="estimated error in y"></column> 126 <column name="instFlux" type="TFLOAT" default="-999" comment="PSF instrumental flux"></column> 127 <column name="instFluxErr" type="TFLOAT" default="-999" comment="estimated error in instrumental flux"></column> 128 <column name="peakFlux" type="TFLOAT" default="-999" comment="ratio of peak flux to total flux"></column> 129 <column name="sky" type="TFLOAT" default="-999" comment="PSF sky level at source (adu)"></column> 130 <column name="skyErr" type="TFLOAT" default="-999" comment="estimated error in sky"></column> 131 <column name="sgSep" type="TFLOAT" default="-999" comment="star/galaxy separator"></column> 132 <column name="psfWidMajor" type="TFLOAT" default="-999" comment="PSF width in major axis"></column> 133 <column name="psfWidMinor" type="TFLOAT" default="-999" comment="PSF width in minor axis"></column> 134 <column name="psfTheta" type="TFLOAT" default="-999" comment="PSF orientation angle"></column> 135 <column name="psfLikelihood" type="TFLOAT" default="-999" comment="PSF likelihood"></column> 136 <column name="psfCf" type="TFLOAT" default="-999" comment="PSF coverage factor"></column> 137 <column name="infoFlag" type="TLONG" default="-999" comment="indicator of strange propeties"></column> 138 <column name="nFrames" type="TLONG" default="-999" comment="number of frames contributing to source"></column> 139 <column name="wlSigma" type="TFLOAT" default="-999" comment="weak lensing sigma"></column> 140 <column name="eps1" type="TFLOAT" default="-999" comment="weak lensing vector element eps(1)"></column> 141 <column name="eps2" type="TFLOAT" default="-999" comment="weak lensing vector element eps(2)"></column> 142 <column name="Psm11" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sm(1,1)"></column> 143 <column name="Psm12" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sm(1,2)"></column> 144 <column name="Psm21" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sm(2,1)"></column> 145 <column name="Psm22" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sm(2,2)"></column> 146 <column name="Psh11" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sh(1,1)"></column> 147 <column name="Psh12" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sh(1,2)"></column> 148 <column name="Psh21" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sh(2,1)"></column> 149 <column name="Psh22" type="TFLOAT" default="-999" comment="weak lensing matrix element P_sh(2,2)"></column> 117 <column name="isophotMag" type="TFLOAT" default="-999" comment="isophotal magnitude"></column> 118 <column name="isophotMagErr" type="TFLOAT" default="-999" comment="estimated error in isophotal magnitude"></column> 119 <column name="isophotMajAxis" type="TFLOAT" default="-999" comment="isophotal Major Axis"></column> 120 <column name="isophotMajAxisErr" type="TFLOAT" default="-999" comment="estimated error in isophotal Major Axis"></column> 121 <column name="isophotMinAxis" type="TFLOAT" default="-999" comment="isophotal Minor Axis"></column> 122 <column name="isophotMinAxisErr" type="TFLOAT" default="-999" comment="estimated error in isophotal Minor Axis"></column> 123 <column name="isophotMajAxisGrad" type="TFLOAT" default="-999" comment="isophotal major axis gradient"></column> 124 <column name="isophotMinAxisGrad" type="TFLOAT" default="-999" comment="isophotal minor axis gradient"></column> 125 <column name="isophotPA" type="TFLOAT" default="-999" comment="isophotal position angle"></column> 126 <column name="isophotPAErr" type="TFLOAT" default="-999" comment="estimated error in isophotal position angle"></column> 127 <column name="isophotPAGrad" type="TFLOAT" default="-999" comment="isophotal position angle gradient"></column> 128 <column name="petRadius" type="TFLOAT" default="-999" comment="Petrosian radius"></column> 129 <column name="petRadiusErr" type="TFLOAT" default="-999" comment="estimated error inPetrosian radius"></column> 130 <column name="petMag" type="TFLOAT" default="-999" comment="Petrosian magntiude"></column> 131 <column name="petMagErr" type="TFLOAT" default="-999" comment="estimated error in petMag"></column> 132 <column name="petR50" type="TFLOAT" default="-999" comment="Petrosian radius at 50% light"></column> 133 <column name="petR50Err" type="TFLOAT" default="-999" comment="estimated error inPetrosian radius at 50% light"></column> 134 <column name="petR90" type="TFLOAT" default="-999" comment="Petrosian radius at 90% light"></column> 135 <column name="petR90Err" type="TFLOAT" default="-999" comment="estimated error in Petrosian radius at 90% light"></column> 136 <column name="petCf" type="TFLOAT" default="-999" comment="Petrosian fit coverage factor"></column> 137 <column name="flxR1" type="TFLOAT" default="-999" comment="Flux inside r = 1"></column> 138 <column name="flxR1Err" type="TFLOAT" default="-999" comment="estimated error is flxR1"></column> 139 <column name="flxR1Var" type="TFLOAT" default="-999" comment="estimated variance in flxR1"></column> 140 <column name="flxR2" type="TFLOAT" default="-999" comment="Flux inside r = 2"></column> 141 <column name="flxR2Err" type="TFLOAT" default="-999" comment="estimated error is flxR2"></column> 142 <column name="flxR2Var" type="TFLOAT" default="-999" comment="estimated variance in flxR2"></column> 143 <column name="flxR3" type="TFLOAT" default="-999" comment="Flux inside r = 3"></column> 144 <column name="flxR3Err" type="TFLOAT" default="-999" comment="estimated error is flxR3"></column> 145 <column name="flxR3Var" type="TFLOAT" default="-999" comment="estimated variance in flxR3"></column> 146 <column name="flxR4" type="TFLOAT" default="-999" comment="Flux inside r = 4"></column> 147 <column name="flxR4Err" type="TFLOAT" default="-999" comment="estimated error is flxR4"></column> 148 <column name="flxR4Var" type="TFLOAT" default="-999" comment="estimated variance in flxR4"></column> 149 <column name="flxR5" type="TFLOAT" default="-999" comment="Flux inside r = 5"></column> 150 <column name="flxR5Err" type="TFLOAT" default="-999" comment="estimated error is flxR5"></column> 151 <column name="flxR5Var" type="TFLOAT" default="-999" comment="estimated variance in flxR5"></column> 152 <column name="flxR6" type="TFLOAT" default="-999" comment="Flux inside r = 6"></column> 153 <column name="flxR6Err" type="TFLOAT" default="-999" comment="estimated error is flxR6"></column> 154 <column name="flxR6Var" type="TFLOAT" default="-999" comment="estimated variance in flxR6"></column> 155 <column name="flxR7" type="TFLOAT" default="-999" comment="Flux inside r = 7"></column> 156 <column name="flxR7Err" type="TFLOAT" default="-999" comment="estimated error is flxR7"></column> 157 <column name="flxR7Var" type="TFLOAT" default="-999" comment="estimated variance in flxR7"></column> 158 <column name="flxR8" type="TFLOAT" default="-999" comment="Flux inside r = 8"></column> 159 <column name="flxR8Err" type="TFLOAT" default="-999" comment="estimated error is flxR8"></column> 160 <column name="flxR8Var" type="TFLOAT" default="-999" comment="estimated variance in flxR8"></column> 161 <column name="flxR9" type="TFLOAT" default="-999" comment="Flux inside r = 9"></column> 162 <column name="flxR9Err" type="TFLOAT" default="-999" comment="estimated error is flxR9"></column> 163 <column name="flxR9Var" type="TFLOAT" default="-999" comment="estimated variance in flxR9"></column> 164 <column name="flxR10" type="TFLOAT" default="-999" comment="Flux inside r = 10"></column> 165 <column name="flxR10Err" type="TFLOAT" default="-999" comment="estimated error is flxR10"></column> 166 <column name="flxR10Var" type="TFLOAT" default="-999" comment="estimated variance in flxR10"></column> 167 <column name="c1FlxR1" type="TFLOAT" default="-999" comment="Flux inside r = 1"></column> 168 <column name="c1FlxR1Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR1"></column> 169 <column name="c1FlxR1Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR1"></column> 170 <column name="c1FlxR2" type="TFLOAT" default="-999" comment="Flux inside r = 2"></column> 171 <column name="c1FlxR2Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR2"></column> 172 <column name="c1FlxR2Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR2"></column> 173 <column name="c1FlxR3" type="TFLOAT" default="-999" comment="Flux inside r = 3"></column> 174 <column name="c1FlxR3Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR3"></column> 175 <column name="c1FlxR3Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR3"></column> 176 <column name="c1FlxR4" type="TFLOAT" default="-999" comment="Flux inside r = 4"></column> 177 <column name="c1FlxR4Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR4"></column> 178 <column name="c1FlxR4Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR4"></column> 179 <column name="c1FlxR5" type="TFLOAT" default="-999" comment="Flux inside r = 5"></column> 180 <column name="c1FlxR5Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR5"></column> 181 <column name="c1FlxR5Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR5"></column> 182 <column name="c1FlxR6" type="TFLOAT" default="-999" comment="Flux inside r = 6"></column> 183 <column name="c1FlxR6Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR6"></column> 184 <column name="c1FlxR6Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR6"></column> 185 <column name="c1FlxR7" type="TFLOAT" default="-999" comment="Flux inside r = 7"></column> 186 <column name="c1FlxR7Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR7"></column> 187 <column name="c1FlxR7Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR7"></column> 188 <column name="c1FlxR8" type="TFLOAT" default="-999" comment="Flux inside r = 8"></column> 189 <column name="c1FlxR8Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR8"></column> 190 <column name="c1FlxR8Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR8"></column> 191 <column name="c1FlxR9" type="TFLOAT" default="-999" comment="Flux inside r = 9"></column> 192 <column name="c1FlxR9Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR9"></column> 193 <column name="c1FlxR9Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR9"></column> 194 <column name="c1FlxR10" type="TFLOAT" default="-999" comment="Flux inside r = 10"></column> 195 <column name="c1FlxR10Err" type="TFLOAT" default="-999" comment="estimated error is c1FlxR10"></column> 196 <column name="c1FlxR10Var" type="TFLOAT" default="-999" comment="estimated variance in c1FlxR10"></column> 197 <column name="c2FlxR1" type="TFLOAT" default="-999" comment="Flux inside r = 1"></column> 198 <column name="c2FlxR1Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR1"></column> 199 <column name="c2FlxR1Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR1"></column> 200 <column name="c2FlxR2" type="TFLOAT" default="-999" comment="Flux inside r = 2"></column> 201 <column name="c2FlxR2Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR2"></column> 202 <column name="c2FlxR2Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR2"></column> 203 <column name="c2FlxR3" type="TFLOAT" default="-999" comment="Flux inside r = 3"></column> 204 <column name="c2FlxR3Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR3"></column> 205 <column name="c2FlxR3Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR3"></column> 206 <column name="c2FlxR4" type="TFLOAT" default="-999" comment="Flux inside r = 4"></column> 207 <column name="c2FlxR4Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR4"></column> 208 <column name="c2FlxR4Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR4"></column> 209 <column name="c2FlxR5" type="TFLOAT" default="-999" comment="Flux inside r = 5"></column> 210 <column name="c2FlxR5Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR5"></column> 211 <column name="c2FlxR5Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR5"></column> 212 <column name="c2FlxR6" type="TFLOAT" default="-999" comment="Flux inside r = 6"></column> 213 <column name="c2FlxR6Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR6"></column> 214 <column name="c2FlxR6Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR6"></column> 215 <column name="c2FlxR7" type="TFLOAT" default="-999" comment="Flux inside r = 7"></column> 216 <column name="c2FlxR7Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR7"></column> 217 <column name="c2FlxR7Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR7"></column> 218 <column name="c2FlxR8" type="TFLOAT" default="-999" comment="Flux inside r = 8"></column> 219 <column name="c2FlxR8Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR8"></column> 220 <column name="c2FlxR8Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR8"></column> 221 <column name="c2FlxR9" type="TFLOAT" default="-999" comment="Flux inside r = 9"></column> 222 <column name="c2FlxR9Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR9"></column> 223 <column name="c2FlxR9Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR9"></column> 224 <column name="c2FlxR10" type="TFLOAT" default="-999" comment="Flux inside r = 10"></column> 225 <column name="c2FlxR10Err" type="TFLOAT" default="-999" comment="estimated error is c2FlxR10"></column> 226 <column name="c2FlxR10Var" type="TFLOAT" default="-999" comment="estimated variance in c2FlxR10"></column> 227 <column name="c3FlxR1" type="TFLOAT" default="-999" comment="Flux inside r = 1"></column> 228 <column name="c3FlxR1Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR1"></column> 229 <column name="c3FlxR1Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR1"></column> 230 <column name="c3FlxR2" type="TFLOAT" default="-999" comment="Flux inside r = 2"></column> 231 <column name="c3FlxR2Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR2"></column> 232 <column name="c3FlxR2Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR2"></column> 233 <column name="c3FlxR3" type="TFLOAT" default="-999" comment="Flux inside r = 3"></column> 234 <column name="c3FlxR3Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR3"></column> 235 <column name="c3FlxR3Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR3"></column> 236 <column name="c3FlxR4" type="TFLOAT" default="-999" comment="Flux inside r = 4"></column> 237 <column name="c3FlxR4Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR4"></column> 238 <column name="c3FlxR4Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR4"></column> 239 <column name="c3FlxR5" type="TFLOAT" default="-999" comment="Flux inside r = 5"></column> 240 <column name="c3FlxR5Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR5"></column> 241 <column name="c3FlxR5Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR5"></column> 242 <column name="c3FlxR6" type="TFLOAT" default="-999" comment="Flux inside r = 6"></column> 243 <column name="c3FlxR6Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR6"></column> 244 <column name="c3FlxR6Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR6"></column> 245 <column name="c3FlxR7" type="TFLOAT" default="-999" comment="Flux inside r = 7"></column> 246 <column name="c3FlxR7Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR7"></column> 247 <column name="c3FlxR7Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR7"></column> 248 <column name="c3FlxR8" type="TFLOAT" default="-999" comment="Flux inside r = 8"></column> 249 <column name="c3FlxR8Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR8"></column> 250 <column name="c3FlxR8Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR8"></column> 251 <column name="c3FlxR9" type="TFLOAT" default="-999" comment="Flux inside r = 9"></column> 252 <column name="c3FlxR9Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR9"></column> 253 <column name="c3FlxR9Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR9"></column> 254 <column name="c3FlxR10" type="TFLOAT" default="-999" comment="Flux inside r = 10"></column> 255 <column name="c3FlxR10Err" type="TFLOAT" default="-999" comment="estimated error is c3FlxR10"></column> 256 <column name="c3FlxR10Var" type="TFLOAT" default="-999" comment="estimated variance in c3FlxR10"></column> 257 <column name="logC" type="TFLOAT" default="-999" comment="Abraham concentration index"></column> 258 <column name="logA" type="TFLOAT" default="-999" comment="Abraham asymmetry index"></column> 150 259 <column name="activeFlag" type="TBYTE" default="-999" comment="indicates whether this detection/orphan is still a detection/orphan"></column> 151 <column name="assocDate" type="TSTRING" default="28881231" comment="date object association assigned"></column> 152 <column name="historyModNum" type="TSHORT" default="0" comment="modification number in the O-D association history"></column> 153 <column name="dataRelease" type="TBYTE" default="0" comment="Data release to reproduce queries through data releases"></column> 154 </table> 155 <table name="ObjectCalColor"> 260 <column name="dataRelease" type="TBYTE" default="0" comment="Data release when this detection was taken"></column> 261 </table> 262 <table name="StackModelFit"> 156 263 <column name="objID" type="TLONGLONG" default="0" comment="ODM object identifier"></column> 157 <column name="ippObjID" type="TLONGLONG" default="0" comment="ipp object identifier"></column> 264 <column name="stackDetectID" type="TLONGLONG" default="0" comment="ODM detection identifier"></column> 265 <column name="ippObjID" type="TLONGLONG" default="0" comment="IPP object identifier"></column> 266 <column name="ippDetectID" type="TLONGLONG" default="0" comment="detection ID generated by IPP"></column> 158 267 <column name="filterID" type="TBYTE" default="0" comment="filter identifier"></column> 159 <column name="calColor" type="TFLOAT" default="0" comment=" color adopted for magnitude calculation (unit = mag)"></column> 160 <column name="calColorErr" type="TFLOAT" default="0" comment=" error in calibrating color (unit = mag)"></column> 161 <column name="calibModNum" type="TSHORT" default="0" comment="calibration modification number"></column> 162 <column name="dataRelease" type="TBYTE" default="0" comment="Data release when this color calibration was established"></column> 268 <column name="stackTypeID" type="TBYTE" default="0" comment="stack type identifier"></column> 269 <column name="surveyID" type="TBYTE" default="0" comment="survey flag identifier"></column> 270 <column name="primaryF" type="TBYTE" default="255" comment="identifies best stack detection for Stacks overlapping the same region of the sky."></column> 271 <column name="stackMetaID" type="TLONGLONG" default="0" comment="stack identifier"></column> 272 <column name="deVRadius" type="TFLOAT" default="-999" comment="deVaucouleurs radius"></column> 273 <column name="deVRadiusErr" type="TFLOAT" default="-999" comment="estimated error in deVaucouleurs radius"></column> 274 <column name="deVMag" type="TFLOAT" default="-999" comment="deVaucouleurs magntiude"></column> 275 <column name="deVMagErr" type="TFLOAT" default="-999" comment="estimated error in deV_mag"></column> 276 <column name="deVAb" type="TFLOAT" default="-999" comment="deVaucoulerus axis ratio"></column> 277 <column name="deVAbErr" type="TFLOAT" default="-999" comment="estimated error in deVaucoulerus axis ratio"></column> 278 <column name="raDeVOff" type="TFLOAT" default="-999" comment="Offset in RA of deVaucouleurs fit from PSF RA"></column> 279 <column name="decDeVOff" type="TFLOAT" default="-999" comment="Offset in DEC of deVaucouleurs fit from PSF DEC"></column> 280 <column name="raDeVOffErr" type="TFLOAT" default="-999" comment="estimated error in ra offset"></column> 281 <column name="decDeVOffErr" type="TFLOAT" default="-999" comment="estimated error in dec offset"></column> 282 <column name="deVCf" type="TFLOAT" default="-999" comment="deVaucouleurs fit coverage factor"></column> 283 <column name="deVLikelihood" type="TFLOAT" default="-999" comment="deVaucouleurs fit likelihood factor"></column> 284 <column name="deVCovar11" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 285 <column name="deVCovar12" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 286 <column name="deVCovar13" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 287 <column name="deVCovar14" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 288 <column name="deVCovar15" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 289 <column name="deVCovar16" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 290 <column name="deVCovar22" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 291 <column name="deVCovar23" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 292 <column name="deVCovar24" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 293 <column name="deVCovar25" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 294 <column name="deVCovar26" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 295 <column name="deVCovar33" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 296 <column name="deVCovar34" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 297 <column name="deVCovar35" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 298 <column name="deVCovar36" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 299 <column name="deVCovar44" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 300 <column name="deVCovar45" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 301 <column name="deVCovar46" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 302 <column name="deVCovar55" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 303 <column name="deVCovar56" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 304 <column name="deVCovar66" type="TFLOAT" default="-999" comment="covariance for deVaucouleurs fit"></column> 305 <column name="expRadius" type="TFLOAT" default="-999" comment="Exponential fit radius"></column> 306 <column name="expRadiusErr" type="TFLOAT" default="-999" comment="estimated error in Exponential fit radius"></column> 307 <column name="expMag" type="TFLOAT" default="-999" comment="Exponential fit magntiude"></column> 308 <column name="expMagErr" type="TFLOAT" default="-999" comment="estimated error in expMag"></column> 309 <column name="expAb" type="TFLOAT" default="-999" comment="Exponential fit axis ratio"></column> 310 <column name="expAbErr" type="TFLOAT" default="-999" comment="estimated error in Exponential fit axis ratio"></column> 311 <column name="raExpOff" type="TFLOAT" default="-999" comment="Offset in RA of Exponential fit from PSF RA"></column> 312 <column name="decExpOff" type="TFLOAT" default="-999" comment="Offset in DEC of Exponential fit from PSF DEC"></column> 313 <column name="raExpOffErr" type="TFLOAT" default="-999" comment="estimated error in raExpOff"></column> 314 <column name="decExpOffErr" type="TFLOAT" default="-999" comment="estimated error in decExpOff"></column> 315 <column name="expCf" type="TFLOAT" default="-999" comment="Exponential fit coverage factor"></column> 316 <column name="expLikelihood" type="TFLOAT" default="-999" comment="Exponential fit likelihood factor"></column> 317 <column name="expCovar11" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 318 <column name="expCovar12" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 319 <column name="expCovar13" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 320 <column name="expCovar14" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 321 <column name="expCovar15" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 322 <column name="expCovar16" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 323 <column name="expCovar22" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 324 <column name="expCovar23" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 325 <column name="expCovar24" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 326 <column name="expCovar25" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 327 <column name="expCovar26" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 328 <column name="expCovar33" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 329 <column name="expCovar34" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 330 <column name="expCovar35" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 331 <column name="expCovar36" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 332 <column name="expCovar44" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 333 <column name="expCovar45" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 334 <column name="expCovar46" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 335 <column name="expCovar55" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 336 <column name="expCovar56" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 337 <column name="expCovar66" type="TFLOAT" default="-999" comment="covariance for Exponential fit"></column> 338 <column name="serRadius" type="TFLOAT" default="-999" comment="Sersic radius"></column> 339 <column name="serRadiusErr" type="TFLOAT" default="-999" comment="estimated error in Sersic radius"></column> 340 <column name="serMag" type="TFLOAT" default="-999" comment="Sersic magntiude"></column> 341 <column name="serMagErr" type="TFLOAT" default="-999" comment="estimated error in serMag"></column> 342 <column name="serAb" type="TFLOAT" default="-999" comment="Sersic axis ratio"></column> 343 <column name="serAbErr" type="TFLOAT" default="-999" comment="estimated error in Sersic axis ratio"></column> 344 <column name="serNu" type="TFLOAT" default="-999" comment="Sersic index"></column> 345 <column name="serNuErr" type="TFLOAT" default="-999" comment="estimated error in Sersic index"></column> 346 <column name="raSerOff" type="TFLOAT" default="-999" comment="Offset in RA of Sersic fit from PSF RA"></column> 347 <column name="decSerOff" type="TFLOAT" default="-999" comment="Offset in DEC of Sersic fit from PSF DEC"></column> 348 <column name="raSerOffErr" type="TFLOAT" default="-999" comment="estimated error in raSerOff"></column> 349 <column name="decSerOffErr" type="TFLOAT" default="-999" comment="estimated error in decSerOff"></column> 350 <column name="serCf" type="TFLOAT" default="-999" comment="Sersic fit coverage factor"></column> 351 <column name="serLikelihood" type="TFLOAT" default="-999" comment="Sersic fit likelihood factor"></column> 352 <column name="sersicCovar11" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 353 <column name="sersicCovar12" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 354 <column name="sersicCovar13" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 355 <column name="sersicCovar14" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 356 <column name="sersicCovar15" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 357 <column name="sersicCovar16" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 358 <column name="sersicCovar17" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 359 <column name="sersicCovar22" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 360 <column name="sersicCovar23" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 361 <column name="sersicCovar24" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 362 <column name="sersicCovar25" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 363 <column name="sersicCovar26" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 364 <column name="sersicCovar27" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 365 <column name="sersicCovar33" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 366 <column name="sersicCovar34" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 367 <column name="sersicCovar35" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 368 <column name="sersicCovar36" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 369 <column name="sersicCovar37" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 370 <column name="sersicCovar44" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 371 <column name="sersicCovar45" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 372 <column name="sersicCovar46" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 373 <column name="sersicCovar47" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 374 <column name="sersicCovar55" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 375 <column name="sersicCovar56" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 376 <column name="sersicCovar57" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 377 <column name="sersicCovar66" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 378 <column name="sersicCovar67" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 379 <column name="sersicCovar77" type="TFLOAT" default="-999" comment="covariance for Sersic fit"></column> 380 <column name="activeFlag" type="TBYTE" default="-999" comment="indicates whether this detection/orphan is still a detection/orphan"></column> 381 <column name="dataRelease" type="TBYTE" default="0" comment="Data release when this detection was taken"></column> 382 </table> 383 <table name="StackToImage"> 384 <column name="stackMetaID" type="TLONGLONG" default="0" comment="stack identifier"></column> 385 <column name="imageID" type="TLONGLONG" default="0" comment="hashed exposure-ccdID identifier"></column> 163 386 </table> 164 387 </tableDescriptions> -
branches/eam_branches/ipp-20100823/ippToPsps/perl/checkOdmStatus.pl
r29124 r29515 10 10 use ippToPsps::IppToPspsDb; 11 11 use ippToPsps::Datastore; 12 use ippToPsps::Batch Manager;12 use ippToPsps::Batch; 13 13 14 14 my $singleBatch = undef; … … 19 19 my $product = undef; 20 20 my $filePath = undef; 21 my $removeUnprocessed = undef; 21 22 22 23 … … 27 28 'product|p=s' => \$product, 28 29 'location|l=s' => \$filePath, 30 'remove|r' => \$removeUnprocessed, 29 31 'verbose|v' => \$verbose, 30 32 'save_temps|s' => \$save_temps … … 32 34 33 35 if (!defined $product) { 34 print "* OPTIONAL: a datastore product name -p <name>\n";36 print "* OPTIONAL: a datastore product name -p <name>\n"; 35 37 } 36 38 if (!defined $singleBatch) { 37 print "* OPTIONAL: a single batch -b <batchNum> (default = none)\n";39 print "* OPTIONAL: a single batch -b <batchNum> (default = none)\n"; 38 40 } 39 41 if (!defined $fromTime) { 40 42 $fromTime = "2010-01-01"; 41 print "* OPTIONAL: from time -f <dateTime> (default = $fromTime)\n";43 print "* OPTIONAL: from time -f <dateTime> (default = $fromTime)\n"; 42 44 } 43 45 if (!defined $toTime) { 44 46 $toTime = "2099-12-31"; 45 print "* OPTIONAL: to time -t <dateTime> (default = $toTime)\n";47 print "* OPTIONAL: to time -t <dateTime> (default = $toTime)\n"; 46 48 } 47 49 if (!defined $filePath) { 48 50 print "* OPTIONAL: location for files to be deleted -l <path>\n"; 49 51 } 52 if (!defined $removeUnprocessed) { 53 $removeUnprocessed = 0; 54 print "* OPTIONAL: remove unprocessed files -r (default = $removeUnprocessed)\n"; 55 } 50 56 if (!defined $verbose) { 51 57 $verbose = 0; 52 print "* OPTIONAL: run in verbose mode -v (default = $verbose)\n";58 print "* OPTIONAL: run in verbose mode -v (default = $verbose)\n"; 53 59 } 54 60 if (!defined $save_temps) { 55 61 $save_temps = 0; 56 print "* OPTIONAL: keep temp files -t (default = $save_temps)\n";62 print "* OPTIONAL: keep temp files -t (default = $save_temps)\n"; 57 63 } 58 64 … … 60 66 my $datastore = new ippToPsps::Datastore($product, 0, 0); 61 67 my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps); 62 my $batchManager = new ippToPsps::BatchManager($ippToPspsDb, $filePath, $verbose, $save_temps);63 68 my $odmUrl = "http://web01.psps.ifa.hawaii.edu/a01/OdmWebService/OdmWebService.asmx/GetBatchStatus"; 64 69 my $ua = LWP::UserAgent->new; … … 85 90 86 91 print "\n"; 87 printf("+----------------------+--------------+--------------+----------------+-------------- -+---------+----------+\n");88 printf("| Timestamp | Batch | Exposure ID | Loaded to ODM? | Merge worthy? | Merged? | Deleted? |\n");89 printf("+----------------------+--------------+--------------+----------------+-------------- -+---------+----------+\n");92 printf("+----------------------+--------------+--------------+----------------+--------------+--------------+---------+----------+\n"); 93 printf("| Timestamp | Batch | Exposure ID | Loaded to ODM? | Load failed? |Merge worthy? | Merged? | Deleted? |\n"); 94 printf("+----------------------+--------------+--------------+----------------+--------------+--------------+---------+----------+\n"); 90 95 91 96 # loop round batches … … 95 100 my $numRemovedFromDatastore = 0; 96 101 my $numDeleted = 0; 102 my $newMerged = 0; 97 103 foreach $batch ( @{$batches} ) { 98 my ($timestamp, $expId, $batchId, $surveyType, $deleted, $dvoDb, $processed, $onDatastore, $loadedToOdm, $mergeWorthy, $merged) = @{$batch}; 99 100 if (!$processed) {next;} 104 my ($timestamp, 105 $type, 106 $expId, 107 $batchId, 108 $surveyType, 109 $deleted, 110 $dvoDb, 111 $processed, 112 $onDatastore, 113 $loadedToOdm, 114 $loadFailed, 115 $mergeWorthy, 116 $merged) = @{$batch}; 117 118 if (!$onDatastore) {next;} 119 120 my $batch = ippToPsps::Batch->existing( 121 undef, 122 undef, 123 $batchId, 124 $ippToPspsDb, 125 $filePath, 126 $verbose, 127 $save_temps); 128 129 if (!$processed) { 130 131 if ($removeUnprocessed && defined $filePath) { 132 133 if ($batch->deleteDir()) {$numDeleted++;} 134 } 135 next; 136 } 101 137 102 138 $numBatchesToCheck++; 103 139 104 my $batchName = $batchManager->getBatchName($batchId);105 106 140 # if not merged then update by polling ODM for status 107 if (!$merged) { 108 109 if (checkODM($batchName, \$loadedToOdm, \$mergeWorthy, \$merged)) {$numChecked++;} 141 if (!$merged && !$loadFailed) { 142 143 if (checkODM($batch->getName(), \$loadedToOdm, \$loadFailed, \$mergeWorthy, \$merged)) { 144 145 $numChecked++; 146 if ($merged) {$newMerged++;} 147 } 148 else {next;} 110 149 } 111 150 112 151 # delete from datastore 113 if (defined $product && !$deleted && $loadedToOdm && $mergeWorthy) { 114 115 $deleted = $datastore->remove($batchName); 152 if (defined $product && !$deleted && $loadedToOdm && ($mergeWorthy || $loadFailed)) { 153 154 155 $deleted = $datastore->remove($batch->getName()); 116 156 if ($deleted) { 117 157 $ippToPspsDb->setBatchAsDeleted($batchId, $expId); … … 122 162 if (defined $filePath && $merged && $deleted) { 123 163 124 if($batch Manager->deleteBatch($batchId)) {$numDeleted++;}164 if($batch->deleteFile($batchId)) {$numDeleted++;} 125 165 } 126 166 127 167 # update database 128 $ippToPspsDb->updateODMStatus($batchId, $expId, $loadedToOdm, $ mergeWorthy, $merged, $deleted);129 printf( "| %18s | %11s | %10d | %6s | %6s | %6s | %5s |\n",168 $ippToPspsDb->updateODMStatus($batchId, $expId, $loadedToOdm, $loadFailed, $mergeWorthy, $merged, $deleted); 169 printf( "| %18s | %11s | %10d | %6s | %6s | %6s | %6s | %5s |\n", 130 170 $timestamp, 131 $batch Name,171 $batch->getName(), 132 172 $expId, 133 173 $loadedToOdm ? "yes" : "no", 174 $loadFailed ? "yes" : "no", 134 175 $mergeWorthy ? "yes" : "no", 135 176 $merged ? "yes" : "no", … … 137 178 } 138 179 139 printf("+----------------------+--------------+--------------+----------------+---------------+---------+----------+\n"); 140 180 printf("+----------------------+--------------+--------------+----------------+--------------+--------------+---------+----------+\n"); 141 181 printf( "* Successfully checked %d batch%s out of %d\n", $numChecked, ($numChecked==1) ? "" : "es", $numBatchesToCheck); 182 printf( "* %d newly merged batches\n", $newMerged); 142 183 printf( "* Successfully removed %d batch%s from the datastore\n", $numRemovedFromDatastore, ($numRemovedFromDatastore==1) ? "" : "es"); 143 184 printf( "* Successfully deleted %d batch%s from local file system\n", $numDeleted, ($numDeleted==1) ? "" : "es"); … … 151 192 ######################################################################################## 152 193 sub checkODM { 153 my ($batchName, $loadedToOdm, $ mergeWorthy, $merged) = @_;194 my ($batchName, $loadedToOdm, $loadFailed, $mergeWorthy, $merged) = @_; 154 195 155 196 my $statusFilter = "*"; … … 171 212 172 213 my ($tempFile, $tempName) = tempfile( "/tmp/ippToPsps_odmXml.XXXX", UNLINK => !$save_temps); 214 #print $response->content. "\n"; 173 215 print $tempFile $response->content; 174 216 close($tempFile); 175 217 176 218 ${$loadedToOdm} = 0; 219 ${$loadFailed} = 0; 177 220 ${$mergeWorthy} = 0; 178 221 ${$merged} = 0; 179 222 180 parseXml($tempName, $loadedToOdm, $mergeWorthy, $merged); 223 parseXml($tempName, $loadedToOdm, $loadFailed, $mergeWorthy, $merged); 224 225 unlink($tempFile); 181 226 182 227 return 1; 183 228 } 184 229 185 ###################################################################################### y230 ######################################################################################## 186 231 # 187 232 # Parses ODM XML … … 189 234 ######################################################################################## 190 235 sub parseXml { 191 my ($xmlFile, $loadedToOdm, $ mergeWorthy, $merged) = @_;236 my ($xmlFile, $loadedToOdm, $loadFailed, $mergeWorthy, $merged) = @_; 192 237 193 238 my $parser = XML::LibXML->new; … … 195 240 my $xc = XML::LibXML::XPathContext->new($doc); 196 241 $xc->registerNs('ArrayOfOdmBatchState', 'PanSTARRS.Services.OdmWebService'); 197 my $result = $xc->findvalue('//ArrayOfOdmBatchState:Message'); 242 my $result = $xc->findvalue('//ArrayOfOdmBatchState:BatchState'); 243 244 if ($result =~ m/failed/) { 245 ${$loadFailed} = 1; 246 ${$loadedToOdm} = 1; 247 return; 248 } 249 250 $result = $xc->findvalue('//ArrayOfOdmBatchState:Message'); 198 251 ${$loadedToOdm} = 0; 199 252 ${$mergeWorthy} = 0; -
branches/eam_branches/ipp-20100823/ippToPsps/perl/getSmfForThisBatch.pl
r29124 r29515 7 7 use ippToPsps::Gpc1Db; 8 8 use ippToPsps::IppToPspsDb; 9 use PS::IPP::Config 1.01 qw( :standard );9 use ippToPsps::DetectionBatch; 10 10 11 11 my $camera = undef; 12 my $ singleBatch = undef;12 my $batch = undef; 13 13 my $verbose = undef; 14 14 my $save_temps = undef; 15 15 16 16 GetOptions( 17 'batch|b=s' => \$ singleBatch,17 'batch|b=s' => \$batch, 18 18 'verbose|v' => \$verbose, 19 19 'save_temps|t' => \$save_temps, … … 26 26 if (@ARGV) { 27 27 $quit=1; 28 print "* UNKN KOWN: option @ARGV\n";28 print "* UNKNOWN: option @ARGV\n"; 29 29 } 30 if (!defined $ singleBatch) {30 if (!defined $batch) { 31 31 $quit=1; 32 32 print "* REQUIRED: need to provide a batch -b <batch>\n"; 33 33 } 34 if (!defined $ verbose) {34 if (!defined $camera) { 35 35 $camera = "GPC1"; 36 36 print "* OPTIONAL: select a camera -c (default = $camera)\n"; … … 51 51 my $gpc1Db = new ippToPsps::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser", $verbose, $save_temps); 52 52 my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps); 53 my $ipprc = PS::IPP::Config->new($camera) or (warn "Can't get camera configuration" and exit($PS_EXIT_CONFIG_ERROR));54 53 54 my $detectionBatch = ippToPsps::DetectionBatch->existing( 55 $camera, 56 $gpc1Db, 57 $batch, 58 $ippToPspsDb, 59 "./", 60 $verbose, 61 $save_temps); 55 62 56 my $batches; 57 my $numOfBatches; 58 59 if (defined $singleBatch ) { $numOfBatches = $ippToPspsDb->getBatch($singleBatch, \$batches);} 60 if ($numOfBatches < 1) {return 0;} 61 62 63 # loop round batches 64 my $batch; 65 my $numChecked = 0; 66 foreach $batch ( @{$batches} ) { 67 my ($timestamp, $expId, $batchId, $surveyType, $deleted, $dvoDb, $processed, $onDatastore, $loadedToOdm, $mergeWorthy, $merged) = @{$batch}; 68 69 print "* found $timestamp, $expId, $batchId, $surveyType, $deleted $dvoDb\n"; 70 71 my $nebPath = $gpc1Db->getCameraStageSmfForThisDvoDb($dvoDb, $expId); 72 if (!$nebPath) { print "* Could not determind neb path for SMF\n"; exit; } 73 74 # get real filename from neb 'key' 75 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",$nebPath) or return 0; 76 my $realFile = $ipprc->file_resolve($fpaObjects) or return 0; 77 78 print "$realFile\n"; 79 63 my $smf = $detectionBatch->getSmfFile(); 64 if (defined $smf) { 65 print "$smf\n"; 80 66 } 81 82 67 else { 68 print "* Could not find an smf file for batch $batch\n"; 69 } -
branches/eam_branches/ipp-20100823/ippToPsps/perl/ippToPsps/Datastore.pm
r28951 r29515 27 27 bless $self, $class; 28 28 return $self; 29 } 30 31 ######################################################################################## 32 # 33 # Returns datastore product 34 # 35 ######################################################################################## 36 sub getProduct { 37 my ($self) = @_; 38 return $self->{_product}; 29 39 } 30 40 … … 58 68 print "* Successfully published $file to datastore\n"; 59 69 60 close($tempFile); 70 close $tempFile; 71 if (!$self->{_save_temps}) {unlink $tempFile}; 61 72 62 73 return 1; -
branches/eam_branches/ipp-20100823/ippToPsps/perl/ippToPsps/Gpc1Db.pm
r28877 r29515 8 8 use ippToPsps::MySQLDb; 9 9 our @ISA = qw(ippToPsps::MySQLDb); # inherits from MySQLDb 10 11 ########################################################################### 12 # 13 # Returns path to stack-stage cmf files for this sky_id 14 # 15 ########################################################################### 16 sub getStackStageCmfs { 17 my ($self, $skyId, $nebPath, $numInputs) = @_; 18 19 my $query = $self->{_db}->prepare(<<SQL); 20 SELECT path_base, num_inputs 21 FROM staticskyResult 22 WHERE sky_id = $skyId 23 SQL 24 25 $query->execute; 26 my $rows = $query->fetchall_arrayref(); 27 28 if (@{$rows} < 1 || @{$rows} > 1) {return 0;} 29 30 my $row; 31 foreach $row ( @{$rows} ) { 32 (${$nebPath}, ${$numInputs}) = @{$row}; 33 } 34 35 return 1; 36 } 10 37 11 38 ########################################################################### … … 90 117 ########################################################################### 91 118 sub getExposureListFromDvoDb { 92 my ($self, $dvoDb, $exposures) = @_; 119 my ($self, $dvoDb, $exposures, $lastExposure) = @_; 120 121 if (!defined $lastExposure) {$lastExposure = 0;} 93 122 94 123 my $query = $self->{_db}->prepare(<<SQL); … … 100 129 WHERE addRun.dvodb LIKE '$dvoDb' 101 130 AND addRun.state = 'full' 131 AND rawExp.exp_id > $lastExposure 102 132 ORDER BY exp_id ASC; 103 133 SQL 104 134 105 #AND rawExp.exp_id > 133887106 #AND filter = 'r.00000'107 #AND rawExp.dateobs <= '2010-03-12'108 #AND rawExp.exp_id > $lastExpId109 #AND camRun.label LIKE '%$label%'110 #AND rawExp.exp_id > 136561111 #AND camRun.dist_group LIKE 'sas'112 135 #AND rawExp.decl >= '-0.157079633' AND rawExp.decl <= '0.157079633' Jims Dec range 113 136 … … 115 138 ${$exposures} = $query->fetchall_arrayref(); 116 139 my $numOfExposures = scalar @{${$exposures}}; 117 if ($numOfExposures > 0) {118 119 print "* Found $numOfExposures exposures in DVO Db '$dvoDb'\n";120 return 1;121 }122 140 123 print "* No exposures found in DVO Db '$dvoDb'\n"; 124 return 0; 141 # message 142 if ($numOfExposures) {print "* Found $numOfExposures exposures";} 143 else { print "* No exposures found"; } 144 print " in DVO Db '$dvoDb' (counting from exposure $lastExposure)\n"; 145 146 return ($numOfExposures) ? 1 : 0; 125 147 } 126 148 -
branches/eam_branches/ipp-20100823/ippToPsps/perl/ippToPsps/IppToPspsDb.pm
r29124 r29515 9 9 our @ISA = qw(ippToPsps::MySQLDb); # inherits from MySQLDb 10 10 11 12 11 ########################################################################### 13 12 # … … 19 18 20 19 my $query = $self->{_db}->prepare(<<SQL); 21 SELECT created, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged 20 SELECT created, 21 batch_type, 22 exp_id, 23 batch_id, 24 survey_id, 25 deleted, 26 dvo_db, 27 processed, 28 on_datastore, 29 loaded_to_ODM, 30 load_failed, 31 merge_worthy, 32 merged 22 33 FROM batches 23 34 WHERE created >= '$fromTime' 24 AND created <= '$toTime' ;35 AND created <= '$toTime' 25 36 SQL 26 37 … … 30 41 my $count = scalar @{${$batches}}; 31 42 32 printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es");33 43 return $count; 34 44 } … … 43 53 44 54 my $query = $self->{_db}->prepare(<<SQL); 45 SELECT created, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged 55 SELECT created, 56 batch_type, 57 exp_id, 58 batch_id, 59 survey_id, 60 deleted, 61 dvo_db, 62 processed, 63 on_datastore, 64 loaded_to_ODM, 65 load_failed, 66 merge_worthy, 67 merged 46 68 FROM batches 47 69 WHERE batch_id = $batch_id … … 52 74 my $count = scalar @{${$batches}}; 53 75 54 printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es");55 76 return $count; 56 77 } … … 103 124 # 104 125 ######################################################################################## 105 sub updateBatch{106 my ($self, $batchId, $expId, $ processed, $published, $totalDetections, $minObjId, $maxObjId) = @_;126 sub setAsProcessed { 127 my ($self, $batchId, $expId, $totalDetections, $minObjId, $maxObjId) = @_; 107 128 108 129 if (!$minObjId) {$minObjId = -1;} … … 114 135 UPDATE batches 115 136 SET 116 processed = $processed, 117 on_datastore = $published, 137 processed = 1, 118 138 total_detections = $totalDetections, 119 139 min_obj_id = $minObjId, … … 128 148 ####################################################################################### 129 149 # 130 # Checks whether we have successfully processed this exposure 131 # 132 ######################################################################################## 133 sub isExposureAlreadyProcessed { 150 # Sets published state of a batch 151 # 152 ######################################################################################## 153 sub setPublished { 154 my ($self, $batchId, $expId, $published) = @_; 155 156 my $query = $self->{_db}->prepare(<<SQL); 157 UPDATE batches 158 SET on_datastore = $published 159 WHERE batch_id = $batchId 160 AND exp_id = $expId; 161 SQL 162 163 $query->execute; # TODO check response of this 164 } 165 166 ####################################################################################### 167 # 168 # Checks whether we have successfully processed this exposure and loaded it to the datastore 169 # 170 ######################################################################################## 171 sub isExposureAlreadyPublished { 134 172 my ($self, $expId) = @_; 135 173 … … 138 176 FROM batches 139 177 WHERE exp_id = $expId 140 AND created > '2010-08-12'141 AND processed = 1;178 AND processed 179 AND on_datastore; 142 180 SQL 143 181 … … 179 217 $query->execute; 180 218 181 print "* New batch '$batchId' for exposure ID = $expIdand survey = '$surveyType'\n";219 print "* New batch '$batchId' for exposure ID = '$expId' and survey = '$surveyType'\n"; 182 220 183 221 return $batchId; … … 208 246 ####################################################################################### 209 247 sub updateODMStatus { 210 my ($self,$batchId, $expId, $loadedToOdm, $ mergeWorthy, $mergeCompleted) = @_;248 my ($self,$batchId, $expId, $loadedToOdm, $loadFailed, $mergeWorthy, $mergeCompleted) = @_; 211 249 212 250 my $query = $self->{_db}->prepare(<<SQL); 213 251 UPDATE batches 214 SET loaded_to_ODM = $loadedToOdm, merge_worthy = $mergeWorthy, merged = $mergeCompleted 252 SET loaded_to_ODM = $loadedToOdm, 253 load_failed = $loadFailed, 254 merge_worthy = $mergeWorthy, 255 merged = $mergeCompleted 215 256 WHERE batch_id = $batchId 216 257 AND exp_id = $expId; … … 231 272 232 273 my $currentRevision = -1; 233 my $latestRevision = 6; 234 235 while ($currentRevision != $latestRevision) { 274 275 while (1) { 236 276 237 277 $currentRevision = $self->getRevision(); … … 244 284 elsif ($currentRevision == 4) {$self->createRevision_5();} 245 285 elsif ($currentRevision == 5) {$self->createRevision_6();} 286 elsif ($currentRevision == 6) {$self->createRevision_7();} 287 else {last;} 246 288 } 247 289 } … … 385 427 ####################################################################################### 386 428 # 429 # Create revision 7 of the database 430 # 431 ####################################################################################### 432 sub createRevision_7 { 433 my ($self) = @_; 434 435 print "* Creating revision 7 of '$self->{_dbName}'\n"; 436 437 my $query = $self->{_db}->prepare(<<SQL); 438 ALTER TABLE batches 439 ADD COLUMN load_failed TINYINT DEFAULT 0 440 SQL 441 $query->execute; 442 443 $self->setRevision(7); 444 } 445 446 ####################################################################################### 447 # 387 448 # Sets current revision of ippToPsps database 388 449 # -
branches/eam_branches/ipp-20100823/ippToPsps/perl/ippToPsps/MySQLDb.pm
r28757 r29515 65 65 } 66 66 67 68 67 ########################################################################### 69 68 # 70 # Returns 'now' as a timestamp69 # Adds the provided interval to the provided time 71 70 # 72 71 ########################################################################### 73 sub getIntervalInPast{74 my ($self, $ interval) = @_;72 sub addInterval { 73 my ($self, $time, $interval) = @_; 75 74 76 75 my $query = $self->{_db}->prepare(<<SQL); 77 SELECT now() -INTERVAL $interval;76 SELECT '$time' + INTERVAL $interval; 78 77 SQL 79 78 $query->execute; … … 82 81 } 83 82 83 ########################################################################### 84 # 85 # Subtracts the provided interval from the provided time 86 # 87 ########################################################################### 88 sub subtractInterval { 89 my ($self, $time, $interval) = @_; 90 91 my $query = $self->{_db}->prepare(<<SQL); 92 SELECT '$time' - INTERVAL $interval; 93 SQL 94 $query->execute; 95 96 return scalar $query->fetchrow_array(); 97 } 98 99 ########################################################################### 100 # 101 # Returns whether time1 is before time2 102 # 103 ########################################################################### 104 sub isBefore { 105 my ($self, $time1, $time2) = @_; 106 107 my $query = $self->{_db}->prepare(<<SQL); 108 SELECT '$time1' < '$time2'; 109 SQL 110 $query->execute; 111 112 return scalar $query->fetchrow_array(); 113 } 84 114 85 115 ########################################################################### … … 97 127 98 128 return scalar $query->fetchrow_array(); 129 } 130 131 ####################################################################################### 132 # 133 # Optimizes a table 134 # 135 ####################################################################################### 136 sub optimizeTable { 137 my ($self, $table) = @_; 138 139 my $query = $self->{_db}->prepare(<<SQL); 140 OPTIMIZE TABLE $table; 141 SQL 142 143 my $success = $query->execute; 144 145 print "* "; 146 if (!$success) {print "UN";} 147 print "successfully optimized '$table' table\n"; 148 149 return $success; 99 150 } 100 151 -
branches/eam_branches/ipp-20100823/ippToPsps/perl/pspsSchema2xml.pl
r28889 r29515 50 50 51 51 52 my $output = new IO::File(">tables.xml"); 53 my $writer = new XML::Writer(OUTPUT => $output, DATA_MODE => 1, DATA_INDENT=>2); 54 $writer->xmlDecl('UTF-8'); 55 # $writer->doctype('manifest', "", "psps-manifest.dtd"); 56 $writer->startTag('tableDescriptions', "type" => "$type"); 52 my $tablesOutput = new IO::File(">tables.xml"); 53 my $tablesWriter = new XML::Writer(OUTPUT => $tablesOutput, DATA_MODE => 1, DATA_INDENT=>2); 54 $tablesWriter->xmlDecl('UTF-8'); 55 $tablesWriter->startTag('tableDescriptions', "type" => "$type"); 56 57 my $mapOutput = new IO::File(">map.xml"); 58 my $mapWriter = new XML::Writer(OUTPUT => $mapOutput, DATA_MODE => 1, DATA_INDENT=>2); 59 $mapWriter->xmlDecl('UTF-8'); 60 $mapWriter->startTag('tabledata', "type" => "$type"); 57 61 58 62 if ($type eq "init") {createInit();} … … 63 67 64 68 # finish up XML 65 $writer->endTag(); 66 $writer->end(); 69 $tablesWriter->endTag(); 70 $tablesWriter->end(); 71 72 # finish up XML 73 $mapWriter->endTag(); 74 $mapWriter->end(); 67 75 68 76 print OUT "\n#endif"; … … 164 172 parseTable("StackMeta"); 165 173 parseTable("StackDetection"); 166 parseTable("S kinnyObject");167 parseTable("Stack Orphan");168 parseTable(" ObjectCalColor");174 parseTable("StackApFlx"); 175 parseTable("StackModelFit"); 176 parseTable("StackToImage"); 169 177 } 170 178 … … 197 205 198 206 print OUT "\ntypedef enum {\n"; 199 $writer->startTag('table', "name" => $tableNameOut); 207 $tablesWriter->startTag('table', "name" => $tableNameOut); 208 $mapWriter->startTag('table', 209 "name" => $tableNameOut, 210 "ippfitsextension" => ""); 200 211 201 212 open (SCHEMA, $path); … … 240 251 241 252 if (!$found) {print "Could not find table '$tableName'\n";} 242 $writer->endTag(); 253 $tablesWriter->endTag(); 254 $mapWriter->endTag(); 243 255 print OUT "} ".$tableNameOut.";\n"; 244 256 … … 326 338 print OUT " ".uc($tableName)."_".uc($name)." = ".$colNum.",\n"; 327 339 328 $ writer->startTag('column',340 $tablesWriter->startTag('column', 329 341 "name" => $name, 330 342 "type" => $type, 331 343 "default" => $default, 332 344 "comment" => $comment); 333 334 $writer->endTag(); 345 $tablesWriter->endTag(); 346 347 $mapWriter->comment(" <map pspsName=\"$name\" ippType=\"$type\" ippName=\"\" comment=\"$comment\"/>"); 348 349 # $mapWriter->endTag(); 335 350 336 351 return $colNum; -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPsps.c
r28529 r29515 24 24 extern int ippToPsps_batchDifference(IppToPsps *data); 25 25 26 // Gets uncalibrated instrumental flux from magnitude 27 __inline bool ippToPsps_getFlux(const float exposureTime, const float magnitude, float* flux, const float magnitudeErr, float* fluxErr) { 28 29 *flux = powf(10.0, -0.4*magnitude) / exposureTime; 30 if (!isfinite(*flux) || *flux < 0.000001) return false; 31 if (fluxErr) *fluxErr = fabsf((magnitudeErr * *flux)/1.085736); 32 // if (fluxErr) printf("Mag = %03.03f, Flux = %03.03f, Mag err = %03.03f, Flux Err = %03.03f\n", magnitude, *flux, magnitudeErr, *fluxErr); 33 34 return true; 35 } 36 26 37 // Destructor 27 38 static void ippToPsps_Destructor(IppToPsps* this) { … … 55 66 // save XML document for results 56 67 if (this->resultsXmlDoc) { 57 68 58 69 xmlSaveFormatFileEnc(this->resultsPath, this->resultsXmlDoc, "UTF-8", 1); 59 70 … … 151 162 152 163 psMetadata *arguments = psMetadataAlloc(); 153 psMetadataAddStr(arguments, PS_LIST_TAIL, "- expid", 0, "ExposureID", NULL);164 psMetadataAddStr(arguments, PS_LIST_TAIL, "-id", 0, "ID", NULL); 154 165 psMetadataAddStr(arguments, PS_LIST_TAIL, "-expname", 0, "Exposure name", NULL); 155 166 psMetadataAddStr(arguments, PS_LIST_TAIL, "-survey", 0, "Survey type", NULL); … … 158 169 psMetadataAddStr(arguments, PS_LIST_TAIL, "-results", 0, "Path to results output", NULL); 159 170 psMetadataAddStr(arguments, PS_LIST_TAIL, "-config", 0, "Path to config dir", NULL); 160 psMetadataAddStr(arguments, PS_LIST_TAIL, "-batch", 0, "Product type: [ det|stack|diff]", NULL);171 psMetadataAddStr(arguments, PS_LIST_TAIL, "-batch", 0, "Product type: [IN|P2|ST|TODO]", NULL); 161 172 162 173 bool ret = true; … … 168 179 else { 169 180 170 char *tmp = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "- expid"));171 if (tmp) this-> expId = atoi(tmp);181 char *tmp = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-id")); 182 if (tmp) this->id = atoi(tmp); 172 183 //free(tmp); tmp = NULL; 173 184 this->expName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-expname")); … … 181 192 if (!tmp) this->batchType = BATCH_UNDEFINED; 182 193 else if (strcmp(tmp, "test") == 0) this->batchType = BATCH_TEST; 183 else if (strcmp(tmp, " init") == 0) this->batchType = BATCH_INIT;184 else if (strcmp(tmp, " det") == 0) this->batchType = BATCH_DETECTION;185 else if (strcmp(tmp, " stack") == 0) this->batchType = BATCH_STACK;186 else if (strcmp(tmp, " diff") == 0) this->batchType = BATCH_DIFFERENCE;194 else if (strcmp(tmp, "IN") == 0) this->batchType = BATCH_INIT; 195 else if (strcmp(tmp, "P2") == 0) this->batchType = BATCH_DETECTION; 196 else if (strcmp(tmp, "ST") == 0) this->batchType = BATCH_STACK; 197 else if (strcmp(tmp, "TODO") == 0) this->batchType = BATCH_DIFFERENCE; 187 198 else this->batchType = BATCH_UNDEFINED; 188 199 … … 192 203 (this->batchType != BATCH_INIT && !this->fitsInPath) || 193 204 (this->batchType != BATCH_INIT && !this->resultsPath) || 194 (this->batchType != BATCH_INIT && this-> expId == -1) ||205 (this->batchType != BATCH_INIT && this->id == -1) || 195 206 !this->fitsOutPath || 196 207 !this->configsDir || … … 211 222 static int ippToPsps_run(IppToPsps *this) { 212 223 224 // any files? 225 if (this->batchType == BATCH_DETECTION || 226 this->batchType == BATCH_STACK || 227 this->batchType == BATCH_DIFFERENCE ) { 228 229 if (this->numOfInputFiles < 1) { 230 231 this->exitCode = PS_EXIT_DATA_ERROR; 232 psError(PS_ERR_UNKNOWN, false, "No input files for this batch"); 233 } 234 235 } 236 213 237 if(this->exitCode == PS_EXIT_SUCCESS) { 214 238 … … 250 274 psMemSetDeallocator(this, (psFreeFunc)ippToPsps_Destructor); 251 275 252 this->expId = -1; 276 // deal with DVO database 277 bool haveDvo = false; 278 for (int i=0;i<*argc; i++) { 279 280 if (strcmp(argv[i], "CATDIR") == 0) {haveDvo = true; break;} 281 } 282 if (haveDvo) this->dvoConfig = dvoConfigRead(argc, argv); 283 else this->dvoConfig = NULL; 284 285 // remaining args 286 this->id = -1; 253 287 this->expName = NULL; 254 288 this->surveyType = NULL; 289 this->surveyID = -1; 255 290 this->fitsInPath = NULL; 256 291 this->resultsPath = NULL; … … 261 296 this->fitsOut = NULL; 262 297 this->configsDir = NULL; 263 this->dvoConfig = NULL;264 298 this->config = NULL; 265 this->dvoConfig = dvoConfigRead(argc, argv);266 299 this->pmconfig = pmConfigRead(argc, argv, NULL); 267 300 this->exitCode = PS_EXIT_SUCCESS; 268 301 this->run = ippToPsps_run; 302 303 // sort out current time 304 time_t now = time(NULL);; 305 struct tm *ts = gmtime(&now); // TODO should be UTC 306 strftime(this->todaysDate, sizeof(this->todaysDate), "%Y-%m-%d", ts); 269 307 270 308 if (!this->pmconfig) { … … 299 337 psStringAppend(&this->configsDir, "/stack"); 300 338 301 339 // create filename 302 340 char outputName[100]; 303 sprintf(outputName, "%08d.FITS", this-> expId);341 sprintf(outputName, "%08d.FITS", this->id); 304 342 psStringAppend(&this->fitsOutPath, "/%s", outputName); 305 343 … … 321 359 } 322 360 361 // get survey ID using config object 362 if (this->batchType != BATCH_INIT && 363 !ippToPspsConfig_getSurveyId(this->config, this->surveyType, &this->surveyID)) { 364 365 this->exitCode = PS_EXIT_CONFIG_ERROR; 366 return this; 367 } 368 323 369 // create XML document for results 324 370 if (this->resultsPath) { -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPsps.h
r28530 r29515 18 18 #include <libxml/tree.h> 19 19 20 #define MAXDETECT 30000 //TODO limit ok?20 #define MAXDETECT 60000 //TODO limit ok? 21 21 22 22 typedef struct { 23 23 24 uint32_t expId; // the exposure ID to be used24 uint32_t id; // ID: might be expId for detections, skycell ID etc 25 25 psString expName; // the exposure name 26 26 psString surveyType; // the survey type, eg 3PI, MD01, STS, SSS 27 int8_t surveyID; // survey ID 27 28 uint8_t batchType; // PSPS batch type 28 29 psString fitsInPath; // path to FITS input … … 37 38 dvoConfig* dvoConfig; // dvo database 38 39 IppToPspsConfig* config; // config structure 40 char todaysDate[12]; // today's date 39 41 int exitCode; // ps exit code 40 42 … … 45 47 IppToPsps *ippToPsps_Constructor(int *argc, char **argv); 46 48 void ippToPsps_VersionPrint(void); 49 bool ippToPsps_getFlux( 50 const float exposureTime, 51 const float magnitude, 52 float* flux, 53 const float magnitudeErr, 54 float* fluxErr); 47 55 48 56 # endif // IPPTOPSPS_H -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsBatchDetection.c
r29124 r29515 11 11 #include "ippToPspsConfig.h" 12 12 #include "ippToPspsDetEnums.h" 13 #include "fitsio.h"14 15 // Gets uncalibrated instrumental flux from magnitude16 static __inline bool ippToPsps_getFlux(const float exposureTime, const float magnitude, float* flux, const float magnitudeErr, float* fluxErr) {17 18 *flux = powf(10.0, -0.4*magnitude) / exposureTime;19 if (!isfinite(*flux) || *flux < 0.000001) return false;20 if (fluxErr) *fluxErr = fabsf((magnitudeErr * *flux)/1.085736);21 // if (fluxErr) printf("Mag = %03.03f, Flux = %03.03f, Mag err = %03.03f, Flux Err = %03.03f\n", magnitude, *flux, magnitudeErr, *fluxErr);22 23 return true;24 }25 13 26 14 /** … … 35 23 int ippToPsps_batchDetection(IppToPsps *this) { 36 24 37 if (this->numOfInputFiles < 1) return PS_EXIT_DATA_ERROR;38 39 25 int status = 0; 40 26 fitsfile *fitsIn; 41 int nKeys;42 27 43 28 if (fits_open_file(&fitsIn, this->inputFiles[0], READONLY, &status)) { … … 48 33 49 34 // get primary header and pull stuff out for later 35 int nKeys; 50 36 fits_get_hdrspace(fitsIn, &nKeys, NULL, &status); 51 37 … … 65 51 66 52 // FrameMeta values 67 fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this-> expId, &status);53 fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this->id, &status); 68 54 fits_write_col(this->fitsOut, TSTRING, FRAMEMETA_FRAMENAME, 1, 1, 1, &this->expName, &status); 69 55 70 int8_t surveyID = -1; 71 if (!ippToPspsConfig_getSurveyId(this->config, this->surveyType, &surveyID)) {return PS_EXIT_DATA_ERROR;} 72 fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_SURVEYID, 1, 1, 1, &surveyID, &status); 56 fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_SURVEYID, 1, 1, 1, &this->surveyID, &status); 73 57 74 58 int8_t filterID = -1; … … 97 81 98 82 // stuff for detections table 99 time_t now;100 struct tm *ts;101 char timeStr[12];102 now = time(NULL);103 ts = gmtime(&now); // TODO should be UTC104 strftime(timeStr, sizeof(timeStr), "%Y-%m-%d", ts);105 106 83 uint32_t s,d, invalidDvoRows, smfJumps, unmatched, totalDetections = 0; 107 84 … … 128 105 129 106 filterIDs[s] = filterID; 130 surveyIDs[s] = surveyID;131 strcpy(assocDate[s], t imeStr);107 surveyIDs[s] = this->surveyID; 108 strcpy(assocDate[s], this->todaysDate); 132 109 } 133 110 … … 192 169 193 170 // create unique int from 'frameID' (aka exposure ID) and ccd number 194 pspsImageId = (this-> expId*100) + image->ccdnum;171 pspsImageId = (this->id*100) + image->ccdnum; 195 172 196 173 // now get DVO detections … … 206 183 imageFlags = (uint64_t)image->flags; 207 184 fits_write_col(this->fitsOut, TLONGLONG, IMAGEMETA_IMAGEID, 1, 1, 1, &pspsImageId, &status); 208 fits_write_col(this->fitsOut, TLONG, IMAGEMETA_FRAMEID, 1, 1, 1, &this-> expId, &status);185 fits_write_col(this->fitsOut, TLONG, IMAGEMETA_FRAMEID, 1, 1, 1, &this->id, &status); 209 186 fits_write_col(this->fitsOut, TSHORT, IMAGEMETA_CCDID, 1, 1, 1, &image->ccdnum, &status); 210 187 fits_write_col(this->fitsOut, TLONG, IMAGEMETA_PHOTOCALID, 1, 1, 1, &image->photcode, &status); -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsBatchStack.c
r27686 r29515 9 9 #include "ippToPsps.h" 10 10 #include "ippToPspsConfig.h" 11 #include "ippToPspsStackEnums.h" 12 11 13 12 14 /** … … 15 17 int ippToPsps_batchStack(IppToPsps *this) { 16 18 17 // char extensionName[20];18 uint32_t skycell = 0; // TODO19 int status = 0; 20 fitsfile *fitsIn; 19 21 20 for (uint16_t i = 0; i<this->numOfInputFiles; i++) {22 if (fits_open_file(&fitsIn, this->inputFiles[0], READONLY, &status)) { 21 23 22 skycell = i; // TODO 24 fits_report_error(stderr, status); 25 return PS_EXIT_SYS_ERROR; 26 } 27 28 long removeList[MAXDETECT]; 29 float instMag[MAXDETECT]; 30 float floatnull = -999.0; 31 int anynull = 0; 32 33 // get primary header and pull stuff out for later 34 int nKeys = 0; 35 fits_get_hdrspace(fitsIn, &nKeys, NULL, &status); 36 float exposureTime; status=0; fits_read_key(fitsIn, TFLOAT, "EXPTIME", &exposureTime, NULL, &status); 37 char filterType[20]; status=0; fits_read_key(fitsIn, TSTRING, "FPA.FILTERID", filterType, NULL, &status); 23 38 24 39 40 char** assocDate = (char**)calloc(MAXDETECT, sizeof(char**)); 41 for (uint32_t i=0; i<MAXDETECT;i++) assocDate[i] = (char*)calloc(20,sizeof(char)); 42 int8_t filterIDs[MAXDETECT], surveyIDs[MAXDETECT]; 43 44 45 // write StackMeta 46 ippToPspsConfig_writeTable(this->config, fitsIn, this->fitsOut, 1, "StackMeta", true); 47 fits_write_col(this->fitsOut, TLONG, STACKMETA_SKYCELLID, 1, 1, 1, &this->id, &status); 48 49 int8_t filterID = -1; 50 if (!ippToPspsConfig_getFilterId(this->config, filterType, &filterID)) {return PS_EXIT_DATA_ERROR;} 51 fits_write_col(this->fitsOut, TBYTE, STACKMETA_FILTERID, 1, 1, 1, &filterID, &status); 52 53 fits_write_col(this->fitsOut, TBYTE, STACKMETA_SURVEYID, 1, 1, 1, &this->surveyID, &status); 54 55 56 // psf detections 57 char extensionName[15]; 58 sprintf(extensionName, "SkyChip.psf"); 59 if (fits_movnam_hdu(fitsIn, BINARY_TBL, extensionName, 0, &status)) { 60 psError(PS_ERR_IO, false, "Can't move to extension: %s\n", extensionName); 61 25 62 } 63 else { 64 65 // some stuff is the same for all detections so we can populate here 66 for (long s = 0; s<MAXDETECT; s++) { 67 68 filterIDs[s] = filterID; 69 surveyIDs[s] = this->surveyID; 70 strcpy(assocDate[s], this->todaysDate); 71 } 72 73 74 long nDet = 0; 75 if (fits_get_num_rows(fitsIn, &nDet, &status)) { 76 fits_report_error(stderr, status); 77 } 78 79 int instMagNum; 80 status=0;fits_get_colnum(fitsIn, CASESEN, "PSF_INST_MAG", &instMagNum, &status); 81 if (status) psError(PS_ERR_IO, false, "Unable to read col num for PSF_INST_MAG"); 82 fits_read_col(fitsIn, TFLOAT, instMagNum, 1, 1, nDet, &floatnull, instMag, &anynull, &status); 83 84 85 printf("Looping through %ld psf detections\n", nDet); 86 float mag; 87 long unmatched = 0, totalDetections = 0, numOfDuplicates = 0, numInvalidFlux = 0, numDetectionsOut = 0; 88 89 for (long s = 0; s<nDet; s++) { 90 91 // TODO implement this match in DVO 92 if (1) { 93 94 mag = instMag[s]; 95 if (!isfinite(mag) || mag < -998.0) { 96 97 removeList[numOfDuplicates+numInvalidFlux] = s+1; 98 numInvalidFlux++; 99 } 100 101 totalDetections++; 102 } 103 else { 104 105 unmatched++; 106 continue; 107 } 108 } 109 110 numDetectionsOut = totalDetections - numInvalidFlux; 111 112 if (numDetectionsOut > 0) { 113 114 ippToPspsConfig_writeTable(this->config, fitsIn, this->fitsOut, nDet, "StackDetection", false); 115 fits_write_col(this->fitsOut, TLONG, STACKDETECTION_SKYCELLID, 1, 1, 1, &this->id, &status); 116 fits_write_col(this->fitsOut, TBYTE, STACKDETECTION_FILTERID, 1, 1, nDet, filterIDs, &status); 117 fits_write_col(this->fitsOut, TBYTE, STACKDETECTION_SURVEYID, 1, 1, nDet, surveyIDs, &status); 118 fits_write_col(this->fitsOut, TSTRING, STACKDETECTION_ASSOCDATE, 1, 1, nDet, assocDate, &status); 119 120 if (numInvalidFlux) fits_delete_rowlist(this->fitsOut, removeList, numInvalidFlux, &status); 121 122 } 123 psLogMsg("ippToPsps", PS_LOG_INFO, 124 "+---------------+---------+----------+------------------+---------------+--------------+\n" 125 "| Extension | Rows in | Rows out | Missing from DVO | Duplicate IDs | Invalid Flux |\n" 126 "| %12s | %5ld | %5ld | %5ld | %5ld | %5ld |\n", 127 extensionName, nDet, numDetectionsOut, unmatched, numOfDuplicates, numInvalidFlux); 128 129 } 130 131 132 133 // extended source 134 sprintf(extensionName, "SkyChip.xsrc"); 135 if (fits_movnam_hdu(fitsIn, BINARY_TBL, extensionName, 0, &status)) { 136 psError(PS_ERR_IO, false, "Can't move to extension: %s\n", extensionName); 137 138 } 139 else { 140 141 long nDet = 0; 142 if (fits_get_num_rows(fitsIn, &nDet, &status)) { 143 fits_report_error(stderr, status); 144 } 145 146 printf("Looping through %ld extended source detections\n", nDet); 147 for (long s = 0; s<nDet; s++) { 148 149 150 151 } 152 153 ippToPspsConfig_writeTable(this->config, fitsIn, this->fitsOut, nDet, "StackApFlx", false); 154 fits_write_col(this->fitsOut, TBYTE, STACKAPFLX_FILTERID, 1, 1, nDet, filterIDs, &status); 155 fits_write_col(this->fitsOut, TBYTE, STACKAPFLX_SURVEYID, 1, 1, nDet, surveyIDs, &status); 156 } 157 158 status=0; 159 if (fits_close_file(fitsIn, &status)) fits_report_error(stderr, status); 160 26 161 27 162 return PS_EXIT_SUCCESS; -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsBatchTest.c
r28759 r29515 13 13 #include "fitsio.h" 14 14 15 // Gets uncalibrated instrumental flux from magnitude16 static __inline bool ippToPsps_getFlux(const float exposureTime, const float magnitude, float* flux, const float magnitudeErr, float* fluxErr) {17 18 *flux = powf(10.0, -0.4*magnitude) / exposureTime;19 if (!isfinite(*flux) || *flux < 0.000001) return false;20 if (fluxErr) *fluxErr = fabsf((magnitudeErr * *flux)/1.085736);21 // if (fluxErr) printf("Mag = %03.03f, Flux = %03.03f, Mag err = %03.03f, Flux Err = %03.03f\n", magnitude, *flux, magnitudeErr, *fluxErr);22 23 return true;24 }25 15 26 16 /** … … 55 45 56 46 // FrameMeta values 57 // fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this-> expId, &status);47 // fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this->id, &status); 58 48 59 49 int8_t filterID = -1; … … 187 177 188 178 // create unique int from 'frameID' (aka exposure ID) and ccd number 189 pspsImageId = (this-> expId*100) + pImage->ccdnum;179 pspsImageId = (this->id*100) + pImage->ccdnum; 190 180 191 181 // now get DVO detections -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsConfig.c
r28559 r29515 701 701 } 702 702 703 // gets metadata about a column 704 bool ippToPspsConfig_getFitsColumnMeta( 705 char* name, 706 int* colNum, 707 int* type, 708 long* repeat, 709 fitsfile *fitsIn ) { 710 711 int status = 0; 712 fits_get_colnum(fitsIn, CASESEN, name, colNum, &status); 713 if (status) { 714 psError(PS_ERR_IO, false, "Unable to read col '%s'", name); 715 return false; 716 } 717 718 status = 0; 719 fits_get_eqcoltype(fitsIn, *colNum, type, repeat, NULL, &status); 720 if (status) { 721 psError(PS_ERR_IO, false, "Unable to read type info for '%s'", name); 722 return false; 723 } 724 725 return true; 726 } 727 703 728 // populate with data from another FITS table into this one 704 729 static bool ippToPspsConfig_populateTableFromFits( … … 730 755 int readStatus = 0; 731 756 int writeStatus = 0; 732 757 733 758 // first loop round all columns and get IPP col numbers for provided column names TODO only do once, first time in 734 759 if(!fromHeader) { … … 737 762 738 763 if (strlen(table->columns[i].ippName) < 1) continue; 739 readStatus = 0; 740 fits_get_colnum(fitsIn, CASESEN, table->columns[i].ippName, &table->columns[i].ippColNum, &readStatus); 741 if (readStatus) psError(PS_ERR_IO, false, "%d Unable to read col num for '%s' '%s' %d", i, table->columns[i].pspsName, table->columns[i].ippName, table->columns[i].ippColNum); 764 765 if (!ippToPspsConfig_getFitsColumnMeta( 766 table->columns[i].ippName, 767 &table->columns[i].ippColNum, 768 &table->columns[i].ippType, 769 &table->columns[i].ippRepeat, 770 fitsIn)) {return false;} 742 771 } 743 772 } -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsConfig.h
r28249 r29515 20 20 char ippName[100]; 21 21 int ippType; 22 long ippRepeat; 22 23 char pspsName[100]; // TODO change to 'name' 23 24 int pspsType; -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsStackEnums.h
r27431 r29515 35 35 STACKMETA_CRPIX1 = 30, 36 36 STACKMETA_CRPIX2 = 31, 37 STACKMETA_PC001001 = 32, 38 STACKMETA_PC001002 = 33, 39 STACKMETA_PC002001 = 34, 40 STACKMETA_PC002002 = 35, 41 STACKMETA_POLYORDER = 36, 42 STACKMETA_PCA1X3Y0 = 37, 43 STACKMETA_PCA1X2Y1 = 38, 44 STACKMETA_PCA1X1Y2 = 39, 45 STACKMETA_PCA1X0Y3 = 40, 46 STACKMETA_PCA1X2Y0 = 41, 47 STACKMETA_PCA1X1Y1 = 42, 48 STACKMETA_PCA1X0Y2 = 43, 49 STACKMETA_PCA2X3Y0 = 44, 50 STACKMETA_PCA2X2Y1 = 45, 51 STACKMETA_PCA2X1Y2 = 46, 52 STACKMETA_PCA2X0Y3 = 47, 53 STACKMETA_PCA2X2Y0 = 48, 54 STACKMETA_PCA2X1Y1 = 49, 55 STACKMETA_PCA2X0Y2 = 50, 56 STACKMETA_CALIBMODNUM = 51, 57 STACKMETA_DATARELEASE = 52, 37 STACKMETA_CDELT1 = 32, 38 STACKMETA_CDELT2 = 33, 39 STACKMETA_PC001001 = 34, 40 STACKMETA_PC001002 = 35, 41 STACKMETA_PC002001 = 36, 42 STACKMETA_PC002002 = 37, 43 STACKMETA_POLYORDER = 38, 44 STACKMETA_PCA1X3Y0 = 39, 45 STACKMETA_PCA1X2Y1 = 40, 46 STACKMETA_PCA1X1Y2 = 41, 47 STACKMETA_PCA1X0Y3 = 42, 48 STACKMETA_PCA1X2Y0 = 43, 49 STACKMETA_PCA1X1Y1 = 44, 50 STACKMETA_PCA1X0Y2 = 45, 51 STACKMETA_PCA2X3Y0 = 46, 52 STACKMETA_PCA2X2Y1 = 47, 53 STACKMETA_PCA2X1Y2 = 48, 54 STACKMETA_PCA2X0Y3 = 49, 55 STACKMETA_PCA2X2Y0 = 50, 56 STACKMETA_PCA2X1Y1 = 51, 57 STACKMETA_PCA2X0Y2 = 52, 58 STACKMETA_CALIBMODNUM = 53, 59 STACKMETA_DATARELEASE = 54, 58 60 } StackMeta; 59 61 … … 107 109 108 110 typedef enum { 109 SKINNYOBJECT_OBJID = 1, 110 SKINNYOBJECT_IPPOBJID = 2, 111 SKINNYOBJECT_PROJECTIONCELLID = 3, 112 SKINNYOBJECT_DATARELEASE = 4, 113 } SkinnyObject; 114 115 typedef enum { 116 STACKORPHAN_PARTITIONKEY = 1, 117 STACKORPHAN_STACKDETECTID = 2, 118 STACKORPHAN_IPPDETECTID = 3, 119 STACKORPHAN_FILTERID = 4, 120 STACKORPHAN_STACKTYPEID = 5, 121 STACKORPHAN_SURVEYID = 6, 122 STACKORPHAN_PRIMARYF = 7, 123 STACKORPHAN_STACKMETAID = 8, 124 STACKORPHAN_SKYCELLID = 9, 125 STACKORPHAN_STACKVER = 10, 126 STACKORPHAN_XPOS = 11, 127 STACKORPHAN_YPOS = 12, 128 STACKORPHAN_XPOSERR = 13, 129 STACKORPHAN_YPOSERR = 14, 130 STACKORPHAN_INSTFLUX = 15, 131 STACKORPHAN_INSTFLUXERR = 16, 132 STACKORPHAN_PEAKFLUX = 17, 133 STACKORPHAN_SKY = 18, 134 STACKORPHAN_SKYERR = 19, 135 STACKORPHAN_SGSEP = 20, 136 STACKORPHAN_PSFWIDMAJOR = 21, 137 STACKORPHAN_PSFWIDMINOR = 22, 138 STACKORPHAN_PSFTHETA = 23, 139 STACKORPHAN_PSFLIKELIHOOD = 24, 140 STACKORPHAN_PSFCF = 25, 141 STACKORPHAN_INFOFLAG = 26, 142 STACKORPHAN_NFRAMES = 27, 143 STACKORPHAN_WLSIGMA = 28, 144 STACKORPHAN_EPS1 = 29, 145 STACKORPHAN_EPS2 = 30, 146 STACKORPHAN_PSM11 = 31, 147 STACKORPHAN_PSM12 = 32, 148 STACKORPHAN_PSM21 = 33, 149 STACKORPHAN_PSM22 = 34, 150 STACKORPHAN_PSH11 = 35, 151 STACKORPHAN_PSH12 = 36, 152 STACKORPHAN_PSH21 = 37, 153 STACKORPHAN_PSH22 = 38, 154 STACKORPHAN_ACTIVEFLAG = 39, 155 STACKORPHAN_ASSOCDATE = 40, 156 STACKORPHAN_HISTORYMODNUM = 41, 157 STACKORPHAN_DATARELEASE = 42, 158 } StackOrphan; 159 160 typedef enum { 161 OBJECTCALCOLOR_OBJID = 1, 162 OBJECTCALCOLOR_IPPOBJID = 2, 163 OBJECTCALCOLOR_FILTERID = 3, 164 OBJECTCALCOLOR_CALCOLOR = 4, 165 OBJECTCALCOLOR_CALCOLORERR = 5, 166 OBJECTCALCOLOR_CALIBMODNUM = 6, 167 OBJECTCALCOLOR_DATARELEASE = 7, 168 } ObjectCalColor; 111 STACKAPFLX_OBJID = 1, 112 STACKAPFLX_STACKDETECTID = 2, 113 STACKAPFLX_IPPOBJID = 3, 114 STACKAPFLX_IPPDETECTID = 4, 115 STACKAPFLX_FILTERID = 5, 116 STACKAPFLX_STACKTYPEID = 6, 117 STACKAPFLX_SURVEYID = 7, 118 STACKAPFLX_PRIMARYF = 8, 119 STACKAPFLX_STACKMETAID = 9, 120 STACKAPFLX_ISOPHOTMAG = 10, 121 STACKAPFLX_ISOPHOTMAGERR = 11, 122 STACKAPFLX_ISOPHOTMAJAXIS = 12, 123 STACKAPFLX_ISOPHOTMAJAXISERR = 13, 124 STACKAPFLX_ISOPHOTMINAXIS = 14, 125 STACKAPFLX_ISOPHOTMINAXISERR = 15, 126 STACKAPFLX_ISOPHOTMAJAXISGRAD = 16, 127 STACKAPFLX_ISOPHOTMINAXISGRAD = 17, 128 STACKAPFLX_ISOPHOTPA = 18, 129 STACKAPFLX_ISOPHOTPAERR = 19, 130 STACKAPFLX_ISOPHOTPAGRAD = 20, 131 STACKAPFLX_PETRADIUS = 21, 132 STACKAPFLX_PETRADIUSERR = 22, 133 STACKAPFLX_PETMAG = 23, 134 STACKAPFLX_PETMAGERR = 24, 135 STACKAPFLX_PETR50 = 25, 136 STACKAPFLX_PETR50ERR = 26, 137 STACKAPFLX_PETR90 = 27, 138 STACKAPFLX_PETR90ERR = 28, 139 STACKAPFLX_PETCF = 29, 140 STACKAPFLX_FLXR1 = 30, 141 STACKAPFLX_FLXR1ERR = 31, 142 STACKAPFLX_FLXR1VAR = 32, 143 STACKAPFLX_FLXR2 = 33, 144 STACKAPFLX_FLXR2ERR = 34, 145 STACKAPFLX_FLXR2VAR = 35, 146 STACKAPFLX_FLXR3 = 36, 147 STACKAPFLX_FLXR3ERR = 37, 148 STACKAPFLX_FLXR3VAR = 38, 149 STACKAPFLX_FLXR4 = 39, 150 STACKAPFLX_FLXR4ERR = 40, 151 STACKAPFLX_FLXR4VAR = 41, 152 STACKAPFLX_FLXR5 = 42, 153 STACKAPFLX_FLXR5ERR = 43, 154 STACKAPFLX_FLXR5VAR = 44, 155 STACKAPFLX_FLXR6 = 45, 156 STACKAPFLX_FLXR6ERR = 46, 157 STACKAPFLX_FLXR6VAR = 47, 158 STACKAPFLX_FLXR7 = 48, 159 STACKAPFLX_FLXR7ERR = 49, 160 STACKAPFLX_FLXR7VAR = 50, 161 STACKAPFLX_FLXR8 = 51, 162 STACKAPFLX_FLXR8ERR = 52, 163 STACKAPFLX_FLXR8VAR = 53, 164 STACKAPFLX_FLXR9 = 54, 165 STACKAPFLX_FLXR9ERR = 55, 166 STACKAPFLX_FLXR9VAR = 56, 167 STACKAPFLX_FLXR10 = 57, 168 STACKAPFLX_FLXR10ERR = 58, 169 STACKAPFLX_FLXR10VAR = 59, 170 STACKAPFLX_C1FLXR1 = 60, 171 STACKAPFLX_C1FLXR1ERR = 61, 172 STACKAPFLX_C1FLXR1VAR = 62, 173 STACKAPFLX_C1FLXR2 = 63, 174 STACKAPFLX_C1FLXR2ERR = 64, 175 STACKAPFLX_C1FLXR2VAR = 65, 176 STACKAPFLX_C1FLXR3 = 66, 177 STACKAPFLX_C1FLXR3ERR = 67, 178 STACKAPFLX_C1FLXR3VAR = 68, 179 STACKAPFLX_C1FLXR4 = 69, 180 STACKAPFLX_C1FLXR4ERR = 70, 181 STACKAPFLX_C1FLXR4VAR = 71, 182 STACKAPFLX_C1FLXR5 = 72, 183 STACKAPFLX_C1FLXR5ERR = 73, 184 STACKAPFLX_C1FLXR5VAR = 74, 185 STACKAPFLX_C1FLXR6 = 75, 186 STACKAPFLX_C1FLXR6ERR = 76, 187 STACKAPFLX_C1FLXR6VAR = 77, 188 STACKAPFLX_C1FLXR7 = 78, 189 STACKAPFLX_C1FLXR7ERR = 79, 190 STACKAPFLX_C1FLXR7VAR = 80, 191 STACKAPFLX_C1FLXR8 = 81, 192 STACKAPFLX_C1FLXR8ERR = 82, 193 STACKAPFLX_C1FLXR8VAR = 83, 194 STACKAPFLX_C1FLXR9 = 84, 195 STACKAPFLX_C1FLXR9ERR = 85, 196 STACKAPFLX_C1FLXR9VAR = 86, 197 STACKAPFLX_C1FLXR10 = 87, 198 STACKAPFLX_C1FLXR10ERR = 88, 199 STACKAPFLX_C1FLXR10VAR = 89, 200 STACKAPFLX_C2FLXR1 = 90, 201 STACKAPFLX_C2FLXR1ERR = 91, 202 STACKAPFLX_C2FLXR1VAR = 92, 203 STACKAPFLX_C2FLXR2 = 93, 204 STACKAPFLX_C2FLXR2ERR = 94, 205 STACKAPFLX_C2FLXR2VAR = 95, 206 STACKAPFLX_C2FLXR3 = 96, 207 STACKAPFLX_C2FLXR3ERR = 97, 208 STACKAPFLX_C2FLXR3VAR = 98, 209 STACKAPFLX_C2FLXR4 = 99, 210 STACKAPFLX_C2FLXR4ERR = 100, 211 STACKAPFLX_C2FLXR4VAR = 101, 212 STACKAPFLX_C2FLXR5 = 102, 213 STACKAPFLX_C2FLXR5ERR = 103, 214 STACKAPFLX_C2FLXR5VAR = 104, 215 STACKAPFLX_C2FLXR6 = 105, 216 STACKAPFLX_C2FLXR6ERR = 106, 217 STACKAPFLX_C2FLXR6VAR = 107, 218 STACKAPFLX_C2FLXR7 = 108, 219 STACKAPFLX_C2FLXR7ERR = 109, 220 STACKAPFLX_C2FLXR7VAR = 110, 221 STACKAPFLX_C2FLXR8 = 111, 222 STACKAPFLX_C2FLXR8ERR = 112, 223 STACKAPFLX_C2FLXR8VAR = 113, 224 STACKAPFLX_C2FLXR9 = 114, 225 STACKAPFLX_C2FLXR9ERR = 115, 226 STACKAPFLX_C2FLXR9VAR = 116, 227 STACKAPFLX_C2FLXR10 = 117, 228 STACKAPFLX_C2FLXR10ERR = 118, 229 STACKAPFLX_C2FLXR10VAR = 119, 230 STACKAPFLX_C3FLXR1 = 120, 231 STACKAPFLX_C3FLXR1ERR = 121, 232 STACKAPFLX_C3FLXR1VAR = 122, 233 STACKAPFLX_C3FLXR2 = 123, 234 STACKAPFLX_C3FLXR2ERR = 124, 235 STACKAPFLX_C3FLXR2VAR = 125, 236 STACKAPFLX_C3FLXR3 = 126, 237 STACKAPFLX_C3FLXR3ERR = 127, 238 STACKAPFLX_C3FLXR3VAR = 128, 239 STACKAPFLX_C3FLXR4 = 129, 240 STACKAPFLX_C3FLXR4ERR = 130, 241 STACKAPFLX_C3FLXR4VAR = 131, 242 STACKAPFLX_C3FLXR5 = 132, 243 STACKAPFLX_C3FLXR5ERR = 133, 244 STACKAPFLX_C3FLXR5VAR = 134, 245 STACKAPFLX_C3FLXR6 = 135, 246 STACKAPFLX_C3FLXR6ERR = 136, 247 STACKAPFLX_C3FLXR6VAR = 137, 248 STACKAPFLX_C3FLXR7 = 138, 249 STACKAPFLX_C3FLXR7ERR = 139, 250 STACKAPFLX_C3FLXR7VAR = 140, 251 STACKAPFLX_C3FLXR8 = 141, 252 STACKAPFLX_C3FLXR8ERR = 142, 253 STACKAPFLX_C3FLXR8VAR = 143, 254 STACKAPFLX_C3FLXR9 = 144, 255 STACKAPFLX_C3FLXR9ERR = 145, 256 STACKAPFLX_C3FLXR9VAR = 146, 257 STACKAPFLX_C3FLXR10 = 147, 258 STACKAPFLX_C3FLXR10ERR = 148, 259 STACKAPFLX_C3FLXR10VAR = 149, 260 STACKAPFLX_LOGC = 150, 261 STACKAPFLX_LOGA = 151, 262 STACKAPFLX_ACTIVEFLAG = 152, 263 STACKAPFLX_DATARELEASE = 153, 264 } StackApFlx; 265 266 typedef enum { 267 STACKMODELFIT_OBJID = 1, 268 STACKMODELFIT_STACKDETECTID = 2, 269 STACKMODELFIT_IPPOBJID = 3, 270 STACKMODELFIT_IPPDETECTID = 4, 271 STACKMODELFIT_FILTERID = 5, 272 STACKMODELFIT_STACKTYPEID = 6, 273 STACKMODELFIT_SURVEYID = 7, 274 STACKMODELFIT_PRIMARYF = 8, 275 STACKMODELFIT_STACKMETAID = 9, 276 STACKMODELFIT_DEVRADIUS = 10, 277 STACKMODELFIT_DEVRADIUSERR = 11, 278 STACKMODELFIT_DEVMAG = 12, 279 STACKMODELFIT_DEVMAGERR = 13, 280 STACKMODELFIT_DEVAB = 14, 281 STACKMODELFIT_DEVABERR = 15, 282 STACKMODELFIT_RADEVOFF = 16, 283 STACKMODELFIT_DECDEVOFF = 17, 284 STACKMODELFIT_RADEVOFFERR = 18, 285 STACKMODELFIT_DECDEVOFFERR = 19, 286 STACKMODELFIT_DEVCF = 20, 287 STACKMODELFIT_DEVLIKELIHOOD = 21, 288 STACKMODELFIT_DEVCOVAR11 = 22, 289 STACKMODELFIT_DEVCOVAR12 = 23, 290 STACKMODELFIT_DEVCOVAR13 = 24, 291 STACKMODELFIT_DEVCOVAR14 = 25, 292 STACKMODELFIT_DEVCOVAR15 = 26, 293 STACKMODELFIT_DEVCOVAR16 = 27, 294 STACKMODELFIT_DEVCOVAR22 = 28, 295 STACKMODELFIT_DEVCOVAR23 = 29, 296 STACKMODELFIT_DEVCOVAR24 = 30, 297 STACKMODELFIT_DEVCOVAR25 = 31, 298 STACKMODELFIT_DEVCOVAR26 = 32, 299 STACKMODELFIT_DEVCOVAR33 = 33, 300 STACKMODELFIT_DEVCOVAR34 = 34, 301 STACKMODELFIT_DEVCOVAR35 = 35, 302 STACKMODELFIT_DEVCOVAR36 = 36, 303 STACKMODELFIT_DEVCOVAR44 = 37, 304 STACKMODELFIT_DEVCOVAR45 = 38, 305 STACKMODELFIT_DEVCOVAR46 = 39, 306 STACKMODELFIT_DEVCOVAR55 = 40, 307 STACKMODELFIT_DEVCOVAR56 = 41, 308 STACKMODELFIT_DEVCOVAR66 = 42, 309 STACKMODELFIT_EXPRADIUS = 43, 310 STACKMODELFIT_EXPRADIUSERR = 44, 311 STACKMODELFIT_EXPMAG = 45, 312 STACKMODELFIT_EXPMAGERR = 46, 313 STACKMODELFIT_EXPAB = 47, 314 STACKMODELFIT_EXPABERR = 48, 315 STACKMODELFIT_RAEXPOFF = 49, 316 STACKMODELFIT_DECEXPOFF = 50, 317 STACKMODELFIT_RAEXPOFFERR = 51, 318 STACKMODELFIT_DECEXPOFFERR = 52, 319 STACKMODELFIT_EXPCF = 53, 320 STACKMODELFIT_EXPLIKELIHOOD = 54, 321 STACKMODELFIT_EXPCOVAR11 = 55, 322 STACKMODELFIT_EXPCOVAR12 = 56, 323 STACKMODELFIT_EXPCOVAR13 = 57, 324 STACKMODELFIT_EXPCOVAR14 = 58, 325 STACKMODELFIT_EXPCOVAR15 = 59, 326 STACKMODELFIT_EXPCOVAR16 = 60, 327 STACKMODELFIT_EXPCOVAR22 = 61, 328 STACKMODELFIT_EXPCOVAR23 = 62, 329 STACKMODELFIT_EXPCOVAR24 = 63, 330 STACKMODELFIT_EXPCOVAR25 = 64, 331 STACKMODELFIT_EXPCOVAR26 = 65, 332 STACKMODELFIT_EXPCOVAR33 = 66, 333 STACKMODELFIT_EXPCOVAR34 = 67, 334 STACKMODELFIT_EXPCOVAR35 = 68, 335 STACKMODELFIT_EXPCOVAR36 = 69, 336 STACKMODELFIT_EXPCOVAR44 = 70, 337 STACKMODELFIT_EXPCOVAR45 = 71, 338 STACKMODELFIT_EXPCOVAR46 = 72, 339 STACKMODELFIT_EXPCOVAR55 = 73, 340 STACKMODELFIT_EXPCOVAR56 = 74, 341 STACKMODELFIT_EXPCOVAR66 = 75, 342 STACKMODELFIT_SERRADIUS = 76, 343 STACKMODELFIT_SERRADIUSERR = 77, 344 STACKMODELFIT_SERMAG = 78, 345 STACKMODELFIT_SERMAGERR = 79, 346 STACKMODELFIT_SERAB = 80, 347 STACKMODELFIT_SERABERR = 81, 348 STACKMODELFIT_SERNU = 82, 349 STACKMODELFIT_SERNUERR = 83, 350 STACKMODELFIT_RASEROFF = 84, 351 STACKMODELFIT_DECSEROFF = 85, 352 STACKMODELFIT_RASEROFFERR = 86, 353 STACKMODELFIT_DECSEROFFERR = 87, 354 STACKMODELFIT_SERCF = 88, 355 STACKMODELFIT_SERLIKELIHOOD = 89, 356 STACKMODELFIT_SERSICCOVAR11 = 90, 357 STACKMODELFIT_SERSICCOVAR12 = 91, 358 STACKMODELFIT_SERSICCOVAR13 = 92, 359 STACKMODELFIT_SERSICCOVAR14 = 93, 360 STACKMODELFIT_SERSICCOVAR15 = 94, 361 STACKMODELFIT_SERSICCOVAR16 = 95, 362 STACKMODELFIT_SERSICCOVAR17 = 96, 363 STACKMODELFIT_SERSICCOVAR22 = 97, 364 STACKMODELFIT_SERSICCOVAR23 = 98, 365 STACKMODELFIT_SERSICCOVAR24 = 99, 366 STACKMODELFIT_SERSICCOVAR25 = 100, 367 STACKMODELFIT_SERSICCOVAR26 = 101, 368 STACKMODELFIT_SERSICCOVAR27 = 102, 369 STACKMODELFIT_SERSICCOVAR33 = 103, 370 STACKMODELFIT_SERSICCOVAR34 = 104, 371 STACKMODELFIT_SERSICCOVAR35 = 105, 372 STACKMODELFIT_SERSICCOVAR36 = 106, 373 STACKMODELFIT_SERSICCOVAR37 = 107, 374 STACKMODELFIT_SERSICCOVAR44 = 108, 375 STACKMODELFIT_SERSICCOVAR45 = 109, 376 STACKMODELFIT_SERSICCOVAR46 = 110, 377 STACKMODELFIT_SERSICCOVAR47 = 111, 378 STACKMODELFIT_SERSICCOVAR55 = 112, 379 STACKMODELFIT_SERSICCOVAR56 = 113, 380 STACKMODELFIT_SERSICCOVAR57 = 114, 381 STACKMODELFIT_SERSICCOVAR66 = 115, 382 STACKMODELFIT_SERSICCOVAR67 = 116, 383 STACKMODELFIT_SERSICCOVAR77 = 117, 384 STACKMODELFIT_ACTIVEFLAG = 118, 385 STACKMODELFIT_DATARELEASE = 119, 386 } StackModelFit; 387 388 typedef enum { 389 STACKTOIMAGE_STACKMETAID = 1, 390 STACKTOIMAGE_IMAGEID = 2, 391 } StackToImage; 169 392 170 393 #endif -
branches/eam_branches/ipp-20100823/ippTools/configure.ac
r29124 r29515 1 1 AC_PREREQ(2.61) 2 2 3 AC_INIT([ipptools], [1.1.6 3], [ipp-support@ifa.hawaii.edu])3 AC_INIT([ipptools], [1.1.65], [ipp-support@ifa.hawaii.edu]) 4 4 AC_CONFIG_SRCDIR([autogen.sh]) 5 5 … … 18 18 PKG_CHECK_MODULES([PSLIB], [pslib >= 1.1.0]) 19 19 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 1.1.0]) 20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.6 3])20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.65]) 21 21 PKG_CHECK_MODULES([PPSTAMP], [ppstamp >= 0.1.1]) 22 22 -
branches/eam_branches/ipp-20100823/ippTools/share/Makefile.am
r28959 r29515 61 61 chiptool_pendingimfile.sql \ 62 62 chiptool_processedimfile.sql \ 63 chiptool_revertcleanup.sql \ 63 64 chiptool_revertprocessedimfile.sql \ 64 65 chiptool_revertupdatedimfile.sql \ … … 138 139 difftool_inputskyfile.sql \ 139 140 difftool_listrun.sql \ 141 difftool_listssrun.sql \ 140 142 difftool_pendingcleanuprun.sql \ 141 143 difftool_pendingcleanupskyfile.sql \ 142 144 difftool_revertdiffskyfile_delete.sql \ 143 145 difftool_revertdiffskyfile_updated.sql \ 146 difftool_revertcleanup.sql \ 144 147 difftool_setskyfiletoupdate.sql \ 145 148 difftool_skyfile.sql \ … … 274 277 pstamptool_revertreq.sql \ 275 278 pstamptool_revertreq_deletejobs.sql \ 279 pstamptool_stopdependentjob.sql \ 276 280 pstamptool_updatejob.sql \ 277 281 pxadmin_create_tables.sql \ … … 356 360 warptool_revertwarped_delete.sql \ 357 361 warptool_revertwarped_updated.sql \ 362 warptool_revertcleanup.sql \ 358 363 warptool_runstate.sql \ 359 364 warptool_scmap.sql \ -
branches/eam_branches/ipp-20100823/ippTools/share/addtool_find_cam_id.sql
r26915 r29515 2 2 camRun.* 3 3 FROM camRun 4 JOIN camProcessedExp 5 USING(cam_id) 4 6 JOIN chipRun 5 7 USING(chip_id) … … 10 12 FROM addRun 11 13 JOIN camRun USING(cam_id) 12 JOIN chipRun USING(chip_id)14 JOIN chipRun USING(chip_id) 13 15 ) as foo 14 16 ON exp_id = added_exp_id … … 17 19 WHERE 18 20 camRun.state = 'full' 21 AND camProcessedExp.quality = 0 19 22 AND added_exp_id IS NULL 20 23 -- addtool adds checks on exposure being added to the dvodb previously -
branches/eam_branches/ipp-20100823/ippTools/share/addtool_find_cam_id_dvo.sql
r28856 r29515 1 1 SELECT camRun.* FROM camRun 2 JOIN camProcessedExp USING(cam_id) 2 3 JOIN chipRun USING(chip_id) 3 4 JOIN rawExp USING(exp_id) 4 WHERE camRun.state = 'full' 5 WHERE camRun.state = 'full' and camProcessedExp.quality = 0 5 6 AND exp_id NOT IN (SELECT exp_id 6 7 FROM addRun -
branches/eam_branches/ipp-20100823/ippTools/share/chiptool_listrun.sql
r28586 r29515 29 29 LEFT JOIN camProcessedExp USING(cam_id) 30 30 LEFT JOIN magicDSRun 31 ON stage_id = chip_id AND stage = 'chip' AND magicDSRun.re_place 31 ON stage_id = chip_id AND stage = 'chip' AND magicDSRun.re_place AND magicDSRun.state != 'drop' -
branches/eam_branches/ipp-20100823/ippTools/share/chiptool_processedimfile.sql
r28587 r29515 42 42 AND chipProcessedImfile.class_id = rawImfile.class_id 43 43 LEFT JOIN magicDSRun 44 ON stage_id = chip_id AND stage = 'chip' AND magicDSRun.re_place 44 ON stage_id = chip_id AND stage = 'chip' AND magicDSRun.re_place AND magicDSRun.state != 'drop' -
branches/eam_branches/ipp-20100823/ippTools/share/difftool_listrun.sql
r27743 r29515 12 12 diffRun.bothways, 13 13 warp1, 14 stack1,15 14 warp2, 16 stack2,17 15 -- The following are only valid for warps 18 16 -- XXX This needs to be more clever to handle diffs between stacks … … 27 25 rawInput.exp_name AS exp_name_1, 28 26 rawInput.exp_id AS exp_id_1, 27 rawInput.comment AS comment_1, 28 rawInput.dateobs AS dateobs_1, 29 29 chipInput.chip_id AS chip_id_1, 30 30 camInput.cam_id AS cam_id_1, … … 34 34 rawTemplate.exp_name AS exp_name_2, 35 35 rawTemplate.exp_id AS exp_id_2, 36 rawTemplate.comment AS comment_2, 37 rawTemplate.dateobs AS dateobs_2, 36 38 chipTemplate.chip_id AS chip_id_2, 37 39 camTemplate.cam_id AS cam_id_2, -
branches/eam_branches/ipp-20100823/ippTools/share/difftool_todiffskyfile.sql
r27920 r29515 13 13 diffRun.bothways, 14 14 diffRun.diff_mode, 15 diffSkyfile.path_base 15 diffSkyfile.path_base, 16 IFNULL(priority, 10000) AS priority 16 17 FROM diffRun 17 18 JOIN diffInputSkyfile USING(diff_id) … … 62 63 ON diffInputSkyfile.diff_id = diffSkyfile.diff_id 63 64 AND diffInputSkyfile.skycell_id = diffSkyfile.skycell_id 65 LEFT JOIN Label ON Label.label = diffRun.label 64 66 WHERE 65 67 -- Ready to be processed … … 70 72 AND diffSkyfile.data_state = 'update') 71 73 ) 74 AND (Label.active OR Label.active IS NULL) 72 75 -- Ensure input warps are available 73 76 AND (diffInputSkyfile.warp1 IS NULL … … 93 96 AND stackTemplateSkyfile.quality = 0)) 94 97 95 96 -
branches/eam_branches/ipp-20100823/ippTools/share/disttool_pending_camera.sql
r26567 r29515 30 30 AND distRun.stage = 'camera' 31 31 AND distComponent.dist_id IS NULL 32 AND (((c hipRun.magicked > 0) AND (camRun.magicked > 0)) OR distRun.no_magic)32 AND (((clean OR (chipRun.magicked > 0)) AND (camRun.magicked > 0)) OR distRun.no_magic) 33 33 AND (camRun.state = 'full' OR (distRun.clean AND camRun.state = 'cleaned')) -
branches/eam_branches/ipp-20100823/ippTools/share/magicdstool_completed_runs.sql
r25465 r29515 1 1 SELECT DISTINCT 2 2 magic_ds_id, 3 magicked, 3 4 re_place, 4 5 label … … 7 8 -- raw stage 8 9 SELECT 9 magicDSRun.* 10 magicDSRun.*, 11 rawExp.magicked 10 12 FROM magicDSRun 11 13 JOIN rawImfile ON stage_id = rawImfile.exp_id 14 JOIN rawExp using(exp_id) 12 15 LEFT JOIN magicDSFile 13 16 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id … … 25 28 -- chip stage 26 29 SELECT 27 magicDSRun.* 30 magicDSRun.*, 31 chipRun.magicked 28 32 FROM magicDSRun 29 JOIN chipProcessedImfile ON stage_id = chip_id 33 JOIN chipRun ON stage_id = chip_id 34 JOIN chipProcessedImfile USING(chip_id) 30 35 LEFT JOIN magicDSFile 31 36 ON magicDSFile.magic_ds_id = magicDSRun.magic_ds_id … … 44 49 -- camera stage 45 50 SELECT 46 magicDSRun.* 51 magicDSRun.*, 52 camRun.magicked 47 53 FROM magicDSRun 48 JOIN camProcessedExp ON stage_id = camProcessedExp.cam_id 54 JOIN camRun ON stage_id = camRun.cam_id 55 JOIN camProcessedExp ON camRun.cam_id = camProcessedExp.cam_id 49 56 LEFT JOIN magicDSFile 50 57 ON magicDSFile.magic_ds_id = magicDSRun.magic_ds_id … … 61 68 -- warp stage 62 69 SELECT 63 magicDSRun.* 70 magicDSRun.*, 71 warpRun.magicked 64 72 FROM magicDSRun 65 JOIN warpSkyfile on stage_id = warp_id 73 JOIN warpRun on stage_id = warp_id 74 JOIN warpSkyfile USING(warp_id) 66 75 LEFT JOIN magicDSFile 67 76 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id … … 81 90 -- diff stage 82 91 SELECT DISTINCT 83 magicDSRun.* 92 magicDSRun.*, 93 diffRun.magicked 84 94 FROM magicDSRun 85 95 JOIN magicRun USING (magic_id) 86 96 JOIN magicInputSkyfile USING(magic_id) 97 JOIN diffRun 98 ON magicRun.diff_id = diffRun.diff_id 87 99 JOIN diffSkyfile 88 ON magicRun.diff_id = diffSkyfile.diff_id100 ON diffRun.diff_id = diffSkyfile.diff_id 89 101 AND magicInputSkyfile.node = diffSkyfile.skycell_id 90 102 LEFT JOIN magicDSFile -
branches/eam_branches/ipp-20100823/ippTools/share/magicdstool_todestreak_camera.sql
r27945 r29515 7 7 camera, 8 8 magicMask.uri AS streaks_uri, 9 magicMask.path_base AS streaks_path_base, 9 10 CAST(NULL AS CHAR(255)) AS inv_streaks_uri, 11 CAST(NULL AS CHAR(255)) AS inv_streaks_path_base, 10 12 stage, 11 13 stage_id, … … 19 21 recoveryroot, 20 22 re_place, 21 remove 23 remove, 24 IFNULL(Label.priority, 10000) AS priority 22 25 FROM magicDSRun 23 26 JOIN magicMask USING (magic_id) … … 29 32 LEFT JOIN magicDSFile 30 33 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id 34 LEFT JOIN Label ON magicDSRun.label = Label.label 31 35 WHERE 32 36 magicDSRun.state = 'new' … … 38 42 AND camProcessedExp.quality = 0 39 43 AND magicDSFile.component IS NULL 44 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20100823/ippTools/share/magicdstool_todestreak_chip.sql
r27945 r29515 7 7 camera, 8 8 magicMask.uri AS streaks_uri, 9 magicMask.path_base AS streaks_path_base, 9 10 CAST(NULL AS CHAR(255)) AS inv_streaks_uri, 11 CAST(NULL AS CHAR(255)) AS inv_streaks_path_base, 10 12 stage, 11 13 stage_id, … … 19 21 recoveryroot, 20 22 re_place, 21 remove 23 remove, 24 IFNULL(Label.priority, 10000) AS priority 22 25 FROM magicDSRun 23 26 JOIN magicMask USING (magic_id) … … 31 34 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id 32 35 AND magicDSFile.component = chipProcessedImfile.class_id 36 LEFT JOIN Label 37 ON magicDSRun.label = Label.label 33 38 WHERE 34 39 magicDSRun.state = 'new' … … 38 43 AND chipProcessedImfile.quality = 0 39 44 AND magicDSFile.component IS NULL 45 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20100823/ippTools/share/magicdstool_todestreak_diff.sql
r27945 r29515 7 7 rawExp.camera, 8 8 magicMask.uri AS streaks_uri, 9 magicMask.path_base AS streaks_path_base, 9 10 CAST(NULL AS CHAR(255)) AS inv_streaks_uri, 11 CAST(NULL AS CHAR(255)) AS inv_streaks_path_base, 10 12 stage, 11 13 magicRun.diff_id AS stage_id, … … 20 22 recoveryroot, 21 23 re_place, 22 remove 24 remove, 25 IFNULL(Label.priority, 10000) AS priority 23 26 FROM rawExp 24 27 JOIN magicRun USING (exp_id) … … 33 36 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id 34 37 AND magicDSFile.component = diffSkyfile.skycell_id 38 LEFT JOIN Label ON magicDSRun.label = Label.label 35 39 WHERE 36 40 magicDSRun.state = 'new' … … 40 44 AND diffSkyfile.quality = 0 41 45 AND magicDSFile.component IS NULL 46 AND (Label.active OR Label.active IS NULL) 42 47 -- bothways diffSkyfiles 43 48 UNION … … 49 54 rawExp.camera, 50 55 magicMask.uri AS streaks_uri, 56 magicMask.path_base AS streaks_path_base, 51 57 (SELECT uri from magicMask where magic_id = inv_magic_id) AS inv_streaks_uri, 58 (SELECT path_base from magicMask where magic_id = inv_magic_id) AS inv_streaks_path_base, 52 59 stage, 53 60 magicRun.diff_id AS stage_id, … … 62 69 recoveryroot, 63 70 re_place, 64 remove 71 remove, 72 IFNULL(Label.priority, 10000) AS priority 65 73 FROM rawExp 66 74 JOIN magicRun USING (exp_id) … … 75 83 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id 76 84 AND magicDSFile.component = diffSkyfile.skycell_id 85 LEFT JOIN Label ON magicDSRun.label = Label.label 77 86 WHERE 78 87 magicDSRun.state = 'new' … … 82 91 AND diffSkyfile.quality = 0 83 92 AND magicDSFile.component IS NULL 93 AND (Label.active OR Label.active IS NULL) 84 94 ) AS magicDSRun 85 95 -- we need the following so this query is compatible with the other stages -
branches/eam_branches/ipp-20100823/ippTools/share/magicdstool_todestreak_raw.sql
r27945 r29515 6 6 rawExp.camera, 7 7 magicMask.uri as streaks_uri, 8 magicMask.path_base as streaks_path_base, 8 9 CAST(NULL AS CHAR(255)) AS inv_streaks_uri, 10 CAST(NULL AS CHAR(255)) AS inv_streaks_path_base, 9 11 stage, 10 12 stage_id, … … 20 22 recoveryroot, 21 23 re_place, 22 remove 24 remove, 25 10000 AS priority 23 26 FROM magicDSRun 24 27 JOIN magicMask USING (magic_id) -
branches/eam_branches/ipp-20100823/ippTools/share/magicdstool_todestreak_warp.sql
r27945 r29515 6 6 camera, 7 7 magicMask.uri as streaks_uri, 8 magicMask.path_base as streaks_path_base, 8 9 CAST(NULL AS CHAR(255)) AS inv_streaks_uri, 10 CAST(NULL AS CHAR(255)) AS inv_streaks_path_base, 9 11 stage, 10 12 stage_id, … … 19 21 recoveryroot, 20 22 re_place, 21 remove 23 remove, 24 IFNULL(Label.priority, 10000) AS priority 22 25 FROM magicDSRun 23 26 JOIN magicMask USING (magic_id) … … 29 32 ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id 30 33 AND magicDSFile.component = warpSkyfile.skycell_id 34 LEFT JOIN Label ON magicDSRun.label = Label.label 31 35 WHERE 32 36 magicDSRun.state = 'new' … … 36 40 AND warpSkyfile.quality = 0 37 41 AND magicDSFile.component IS NULL 42 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20100823/ippTools/share/magictool_definebyquery_select.sql
r28765 r29515 15 15 FROM diffRun 16 16 JOIN diffInputSkyfile USING(diff_id) 17 JOIN diffSkyfile USING(diff_id, skycell_id) 17 18 WHERE diffInputSkyfile.warp1 IS NOT NULL 18 19 AND diffRun.exposure = 1 19 20 AND diffRun.magicked = 0 21 AND diffSkyfile.quality = 0 20 22 -- diff WHERE hook %s 21 23 UNION … … 28 30 FROM diffRun 29 31 JOIN diffInputSkyfile USING(diff_id) 32 JOIN diffSkyfile USING(diff_id, skycell_id) 30 33 WHERE diffInputSkyfile.warp2 IS NOT NULL 31 34 AND diffRun.exposure = 1 32 35 AND diffRun.bothways = 1 33 36 AND diffRun.magicked = 0 37 AND diffSkyfile.quality = 0 34 38 -- diff WHERE hook %s 35 39 ) AS diffWarps -
branches/eam_branches/ipp-20100823/ippTools/share/magictool_revertnode.sql
r23660 r29515 3 3 JOIN magicRun USING(magic_id) 4 4 WHERE magicNodeResult.fault != 0 5 AND magicRun.state = 'new' -
branches/eam_branches/ipp-20100823/ippTools/share/magictool_toprocess_inputs.sql
r28768 r29515 3 3 magicRun.workdir, 4 4 rawExp.exp_id, 5 rawExp.exp_name, 6 rawExp.workdir AS raw_workdir, 5 7 rawExp.camera, 6 8 -- convert magic_id into a boolean value (1 or 0) -
branches/eam_branches/ipp-20100823/ippTools/share/magictool_toprocess_tree.sql
r28768 r29515 3 3 magicRun.workdir, 4 4 rawExp.exp_id, 5 rawExp.exp_name, 6 rawExp.workdir AS raw_workdir, 5 7 rawExp.camera, 6 8 -- convert magic_id into a boolean value (1 or 0) … … 16 18 WHERE 17 19 magicRun.state = 'new' 20 AND (Label.active OR Label.active IS NULL) 18 21 -- WHERE hook %s 19 22 ORDER BY -
branches/eam_branches/ipp-20100823/ippTools/share/magictool_totree.sql
r28768 r29515 18 18 AND magicTree.node IS NULL 19 19 AND magicRun.fault = 0 20 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20100823/ippTools/share/pstamptool_revertdependent.sql
r28146 r29515 3 3 JOIN pstampRequest USING(req_id) 4 4 SET pstampDependent.fault = 0 5 -- fault count hook %s 5 6 WHERE pstampDependent.state = 'new' 6 7 AND (pstampDependent.fault > 0) -
branches/eam_branches/ipp-20100823/ippTools/share/pstamptool_revertjob.sql
r26213 r29515 2 2 JOIN pstampRequest USING(req_id) 3 3 SET pstampJob.fault = 0 4 -- clear fault count clause goes here %s 4 5 WHERE pstampRequest.state = 'run' 5 6 AND pstampJob.state = 'run' -
branches/eam_branches/ipp-20100823/ippTools/share/pstamptool_updatejob.sql
r27874 r29515 1 UPDATE pstampJob LEFT JOIN pstampDependent USING(dep_id) 1 UPDATE pstampJob 2 JOIN pstampRequest USING(req_id) 3 LEFT JOIN pstampDependent USING(dep_id) 2 4 SET -
branches/eam_branches/ipp-20100823/ippTools/share/pubtool_revert.sql
r25929 r29515 2 2 USING publishDone, publishRun, publishClient 3 3 WHERE publishDone.pub_id = publishRun.pub_id 4 AND publishRun.state = 'new' 4 5 AND publishRun.client_id = publishClient.client_id 5 6 AND publishClient.active = 1 -
branches/eam_branches/ipp-20100823/ippTools/share/pxadmin_create_tables.sql
r28874 r29515 1221 1221 CREATE TABLE magicInputSkyfile ( 1222 1222 magic_id BIGINT, 1223 diff_id BIGINT,1224 1223 node VARCHAR(64), 1225 PRIMARY KEY(magic_id, diff_id, node), 1226 FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id), 1227 FOREIGN KEY(diff_id) REFERENCES diffRun(diff_id) 1224 PRIMARY KEY(magic_id, node), 1225 FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id) 1228 1226 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1229 1227 … … 1253 1251 magic_id BIGINT, 1254 1252 uri VARCHAR(255), 1253 path_base VARCHAR(255), 1255 1254 streaks INT, 1256 1255 fault SMALLINT, … … 1441 1440 imagedb VARCHAR(64), 1442 1441 rlabel VARCHAR(64), 1442 need_magic TINYINT, 1443 1443 outdir VARCHAR(255), 1444 need_magic TINYINT, 1444 fault SMALLINT, 1445 fault_count INT, 1445 1446 PRIMARY KEY(dep_id), 1446 1447 KEY(state), 1447 1448 KEY(stage), 1448 KEY(stage_id) 1449 KEY(stage_id), 1450 KEY(fault) 1449 1451 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1450 1452 … … 1837 1839 registered TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- time run was registered 1838 1840 note VARCHAR(255), -- note 1841 magicked BIGINT NOT NULL DEFAULT 0, -- magic mask applied 1839 1842 PRIMARY KEY(diff_phot_id), 1840 1843 KEY(diff_id), -
branches/eam_branches/ipp-20100823/ippTools/share/stacktool_tosum.sql
r27929 r29515 7 7 stackRun.label, 8 8 stackRun.state, 9 stackSumSkyfile.path_base 9 stackSumSkyfile.path_base, 10 IFNULL(Label.priority, 10000) AS priority 10 11 FROM stackRun 11 12 JOIN stackInputSkyfile USING(stack_id) 12 13 JOIN warpRun USING(warp_id) 13 14 LEFT JOIN stackSumSkyfile USING(stack_id) 15 LEFT JOIN Label ON Label.label = stackRun.label 14 16 WHERE 15 17 ((stackRun.state = 'new' AND stackSumSkyfile.stack_id IS NULL) 16 18 OR (stackRun.state = 'update' AND stackSumSkyfile.fault = 0 AND stackSumSkyfile.quality = 0)) 19 AND (Label.active OR Label.active IS NULL) 17 20 -- WHERE hook %s 18 21 GROUP BY stack_id -
branches/eam_branches/ipp-20100823/ippTools/share/warptool_scmap.sql
r27737 r29515 7 7 chipRun.state, 8 8 chipProcessedImfile.data_state, 9 chipProcessedImfile.fault AS chip_fault, 9 10 chipProcessedImfile.magicked, 10 rawImfile.magicked AS raw_magicked 11 rawImfile.magicked AS raw_magicked, 12 IFNULL(magicDSRun.magic_ds_id, 0) AS magic_ds_id, 13 IFNULL(magicDSRun.state, 0) AS dsRun_state, 14 IFNULL(magicDSFile.fault, 0) as dsFile_fault 11 15 FROM warpRun 12 16 JOIN warpSkyCellMap … … 26 30 ON chipRun.exp_id = rawImfile.exp_id 27 31 AND chipProcessedImfile.class_id = rawImfile.class_id 32 LEFT JOIN magicDSRun 33 ON chipRun.chip_id = magicDSRun.stage_id AND magicDSRun.stage = 'chip' 34 LEFT JOIN magicDSFile 35 ON magicDSFile.magic_ds_id = magicDSRun.magic_ds_id 36 AND chipProcessedImfile.class_id = magicDSFile.component 28 37 WHERE 29 38 1 -
branches/eam_branches/ipp-20100823/ippTools/share/warptool_towarped.sql
r28082 r29515 97 97 AND warpSkyfile.fault = 0 98 98 AND camRun.state = 'full' 99 AND chipProcessedImfile.data_state = 'full'100 -- if warpSkyfile was magicked previously require inputs to be magicked101 -- this blocks processing until all the chip inputs have been destreaked102 AND (warpSkyfile.magicked = 0 OR chipProcessedImfile.magicked >= 0)103 99 AND (Label.active OR Label.active IS NULL) 104 100 -- where hook 2 %s 105 101 GROUP BY warp_id, skycell_id 106 HAVING COUNT(warpSkyCellMap.class_id) = COUNT(chipProcessedImfile.class_id) 102 -- if warpSkyfile was magicked previously require inputs to be magicked 103 -- this blocks processing until all the chip inputs have been destreaked 104 HAVING COUNT(warpSkyCellMap.class_id) = SUM(IF(chipProcessedImfile.data_state ='full' and (chipRun.magicked = 0 OR chipProcessedImfile.magicked > 0), 1, 0)) 107 105 -- limit hook 2 %s 108 106 ) -
branches/eam_branches/ipp-20100823/ippTools/src/addtool.c
r28856 r29515 493 493 494 494 // since there is only one exp per 'new' set addRun.state = 'full' 495 if (!pxaddRunSetState(config, row->add_id, "full")) { 495 // but check to make sure there are no faults 496 497 if (!fault) { 498 if (!pxaddRunSetState(config, row->add_id, "full")) { 496 499 psError(PS_ERR_UNKNOWN, false, "failed to change addRun.state for add_id: %" PRId64, row->add_id); 497 500 psFree(row); 498 501 psFree(pendingRow); 499 502 return false; 503 } 500 504 } 501 505 psFree(row); -
branches/eam_branches/ipp-20100823/ippTools/src/bgtool.c
r28941 r29515 658 658 } 659 659 660 if (!chipBackgroundImfileInsert(config->dbh, chip_bg_id, class_id, path_base, magicked, dtime_script,660 if (!chipBackgroundImfileInsert(config->dbh, chip_bg_id, class_id, path_base, "full", magicked, dtime_script, 661 661 hostname, quality, fault, ver_code, bg, bg_stdev, maskfrac_npix, 662 662 maskfrac_static, maskfrac_dynamic, maskfrac_magic, maskfrac_advisory)) { … … 1497 1497 } 1498 1498 1499 if (!warpBackgroundSkyfileInsert(config->dbh, warp_bg_id, skycell_id, path_base, magicked, dtime_script,1499 if (!warpBackgroundSkyfileInsert(config->dbh, warp_bg_id, skycell_id, path_base, "full", magicked, dtime_script, 1500 1500 hostname, quality, fault, ver_code, bg, bg_stdev, maskfrac_npix, 1501 1501 maskfrac_static, maskfrac_dynamic, maskfrac_magic, maskfrac_advisory)) { -
branches/eam_branches/ipp-20100823/ippTools/src/chiptool.c
r28716 r29515 50 50 static bool pendingcleanuprunMode(pxConfig *config); 51 51 static bool pendingcleanupimfileMode(pxConfig *config); 52 static bool revertcleanupMode(pxConfig *config); 52 53 static bool donecleanupMode(pxConfig *config); 53 54 static bool runMode(pxConfig *config); … … 94 95 MODECASE(CHIPTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 95 96 MODECASE(CHIPTOOL_MODE_PENDINGCLEANUPIMFILE, pendingcleanupimfileMode); 97 MODECASE(CHIPTOOL_MODE_REVERTCLEANUP, revertcleanupMode); 96 98 MODECASE(CHIPTOOL_MODE_DONECLEANUP, donecleanupMode); 97 99 MODECASE(CHIPTOOL_MODE_RUN, runMode); … … 859 861 } 860 862 psString query_update = pxDataGet("chiptool_revertupdatedimfile.sql"); 861 if (!query ) {863 if (!query_update) { 862 864 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 863 865 psFree(where); 864 866 return false; 865 867 } 868 866 869 867 870 if (where && psListLength(where->list)) { … … 886 889 } 887 890 psFree(query_update); 891 892 return true; 893 } 894 static bool revertcleanupMode(pxConfig *config) 895 { 896 PS_ASSERT_PTR_NON_NULL(config, false); 897 898 psMetadata *where = psMetadataAlloc(); 899 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "=="); 900 pxAddLabelSearchArgs (config, where, "-label", "chipRun.label", "LIKE"); 901 pxAddLabelSearchArgs (config, where, "-data_group", "chipRun.data_group", "LIKE"); 902 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 903 904 char* newState = NULL; 905 if (!state) { 906 state = "error_cleaned"; 907 } 908 if (!strcmp(state, "error_cleaned")) { 909 newState = "goto_cleaned"; 910 } else if (!strcmp(state, "error_purged")) { 911 newState = "goto_purged"; 912 } else if (!strcmp(state, "error_scrubbed")) { 913 newState = "goto_scrubbed"; 914 } else { 915 psError(PXTOOLS_ERR_CONFIG, true, "-state must be either error_cleaned, error_purged, or error_scrubbed"); 916 return false; 917 } 918 919 if (!psListLength(where->list)) { 920 psFree(where); 921 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 922 return false; 923 } 924 925 psString query = pxDataGet("chiptool_revertcleanup.sql"); 926 if (!query) { 927 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 928 psFree(where); 929 return false; 930 } 931 932 if (where && psListLength(where->list)) { 933 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 934 psStringAppend(&query, " AND %s", whereClause); 935 psFree(whereClause); 936 } 937 938 psFree(where); 939 940 if (!p_psDBRunQueryF(config->dbh, query, newState, state, state)) { 941 psError(PS_ERR_UNKNOWN, false, "database error"); 942 psFree(query); 943 return false; 944 } 945 psFree(query); 888 946 889 947 return true; -
branches/eam_branches/ipp-20100823/ippTools/src/chiptool.h
r27742 r29515 42 42 CHIPTOOL_MODE_PENDINGCLEANUPRUN, 43 43 CHIPTOOL_MODE_PENDINGCLEANUPIMFILE, 44 CHIPTOOL_MODE_REVERTCLEANUP, 44 45 CHIPTOOL_MODE_DONECLEANUP, 45 46 CHIPTOOL_MODE_RUN, -
branches/eam_branches/ipp-20100823/ippTools/src/chiptoolConfig.c
r28716 r29515 290 290 psMetadataAddU64(donecleanupArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 291 291 292 // -revertcleanup 293 psMetadata *revertcleanupArgs = psMetadataAlloc(); 294 psMetadataAddS64(revertcleanupArgs, PS_LIST_TAIL, "-chip_id", 0, "search by chip ID", 0); 295 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by chipRun label (LIKE comparison)", NULL); 296 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by chipRun data_group (LIKE comparison)", NULL); 297 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-state", 0, "search by current state", NULL); 298 psMetadataAddS16(revertcleanupArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0); 299 292 300 // -run 293 301 psMetadata *runArgs = psMetadataAlloc(); … … 371 379 PXOPT_ADD_MODE("-pendingcleanupimfile", "show runs that need to be cleaned up", CHIPTOOL_MODE_PENDINGCLEANUPIMFILE, pendingcleanupimfileArgs); 372 380 PXOPT_ADD_MODE("-donecleanup", "show runs that have been cleaned", CHIPTOOL_MODE_DONECLEANUP, donecleanupArgs); 381 PXOPT_ADD_MODE("-revertcleanup", "show runs that have been cleaned", CHIPTOOL_MODE_REVERTCLEANUP, revertcleanupArgs); 373 382 PXOPT_ADD_MODE("-run", "show runs", CHIPTOOL_MODE_RUN, runArgs); 374 383 PXOPT_ADD_MODE("-tocleanedimfile", "set imfile state to cleaned", CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileArgs); -
branches/eam_branches/ipp-20100823/ippTools/src/difftool.c
r29324 r29515 48 48 static bool pendingcleanuprunMode(pxConfig *config); 49 49 static bool pendingcleanupskyfileMode(pxConfig *config); 50 static bool revertcleanupMode(pxConfig *config); 50 51 static bool donecleanupMode(pxConfig *config); 51 52 static bool updatediffskyfileMode(pxConfig *config); … … 60 61 static bool tofullskyfileMode(pxConfig *config); 61 62 static bool listrunMode(pxConfig *config); 63 static bool listssrunMode(pxConfig *config); 62 64 static bool setskyfiletoupdateMode(pxConfig *config); 63 65 … … 99 101 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 100 102 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileMode); 103 MODECASE(DIFFTOOL_MODE_REVERTCLEANUP, revertcleanupMode); 101 104 MODECASE(DIFFTOOL_MODE_DONECLEANUP, donecleanupMode); 102 105 MODECASE(DIFFTOOL_MODE_UPDATEDIFFSKYFILE, updatediffskyfileMode); … … 108 111 MODECASE(DIFFTOOL_MODE_TOFULLSKYFILE, tofullskyfileMode); 109 112 MODECASE(DIFFTOOL_MODE_LISTRUN, listrunMode); 113 MODECASE(DIFFTOOL_MODE_LISTSSRUN, listssrunMode); 110 114 MODECASE(DIFFTOOL_MODE_SETSKYFILETOUPDATE, setskyfiletoupdateMode); 111 115 … … 478 482 } 479 483 psFree(where); 484 485 psStringAppend(&query, "\nORDER by priority DESC, diff_id"); 480 486 481 487 // treat limit == 0 as "no limit" … … 1236 1242 PXOPT_COPY_F32(config->args, warp2Where, "-good_frac", "warpSkyfile.good_frac", ">="); 1237 1243 PXOPT_COPY_STR(config->args, stackWhere, "-stack_label", "stackRun.label", "=="); 1244 PXOPT_COPY_STR(config->args, stackWhere, "-stack_data_group", "stackRun.data_group", "=="); 1238 1245 1239 1246 PXOPT_LOOKUP_BOOL(bothways, config->args, "-bothways", false); … … 1609 1616 PXOPT_COPY_S64(config->args, selectWhere, "-warp_id", "inputWarpRun.warp_id", "=="); 1610 1617 PXOPT_COPY_S64(config->args, selectWhere, "-exp_id", "inputRawExp.exp_id", "=="); 1618 PXOPT_COPY_S64(config->args, selectWhere, "-template_exp_id", "templateRawExp.exp_id", "=="); 1611 1619 PXOPT_COPY_STR(config->args, selectWhere, "-filter", "inputRawExp.filter", "=="); 1612 1620 PXOPT_COPY_STR(config->args, selectWhere, "-obs_mode", "inputRawExp.obs_mode", "=="); … … 1647 1655 PXOPT_COPY_F32(config->args, selectWhere, "-sun_angle_min", "inputRawExp.sun_angle", ">="); 1648 1656 PXOPT_COPY_F32(config->args, selectWhere, "-sun_angle_max", "inputRawExp.sun_angle", "<"); 1649 PXOPT_COPY_STR(config->args, selectWhere, "-comment", "inputRawExp.comment", "LIKE"); 1657 PXOPT_COPY_STR(config->args, selectWhere, "-input_comment", "inputRawExp.comment", "LIKE"); 1658 PXOPT_COPY_STR(config->args, selectWhere, "-template_comment", "templateRawExp.comment", "LIKE"); 1650 1659 1651 1660 PXOPT_LOOKUP_BOOL(not_bothways, config->args, "-not-bothways", false); … … 1680 1689 1681 1690 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1691 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1682 1692 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 1683 1693 … … 1839 1849 long numGood = 0; // Number of good rows added 1840 1850 for (long i = 0; i < results->n; i++) { 1851 if (limit && numGood >= limit) { 1852 break; 1853 } 1841 1854 psMetadata *row = results->data[i]; // Result row from query 1842 1855 … … 2535 2548 2536 2549 2550 static bool revertcleanupMode(pxConfig *config) 2551 { 2552 PS_ASSERT_PTR_NON_NULL(config, false); 2553 2554 psMetadata *where = psMetadataAlloc(); 2555 PXOPT_COPY_S64(config->args, where, "-diff_id", "diffSkyfile.diff_id", "=="); 2556 pxAddLabelSearchArgs (config, where, "-label", "diffRun.label", "LIKE"); 2557 pxAddLabelSearchArgs (config, where, "-data_group", "diffRun.data_group", "LIKE"); 2558 2559 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 2560 2561 if (!psListLength(where->list)) { 2562 psFree(where); 2563 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 2564 return false; 2565 } 2566 if (!state) { 2567 state = "error_cleaned"; 2568 } 2569 char *newState = NULL; 2570 if (!strcmp(state, "error_cleaned")) { 2571 newState = "goto_cleaned"; 2572 } else if (!strcmp(state, "error_purged")) { 2573 newState = "goto_purged"; 2574 } else if (!strcmp(state, "error_scrubbed")) { 2575 newState = "goto_scrubbed"; 2576 } else { 2577 psError(PXTOOLS_ERR_CONFIG, true, "-state must be either error_cleaned, error_purged, or error_scrubbed"); 2578 return false; 2579 } 2580 2581 psString query = pxDataGet("difftool_revertcleanup.sql"); 2582 if (!query) { 2583 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 2584 return false; 2585 } 2586 2587 if (psListLength(where->list)) { 2588 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 2589 psStringAppend(&query, " AND %s", whereClause); 2590 psFree(whereClause); 2591 } 2592 psFree(where); 2593 2594 if (!p_psDBRunQueryF(config->dbh, query, newState, state, state)) { 2595 psError(PS_ERR_UNKNOWN, false, "database error"); 2596 psFree(query); 2597 return false; 2598 } 2599 psFree(query); 2600 2601 int numDeleted = psDBAffectedRows(config->dbh); 2602 2603 psLogMsg("difftool", PS_LOG_INFO, "Reverted %d diffRuns and diffSkyfiles", numDeleted); 2604 2605 return true; 2606 } 2537 2607 static bool donecleanupMode(pxConfig *config) 2538 2608 { … … 2877 2947 2878 2948 psMetadata *where = psMetadataAlloc(); 2879 PXOPT_COPY_S64(config->args, where, "-diff_id", "diffRun.diff_id", "=="); 2880 PXOPT_COPY_STR(config->args, where, "-tess_id", "diffRun.tess_id", "=="); 2881 PXOPT_COPY_S64(config->args, where, "-magicked", "diffRun.magicked", "=="); 2882 pxAddLabelSearchArgs (config, where, "-label", "diffRun.label", "LIKE"); 2949 PXOPT_COPY_S64(config->args, where, "-diff_id", "diffRun.diff_id", "=="); 2950 PXOPT_COPY_STR(config->args, where, "-tess_id", "diffRun.tess_id", "LIKE"); 2951 PXOPT_COPY_S64(config->args, where, "-magicked", "diffRun.magicked", "=="); 2952 PXOPT_COPY_STR(config->args, where, "-state", "diffRun.state", "=="); 2953 pxAddLabelSearchArgs (config, where, "-label", "diffRun.label", "LIKE"); 2883 2954 pxAddLabelSearchArgs (config, where, "-data_group", "diffRun.data_group", "LIKE"); 2884 2955 pxAddLabelSearchArgs (config, where, "-dist_group", "diffRun.dist_group", "LIKE"); 2885 2956 2886 2957 PXOPT_LOOKUP_BOOL(template, config->args, "-template", false); 2887 2958 if (!template) { … … 2905 2976 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 2906 2977 PXOPT_LOOKUP_BOOL(pstamp_order, config->args, "-pstamp_order", false); 2907 2978 PXOPT_LOOKUP_S16(diff_mode, config->args, "-diff_mode", false, false); 2979 if (diff_mode) { 2980 PXOPT_COPY_S16(config->args, where, "-diff_mode", "diffRun.diff_mode", "=="); 2981 } 2908 2982 2909 2983 psString where2 = NULL; … … 2983 3057 return true; 2984 3058 } 3059 static bool listssrunMode(pxConfig *config) 3060 { 3061 PS_ASSERT_PTR_NON_NULL(config, false); 3062 3063 psMetadata *where = psMetadataAlloc(); 3064 PXOPT_COPY_S64(config->args, where, "-diff_id", "diffRun.diff_id", "=="); 3065 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackInput.stack_id", "=="); 3066 PXOPT_COPY_S64(config->args, where, "-template_stack_id", "stackTemplate.stack_id", "=="); 3067 PXOPT_COPY_STR(config->args, where, "-tess_id", "diffRun.tess_id", "LIKE"); 3068 PXOPT_COPY_STR(config->args, where, "-state", "diffRun.state", "=="); 3069 pxAddLabelSearchArgs (config, where, "-label", "diffRun.label", "LIKE"); 3070 pxAddLabelSearchArgs (config, where, "-data_group", "diffRun.data_group", "LIKE"); 3071 pxAddLabelSearchArgs (config, where, "-dist_group", "diffRun.dist_group", "LIKE"); 3072 3073 // lookup these so we don't compare to zero if they are not supplied 3074 PXOPT_LOOKUP_F64(mjd_obs_begin, config->args, "-mjd_obs_begin", false, false); 3075 PXOPT_LOOKUP_F64(mjd_obs_end, config->args, "-mjd_obs_end", false, false); 3076 3077 PXOPT_LOOKUP_BOOL(template, config->args, "-template", false); 3078 3079 if (!template) { 3080 if (mjd_obs_begin) { 3081 PXOPT_COPY_F64(config->args, where, "-mjd_obs_begin", "stackInput.mjd_obs", ">="); 3082 } 3083 if (mjd_obs_end) { 3084 PXOPT_COPY_F64(config->args, where, "-mjd_obs_end", "stackInput.mjd_obs", "<="); 3085 } 3086 PXOPT_COPY_STR(config->args, where, "-filter", "stackInputRun.filter", "LIKE"); 3087 } else { 3088 if (mjd_obs_begin) { 3089 PXOPT_COPY_F64(config->args, where, "-mjd_obs_begin", "stackTemplate.mjd_obs", ">="); 3090 } 3091 if (mjd_obs_end) { 3092 PXOPT_COPY_F64(config->args, where, "-mjd_obs_end", "stackTemplate.mjd_obs", "<="); 3093 } 3094 PXOPT_COPY_STR(config->args, where, "-filter", "stackTemplateRun.filter", "LIKE"); 3095 } 3096 3097 PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 3098 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 3099 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 3100 PXOPT_LOOKUP_BOOL(pstamp_order, config->args, "-pstamp_order", false); 3101 3102 psString where2 = NULL; 3103 psString query = pxDataGet("difftool_listssrun.sql"); 3104 if (!query) { 3105 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 3106 return false; 3107 } 3108 3109 if (psListLength(where->list)) { 3110 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 3111 psStringAppend(&query, " AND %s", whereClause); 3112 psFree(whereClause); 3113 } else if (where2) { 3114 psStringAppend(&query, " AND %s", where2); 3115 } else if (!all) { 3116 psError(PXTOOLS_ERR_CONFIG, true, "search parameters or -all are required"); 3117 return false; 3118 } 3119 psFree(where); 3120 3121 if (pstamp_order) { 3122 if (template) { 3123 psStringAppend(&query, " ORDER BY stackTemplate.stack_id, diff_id DESC"); 3124 } else { 3125 psStringAppend(&query, " ORDER BY stackInput.stack_id, diff_id DESC"); 3126 } 3127 } 3128 3129 // treat limit == 0 as "no limit" 3130 if (limit) { 3131 psString limitString = psDBGenerateLimitSQL(limit); 3132 psStringAppend(&query, " %s", limitString); 3133 psFree(limitString); 3134 } 3135 3136 if (!p_psDBRunQuery(config->dbh, query)) { 3137 psError(PS_ERR_UNKNOWN, false, "database error"); 3138 psFree(query); 3139 return false; 3140 } 3141 psFree(query); 3142 3143 psArray *output = p_psDBFetchResult(config->dbh); 3144 if (!output) { 3145 psErrorCode err = psErrorCodeLast(); 3146 switch (err) { 3147 case PS_ERR_DB_CLIENT: 3148 psError(PXTOOLS_ERR_SYS, false, "database error"); 3149 case PS_ERR_DB_SERVER: 3150 psError(PXTOOLS_ERR_PROG, false, "database error"); 3151 default: 3152 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 3153 } 3154 3155 return false; 3156 } 3157 if (!psArrayLength(output)) { 3158 psTrace("difftool", PS_LOG_INFO, "no rows found"); 3159 psFree(output); 3160 return true; 3161 } 3162 3163 if (psArrayLength(output)) { 3164 // negative simple so the default is true 3165 if (!ippdbPrintMetadatas(stdout, output, "diffRun", !simple)) { 3166 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 3167 psFree(output); 3168 return false; 3169 } 3170 } 3171 3172 psFree(output); 3173 3174 return true; 3175 } 2985 3176 // a very specfic function to queue a cleaned warpSkyfile to be updated 2986 3177 static bool setskyfiletoupdateMode(pxConfig *config) -
branches/eam_branches/ipp-20100823/ippTools/src/difftool.h
r28375 r29515 42 42 DIFFTOOL_MODE_PENDINGCLEANUPRUN, 43 43 DIFFTOOL_MODE_PENDINGCLEANUPSKYFILE, 44 DIFFTOOL_MODE_REVERTCLEANUP, 44 45 DIFFTOOL_MODE_DONECLEANUP, 45 46 DIFFTOOL_MODE_UPDATEDIFFSKYFILE, … … 51 52 DIFFTOOL_MODE_TOFULLSKYFILE, 52 53 DIFFTOOL_MODE_LISTRUN, 54 DIFFTOOL_MODE_LISTSSRUN, 53 55 DIFFTOOL_MODE_SETSKYFILETOUPDATE, 54 56 } difftoolMode; -
branches/eam_branches/ipp-20100823/ippTools/src/difftoolConfig.c
r29324 r29515 173 173 psMetadata *listrunArgs = psMetadataAlloc(); 174 174 psMetadataAddS64(listrunArgs, PS_LIST_TAIL, "-diff_id", 0, "search by diff ID", 0); 175 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tessellation ID ", NULL);175 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tessellation ID (LIKE comparison)", NULL); 176 176 psMetadataAddStr(listrunArgs , PS_LIST_TAIL, "-warp_id", 0, "search by warp_id", NULL); 177 177 psMetadataAddBool(listrunArgs, PS_LIST_TAIL, "-template", 0, "apply exposure args to template of bothways diff", false); … … 184 184 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by diffRun data_group (LIKE comparison)", NULL); 185 185 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-dist_group", PS_META_DUPLICATE_OK, "search by diffRun dist_group (LIKE comparison)", NULL); 186 psMetadataAddS16(listrunArgs, PS_LIST_TAIL, "-diff_mode", 0, "search for diff_mode", 0); 187 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 186 188 pxmagicAddArguments(listrunArgs); 187 189 pxspaceAddArguments(listrunArgs); … … 192 194 psMetadataAddU64(listrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 193 195 psMetadataAddBool(listrunArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 196 197 198 // -listssrun 199 psMetadata *listssrunArgs = psMetadataAlloc(); 200 psMetadataAddS64(listssrunArgs, PS_LIST_TAIL, "-diff_id", 0, "search by diff ID", 0); 201 psMetadataAddStr(listssrunArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tessellation ID (LIKE comparison)", NULL); 202 psMetadataAddS64(listssrunArgs , PS_LIST_TAIL, "-stack_id", 0, "search by input stack_id", 0); 203 psMetadataAddS64(listssrunArgs , PS_LIST_TAIL, "-template_stack_id",0, "search by template stack_id", 0); 204 psMetadataAddBool(listssrunArgs, PS_LIST_TAIL, "-template", 0, "apply stack selectors to template", false); 205 psMetadataAddF64(listssrunArgs, PS_LIST_TAIL, "-mjd_obs_begin", 0, "search by stack MJD-OBS (>=)", 0); 206 psMetadataAddF64(listssrunArgs, PS_LIST_TAIL, "-mjd_obs_end", 0, "search by stack MJD-OBS(<=)", 0); 207 psMetadataAddStr(listssrunArgs, PS_LIST_TAIL, "-filter", 0, "search by stack filter", NULL); 208 psMetadataAddStr(listssrunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by diffRun label (LIKE comparison)", NULL); 209 psMetadataAddStr(listssrunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by diffRun data_group (LIKE comparison)", NULL); 210 psMetadataAddStr(listssrunArgs, PS_LIST_TAIL, "-dist_group", PS_META_DUPLICATE_OK, "search by diffRun dist_group (LIKE comparison)", NULL); 211 psMetadataAddS16(listssrunArgs, PS_LIST_TAIL, "-diff_mode", 0, "search for diff_mode", 0); 212 psMetadataAddStr(listssrunArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 213 pxmagicAddArguments(listssrunArgs); 214 pxspaceAddArguments(listssrunArgs); 215 216 psMetadataAddBool(listssrunArgs, PS_LIST_TAIL, "-pstamp_order", 0, "order results for postage stamp server", false); 217 218 psMetadataAddBool(listssrunArgs, PS_LIST_TAIL, "-all", 0, "search without arguments", false); 219 psMetadataAddU64(listssrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 220 psMetadataAddBool(listssrunArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 194 221 195 222 … … 226 253 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-comment", 0, "search by comment (LIKE)", NULL); 227 254 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-stack_label", 0, "search by stack label", NULL); 255 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-stack_data_group", 0, "search by stack data_group", NULL); 228 256 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-warp_label", 0, "search by warp label", NULL); 229 257 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-data_group", 0, "search by data_group", NULL); … … 247 275 psMetadataAddS64(definewarpwarpArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exposure ID", 0); 248 276 psMetadataAddBool(definewarpwarpArgs, PS_LIST_TAIL, "-not-bothways", 0, "only do the single-direction subtraction?", false); 277 psMetadataAddS64(definewarpwarpArgs, PS_LIST_TAIL, "-template_exp_id", 0, "search by template exposure ID", 0); 249 278 psMetadataAddStr(definewarpwarpArgs, PS_LIST_TAIL, "-filter", 0, "search by filter", NULL); 250 279 psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-distance", 0, "limit distance between input and template (deg)", NAN); … … 292 321 psMetadataAddF64(definewarpwarpArgs, PS_LIST_TAIL, "-posang_min", 0, "search by min rotator position angle", NAN); 293 322 psMetadataAddF64(definewarpwarpArgs, PS_LIST_TAIL, "-posang_max", 0, "search by max rotator position angle", NAN); 294 psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-sun_angle_min", 0, "search by min solar angle", NAN); 295 psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-sun_angle_max", 0, "search by max solar angle", NAN); 296 psMetadataAddStr(definewarpwarpArgs, PS_LIST_TAIL, "-comment", 0, "search by comment field (LIKE comparison)", NULL); 323 psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-sun_angle_min", 0, "search by min solar angle", NAN); 324 psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-sun_angle_max", 0, "search by max solar angle", NAN); 325 psMetadataAddStr(definewarpwarpArgs, PS_LIST_TAIL, "-input_comment", 0, "search by comment field for input exposure(LIKE comparison)", NULL); 326 psMetadataAddStr(definewarpwarpArgs, PS_LIST_TAIL, "-template_comment", 0, "search by comment field for template exposure(LIKE comparison)", NULL); 327 psMetadataAddU64(definewarpwarpArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 297 328 298 329 // -definestackstack … … 362 393 psMetadataAddU64(pendingcleanupskyfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 363 394 395 // -revertcleanup 396 psMetadata *revertcleanupArgs = psMetadataAlloc(); 397 psMetadataAddS64(revertcleanupArgs, PS_LIST_TAIL, "-diff_id", 0, "search by difftool ID", 0); 398 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by diffRun label", NULL); 399 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by diffRun data_group", NULL); 400 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 401 402 364 403 // -donecleanup 365 404 psMetadata *donecleanupArgs = psMetadataAlloc(); … … 427 466 PXOPT_ADD_MODE("-advance", "", DIFFTOOL_MODE_ADVANCE, advanceArgs); 428 467 PXOPT_ADD_MODE("-diffskyfile", "", DIFFTOOL_MODE_DIFFSKYFILE, diffskyfileArgs); 429 PXOPT_ADD_MODE("-listrun", "", DIFFTOOL_MODE_LISTRUN, listrunArgs);430 468 PXOPT_ADD_MODE("-revertdiffskyfile","", DIFFTOOL_MODE_REVERTDIFFSKYFILE, revertdiffskyfileArgs); 431 469 PXOPT_ADD_MODE("-definepoprun", "", DIFFTOOL_MODE_DEFINEPOPRUN, definepoprunArgs); … … 433 471 PXOPT_ADD_MODE("-definewarpwarp", "", DIFFTOOL_MODE_DEFINEWARPWARP, definewarpwarpArgs); 434 472 PXOPT_ADD_MODE("-definestackstack", "", DIFFTOOL_MODE_DEFINESTACKSTACK, definestackstackArgs); 473 PXOPT_ADD_MODE("-listrun", "list diff runs", DIFFTOOL_MODE_LISTRUN, listrunArgs); 474 PXOPT_ADD_MODE("-listssrun", "list stack-stack diff runs", DIFFTOOL_MODE_LISTSSRUN, listssrunArgs); 435 475 PXOPT_ADD_MODE("-pendingcleanuprun", "show runs that need to be cleaned up", DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunArgs); 436 476 PXOPT_ADD_MODE("-pendingcleanupskyfile", "show runs that need to be cleaned up", DIFFTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileArgs); 477 PXOPT_ADD_MODE("-revertcleanup", "revert cleanup runs with errors", DIFFTOOL_MODE_REVERTCLEANUP, revertcleanupArgs); 437 478 PXOPT_ADD_MODE("-donecleanup", "show runs that have been cleaned", DIFFTOOL_MODE_DONECLEANUP, donecleanupArgs); 438 479 PXOPT_ADD_MODE("-updatediffskyfile", "update fault code for a diffskyfile", DIFFTOOL_MODE_UPDATEDIFFSKYFILE, updatediffskyfileArgs); -
branches/eam_branches/ipp-20100823/ippTools/src/magicdstool.c
r28936 r29515 637 637 psFree(where); 638 638 639 psStringAppend(&query, "\nORDER BY priority DESC, magic_ds_id"); 640 639 641 // treat limit == 0 as "no limit" 640 642 if (limit) { … … 933 935 } 934 936 937 // treat limit == 0 as "no limit" 938 if (limit) { 939 psString limitString = psDBGenerateLimitSQL(limit); 940 psStringAppend(&query, " %s", limitString); 941 psFree(limitString); 942 } 943 935 944 if (!p_psDBRunQuery(config->dbh, query)) { 936 945 psError(PS_ERR_UNKNOWN, false, "database error"); … … 950 959 return true; 951 960 } 952 if (!psDBTransaction(config->dbh)) {953 psError(PS_ERR_UNKNOWN, false, "database error");954 return false;955 }956 961 for (long i = 0; i < psArrayLength(output); i++) { 957 962 psMetadata *row = output->data[i]; 958 963 959 964 psS64 magic_ds_id = psMetadataLookupS64(NULL, row, "magic_ds_id"); 965 psS64 magicked = psMetadataLookupS64(NULL, row, "magicked"); 966 if (!psDBTransaction(config->dbh)) { 967 psError(PS_ERR_UNKNOWN, false, "database error"); 968 return false; 969 } 960 970 961 971 // if re_place, set stageRun.magicked 962 972 bool setmagicked = psMetadataLookupBool(NULL, row, "re_place"); 963 if (setmagicked && !setRunMagicked(config, magic_ds_id)) { 964 psError(PS_ERR_UNKNOWN, false, "failed to change stageRun.magicked for magic_ds_id: %" PRId64, 965 magic_ds_id); 966 if (!psDBRollback(config->dbh)) { 967 psError(PS_ERR_UNKNOWN, false, "database error"); 973 if (setmagicked) { 974 if (magicked <= 0) { 975 if (!setRunMagicked(config, magic_ds_id)) { 976 psError(PS_ERR_UNKNOWN, false, "failed to change stageRun.magicked for magic_ds_id: %" PRId64, 977 magic_ds_id); 978 if (!psDBRollback(config->dbh)) { 979 psError(PS_ERR_UNKNOWN, false, "database error"); 980 } 981 return false; 982 } 983 } else { 984 fprintf(stderr, "run is already marked as destreaked for magic_ds_id %" PRId64 "\n", magic_ds_id); 968 985 } 969 return false;970 986 } 971 987 … … 980 996 return false; 981 997 } 982 }983 if (!psDBCommit(config->dbh)) {984 psError(PS_ERR_UNKNOWN, false, "database error");985 return false;998 if (!psDBCommit(config->dbh)) { 999 psError(PS_ERR_UNKNOWN, false, "database error"); 1000 return false; 1001 } 986 1002 } 987 1003 -
branches/eam_branches/ipp-20100823/ippTools/src/magictool.c
r28768 r29515 50 50 static bool exposureMode(pxConfig *config); 51 51 52 static bool setmagicRunState(pxConfig *config, psS64 magic_id, const char *state );52 static bool setmagicRunState(pxConfig *config, psS64 magic_id, const char *state, psString setString); 53 53 static bool parseAndInsertNodeDeps(pxConfig *config, psS64 magic_id, const char *filename); 54 54 … … 131 131 132 132 psMetadata *queryWhere = psMetadataAlloc(); // WHERE conditions for everything else 133 PXOPT_COPY_S64(config->args, queryWhere, "-exp_id", " exp_id", "==");133 PXOPT_COPY_S64(config->args, queryWhere, "-exp_id", "rawExp.exp_id", "=="); 134 134 PXOPT_COPY_STR(config->args, queryWhere, "-select_filter", "rawExp.filter", "=="); 135 135 … … 394 394 // required 395 395 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 396 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 396 PXOPT_LOOKUP_STR(state, config->args, "-set_state", true, false); 397 PXOPT_LOOKUP_S16(fault, config->args, "-set_fault", false, false); 398 PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false); 399 PXOPT_LOOKUP_BOOL(clearfault, config->args, "-clearfault", false); 400 401 psString setString = NULL; 402 if (fault || clearfault) { 403 psStringAppend(&setString, ", fault = %d", fault); 404 } 405 if (note) { 406 psStringAppend(&setString, ", note = '%s'", note); 407 } 397 408 398 409 if (state) { 399 410 // set detRun.state to state 400 return setmagicRunState(config, magic_id, state );411 return setmagicRunState(config, magic_id, state, setString); 401 412 } 402 413 … … 612 623 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 613 624 614 psString query = psStringCopy("UPDATE magicRun SET fault = 0 , state = 'new' WHEREfault != 0");625 psString query = psStringCopy("UPDATE magicRun SET fault = 0 WHERE state = 'new' AND fault != 0"); 615 626 616 627 if (psListLength(where->list)) { … … 1171 1182 1172 1183 // optional 1173 PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false); 1184 // PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false); 1185 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false); 1174 1186 PXOPT_LOOKUP_S32(streaks, config->args, "-streaks", false, false); 1175 1187 … … 1184 1196 if (!magicMaskInsert(config->dbh, 1185 1197 magic_id, 1186 uri, 1198 NULL, 1199 path_base, 1187 1200 streaks, 1188 1201 fault … … 1364 1377 } 1365 1378 1366 static bool setmagicRunState(pxConfig *config, psS64 magic_id, const char *state )1379 static bool setmagicRunState(pxConfig *config, psS64 magic_id, const char *state, psString setString) 1367 1380 { 1368 1381 PS_ASSERT_PTR_NON_NULL(state, false); … … 1380 1393 return false; 1381 1394 } 1382 1383 char *query = "UPDATE magicRun SET state = '%s' WHERE magic_id = %" PRId64; 1384 if (!p_psDBRunQueryF(config->dbh, query, state, magic_id)) { 1395 psString query = NULL; 1396 psStringAppend(&query, "UPDATE magicRun SET state = '%s'", state); 1397 if (setString) { 1398 psStringAppend(&query, setString); 1399 } 1400 psStringAppend(&query, " WHERE magic_id = %" PRId64, magic_id);; 1401 1402 // char *query = "UPDATE magicRun SET state = '%s' WHERE magic_id = %" PRId64; 1403 if (!p_psDBRunQuery(config->dbh, query)) { 1385 1404 psError(PS_ERR_UNKNOWN, false, 1386 1405 "failed to change state for magic_id %" PRId64, magic_id); -
branches/eam_branches/ipp-20100823/ippTools/src/magictoolConfig.c
r28039 r29515 79 79 psMetadata *updaterunArgs = psMetadataAlloc(); 80 80 psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-magic_id", 0, "define magictool ID (required)", 0); 81 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0, "set state (required)", NULL); 81 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state", 0, "set state (required)", NULL); 82 psMetadataAddS16(updaterunArgs, PS_LIST_TAIL, "-set_fault", 0, "set fault code", 0); 83 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0, "define note", NULL); 84 psMetadataAddBool(updaterunArgs, PS_LIST_TAIL, "-clearfault", 0, "set fault to zero", NULL); 82 85 83 86 // -addinputskyfile … … 149 152 psMetadata *addmaskArgs = psMetadataAlloc(); 150 153 psMetadataAddS64(addmaskArgs, PS_LIST_TAIL, "-magic_id", 0, "define magictool ID (required)", 0); 151 psMetadataAddStr(addmaskArgs, PS_LIST_TAIL, "- uri", 0, "define URI", NULL);154 psMetadataAddStr(addmaskArgs, PS_LIST_TAIL, "-path_base", 0, "define path_base (required)", NULL); 152 155 psMetadataAddS32(addmaskArgs, PS_LIST_TAIL, "-streaks", 0, "define number of streaks", 0); 153 156 psMetadataAddS16(addmaskArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); -
branches/eam_branches/ipp-20100823/ippTools/src/pstamptool.c
r28937 r29515 46 46 static bool pendingjobMode(pxConfig *config); 47 47 static bool updatejobMode(pxConfig *config); 48 static bool stopdependentjobMode(pxConfig *config); 48 49 static bool revertjobMode(pxConfig *config); 49 50 static bool addprojectMode(pxConfig *config); … … 63 64 break; 64 65 66 // XXX make this a configurable parameter 67 #define PSTAMP_MAX_JOB_FAULTS 5 68 #define PSTAMP_MAX_DEP_FAULTS 5 65 69 66 70 int main(int argc, char **argv) … … 89 93 MODECASE(PSTAMPTOOL_MODE_PENDINGJOB, pendingjobMode); 90 94 MODECASE(PSTAMPTOOL_MODE_UPDATEJOB, updatejobMode); 95 MODECASE(PSTAMPTOOL_MODE_STOPDEPENDENTJOB, stopdependentjobMode); 91 96 MODECASE(PSTAMPTOOL_MODE_REVERTJOB, revertjobMode); 92 97 MODECASE(PSTAMPTOOL_MODE_ADDPROJECT, addprojectMode); … … 715 720 outputBase, 716 721 options, 717 dep_id 722 dep_id, 723 0 // fault_count 718 724 )) { 719 725 psError(PS_ERR_UNKNOWN, false, "database error"); … … 877 883 PXOPT_LOOKUP_S64(req_id, config->args, "-req_id", false, false); 878 884 PXOPT_LOOKUP_S64(dep_id, config->args, "-dep_id", false, false); 879 880 if (!job_id && !req_id && !dep_id) { 881 psError(PS_ERR_UNKNOWN, true, "at least one of -job_id -req_id or -dep_id is required"); 885 PXOPT_LOOKUP_S32(fault_count, config->args, "-fault_count", false, false); 886 887 if (!job_id && !req_id && !dep_id && !fault_count) { 888 psError(PS_ERR_UNKNOWN, true, "at least one of -job_id -req_id -dep_id or -fault_count is required"); 882 889 return false; 883 890 } … … 898 905 PXOPT_COPY_S32(config->args, where, "-fault", "pstampJob.fault", "=="); 899 906 PXOPT_COPY_STR(config->args, where, "-state", "pstampJob.state", "=="); 907 PXOPT_COPY_S32(config->args, where, "-fault_count", "pstampJob.fault_count", ">="); 908 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 900 909 901 910 psString query = pxDataGet("pstamptool_updatejob.sql"); … … 909 918 psStringAppend(&query, "\n %c pstampJob.fault = %d", c, fault); 910 919 c = ','; 920 psStringAppend(&query, ", pstampJob.fault_count = pstampJob.fault_count+ 1"); 911 921 } 912 922 … … 925 935 psU64 affected = psDBAffectedRows(config->dbh); 926 936 psLogMsg("pstamptool", PS_LOG_INFO, "Updated %" PRIu64 " pstampJobs", affected); 937 938 return true; 939 } 940 // Terminate jobs which have dependents setting both the pstampDependent and pstampJob.fault 941 static bool stopdependentjobMode(pxConfig *config) 942 { 943 PS_ASSERT_PTR_NON_NULL(config, false); 944 945 PXOPT_LOOKUP_S32(fault, config->args, "-set_fault", true, false); 946 947 psMetadata *where = psMetadataAlloc(); 948 949 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); 950 PXOPT_COPY_S64(config->args, where, "-job_id", "job_id", "=="); 951 PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "=="); 952 PXOPT_COPY_S32(config->args, where, "-fault", "pstampDependent.fault", "=="); 953 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 954 // if (fault_count) { 955 PXOPT_COPY_S32(config->args, where, "-fault_count", "pstampDependent.fault_count", ">="); 956 // } 957 958 // XXX: How about selecting by pstampRequest.label? No. That is too dangerous by itself. 959 960 psString query = pxDataGet("pstamptool_stopdependentjob.sql"); 961 962 if (psListLength(where->list)) { 963 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 964 psStringAppend(&query, " AND %s", whereClause); 965 psFree(whereClause); 966 } else { 967 psFree(where); 968 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 969 return false; 970 } 971 psFree(where); 972 973 if (!p_psDBRunQueryF(config->dbh, query, fault, fault)) { 974 psError(PS_ERR_UNKNOWN, false, "database error"); 975 psFree(query); 976 return false; 977 } 978 psFree(query); 979 980 psU64 affected = psDBAffectedRows(config->dbh); 981 psLogMsg("pstamptool", PS_LOG_INFO, "Updated %" PRIu64 " pstampJobs and pstampDependents", affected); 927 982 928 983 return true; … … 941 996 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 942 997 998 PXOPT_LOOKUP_BOOL(clear_fault_count, config->args, "-clear_fault_count", false); 999 943 1000 PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 1001 1002 // XXX: we don't actually use -limit. It doesn't work for UPDATE 1003 // it's an allowed arg because add_poll_args adds it 944 1004 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 945 1005 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); … … 947 1007 // By default only revert faults < PSTAMP_FIRST_ERROR_CODE which are our "ipp exit codes" 948 1008 // codes larger than that are the pstamp request interface. 949 // Don't fault those unless -fault wa aprovided1009 // Don't fault those unless -fault was explicitly provided 950 1010 psString faultClause = psStringCopy(""); 951 1011 if (!fault) { … … 966 1026 psFree(where); 967 1027 968 if (!p_psDBRunQueryF(config->dbh, query, faultClause)) { 1028 // don't keep reverting once the number of faults reaches some value unless 1029 // a parameter asking us to clear that count is provided 1030 psString faultCountClause = NULL; 1031 if (clear_fault_count) { 1032 psStringAppend(&faultCountClause, "\n, pstampJob.fault_count = 0"); 1033 } else { 1034 psStringAppend(&query, " AND pstampJob.fault_count < %d", PSTAMP_MAX_JOB_FAULTS); 1035 } 1036 1037 if (!p_psDBRunQueryF(config->dbh, query, faultCountClause, faultClause)) { 1038 psFree(faultCountClause); 969 1039 psFree(faultClause); 970 1040 psFree(query); … … 974 1044 975 1045 psFree(faultClause); 1046 psFree(faultCountClause); 1047 psFree(query); 976 1048 977 1049 return true; … … 1178 1250 need_magic, 1179 1251 outdir, 1180 0 // fault 1252 0, // fault 1253 0 // fault_count 1181 1254 )) { 1182 1255 if (!psDBRollback(config->dbh)) { … … 1300 1373 psStringAppend(&query, "%s fault = %d", needComma ? ", " : "", fault); 1301 1374 needComma = true; 1375 psStringAppend(&query, ", pstampDependent.fault_count = pstampDependent.fault_count + 1"); 1302 1376 } 1303 1377 psStringAppend(&query, " WHERE dep_id = %" PRId64, dep_id); … … 1325 1399 PXOPT_COPY_S64(config->args, where, "-fault", "pstampDependent.fault", "=="); 1326 1400 PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "=="); 1401 PXOPT_COPY_S64(config->args, where, "-job_id", "job_id", "=="); 1402 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); 1327 1403 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "=="); 1404 PXOPT_LOOKUP_BOOL(clear_fault_count, config->args, "-clear_fault_count", false); 1405 1406 // XXX: we don't actually use -limit. It doesn't work for UPDATE 1407 // it's an allowed arg because add_poll_args adds it 1408 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1328 1409 1329 1410 if (!psListLength(where->list)) { … … 1352 1433 } 1353 1434 1354 if (!p_psDBRunQuery(config->dbh, query)) { 1435 // don't keep reverting once the number of faults reaches some value unless 1436 // a parameter asking us to clear that count is provided 1437 psString faultCountClause = NULL; 1438 if (clear_fault_count) { 1439 psStringAppend(&faultCountClause, "\n, pstampDependent.fault_count = 0"); 1440 } else { 1441 psStringAppend(&faultCountClause, " "); 1442 psStringAppend(&query, " AND pstampDependent.fault_count < %d", PSTAMP_MAX_DEP_FAULTS); 1443 } 1444 1445 if (!p_psDBRunQueryF(config->dbh, query, faultCountClause)) { 1355 1446 psError(PS_ERR_UNKNOWN, false, "database error"); 1356 1447 psFree(query); -
branches/eam_branches/ipp-20100823/ippTools/src/pstamptool.h
r28183 r29515 38 38 PSTAMPTOOL_MODE_LISTJOB, 39 39 PSTAMPTOOL_MODE_PENDINGJOB, 40 PSTAMPTOOL_MODE_STOPDEPENDENTJOB, 40 41 PSTAMPTOOL_MODE_JOBRESULT, 41 42 PSTAMPTOOL_MODE_UPDATEJOB, -
branches/eam_branches/ipp-20100823/ippTools/src/pstamptoolConfig.c
r28937 r29515 167 167 psMetadataAddStr(updatejobArgs, PS_LIST_TAIL, "-state", 0, "current state of jobs to update", 0); 168 168 psMetadataAddS16(updatejobArgs, PS_LIST_TAIL, "-fault", 0, "current value for job fault", 0); 169 psMetadataAddStr(updatejobArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL); 170 psMetadataAddS32(updatejobArgs, PS_LIST_TAIL, "-fault_count", 0, "select by fault_count (>=)", 0); 169 171 psMetadataAddStr(updatejobArgs, PS_LIST_TAIL, "-set_state", 0, "new state", NULL); 170 172 psMetadataAddS16(updatejobArgs, PS_LIST_TAIL, "-set_fault", 0, "new result", 0); 173 psMetadataAddU64(updatejobArgs, PS_LIST_TAIL, "-limit", 0, "not used", 0); 174 175 // -stopdependentjob 176 psMetadata *stopdependentjobArgs = psMetadataAlloc(); 177 psMetadataAddS64(stopdependentjobArgs, PS_LIST_TAIL, "-req_id", 0, "req_id of jobs to update", 0); 178 psMetadataAddS64(stopdependentjobArgs, PS_LIST_TAIL, "-job_id", 0, "job_id of jobs to update", 0); 179 psMetadataAddS64(stopdependentjobArgs, PS_LIST_TAIL, "-dep_id", 0, "dep_id of jobs to update", 0); 180 psMetadataAddS16(stopdependentjobArgs, PS_LIST_TAIL, "-fault", 0, "current value for dependent fault", 0); 181 psMetadataAddS32(stopdependentjobArgs, PS_LIST_TAIL, "-fault_count", 0, "select by fault_count (>=)", 0); 182 psMetadataAddS16(stopdependentjobArgs, PS_LIST_TAIL, "-set_fault", 0, "new fault value for job and dependent (required)", 0); 183 psMetadataAddStr(stopdependentjobArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL); 184 psMetadataAddU64(stopdependentjobArgs, PS_LIST_TAIL, "-limit", 0, "not used", 0); 171 185 172 186 // -revertjob … … 177 191 psMetadataAddS16(revertjobArgs, PS_LIST_TAIL, "-fault", 0, "fault to revert", 0); 178 192 psMetadataAddStr(revertjobArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampRequest label (LIKE comparision)", NULL); 193 psMetadataAddBool(revertjobArgs, PS_LIST_TAIL, "-clear_fault_count", 0, "clear job fault count", false); 179 194 psMetadataAddBool(revertjobArgs, PS_LIST_TAIL, "-all", 0, "revert all faulted jobs", false); 180 psMetadataAddU64(revertjobArgs, PS_LIST_TAIL, "-limit", 0, " limit result set to N items", 0);195 psMetadataAddU64(revertjobArgs, PS_LIST_TAIL, "-limit", 0, "not used", 0); 181 196 182 197 // -getdependent … … 201 216 // -revertdependent 202 217 psMetadata *revertdependentArgs = psMetadataAlloc(); 203 psMetadataAddS64(revertdependentArgs, PS_LIST_TAIL, "-dep_id", 0, "define id for dependent", 0); 218 psMetadataAddS64(revertdependentArgs, PS_LIST_TAIL, "-dep_id", 0, "search by dep_id for dependent", 0); 219 psMetadataAddS64(revertdependentArgs, PS_LIST_TAIL, "-job_id", 0, "search by job_ idfor dependent", 0); 220 psMetadataAddS64(revertdependentArgs, PS_LIST_TAIL, "-req_id", 0, "search by req_id for dependent", 0); 204 221 psMetadataAddStr(revertdependentArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "define label for dependent ", NULL); 205 psMetadataAddS16(revertdependentArgs, PS_LIST_TAIL, "-fault", 0, "define fault", 0); 222 psMetadataAddS16(revertdependentArgs, PS_LIST_TAIL, "-fault", 0, "search by dependent fault", 0); 223 psMetadataAddBool(revertdependentArgs, PS_LIST_TAIL, "-clear_fault_count", 0, "clear job fault count", false); 224 psMetadataAddU64(revertdependentArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 206 225 207 226 // -pendingdependent … … 262 281 PXOPT_ADD_MODE("-pendingjob", "", PSTAMPTOOL_MODE_PENDINGJOB, pendingjobArgs); 263 282 PXOPT_ADD_MODE("-updatejob", "", PSTAMPTOOL_MODE_UPDATEJOB, updatejobArgs); 283 PXOPT_ADD_MODE("-stopdependentjob", "", PSTAMPTOOL_MODE_STOPDEPENDENTJOB, stopdependentjobArgs); 264 284 PXOPT_ADD_MODE("-revertjob", "", PSTAMPTOOL_MODE_REVERTJOB, revertjobArgs); 265 285 -
branches/eam_branches/ipp-20100823/ippTools/src/pubtool.c
r28494 r29515 340 340 } 341 341 342 if (!p_psDBRunQueryF(config->dbh, query, whereClause, whereClause )) {342 if (!p_psDBRunQueryF(config->dbh, query, whereClause, whereClause, whereClause)) { 343 343 psError(PS_ERR_UNKNOWN, false, "Database error"); 344 344 psFree(whereClause); -
branches/eam_branches/ipp-20100823/ippTools/src/stacktool.c
r28681 r29515 901 901 psFree(where); 902 902 903 psStringAppend(&query, "\nORDER by priority DESC, stack_id"); 904 903 905 // treat limit == 0 as "no limit" 904 906 if (limit) { … … 982 984 PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false); 983 985 PXOPT_LOOKUP_F32(good_frac, config->args, "-good_frac", false, false); 986 PXOPT_LOOKUP_F64(mjd_obs, config->args, "-mjd_obs", false, false); 984 987 985 988 PXOPT_LOOKUP_STR(ver_pslib, config->args, "-ver_pslib", false, false); … … 1047 1050 hostname, 1048 1051 good_frac, 1052 mjd_obs, 1049 1053 fault, 1050 1054 software_ver, … … 1094 1098 psMetadata *where = psMetadataAlloc(); 1095 1099 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "=="); 1096 PXOPT_COPY_STR(config->args, where, "-tess_id", "stackRun.tess_id", " ==");1100 PXOPT_COPY_STR(config->args, where, "-tess_id", "stackRun.tess_id", "LIKE"); 1097 1101 PXOPT_COPY_STR(config->args, where, "-skycell_id", "stackRun.skycell_id", "=="); 1098 1102 PXOPT_COPY_STR(config->args, where, "-filter", "stackRun.filter", "LIKE"); … … 1100 1104 PXOPT_COPY_STR(config->args, where, "-data_group", "stackRun.data_group", "LIKE"); 1101 1105 PXOPT_COPY_S16(config->args, where, "-fault", "stackSumSkyfile.fault", "=="); 1106 PXOPT_COPY_F64(config->args, where, "-mjd_obs_begin", "stackSumSkyfile.mjd_obs", ">="); 1107 PXOPT_COPY_F64(config->args, where, "-mjd_obs_end", "stackSumSkyfile.mjd_obs", "<="); 1108 1102 1109 1103 1110 // The following three selectors are incompatible with the sql so omit them -
branches/eam_branches/ipp-20100823/ippTools/src/stacktoolConfig.c
r28681 r29515 172 172 psMetadataAddStr(addsumskyfileArgs, PS_LIST_TAIL, "-hostname", 0, "define hostname", 0); 173 173 psMetadataAddF32(addsumskyfileArgs, PS_LIST_TAIL, "-good_frac", 0, "define %% of good pixels", NAN); 174 psMetadataAddF64(addsumskyfileArgs, PS_LIST_TAIL, "-mjd_obs", 0, "define mjd_obs (average mjd_obs of inputs)", NAN); 174 175 psMetadataAddS16(addsumskyfileArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); 175 176 psMetadataAddS16(addsumskyfileArgs, PS_LIST_TAIL, "-quality", 0, "set quality", 0); … … 185 186 psMetadata *sumskyfileArgs= psMetadataAlloc(); 186 187 psMetadataAddS64(sumskyfileArgs, PS_LIST_TAIL, "-stack_id", 0, "search by stack ID", 0); 187 psMetadataAddStr(sumskyfileArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tess ID ", 0);188 psMetadataAddStr(sumskyfileArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tess ID (LIKE comparison)", 0); 188 189 psMetadataAddStr(sumskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "search by skycell ID", 0); 189 190 #ifdef notdef … … 196 197 psMetadataAddStr(sumskyfileArgs, PS_LIST_TAIL, "-data_group", 0, "search by stackRun.data_group (LIKE comparison)", NULL); 197 198 psMetadataAddStr(sumskyfileArgs, PS_LIST_TAIL, "-filter", 0, "search by filter (LIKE comparison)", NULL); 199 psMetadataAddF64(sumskyfileArgs, PS_LIST_TAIL, "-mjd_obs_begin", 0, "search by mjd_obs (average mjd_obs of inputs <=)", NAN); 200 psMetadataAddF64(sumskyfileArgs, PS_LIST_TAIL, "-mjd_obs_end", 0, "search by mjd_obs (average mjd_obs of inputs>=)", NAN); 198 201 psMetadataAddS16(sumskyfileArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0); 199 202 psMetadataAddU64(sumskyfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); … … 204 207 psMetadata *sassskyfileArgs = psMetadataAlloc(); 205 208 psMetadataAddS64(sassskyfileArgs, PS_LIST_TAIL, "-sass_id", 0, "search by stack association ID", 0); 206 psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tess ID ", 0);209 psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tess ID (LIKE comparison)", 0); 207 210 psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-projection_cell", 0, "search by projection cell", 0); 208 211 -
branches/eam_branches/ipp-20100823/ippTools/src/warptool.c
r28375 r29515 52 52 static bool pendingcleanuprunMode(pxConfig *config); 53 53 static bool pendingcleanupwarpMode(pxConfig *config); 54 static bool revertcleanupMode(pxConfig *config); 54 55 static bool donecleanupMode(pxConfig *config); 55 56 static bool tocleanedskyfileMode(pxConfig *config); … … 107 108 MODECASE(WARPTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 108 109 MODECASE(WARPTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupwarpMode); 110 MODECASE(WARPTOOL_MODE_REVERTCLEANUP, revertcleanupMode); 109 111 MODECASE(WARPTOOL_MODE_DONECLEANUP, donecleanupMode); 110 112 MODECASE(WARPTOOL_MODE_TOCLEANEDSKYFILE, tocleanedskyfileMode); … … 1805 1807 1806 1808 1809 static bool revertcleanupMode(pxConfig *config) 1810 { 1811 PS_ASSERT_PTR_NON_NULL(config, false); 1812 1813 psMetadata *where = psMetadataAlloc(); 1814 PXOPT_COPY_S64(config->args, where, "-warp_id", "warpSkyfile.warp_id", "=="); 1815 pxAddLabelSearchArgs (config, where, "-label", "warpRun.label", "LIKE"); 1816 pxAddLabelSearchArgs (config, where, "-data_group", "warpRun.data_group", "LIKE"); 1817 1818 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 1819 1820 if (!psListLength(where->list)) { 1821 psFree(where); 1822 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 1823 return false; 1824 } 1825 if (!state) { 1826 state = "error_cleaned"; 1827 } 1828 char *newState = NULL; 1829 if (!strcmp(state, "error_cleaned")) { 1830 newState = "goto_cleaned"; 1831 } else if (!strcmp(state, "error_purged")) { 1832 newState = "goto_purged"; 1833 } else if (!strcmp(state, "error_scrubbed")) { 1834 newState = "goto_scrubbed"; 1835 } else { 1836 psError(PXTOOLS_ERR_CONFIG, true, "-state must be either error_cleaned, error_purged, or error_scrubbed"); 1837 return false; 1838 } 1839 1840 psString query = pxDataGet("warptool_revertcleanup.sql"); 1841 if (!query) { 1842 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1843 return false; 1844 } 1845 1846 if (psListLength(where->list)) { 1847 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1848 psStringAppend(&query, " AND %s", whereClause); 1849 psFree(whereClause); 1850 } 1851 psFree(where); 1852 1853 if (!p_psDBRunQueryF(config->dbh, query, newState, state, state)) { 1854 psError(PS_ERR_UNKNOWN, false, "database error"); 1855 psFree(query); 1856 return false; 1857 } 1858 psFree(query); 1859 1860 int numDeleted = psDBAffectedRows(config->dbh); 1861 1862 psLogMsg("warptool", PS_LOG_INFO, "Reverted %d warpRuns and warpSkyfiles", numDeleted); 1863 1864 return true; 1865 } 1807 1866 static bool donecleanupMode(pxConfig *config) 1808 1867 { -
branches/eam_branches/ipp-20100823/ippTools/src/warptool.h
r28375 r29515 48 48 WARPTOOL_MODE_PENDINGCLEANUPRUN, 49 49 WARPTOOL_MODE_PENDINGCLEANUPSKYFILE, 50 WARPTOOL_MODE_REVERTCLEANUP, 50 51 WARPTOOL_MODE_DONECLEANUP, 51 52 WARPTOOL_MODE_TOCLEANEDSKYFILE, -
branches/eam_branches/ipp-20100823/ippTools/src/warptoolConfig.c
r28375 r29515 362 362 psMetadataAddU64(pendingcleanupskyfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 363 363 364 // -revertcleanup 365 psMetadata *revertcleanupArgs = psMetadataAlloc(); 366 psMetadataAddS64(revertcleanupArgs, PS_LIST_TAIL, "-warp_id", 0, "search by warptool ID", 0); 367 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by warpRun label", NULL); 368 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by warpRun data_group", NULL); 369 psMetadataAddStr(revertcleanupArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 370 364 371 // -donecleanup 365 372 psMetadata *donecleanupArgs = psMetadataAlloc(); … … 451 458 PXOPT_ADD_MODE("-pendingcleanuprun", "show runs that need to be cleaned up", WARPTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunArgs); 452 459 PXOPT_ADD_MODE("-pendingcleanupskyfile", "show runs that need to be cleaned up", WARPTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileArgs); 460 PXOPT_ADD_MODE("-revertcleanup", "revert cleanup runs with errors", WARPTOOL_MODE_REVERTCLEANUP, revertcleanupArgs); 453 461 PXOPT_ADD_MODE("-donecleanup", "show runs that have been cleaned", WARPTOOL_MODE_DONECLEANUP, donecleanupArgs); 454 462 PXOPT_ADD_MODE("-tocleanedskyfile", "set skyfile as cleaned", WARPTOOL_MODE_TOCLEANEDSKYFILE, tocleanedskyfileArgs); -
branches/eam_branches/ipp-20100823/magic/remove/src/streaksio.c
r28310 r29515 1266 1266 return; 1267 1267 } 1268 if (sfiles->inMask && sfiles->inMask->header) { 1269 if (!pmConfigMaskReadHeader(sfiles->config, sfiles->inMask->header)) { 1270 streaksExit("failed to read mask values from file", PS_EXIT_CONFIG_ERROR); 1271 } 1272 } 1273 1274 bool status; 1275 psMetadata *masks = psMetadataLookupMetadata(&status, sfiles->config->recipes, "MASKS"); 1276 if (!status) { 1277 psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n"); 1278 streaksExit("", PS_EXIT_CONFIG_ERROR); 1279 } 1280 sfiles->maskStreak = psMetadataLookupU32(&status, masks, "STREAK"); 1281 if (!status) { 1282 psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n"); 1283 streaksExit("", PS_EXIT_CONFIG_ERROR); 1284 } 1285 1286 // optionally setting pixels with any mask bits execpt CONV.POOR to NAN 1287 // check old name first 1288 psU32 convPoor = (double) psMetadataLookupU32(&status, masks, "POOR.WARP"); 1289 if (!status) { 1290 convPoor = (double) psMetadataLookupU32(&status, masks, "CONV.POOR"); 1291 if (!status) { 1292 psError(PM_ERR_CONFIG, false, "failed to lookup mask value for CONV.POOR in recipes\n"); 1293 streaksExit("", PS_EXIT_CONFIG_ERROR); 1294 } 1295 } 1296 // preserve pixels that are only suspect 1297 psU32 suspect = (double) psMetadataLookupU32(&status, masks, "SUSPECT"); 1298 if (!status) { 1299 psError(PM_ERR_CONFIG, false, "failed to lookup mask value for SUSPECT in recipes\n"); 1300 streaksExit("", PS_EXIT_CONFIG_ERROR); 1301 } 1302 1303 sfiles->maskMask = ~(convPoor | suspect); 1268 if (!pmCensorGetMasks(sfiles->config, &sfiles->maskMask, &sfiles->maskStreak)) { 1269 streaksExit("failed to find mask values", PS_EXIT_CONFIG_ERROR); 1270 } 1304 1271 } 1305 1272 -
branches/eam_branches/ipp-20100823/pstamp/scripts/Makefile.am
r29124 r29515 20 20 pstamp_get_image_job.pl \ 21 21 psmkreq \ 22 pstampstopfaulted \ 22 23 pstamp_checkdependent.pl \ 23 24 request_finish.pl \ -
branches/eam_branches/ipp-20100823/pstamp/scripts/detect_query_create
r28806 r29515 307 307 while (<$in>) { 308 308 chomp; 309 # print STDERR "$line_num $#keywords $_\n"; 310 if ($_ =~ /^\s*$/) { 311 next; 312 } 309 313 if ($line_num == 0) { 314 if ($_ !~ /EXTVER/) { 315 next; 316 } 310 317 # Parse header information keywords 311 318 $_ =~ s/#//g; … … 319 326 my @values = split /\s+/; 320 327 if ($#values != $#keywords) { 321 die "Number of header columns in input does not equal expected number of header words ";328 die "Number of header columns in input does not equal expected number of header words $#values $#keywords"; 322 329 } 323 330 for (my $i = 0; $i <= $#values; $i++) { … … 326 333 } 327 334 elsif ($line_num == 2) { 335 if ($_ !~ /ROWNUM/) { 336 next; 337 } 328 338 # Parse table information keywords, dumping old keywords 329 339 $_ =~ s/#//g; … … 338 348 my @values = split /\s+/; 339 349 if ($#values != $#keywords) { 340 die "Number of header columns in input does not equal expected number of header words ";350 die "Number of header columns in input does not equal expected number of header words $#values $#keywords"; 341 351 } 342 352 for (my $i = 0; $i <= $#values; $i++) { -
branches/eam_branches/ipp-20100823/pstamp/scripts/detect_query_read
r28808 r29515 36 36 37 37 my $regtool = can_run('regtool') or (die "Can't find regtool"); 38 my $camtool = can_run('camtool') or (die "Can't find regtool"); 38 my $camtool = can_run('camtool') or (die "Can't find camtool"); 39 my $difftool = can_run('difftool') or (die "Can't find difftool"); 39 40 40 41 … … 164 165 } 165 166 elsif ($status == 219) { 166 @{ $colData{$col->{name}} } = map { "Not Set" } (0 .. $numRows - 1);167 @{ $colData{$col->{name}} } = map { "Not_Set" } (0 .. $numRows - 1); 167 168 $status = 0; 168 169 } … … 173 174 # Simple stuff first. 174 175 my %known_filters = (); 175 if ($colData{STAGE}[$i] eq "Not Set") {176 if ($colData{STAGE}[$i] eq "Not_Set") { 176 177 $colData{STAGE}[$i] = 'diff'; 177 178 } 178 if ($colData{OBSCODE}[$i] eq "Not Set") {179 if ($colData{OBSCODE}[$i] eq "Not_Set") { 179 180 $colData{OBSCODE}[$i] = 566; 180 181 } 181 182 # Define filter and MJD from FPA_ID 182 if (($colData{FILTER}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "NotSet")) {183 if (($colData{FILTER}[$i] eq "Not_Set")&&($colData{FPA_ID}[$i] ne "Not_Set")) { 183 184 if (exists($known_filters{$colData{FPA_ID}[$i]})) { 184 185 $colData{FILTER}[$i] = $known_filters{$colData{FPA_ID}[$i]}; … … 210 211 } 211 212 } 212 if (($colData{'MJD-OBS'}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "Not Set")) { 213 # Calculate a MJD 214 if (($colData{'MJD-OBS'}[$i] eq "Not_Set")&&($colData{FPA_ID}[$i] ne "Not_Set")) { 213 215 # HACK! 214 216 my $mjd = $colData{FPA_ID}[$i]; … … 217 219 $colData{'MJD-OBS'}[$i] = $mjd; 218 220 } 219 if (($colData{FPA_ID}[$i] eq "Not Set")&&(($colData{'FILTER'}[$i] ne "Not Set")&& 220 ($colData{'MJD-OBS'}[$i] ne "Not Set"))) { 221 # Calculate an exp_id 222 if (($colData{FPA_ID}[$i] eq "Not_Set")&&(($colData{'FILTER'}[$i] ne "Not_Set")&& 223 ($colData{'MJD-OBS'}[$i] ne "Not_Set"))) { 221 224 my $dateobs_begin = mjd_to_dateobs($colData{'MJD-OBS'}[$i]); 222 225 my $dateobs_end = mjd_to_dateobs($colData{'MJD-OBS'}[$i] + 1); … … 224 227 my $dec = $colData{'DEC1_DEG'}[$i]; 225 228 my $filter = $colData{'FILTER'}[$i] . ".00000"; 226 my $cmd = "$camtool -processedexp -dbname $dbname -filter $filter "; 227 $cmd .= " -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end "; 228 $cmd .= " -ra $ra -decl $dec -radius 1.5 -limit 1"; 229 my $cmd; 230 if ($colData{STAGE}[$i] eq 'SSdiff') { 231 $cmd = "$difftool -listrun -dbname $dbname -filter $filter "; 232 $cmd .= " -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end "; 233 $cmd .= " -ra $ra -decl $dec -radius 1.5 -limit 1 -diff_mode 4"; 234 } 235 elsif ($colData{STAGE}[$i] eq 'WSdiff') { 236 $cmd = "$difftool -listrun -dbname $dbname -filter $filter "; 237 $cmd .= " -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end "; 238 $cmd .= " -ra $ra -decl $dec -radius 1.5 -limit 1 -diff_mode 2"; 239 } 240 elsif ($colData{STAGE}[$i] eq 'diff') { 241 $cmd = "$difftool -listrun -dbname $dbname -filter $filter "; 242 $cmd .= " -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end "; 243 $cmd .= " -ra $ra -decl $dec -radius 1.5 -limit 1"; 244 } 245 else { 246 $cmd = "$camtool -processedexp -dbname $dbname -filter $filter "; 247 $cmd .= " -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end "; 248 $cmd .= " -ra $ra -decl $dec -radius 1.5 -limit 1"; 249 } 229 250 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 230 run(command => $cmd, verbose => 0);251 run(command => $cmd, verbose => 1); 231 252 unless ($success) { 232 253 # This is a problem, because I'm not sure how we handle a failure to read something. … … 243 264 my ($key,$type,$value) = @line; 244 265 # print "$entry => $key / $type / $value \n"; 245 if ($key =~ /exp_name/i) { 246 $colData{FPA_ID}[$i] = $value; 247 } 248 } 266 if ($colData{STAGE}[$i] =~ /diff/) { 267 if ($key =~ /diff_id/i) { 268 $colData{FPA_ID}[$i] = $value; 269 } 270 } 271 else { 272 if ($key =~ /exp_name/i) { 273 $colData{FPA_ID}[$i] = $value; 274 } 275 } 276 } 277 } 278 # Correct diff modes 279 if ($colData{STAGE}[$i] eq 'WSdiff') { 280 $colData{STAGE}[$i] = 'diff'; 281 } 282 elsif ($colData{STAGE}[$i] eq 'SSdiff') { 283 $colData{STAGE}[$i] = 'diff'; 249 284 } 250 285 } -
branches/eam_branches/ipp-20100823/pstamp/scripts/detectability_respond.pl
r29124 r29515 91 91 print "Reading wisdom file $wisdom_file instead of parsing...\n"; 92 92 open(WISDOM,"$wisdom_file") or my_die("failed to open wisdom file $wisdom_file"); 93 my $i = 0;94 93 while(<WISDOM>) { 95 94 chomp; 96 95 my ($fpa_id,@key_values) = split /\s+/; 96 my $index = $#{ $query{$fpa_id}{ROWNUM} } + 1; 97 97 while ($#key_values > -1) { 98 98 my $key = shift(@key_values); … … 102 102 $val = 0; 103 103 } 104 $query{$fpa_id}{$key}[$i] = $val; 105 } 106 $i++; 104 $query{$fpa_id}{$key}[$index] = $val; 105 } 107 106 } 108 107 close(WISDOM); … … 150 149 my $filter; 151 150 my $mjd; 152 # Determine the query style for this fpa_id153 if ($fpa_id =~ /o.*g.*o/) {154 $query_style = 'byexp';155 }156 elsif ($fpa_id =~ /\d+/) {157 $query_style = 'byid';158 }159 else {160 exit_with_failure(21,"Parse error in request file");161 }162 151 # Confirm that we only have one stage/filter/mjd 163 for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) { 164 $temp_hash{STAGE}{$query{$fpa_id}{STAGE}[$i]} = 1; 165 $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1; 166 $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1; 167 } 168 if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) { 169 $stage = (keys(%{ $temp_hash{STAGE} }))[0]; 170 } 171 else { 172 exit_with_failure(21,"Too many STAGEs specified"); 173 } 174 if (scalar(keys(%{ $temp_hash{FILTER} })) == 1) { 175 $filter = (keys(%{ $temp_hash{FILTER} }))[0]; 176 } 177 else { 178 exit_with_failure(21,"Too many FILTERs specified"); 179 } 180 if (scalar(keys(%{ $temp_hash{'MJD-OBS'} })) == 1) { 181 $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0]; 182 } 183 else { 184 exit_with_failure(21,"Too many MJD-OBS specified"); 185 } 186 # Set common request components 187 my $option_mask |= 1; 188 $option_mask |= $PSTAMP_SELECT_IMAGE; 189 $option_mask |= $PSTAMP_SELECT_MASK; 190 $option_mask |= $PSTAMP_SELECT_VARIANCE; 191 $option_mask |= $PSTAMP_SELECT_PSF; 192 my $need_magic = 1; 193 if ($stage eq 'stack') { 194 $need_magic = 0; 195 } 196 my $mjd_min = $mjd; 197 my $mjd_max = $mjd + 1; 198 199 # Construct a row list. 152 if ($fpa_id ne 'Not_Set') { # We only need to check things that aren't the known odd case. 153 for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) { 154 $temp_hash{STAGE}{$query{$fpa_id}{STAGE}[$i]} = 1; 155 $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1; 156 $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1; 157 } 158 if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) { 159 $stage = (keys(%{ $temp_hash{STAGE} }))[0]; 160 } 161 else { 162 exit_with_failure(21,"Too many STAGEs specified"); 163 } 164 if (scalar(keys(%{ $temp_hash{FILTER} })) == 1) { 165 $filter = (keys(%{ $temp_hash{FILTER} }))[0]; 166 } 167 else { 168 exit_with_failure(21,"Too many FILTERs specified"); 169 } 170 if (scalar(keys(%{ $temp_hash{'MJD-OBS'} })) == 1) { 171 $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0]; 172 } 173 else { 174 exit_with_failure(21,"Too many MJD-OBS specified"); 175 } 176 } 177 178 # Set up a rowList with default values 200 179 my @rowList; 201 180 for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) { … … 223 202 $query{$fpa_id}{FAULT}[$i] = 'no_fault'; 224 203 $query{$fpa_id}{BURNTOOL_STATE}[$i] = 'no_btstate'; 225 226 } 204 } 205 206 # Determine the query style for this fpa_id 207 if ($fpa_id =~ /o.*g.*o/) { 208 $query_style = 'byexp'; 209 } 210 elsif ($fpa_id =~ /\d+/) { 211 $query_style = 'byid'; 212 } 213 elsif ($fpa_id eq 'Not_Set') { 214 next; 215 } 216 else { 217 exit_with_failure(21,"Parse error in request file"); 218 } 219 # Set common request components 220 my $option_mask |= 1; 221 $option_mask |= $PSTAMP_SELECT_IMAGE; 222 $option_mask |= $PSTAMP_SELECT_MASK; 223 $option_mask |= $PSTAMP_SELECT_VARIANCE; 224 $option_mask |= $PSTAMP_SELECT_PSF; 225 my $need_magic = 1; 226 if ($stage eq 'stack') { 227 $need_magic = 0; 228 } 229 my $mjd_min = $mjd; 230 my $mjd_max = $mjd + 1; 231 227 232 228 233 # Call the PStamp code to find the images that contain the target on the given MJD in the specified filter. … … 321 326 open(WISDOM,">$wisdom_file") or my_die("failed to open wisdom file $wisdom_file"); 322 327 foreach my $fpa_id (keys %query) { 323 for (my $i = 0; $i <= $#{ $query{$fpa_id}{ STAGE} }; $i++) {328 for (my $i = 0; $i <= $#{ $query{$fpa_id}{ROWNUM} }; $i++) { 324 329 print WISDOM "$fpa_id\t"; 325 330 foreach my $key (keys %{ $query{$fpa_id} }) { … … 639 644 $columns = [ 640 645 # matching rownum from detectability original request 641 { name => 'ROWNUM', type => ' V', writetype => TULONG },646 { name => 'ROWNUM', type => '20A', writetype => TULONG }, 642 647 # any errors that occurred during processing 643 648 { name => 'ERROR_CODE', type => 'V', writetype => TULONG }, … … 690 695 $inHeader->{FPA_ID}->{value} = $fpa_id; 691 696 } 692 697 693 698 push @{$colData{'ROWNUM'}}, @{ $query{$fpa_id}{ROWNUM} }; 694 699 push @{$colData{'ERROR_CODE'}}, @{ $query{$fpa_id}{PROC_ERROR} }; -
branches/eam_branches/ipp-20100823/pstamp/scripts/psmkreq
r29124 r29515 24 24 25 25 # list file columns 26 # RA DEC FILTER MJD_MIN MJD_MAX 26 # RA DEC FILTER MJD_MIN MJD_MAX | COMMENT 27 27 28 28 my ($ra, $dec, $x, $y, $list, $output, $req_name, $req_name_base); … … 62 62 GetOptions( 63 63 'list=s' => \$list, # list of coordinates if undef ra and dec or x and y are required 64 'ra=s' => \$ra, #64 'ra=s' => \$ra, # 65 65 'dec=s' => \$dec, 66 66 'x=s' => \$x, -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_checkdependent.pl
r29124 r29515 239 239 print "skipping $command\n"; 240 240 } 241 } elsif ($chip->{fault}) { 242 # fault the dependent 243 my_die("chip $chip->{chip_id} $chip->{class_id} faulted: $chip->{fault}", $chip->{fault}); 244 } elsif ($chip->{dsFile_fault}) { 245 # fault the dependent 246 my_die("magicDSFile $chip->{magic_ds_id} $chip->{chip_id} $chip->{class_id} faulted: $chip->{dsFile_fault}", $chip->{dsFile_fault}); 241 247 } 242 248 } … … 317 323 if (($chip->{data_state} ne 'full') or ($need_magic and ($chip->{magicked} <= 0))) { 318 324 $chips_ready = 0; 325 $chip->{fault} = $chip->{chip_fault}; 319 326 push @chipsToUpdate, $chip; 320 327 } else { -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_finish.pl
r28229 r29515 191 191 my $filter = $job_params->{filter}; 192 192 $filter = "0" if !$filter; 193 $exp_info = "0|0|0|$filter|0|0"; 193 my $mjd_obs = $job_params->{mjd_obs}; 194 $mjd_obs = "0" if !$mjd_obs; 195 $exp_info = "$mjd_obs|0|0|$filter|0|0"; 194 196 } 195 197 … … 477 479 my $ticks = timegm($sec, $min, $hr, $day, $mon-1, $year-1900); 478 480 481 # dateobs is UTC convert to TAI 482 # XXX: Do this properly 483 if ($year >= 2009) { 484 $ticks += 34; 485 } else { 486 $ticks += 33; 487 } 488 479 489 return 40587.0 + ($ticks/86400.); 480 490 } -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_insert_request.pl
r28106 r29515 44 44 45 45 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 46 my $ pstampdump = can_run('pstampdump') or (warn "Can't find pstampdump" and $missing_tools = 1);46 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1); 47 47 48 48 if ($missing_tools) { … … 53 53 my ($extname, $extver, $req_name); 54 54 { 55 my $command = "$pstampdump -headeronly $tmp_req_file"; 55 # get the header keywords of interest. 56 # Note that if it's a pstamp request then REQ_NAME should be defined. 57 # if it's a detectability query it will not have a REQ_NAME but will have a QUERY_ID 58 my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID"; 56 59 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 57 60 run(command => $command, verbose => $verbose); 61 if (0) { 62 # stoopid fields doesn't set exit status to zero when it works 58 63 unless ($success) { 59 64 print STDERR @$stderr_buf; 60 65 exit $error_code >> 8; 61 66 } 67 } 62 68 my $output = join "", @$stdout_buf; 63 ( $extname, $extver, $req_name) = split " ", $output;64 if ( $extname and ($extname ne "PS1_PS_REQUEST")) {69 (undef, $extname, $extver, $req_name) = split " ", $output; 70 if (!$extname or ! (($extname eq "PS1_PS_REQUEST") or ($extname eq "MOPS_DETECTABILITY_QUERY"))) { 65 71 print STDERR "invalid request file\n"; 66 72 exit $PS_EXIT_DATA_ERROR; 67 73 } 68 74 if (!defined $req_name) { 69 print STDERR "invalid request file no REQ_NAME \n";75 print STDERR "invalid request file no REQ_NAME or QUERY_ID\n"; 70 76 exit $PS_EXIT_DATA_ERROR; 71 77 } … … 91 97 my $req_id = 0; 92 98 { 93 94 my $command = "$pstamptool -addreq -name $req_name -uri $req_file -ds_id 0"; 99 my $command = "$pstamptool -addreq -uri $req_file -ds_id 0 -name $req_name"; 95 100 $command .= " -dbname $dbname" if $dbname; 96 101 $command .= " -dbserver $dbserver" if $dbserver; -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_job_run.pl
r28927 r29515 118 118 $command .= " -dbname $dbname" if $dbname; 119 119 $command .= " -dbserver $dbserver" if $dbserver; 120 $command .= " -stage $params->{stage}" if $params->{stage}; 120 121 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 121 122 run(command => $command, verbose => $verbose); -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_server_status
r27211 r29515 16 16 17 17 my ($rundir, $verbose, $save_temps); 18 my $br = '<br />'; 18 19 19 20 GetOptions( … … 99 100 print "Pantasks Scheduler $scheduler_state.\n"; 100 101 if ($controller_state) { 101 print "Pantasks Controller $controller_state.\n";102 print $br . "Pantasks Controller $controller_state.\n"; 102 103 } else { 103 104 print STDERR "Controller state not found"; 104 105 exit 1; 105 106 } 106 print " \n";107 print "$br$br\n"; 107 108 } else { 108 109 print STDERR "Scheduler state not found"; … … 116 117 117 118 if ($request_run) { 118 print "<b >Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully. $request_run->{nfail} failed to parse.";119 print "<br /><b>Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully. $request_run->{nfail} failed to parse."; 119 120 if ($request_fin) { 120 121 print " $request_fin->{ngood} Requests finished."; … … 125 126 print "\n"; 126 127 if ($job_run) { 127 print "<b >Job Status:</b> $job_run->{nrun} running. $job_run->{ngood} completed successfully. $job_run->{nfail} failed";128 print " \n";128 print "<br /><b>Job Status:</b> $job_run->{nrun} running. $job_run->{ngood} completed successfully. $job_run->{nfail} failed"; 129 print "<br />\n"; 129 130 } else { 130 print "Task pstamp.job.run not found. \n";131 print "Task pstamp.job.run not found.<br />\n"; 131 132 } 133 print "<br /><b>Unfinished Requests</b><br />\n"; 134 print "<pre>\n"; 135 system "/home/panstarrs/bills/ipp/tools/psstatus -r "; 136 print "</pre>\n"; 137 print "<br /><b>Requests completed in last 24 hours (most recently completed first)</b><br />\n"; 138 print "<pre>\n"; 139 # finished requests 140 system "/home/panstarrs/bills/ipp/tools/psstatus -f"; 141 print "</pre>\n"; 132 142 } else { 133 143 print "Task pstamp.request.run not found.\n"; … … 135 145 136 146 147 148 137 149 exit 0; -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_webrequest.pl
r29124 r29515 26 26 my $dbname; 27 27 my $dbserver; 28 my $project;29 my $job_type;30 28 31 29 GetOptions( 32 'job_type=s' => \$job_type,33 30 'dbname=s' => \$dbname, 34 31 'dbserver=s' => \$dbserver, 35 'project=s' => \$project,36 32 'verbose' => \$verbose, 37 33 ); … … 42 38 print "\n\n"; 43 39 print "Starting script $0 on $host\n\n"; 44 }45 46 my $listMode;47 if ($job_type and ($job_type eq 'list_uri')) {48 $listMode=1;49 } else {50 $listMode=0;51 40 } 52 41 … … 105 94 } 106 95 107 # ok at this point we have a request file add it to the database (unless we're in listMode)108 if ($listMode == 1 ) {109 ###110 ### In list mode just parse the file print the output and we're done111 ###112 my $command = "$pstampparse --mode list_uri --file $request_file";113 $command .= " --dbname $dbname" if $dbname;114 $command .= " --dbserver $dbserver" if $dbserver;115 $command .= " --verbose" if $verbose;116 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =117 run(command => $command, verbose => $verbose);118 119 if ($success) {120 ### print "Matching Images:\n";121 print @$stdout_buf;122 exit 0;123 } else {124 # we send the output to STDOUT because that's where PHP finds it125 print @$stdout_buf;126 print @$stderr_buf;127 exit 1;128 }129 }130 131 96 # Queue the request 132 97 my $req_id = 0; -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstampparse.pl
r28878 r29515 805 805 { 806 806 my ($r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_; 807 808 # XXX: The update process for warp and subsequent stages requires # destreaking to be performed809 # because the -pending queries require the inputs to have magicked >= 0810 # The case of stack-stack diffs not needing to be destreaked is taken care of in pstamp_checkdependent811 $need_magic = 1 if $imagedb eq 'gpc1';812 807 813 808 # chipRun's can be in full state if destreaking is necessary … … 900 895 $$r_newState = 'stop'; 901 896 $$r_fault = $PSTAMP_NOT_AVAILABLE; 902 } elsif ( !$image->{magicked}) {897 } elsif ($need_magic and !$image->{magicked}) { 903 898 $$r_newState = 'stop'; 904 899 $$r_fault = $PSTAMP_NOT_DESTREAKED; … … 906 901 # cause the image to be re-made 907 902 # set up to queue an update run 903 my $require_magic = ($need_magic or $image->{magicked}); 908 904 get_dependent(\$$r_newState, \$$r_fault, $r_dep_id, $image->{imagedb}, 909 $run_state, $stage, $image->{stage_id}, $image->{component}, $ need_magic);905 $run_state, $stage, $image->{stage_id}, $image->{component}, $require_magic ); 910 906 } 911 907 } -
branches/eam_branches/ipp-20100823/pstamp/src/ppstamp.c
r25197 r29515 22 22 23 23 // define the active I/O files 24 if (!ppstampParseCamera(config )) {24 if (!ppstampParseCamera(config, options)) { 25 25 psErrorStackPrint(stderr, "Unable to parse camera."); 26 26 ppstampCleanup(config, options); -
branches/eam_branches/ipp-20100823/pstamp/src/ppstamp.h
r25709 r29515 18 18 19 19 // Determine what type of camera, and initialise 20 bool ppstampParseCamera(pmConfig *config );20 bool ppstampParseCamera(pmConfig *config, ppstampOptions *options); 21 21 22 22 int ppstampMakeStamp(pmConfig *config, ppstampOptions *); -
branches/eam_branches/ipp-20100823/pstamp/src/ppstampArguments.c
r24966 r29515 78 78 psArgumentRemove(argnum, &argc, argv); 79 79 } 80 if ((argnum = psArgumentGet(argc, argv, "-stage"))) { 81 psArgumentRemove(argnum, &argc, argv); 82 options->stage = psStringCopy(argv[argnum]); 83 psArgumentRemove(argnum, &argc, argv); 84 } 80 85 81 86 pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM", "-astrom", "-astromlist"); -
branches/eam_branches/ipp-20100823/pstamp/src/ppstampMakeStamp.c
r28882 r29515 233 233 int status = false; 234 234 235 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PPSTAMP.OUTPUT"); 235 pmFPAfile *output; 236 if (!options->stage || (strcmp(options->stage, "diff") != 0)) { 237 output = psMetadataLookupPtr(NULL, config->files, "PPSTAMP.OUTPUT"); 238 } else { 239 output = psMetadataLookupPtr(NULL, config->files, "PPSTAMP.OUTPUT.DIFF"); 240 } 236 241 if (!output) { 237 242 psError(PS_ERR_UNKNOWN, false, "Can't find output data\n"); … … 674 679 static bool setMaskedToNAN(pmConfig *config, psImage *image, psImage *mask, psImage *variance) 675 680 { 681 #ifdef notdef 676 682 bool status; 677 683 psMetadata *masks = psMetadataLookupMetadata(&status, config->recipes, "MASKS"); … … 719 725 } 720 726 } 721 fprintf(stderr, "excised %ld masked pixels\n", numExcised); 727 #endif 728 729 long numCensored; 730 if (!pmCensorMasked(config, image, mask, variance, &numCensored)) { 731 psError(PS_ERR_UNKNOWN, false, "Failed to censor masked pixels.\n"); 732 return false; 733 } 734 735 // XXX: this shouldn't be a fprintf 736 fprintf(stderr, "Censored %ld masked pixels\n", numCensored); 722 737 723 738 return true; -
branches/eam_branches/ipp-20100823/pstamp/src/ppstampOptions.h
r16132 r29515 10 10 psString chipName; 11 11 psString cellName; 12 psString stage; 12 13 // 13 14 // Calculated Values -
branches/eam_branches/ipp-20100823/pstamp/src/ppstampParseCamera.c
r24966 r29515 8 8 9 9 // Set up the ppstamp output Image file 10 bool setupOutput(pmConfig *config, pmFPAfile *input, bool doMask, bool doWeight)10 bool setupOutput(pmConfig *config, pmFPAfile *input, psString stage, bool doMask, bool doWeight) 11 11 { 12 pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, "PPSTAMP.OUTPUT"); 12 pmFPAfile *output; 13 14 if (!stage || (strcmp(stage, "diff") != 0)) { 15 output = pmFPAfileDefineSkycell(config, NULL, "PPSTAMP.OUTPUT"); 16 } else { 17 // need special filerule for diff stage image to allow for negative values 18 output = pmFPAfileDefineSkycell(config, NULL, "PPSTAMP.OUTPUT.DIFF"); 19 } 20 if (!output) { 21 psError(PS_ERR_UNKNOWN, false, "Unable to setup output."); 22 return false; 23 } 24 13 25 output->save = true; 14 26 … … 29 41 // something else that I'm missing? 30 42 31 bool ppstampParseCamera(pmConfig *config )43 bool ppstampParseCamera(pmConfig *config, ppstampOptions *options) 32 44 { 33 45 bool status = false; … … 83 95 84 96 // Set up the output target 85 if (!setupOutput(config, input, doMask, doWeight)) {97 if (!setupOutput(config, input, options->stage, doMask, doWeight)) { 86 98 psError(PS_ERR_UNKNOWN, false, "Unable to setup output."); 87 99 return false; -
branches/eam_branches/ipp-20100823/pswarp/src/pswarpTransformTile.c
r28006 r29515 78 78 int yMax = PS_MIN(maxPt.y, outNumRows); 79 79 80 double jacobian = map->Xx * map->Yy - map->Yx * map->Xy; // Jacobian of transformation80 double jacobian = fabs(map->Xx * map->Yy - map->Yx * map->Xy); // Jacobian of transformation 81 81 double jacobian2 = PS_SQR(jacobian); // Square Jacobian 82 82 -
branches/eam_branches/ipp-20100823/tools/checkexp
r27928 r29515 20 20 my $endDate; 21 21 my $verbose; 22 my $dbname = "gpc1";22 my $dbname; 23 23 24 24 GetOptions( … … 33 33 # -exitval => 3) 34 34 # unless defined $startDate; 35 36 if (!$dbname) { 37 my $dbname = "gpc1"; 38 } 35 39 36 40 my $dbh = getDBHandle($ipprc, $dbname); -
branches/eam_branches/ipp-20100823/tools/czarclean.pl
r29124 r29515 9 9 10 10 my $czarDbName = undef; 11 my $ begin= undef;12 my $ end= undef;11 my $from = undef; 12 my $to = undef; 13 13 my $interval = undef; 14 14 my $verbose = undef; 15 my $optimize = undef; 15 16 16 17 GetOptions ( 17 18 "dbname|d=s" => \$czarDbName, 18 19 "interval|i=s" => \$interval, 19 "begin|b=s" => \$begin, 20 "end|e=s" => \$end, 20 "from|f=s" => \$from, 21 "to|t=s" => \$to, 22 "optimize|o" => \$optimize, 21 23 "verbose|v" => \$verbose, 22 24 ); … … 30 32 print "* UNKNKOWN: option @ARGV\n"; 31 33 } 32 if (!$ begin) {34 if (!$from) { 33 35 $quit=1; 34 print "* REQUIRED: choose a begin date -b <datetime> (default=7am this morning)\n";36 print "* REQUIRED: choose a from date -b <datetime>\n"; 35 37 } 36 if (!$ end) {37 $end=$begin;38 print "* OPTIONAL: choose a n end date -e <datetime> (default=$end)\n";38 if (!$to) { 39 if($from) {$to=$from;} else {$to="NULL";} 40 print "* OPTIONAL: choose a to date -e <datetime> (default=$to)\n"; 39 41 } 40 42 if (!$czarDbName) { 41 43 $czarDbName = "czardb"; 42 print "* OPTIONAL: choose czar Db name -d <name>(default=$czarDbName\n";44 print "* OPTIONAL: choose czar Db name -d <name> (default=$czarDbName\n"; 43 45 } 44 46 if (!$interval) { 45 47 $interval = "30 MINUTE"; 46 print "* OPTIONAL: choose time interval -i <'1 hour'|'2 hour'|etc> (default=$interval)\n"; 48 print "* OPTIONAL: choose time interval -i <'30 MINUTE'|'1 hour'|etc> (default=$interval)\n"; 49 } 50 if (!$optimize) { 51 $optimize = 0; 52 print "* OPTIONAL: optimize database after cleanup -o <'30 MINUTE'|'1 hour'|etc> (default=$interval)\n"; 47 53 } 48 54 print "*\n*******************************************************************************\n"; … … 59 65 60 66 61 $czarDb->cleanupDateRange($ begin, $end, $interval);62 67 $czarDb->cleanupDateRange($from, $to, $interval); 68 if ($optimize) {$czarDb->optimize();} -
branches/eam_branches/ipp-20100823/tools/czarplot.pl
r29124 r29515 17 17 my $begin = undef; 18 18 my $end = undef; 19 my $day = undef; 19 20 my $path = undef; 20 21 my $verbose = undef; 21 22 my $histogram = undef; 22 23 my $timeSeries = undef; 24 my $rate = undef; 25 my $deriv = undef; 26 my $showCleanup = undef; 23 27 my $nebulous = undef; 24 28 my $savingToFile = undef; … … 26 30 27 31 GetOptions ( 28 "dbname |d=s" => \$czarDbName,32 "dbname=s" => \$czarDbName, 29 33 "label|l=s" => \$label, 30 34 "stage|s=s" => \$stage, … … 32 36 "begin|b=s" => \$begin, 33 37 "end|e=s" => \$end, 38 "day|y=s" => \$day, 34 39 "output|o=s" => \$path, 35 40 "histogram|h" => \$histogram, 36 41 "nebulous|n" => \$nebulous, 42 "cleanup|c" => \$showCleanup, 43 "rate|r" => \$rate, 44 "deriv|d" => \$deriv, 37 45 "timeseries|t" => \$timeSeries, 38 46 "verbose|v" => \$verbose, … … 51 59 if (!$timeSeries) { 52 60 print "* OPTIONAL: plot timeseries -t (default=on)\n";} 61 if (!$rate) { 62 print "* OPTIONAL: plot timeseries of rate -r (default=off)\n";} 63 if (!$deriv) { 64 $deriv = 0; 65 print "* OPTIONAL: plot first derivative -d (default=$deriv)\n";} 66 if (!$showCleanup) { 67 $showCleanup = 0; 68 print "* OPTIONAL: include cleanup in timeseries -c (default=$showCleanup)\n";} 53 69 if (!$log) { 54 70 $log = 0; … … 64 80 print "* OPTIONAL: choose time interval in past -i <'1 hour'|'1 day'|etc> (default=none\n";} 65 81 if (!$begin) { 66 print "* OPTIONAL: choose a begin time -b <datetime> (default= 7am this morning)\n";}82 print "* OPTIONAL: choose a begin time -b <datetime> (default=6:35am this morning)\n";} 67 83 if (!$end) { 68 84 print "* OPTIONAL: choose an end time -e <datetime> (default=now)\n";} 85 if (!$day) { 86 print "* OPTIONAL: choose a single day to plot -y <date> (default=today)\n";} 69 87 if (!$path) { 70 88 print "* OPTIONAL: choose an output location -o <path> (default=none)\n"; … … 85 103 86 104 87 # GENE PLOTS my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png size 1280,960 font \"/usr/share/fonts/corefonts/arial.ttf\" 12" : "X11", $path, $save_temps); 88 my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", $path, $save_temps); 105 my $plotter = new czartool::Plotter( 106 $czarDb, 107 "%Y%m%d-%H%M%S", 108 $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", 109 $path, 110 $save_temps); 89 111 90 112 # sort out times 91 if (!$end) {$end = $czarDb->getNowTimestamp();} 92 if (!$begin) { 93 if ($interval) {$begin = $czarDb->subtractInterval($end, $interval);} 94 else {$begin = strftime('%Y-%m-%d 06:35',localtime);} 113 if($day) { 114 115 # day plots should run from about 6:30am until midnight 116 $begin = "$day 06:35"; 117 $end = "$day 23:59"; 95 118 } 119 else { 96 120 121 if (!$end) {$end = $czarDb->getNowTimestamp();} 122 if (!$begin) { 123 124 if ($interval) {$begin = $czarDb->subtractInterval($end, $interval);} 125 else {$begin = strftime('%Y-%m-%d 06:35',localtime);} 126 } 127 } 97 128 my $diskUsage = 1; # TODO 98 129 99 if (!$nebulous && $timeSeries) {$plotter->createTimeSeries($label, $stage, $begin, $end, $log);} 130 if ($rate) { 131 132 if (!$interval) {$interval = "1 HOUR";} 133 $plotter->createRateTimeSeries($label, $stage, $begin, $end, $interval, $log); 134 exit; 135 } 136 if (!$nebulous && $timeSeries) {$plotter->createTimeSeries($label, $stage, $begin, $end, $log, $showCleanup, $deriv);} 100 137 if ($histogram) {$plotter->createHistogram($label, $begin, $end);} 101 138 if ($nebulous && $timeSeries) {$plotter->plotStorageTimeSeries($begin, $end);} -
branches/eam_branches/ipp-20100823/tools/czartool/Burntool.pm
r29124 r29515 54 54 55 55 chomp($line); 56 if($line =~ m/ ([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)/) {56 if($line =~ m/BTSTATS: $today $target ([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)/) { 57 57 if ($self->{_verbose}) {print "Output = $1 $2 $3 $4\n";} 58 58 ${$pending} = ($2 - $3)/60; -
branches/eam_branches/ipp-20100823/tools/czartool/CzarDb.pm
r29124 r29515 11 11 our @ISA = qw(czartool::MySQLDb); # inherits from MySQLDb 12 12 13 # Override constructor 13 ########################################################################### 14 # 15 # Constructor (overrides superclass) 16 # 17 ########################################################################### 14 18 sub new { 15 19 my ($class) = @_; 16 20 17 # Call the constructor of the parent class , Person.18 my $self = $class->SUPER::new($_[1], $_[2], $_[3], $_[4], $_[5], $_[6]);21 # Call the constructor of the parent class 22 my $self = $class->SUPER::new($_[1], $_[2], $_[3], $_[4], $_[5], $_[6]); 19 23 20 24 bless $self, $class; … … 39 43 SQL 40 44 41 42 if (!$query->execute) { 43 44 return 0; 45 } 45 if (!$query->execute) {return 0;} 46 46 47 47 ${$labels} = $query->fetchall_arrayref(); … … 238 238 ########################################################################### 239 239 # 240 # Gets time series data and stores it to temp file 241 # 242 ########################################################################### 243 sub createTimeSeriesData { 244 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff, $dataFile, $isLog) = @_; 245 246 ${$dataFile} = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat"; 247 248 open (GNUDAT, ">${$dataFile}") or print "* Problem opening gnuplot data file for plot for '$label' '$stage'\n"; 240 # Gets time min/max/diff for a given period 241 # 242 ########################################################################### 243 sub getTimeMinMaxDiff { 244 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff) = @_; 249 245 250 246 my $query = $self->{_db}->prepare(<<SQL); 251 247 SELECT 252 MIN(processed), GREATEST(MAX(pending), MAX(faults), max(processed)-min(processed)) AS maxY,253 LEAST(MIN(pending), MIN(faults), max(processed)-min(processed)) AS minY,254 248 DATE_FORMAT(MAX(timestamp),'$self->{_dateFormat}'), 255 249 DATE_FORMAT(MIN(timestamp),'$self->{_dateFormat}'), … … 262 256 if (!$query->execute) {return 0;} 263 257 264 my $minProcessed = undef; 265 my ($_maxY, $_minY, $_timeDiff); 266 ($minProcessed, $_maxY, $_minY, ${$maxX}, ${$minX}, $_timeDiff) = $query->fetchrow_array(); 267 268 if ($_maxY > ${$maxY}) {${$maxY} = $_maxY;} 269 if ($_minY < ${$minY}) {${$minY} = $_minY;} 258 my ($_timeDiff); 259 (${$maxX}, ${$minX}, $_timeDiff) = $query->fetchrow_array(); 260 270 261 if ($_timeDiff > ${$timeDiff}) {${$timeDiff} = $_timeDiff;} 271 262 263 return 1; 264 } 265 266 267 ########################################################################### 268 # 269 # Gets time series data and stores it to temp file 270 # 271 ########################################################################### 272 sub createTimeSeriesData { 273 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff, $dataFile, $isLog, $showCleanup, $firstDeriv) = @_; 274 275 my $query = $self->{_db}->prepare(<<SQL); 276 SELECT 277 MIN(processed) 278 FROM $stage 279 WHERE label LIKE '$label' 280 AND timestamp >= '$fromTime' AND timestamp <= '$toTime'; 281 SQL 282 283 if (!$query->execute) {return 0;} 284 my $minProcessed = scalar $query->fetchrow_array(); # TODO remove 272 285 if (!defined $minProcessed) {return 0;} 286 287 $self->getTimeMinMaxDiff($label, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff); 273 288 274 289 $query = $self->{_db}->prepare(<<SQL); 275 290 SELECT 276 DATE_FORMAT(timestamp, '$self->{_dateFormat}'), pending, faults, processed-$minProcessed291 timestamp, pending, faults, processed 277 292 FROM $stage 278 293 WHERE label LIKE '$label' … … 283 298 $query->execute; 284 299 285 # loop round results 300 ${$dataFile} = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat"; 301 open (GNUDAT, ">${$dataFile}") or print "* Problem opening gnuplot data file for plot for '$label' '$stage'\n"; 302 303 my $lastProcessed = -1; 304 my $lastPending = -1; 305 my $lastFaults = -1; 306 my $lastTimestamp = undef; 307 my $processed = 0; 308 my $runningProcessed = 0; 309 my $pending = 0; 310 my $faults = 0; 311 my $timestamp = undef; 286 312 while (my @row = $query->fetchrow_array()) { 287 my ($timestamp, $pending, $faults, $processed) = @row; 288 289 if ($isLog) { 290 291 $processed = log($processed + 1); 292 $pending = log($pending + 1); 293 $faults = log($faults + 1); 294 } 313 my ($thisTimestamp, $thisPending, $thisFaults, $thisProcessed) = @row; 314 315 if ($showCleanup ) { 316 317 $runningProcessed = $thisProcessed - $minProcessed; 318 } 319 elsif($lastProcessed != -1 && $thisProcessed > $lastProcessed) { 320 321 $runningProcessed = $runningProcessed + ($thisProcessed - $lastProcessed); 322 } 323 324 325 if ($firstDeriv) { 326 327 if (defined $lastTimestamp) { 328 329 my $timeDiff = $self->diffTimesInSecs($thisTimestamp, $lastTimestamp); 330 331 if ($thisProcessed > $lastProcessed){ 332 $processed = abs($thisProcessed - $lastProcessed)/$timeDiff; 333 #print "$processed = ($thisProcessed - $lastProcessed)/$timeDiff\n"; 334 } 335 else {$processed = 0;} 336 #$pending = abs($thisPending - $lastPending)/$timeDiff; 337 #$faults = abs($thisFaults - $lastFaults)/$timeDiff; 338 } 339 else { 340 $processed = 0; 341 $pending = 0; 342 $faults = 0; 343 } 344 } 345 elsif ($isLog) { 346 347 $processed = ($runningProcessed < 0) ? 0 : $runningProcessed; 348 $pending = ($thisPending < 0) ? 0 : $thisPending; 349 $faults = ($thisFaults < 0) ? 0 : $thisFaults; 350 351 $processed = log($runningProcessed + 1)/log(10); 352 $pending = log($thisPending + 1)/log(10); 353 $faults = log($faults + 1)/log(10); 354 } 355 else { 356 357 $processed = $runningProcessed; 358 $pending = $thisPending; 359 $faults = $thisFaults; 360 } 361 362 $timestamp = $self->getFormattedDate($thisTimestamp); 295 363 296 364 print GNUDAT "$timestamp $pending $faults $processed\n"; 365 366 $lastProcessed = $thisProcessed; 367 $lastPending = $thisPending; 368 $lastFaults = $thisFaults; 369 $lastTimestamp = $thisTimestamp; 297 370 } 298 371 … … 357 430 sub countProcessedPendingAndFaults { 358 431 my ($self, $label, $stage, $fromTime, $toTime, $processed, $pending, $faults) = @_; 359 360 432 361 433 my $query = $self->{_db}->prepare(<<SQL); … … 371 443 (${$pending}, ${$faults}) = $query->fetchrow_array(); 372 444 373 $query = $self->{_db}->prepare(<<SQL); 374 SELECT 375 MAX(processed) - MIN(processed) 376 FROM $stage 377 WHERE label LIKE '$label' 378 AND timestamp >= '$fromTime' AND timestamp <= '$toTime'; 379 SQL 380 $query->execute; 381 (${$processed}) = $query->fetchrow_array(); 445 ${$processed} = $self->countProcessed($label, $stage, $fromTime, $toTime); 446 447 return 1; 382 448 } 383 449 … … 502 568 print GNUDAT "$timestamp $available\n"; 503 569 } 570 504 571 close(GNUDAT); 505 572 506 573 return $dataFile; 507 574 } 508 ########################################################################### 509 # 510 # Determines how much has been processed in the provided interval of time 511 # (format: 1 HOUR, 1 MINUTE 1 DAY etc) 512 # 513 ########################################################################### 514 sub countProcessed { # TODO use time not interval 515 my ($self, $label, $stage, $interval) = @_; 575 576 ########################################################################### 577 # 578 # TODO implement isLog 579 # 580 ########################################################################### 581 sub createProcessingRateData { 582 my ($self, $stage, $label, $startDay, $endDay, $interval, $dataFile, $isLog) = @_; 583 584 my $startTime = $startDay; 585 my $endTime; 586 my $quit = 0; 587 my $processed; 588 my $pending; 589 my $faults; 590 my $timestamp; 591 ${$dataFile} = "/tmp/czarplot_gnuplot_".$label."_".$stage."_r.dat"; 592 open (GNUDAT, ">${$dataFile}") or print "* Problem opening gnuplot data file for plot for '$label' '$stage'\n"; 593 my $cleanupCarry = 0; 594 while(1) { 595 596 if (!$self->isBefore($startTime, $endDay)) {last;} 597 $endTime = $self->addInterval($startTime, $interval); 598 $self->countProcessedPendingAndFaults($label, $stage, $startTime, $endTime, \$processed, \$pending, \$faults); 599 $timestamp = $self->getFormattedDate($endTime); 600 print GNUDAT "$timestamp $processed 0 0\n"; 601 602 $startTime = $endTime; 603 } 604 605 close(GNUDAT) or print "* Problem closing gnuplot data file for rate plot for '$label' '$stage'\n" 606 } 607 608 ########################################################################### 609 # 610 # When did this stage finish? 611 # 612 ########################################################################### 613 sub getFinishTime { 614 my ($self, $label, $stage, $begin, $end) = @_; 516 615 517 616 my $query = $self->{_db}->prepare(<<SQL); 518 617 SELECT 519 MAX(processed) - MIN(processed)520 FROM $stage 618 timestamp, pending, faults 619 FROM $stage 521 620 WHERE label LIKE '$label' 522 AND timestamp > (now() - INTERVAL $interval); 523 SQL 524 $query->execute; 525 526 return scalar $query->fetchrow_array(); 527 } 528 621 AND timestamp >= '$begin' 622 AND timestamp <= '$end' 623 SQL 624 $query->execute; 625 626 my $array = $query->fetchall_arrayref(); 627 628 my $row; 629 my $thisPending = -1; 630 my $lastPending = -1; 631 my $thisFaults = -1; 632 my $lastFaults = -1; 633 my $timestamp; 634 my $started = undef; 635 my $finished = undef; 636 my $thisLeft = 0; 637 my $lastLeft = 0; 638 my $finishTimeout = "01:00:00"; 639 my $numRows = @{$array}; 640 print "$numRows rows\n"; 641 my $n = 0; 642 foreach $row ( @{$array} ){ 643 644 ($timestamp, $thisPending, $thisFaults) = @{$row}; 645 646 # print "$timestamp, $thisPending, $thisFaults\n"; 647 648 $thisLeft = $thisPending - $thisFaults; 649 $lastLeft = $lastPending - $lastFaults; 650 651 652 if ($n == 0 && $thisLeft > 0) { 653 654 print "Starting this time period with stuff pending ($thisLeft)\n"; 655 $started = $timestamp; 656 } 657 658 if (!defined $started && $lastLeft == 0 && $thisLeft > 0) { 659 660 $started = $timestamp; 661 print "STARTED at $started\n"; 662 } 663 664 if ($started && !defined $finished && $thisLeft == 0) { 665 666 $finished = $timestamp; 667 print "setting FINISHED to $finished\n"; 668 } 669 670 if (defined $finished) { 671 672 if ($thisLeft != 0) { 673 674 $finished = undef; 675 676 print "NEW pending at $timestamp\n"; 677 678 } 679 elsif ($thisLeft == 0) { 680 681 my $howLongFinished = $self->diffTimes($timestamp, $finished); 682 683 print "$howLongFinished = $timestamp, $finished\n"; 684 685 if ($self->isIntervalGreaterThan($howLongFinished, $finishTimeout)) { 686 687 print "0 pending for $howLongFinished. We're done \n"; 688 last; 689 } 690 691 } 692 693 } 694 695 696 $lastPending = $thisPending; 697 $lastFaults = $thisFaults; 698 $n++; 699 if ($n == $numRows) { 700 701 if ($thisLeft == 0) { 702 703 print "exceeded interval before reaching finished timeout\n"; 704 } 705 else { 706 print "Reached end of interval and not finished yet. $thisLeft left\n"; 707 } 708 } 709 } 710 711 if ($finished) { 712 713 my $timeTaken = $self->diffTimes($finished, $started); 714 print "FINISHED at $finished with $thisFaults remaining faults, time taken = $timeTaken\n"; 715 } 716 717 } 718 719 ########################################################################### 720 # 721 # Figures out if a stage has plateaued 722 # 723 ########################################################################### 724 sub hasPlateaued { 725 my ($self, $label, $stage, $end, $interval) = @_; 726 727 my $query = $self->{_db}->prepare(<<SQL); 728 SELECT 729 timestamp, pending, faults 730 FROM $stage 731 WHERE label LIKE '$label' 732 AND timestamp >= '$end - INTERVAL $interval' 733 AND timestamp <= '$end' 734 ORDER BY timestamp DESC; 735 SQL 736 $query->execute; 737 738 my $array = $query->fetchall_arrayref(); 739 740 my $thisPending = -1; 741 my $lastPending = -1; 742 my $thisFaults = -1; 743 my $lastFaults = -1; 744 my $timestamp; 745 my $thisLeft = 0; 746 my $lastLeft = 0; 747 my $row; 748 my $numRows = @{$array}; 749 my $n = 0; 750 foreach $row ( @{$array} ){ 751 752 ($timestamp, $thisPending, $thisFaults) = @{$row}; 753 754 $thisLeft = $thisPending - $thisFaults; 755 $lastLeft = $lastPending - $lastFaults; 756 757 print "$timestamp $thisPending\n"; 758 759 if ($n>0) { 760 761 #if () {} 762 763 } 764 765 $lastPending = $thisPending; 766 $lastFaults = $thisFaults; 767 $n++; 768 } 769 } 770 771 ########################################################################### 772 # 773 # Gets count of processed stuff in a given time period 774 # 775 ########################################################################### 776 sub countProcessed { 777 my ($self, $label, $stage, $begin, $end) = @_; 778 779 my $query = $self->{_db}->prepare(<<SQL); 780 SELECT 781 processed 782 FROM $stage 783 WHERE label LIKE '$label' 784 AND timestamp >= '$begin' 785 AND timestamp < '$end' 786 SQL 787 $query->execute; 788 789 my $processedArray = $query->fetchall_arrayref(); 790 791 my $processed; 792 my $thisCount = -1; 793 my $lastCount = -1; 794 my $count = 0; 795 foreach $processed ( @{$processedArray} ){ 796 797 ($thisCount) = @{$processed}; 798 799 if ($thisCount > $lastCount && $lastCount != -1) {$count = $count + ($thisCount - $lastCount);} 800 $lastCount = $thisCount; 801 } 802 803 return $count; 804 } 529 805 530 806 ########################################################################### … … 541 817 542 818 if (!$self->isBefore($thisDay, $endDay)) { 543 819 544 820 $quit = 1; 545 821 } … … 553 829 ########################################################################### 554 830 # 555 # Deletes all but one row per interval from all stage tables for all labels between the provided day 831 # Deletes all but one row per interval from all tables for the provided date range 832 # TODO this is very clumsy, I just have time to thinmk of something more elegant 556 833 # 557 834 ########################################################################### … … 566 843 my $totalDeleted = undef; 567 844 my $quit = 0; 845 my $query = undef; 568 846 while(!$quit) { 569 847 570 848 $toTime = $self->addInterval($fromTime, $interval); 571 849 if (!$self->isBefore($toTime, $endDay)) { 572 850 573 851 $toTime = $endDay; 574 852 $quit = 1; 575 853 } 576 854 577 855 my $stage = undef; 578 856 $totalDeleted = 0; … … 586 864 my ($label) = @{$row}; 587 865 588 my$query = $self->{_db}->prepare(<<SQL);866 $query = $self->{_db}->prepare(<<SQL); 589 867 SELECT COUNT(*) 590 868 FROM $stage … … 609 887 $totalDeleted += $toDelete; 610 888 } 611 } 889 890 } 891 892 # servers table 893 my $servers = undef; 894 if ($self->getServers(\$servers)) { 895 896 my $server = undef; 897 my $row = undef; 898 foreach $row ( @{$servers} ) { 899 my ($server) = @{$row}; 900 901 $query = $self->{_db}->prepare(<<SQL); 902 SELECT COUNT(*) 903 FROM servers 904 WHERE timestamp > '$fromTime' 905 AND timestamp <= '$toTime' 906 AND server = '$server' 907 SQL 908 $query->execute; 909 910 my $toDelete = scalar $query->fetchrow_array() - 1; 911 if ($toDelete > 0) { 912 913 $query = $self->{_db}->prepare(<<SQL); 914 DELETE FROM servers 915 WHERE timestamp > '$fromTime' 916 AND timestamp <= '$toTime' 917 AND server = '$server' ORDER BY timestamp DESC LIMIT $toDelete 918 SQL 919 $query->execute; 920 921 $totalDeleted += $toDelete; 922 } 923 } 924 } 925 926 # now deal with cluster_space table 927 $query = $self->{_db}->prepare(<<SQL); 928 SELECT COUNT(*) 929 FROM cluster_space 930 WHERE timestamp > '$fromTime' 931 AND timestamp <= '$toTime' 932 SQL 933 $query->execute; 934 935 my $toDelete = scalar $query->fetchrow_array() - 1; 936 if ($toDelete > 0) { 937 938 $query = $self->{_db}->prepare(<<SQL); 939 DELETE FROM cluster_space 940 WHERE timestamp > '$fromTime' 941 AND timestamp <= '$toTime' 942 ORDER BY timestamp DESC LIMIT $toDelete 943 SQL 944 $query->execute; 945 946 $totalDeleted += $toDelete; 947 } 948 612 949 print " * Deleted $totalDeleted between $fromTime and $toTime\n"; 613 950 $fromTime = $toTime; 614 951 } 952 } 953 954 ########################################################################### 955 # 956 # Optimizes all tables that need to be optimized 957 # 958 ########################################################################### 959 sub optimize { 960 my ($self) = @_; 961 962 my $stage = undef; 963 foreach $stage (@stages) { 964 965 $self->optimizeTable($stage); 966 } 967 968 $self->optimizeTable("cluster_space"); 969 $self->optimizeTable("servers"); 970 } 971 972 ########################################################################### 973 # 974 # Returns if a particular server has been down for a certain interval 975 # 976 ########################################################################### 977 sub isServerDown { 978 my ($self, $server, $interval) = @_; 979 980 my $query = $self->{_db}->prepare(<<SQL); 981 SELECT COUNT(*) 982 FROM servers 983 WHERE server = "$server" 984 AND timestamp > now() - INTERVAL $interval 985 SQL 986 987 $query->execute; 988 my $numOfReadings = scalar $query->fetchrow_array(); 989 990 if ($numOfReadings == 0) {return 0;} 991 992 $query = $self->{_db}->prepare(<<SQL); 993 SELECT COUNT(*) 994 FROM servers 995 WHERE server = "$server" 996 AND timestamp > now() - INTERVAL $interval 997 AND !running 998 SQL 999 1000 $query->execute; 1001 my $numNotRunning = scalar $query->fetchrow_array(); 1002 1003 if ($numOfReadings == $numNotRunning) {return 1;} 1004 1005 return 0; 1006 } 1007 1008 ########################################################################### 1009 # 1010 # Returns an array of servers 1011 # 1012 ########################################################################### 1013 sub getServers { 1014 my ($self, $servers) = @_; 1015 1016 my $query = $self->{_db}->prepare(<<SQL); 1017 SELECT DISTINCT server 1018 FROM servers 1019 SQL 1020 1021 if (!$query->execute) { 1022 1023 return 0; 1024 } 1025 1026 ${$servers} = $query->fetchall_arrayref(); 1027 1028 return 1; 615 1029 } 616 1030 … … 682 1096 INSERT INTO revision (revision) VALUES ($revision); 683 1097 SQL 684 $query->execute;1098 $query->execute; 685 1099 } 686 1100 … … 701 1115 SQL 702 1116 703 $query->execute;1117 $query->execute; 704 1118 my @row = $query->fetchrow_array(); 705 1119 … … 729 1143 foreach $stage (@stages) { 730 1144 731 my $query = $self->{_db}->prepare(<<SQL);1145 my $query = $self->{_db}->prepare(<<SQL); 732 1146 CREATE TABLE $stage ( 733 1147 timestamp TIMESTAMP DEFAULT NOW(), … … 758 1172 foreach $stage (@stages) { 759 1173 760 my $query = $self->{_db}->prepare(<<SQL);1174 my $query = $self->{_db}->prepare(<<SQL); 761 1175 ALTER TABLE $stage 762 1176 ADD COLUMN reverting TINYINT NOT NULL DEFAULT 0; … … 783 1197 foreach $stage (@stages) { 784 1198 785 my $query = $self->{_db}->prepare(<<SQL);1199 my $query = $self->{_db}->prepare(<<SQL); 786 1200 ALTER TABLE $stage 787 1201 ADD COLUMN processed BIGINT NOT NULL DEFAULT 0; 788 1202 SQL 789 1203 790 $query->execute;1204 $query->execute; 791 1205 } 792 1206 … … 808 1222 SQL 809 1223 810 $query->execute;1224 $query->execute; 811 1225 812 1226 $self->setRevision(4); … … 830 1244 SQL 831 1245 832 $query->execute;1246 $query->execute; 833 1247 834 1248 $self->setRevision(5); … … 854 1268 SQL 855 1269 856 $query->execute;857 } 858 859 my $query = $self->{_db}->prepare(<<SQL);860 CREATE INDEX serverIndex ON servers (timestamp, server);861 SQL 862 863 $query->execute;1270 $query->execute; 1271 } 1272 1273 my $query = $self->{_db}->prepare(<<SQL); 1274 CREATE INDEX serverIndex ON servers (timestamp, server); 1275 SQL 1276 1277 $query->execute; 864 1278 865 1279 … … 882 1296 SQL 883 1297 884 $query->execute;1298 $query->execute; 885 1299 886 1300 $self->setRevision(7); … … 906 1320 SQL 907 1321 908 $query->execute;1322 $query->execute; 909 1323 } 910 1324 … … 916 1330 SQL 917 1331 918 $query->execute;1332 $query->execute; 919 1333 920 1334 # insert stages into revert table … … 926 1340 ('$stage', 0); 927 1341 SQL 928 $query->execute;1342 $query->execute; 929 1343 } 930 1344 … … 951 1365 SQL 952 1366 953 $query->execute;1367 $query->execute; 954 1368 $query = $self->{_db}->prepare(<<SQL); 955 1369 CREATE TABLE hosts ( … … 960 1374 SQL 961 1375 962 $query->execute;963 964 $query = $self->{_db}->prepare(<<SQL);965 CREATE INDEX clusterSpaceIndex ON cluster_space (timestamp);966 SQL 967 968 $query->execute;1376 $query->execute; 1377 1378 $query = $self->{_db}->prepare(<<SQL); 1379 CREATE INDEX clusterSpaceIndex ON cluster_space (timestamp); 1380 SQL 1381 1382 $query->execute; 969 1383 970 1384 $self->setRevision(9); … … 984 1398 ALTER TABLE hosts 985 1399 ADD COLUMN writable TINYINT NOT NULL DEFAULT 0, 986 ADD COLUMN readable TINYINT NOT NULL DEFAULT 0;987 SQL 988 989 $query->execute;1400 ADD COLUMN readable TINYINT NOT NULL DEFAULT 0; 1401 SQL 1402 1403 $query->execute; 990 1404 991 1405 $self->setRevision(10); … … 1012 1426 SQL 1013 1427 1014 $query->execute;1015 $query = $self->{_db}->prepare(<<SQL);1016 CREATE INDEX burntoolIndex ON burntool (timestamp, label);1017 SQL 1018 1019 $query->execute;1428 $query->execute; 1429 $query = $self->{_db}->prepare(<<SQL); 1430 CREATE INDEX burntoolIndex ON burntool (timestamp, label); 1431 SQL 1432 1433 $query->execute; 1020 1434 1021 1435 $self->setRevision(11); … … 1039 1453 SQL 1040 1454 1041 $query->execute;1455 $query->execute; 1042 1456 1043 1457 $self->setRevision(12); -
branches/eam_branches/ipp-20100823/tools/czartool/MySQLDb.pm
r29124 r29515 64 64 return $self->{_dbHost}; 65 65 } 66 ########################################################################### 67 # 68 # Adds the provided interval to the provided time 69 # 70 ########################################################################### 71 sub getFormattedDate { 72 my ($self, $time) = @_; 73 74 my $query = $self->{_db}->prepare(<<SQL); 75 SELECT DATE_FORMAT('$time','$self->{_dateFormat}'); 76 SQL 77 $query->execute; 78 79 return scalar $query->fetchrow_array(); 80 } 66 81 67 82 ########################################################################### … … 83 98 ########################################################################### 84 99 # 100 # Finds the difference of two times 101 # 102 ########################################################################### 103 sub diffTimes { 104 my ($self, $time1, $time2) = @_; 105 106 my $query = $self->{_db}->prepare(<<SQL); 107 SELECT TIMEDIFF('$time1','$time2'); 108 SQL 109 110 $query->execute; 111 return scalar $query->fetchrow_array(); 112 } 113 114 ########################################################################### 115 # 116 # Finds the difference of two times in seconds 117 # 118 ########################################################################### 119 sub diffTimesInSecs { 120 my ($self, $time1, $time2) = @_; 121 122 my $query = $self->{_db}->prepare(<<SQL); 123 SELECT TIME_TO_SEC(TIMEDIFF('$time1','$time2')); 124 SQL 125 126 $query->execute; 127 return scalar $query->fetchrow_array(); 128 } 129 130 ########################################################################### 131 # 132 # Returns whether the first interval is larger than the second 133 # 134 ########################################################################### 135 sub isIntervalGreaterThan { 136 my ($self, $interval1, $interval2) = @_; 137 138 my $query = $self->{_db}->prepare(<<SQL); 139 SELECT INTERVAL('$interval1', '$interval2'); 140 SQL 141 $query->execute; 142 143 return scalar $query->fetchrow_array(); 144 } 145 146 ########################################################################### 147 # 85 148 # Subtracts the provided interval from the provided time 86 149 # … … 127 190 128 191 return scalar $query->fetchrow_array(); 192 } 193 194 ####################################################################################### 195 # 196 # Optimizes a table 197 # 198 ####################################################################################### 199 sub optimizeTable { 200 my ($self, $table) = @_; 201 202 my $query = $self->{_db}->prepare(<<SQL); 203 OPTIMIZE TABLE $table; 204 SQL 205 206 my $success = $query->execute; 207 208 print "* "; 209 if (!$success) {print "UN";} 210 print "successfully optimized '$table' table\n"; 211 212 return $success; 129 213 } 130 214 -
branches/eam_branches/ipp-20100823/tools/czartool/Plotter.pm
r29124 r29515 33 33 ########################################################################### 34 34 sub createImageFileName { 35 my ($self, $label, $stage, $suffix, $isLog ) = @_;35 my ($self, $label, $stage, $suffix, $isLog, $isRate) = @_; 36 36 37 37 my $prefix = $self->{_outputPath} ? $self->{_outputPath} : "."; … … 55 55 ########################################################################### 56 56 # 57 # Plots a time series of processing rate for all stages for this label TODO duplication below. combine 58 # 59 ########################################################################### 60 sub createRateTimeSeries { 61 my ($self, $label, $selectedStage, $beginTime, $endTime, $interval, $isLog) = @_; 62 63 my $minX = 999999999; 64 my $maxX = -9999999999; 65 my $timeDiff = -1; 66 67 my $stages = undef; 68 69 if (!$selectedStage) {$stages = \@allStages;} 70 else {$stages = ["$selectedStage"]}; 71 72 $self->{_czarDb}->getTimeMinMaxDiff($label, $selectedStage, $beginTime, $endTime, \$minX, \$maxX, \$timeDiff); 73 74 my $divX; 75 my $timeFormat; 76 $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat); 77 78 my %gnuplotFiles; 79 my $stage = undef; 80 my $gnuplotFile = undef; 81 my $outputFile = createImageFileName($self, $label, $selectedStage, "r", $isLog); 82 open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot"; 83 use FileHandle; 84 GP->autoflush(1); 85 print GP 86 "set term $self->{_outputFormat};" . 87 "set output \"$outputFile\";" . 88 "set title \"'$label', '$selectedStage' during '$beginTime' to '$endTime'\";" . 89 #"set xdata time;" . 90 "set timefmt \"$self->{_dateFormat}\";" . 91 "set format x \"$timeFormat\";" . 92 "set xtics \"$minX\", $divX, \"$maxX\";" . 93 # "set xrange [\"$minX\":\"$maxX\"];" . 94 "set grid;" . 95 "set boxwidth;" . 96 "set style data histogram;" . 97 "set style histogram rowstacked;" . 98 "set style fill solid border -1;" . 99 "set ylabel \"Exposures processed per $interval\";" . 100 "set boxwidth 0.75;" . 101 "plot "; 102 103 my $first = 1; 104 foreach $stage (@{$stages}) { 105 106 if ($self->{_czarDb}->createProcessingRateData( 107 $stage, 108 $label, 109 $beginTime, 110 $endTime, 111 $interval, 112 \$gnuplotFile, 113 $isLog)) { 114 115 $gnuplotFiles{$stage} = $gnuplotFile; 116 117 if (!$first) { print GP ","; } 118 print GP "'$gnuplotFile' using 2:xtic(1) title \"$stage\" "; 119 $first = 0; 120 } 121 } 122 123 print GP ";\n"; 124 close GP; 125 } 126 ########################################################################### 127 # 57 128 # Plots a time series for all stages for this label 58 129 # 59 130 ########################################################################### 60 131 sub createTimeSeries { 61 my ($self, $label, $selectedStage, $beginTime, $endTime, $isLog) = @_; 62 63 my ($minX, $maxX, $minY, $maxY, $timeDiff); 64 $minX = 999999999; 65 $maxX = -9999999999; 66 $minY = 999999999; 67 $maxY = -99999999; 68 $timeDiff = 0; 132 my ($self, $label, $selectedStage, $beginTime, $endTime, $isLog, $showCleanup, $deriv) = @_; 133 134 my $minX = 999999999; 135 my $maxX = -9999999999; 136 my $timeDiff = 0; 69 137 70 138 my $stages = undef; … … 85 153 \$minX, 86 154 \$maxX, 87 \$minY,88 \$maxY,89 155 \$timeDiff, 90 156 \$gnuplotFile, 91 $isLog)) { 157 $isLog, 158 $showCleanup, 159 $deriv)) { 92 160 93 161 $gnuplotFiles{$stage} = $gnuplotFile; … … 118 186 $maxX, 119 187 $minX, 120 $maxY,121 $minY,122 188 $timeDiff, 123 $isLog); 189 $isLog, 190 $deriv); 124 191 } 125 192 … … 161 228 close(GNUDAT); 162 229 163 plotHistogram($self, $inputFile, $outputFile, $label, $beginTime, $endTime, $maxY); 230 open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot"; 231 use FileHandle; 232 GP->autoflush(1); 233 234 if ($maxY == 0) {$maxY = 1;} 235 else {$maxY = $maxY*1.1;} 236 237 print GP 238 "set term $self->{_outputFormat};" . 239 "set output \"$outputFile\";" . 240 "set title \"'$label', '$beginTime' to '$endTime'\";" . 241 "set grid;" . 242 "set boxwidth;" . 243 "set yrange [\"0\":\"$maxY\"];" . 244 "set style data histogram;" . 245 "set style histogram rowstacked;" . 246 "set style fill solid border -1;" . 247 "set ylabel \"Exposures\";" . 248 "set boxwidth 0.75;" . 249 "plot '$inputFile' using 2:xtic(1) title \"Faults\" lt 1, '' using 3 title \"Processed\" lt 2, '' using 4 title \"Pending\" lt 7;" . 250 "\n"; 251 252 close GP; 164 253 unlink($inputFile); 165 254 } 166 167 255 168 256 ########################################################################### … … 239 327 ########################################################################### 240 328 sub plotTimeSeries { 241 my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $ maxY, $minY, $timeDiff, $isLog) = @_;329 my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $timeDiff, $isLog, $isDeriv) = @_; 242 330 243 331 my $timeFormat = undef; 244 332 my $divX = undef; 245 333 my $yTitle = undef; 246 if ($isLog) {$yTitle = "Log( numExposures )";} 247 else {$yTitle = "numExposures";} 334 if ($isLog) {$yTitle = "Log( Exposures )";} 335 elsif ($isDeriv) {$yTitle = "dExposures/dTime";} 336 else {$yTitle = "Exposures";} 248 337 249 338 $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat); 250 339 251 340 my $numOfPlots = keys %$gnuplotFiles; 252 my $title = undef;253 341 254 342 # sort out plot title 255 if ($numOfPlots == 1) {foreach my $stage (keys %$gnuplotFiles) {$title = "'".$stage."'";}} 256 else {$title = "'All stages'"} 343 my $title = ""; 344 if ($isDeriv) {$title .= "First derivatives of "} 345 if ($numOfPlots == 1) {foreach my $stage (keys %$gnuplotFiles) {$title .= "'".$stage."'";}} 346 else {$title .= "'all stages'"} 257 347 258 348 $title .= " for '$label', '$fromTime' to '$toTime'"; … … 283 373 if ($numOfPlots == 1) { 284 374 375 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:2 title \"Pending\" with lines lt 4 lw 2,"; 285 376 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:4 title \"Processed\" with lines lt 2 lw 2,"; 286 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:2 title \"Pending\" with lines lt 4 lw 2,";287 377 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:3 title \"Faults\" with lines lt 7 lw 2"; 288 378 } … … 346 436 close GP; 347 437 unlink($gnuplotFile); 348 }349 350 ###########################################################################351 #352 # Plots a histogram of processed stuff353 #354 ###########################################################################355 sub plotHistogram {356 my ($self, $inputFile, $outputFile, $label, $fromTime, $toTime, $maxY) = @_;357 358 open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot";359 use FileHandle;360 GP->autoflush(1);361 362 if ($maxY == 0) {$maxY = 1;}363 else {$maxY = $maxY*1.1;}364 365 print GP366 "set term $self->{_outputFormat};" .367 "set output \"$outputFile\";" .368 "set title \"'$label', '$fromTime' to '$toTime'\";" .369 "set grid;" .370 "set boxwidth;" .371 "set yrange [\"0\":\"$maxY\"];" .372 "set style data histogram;" .373 "set style histogram rowstacked;" .374 "set style fill solid border -1;" .375 "set ylabel \"Exposures\";" .376 "set boxwidth 0.75;" .377 "plot '$inputFile' using 2:xtic(1) title \"Faults\" lt 1, '' using 3 title \"Processed\" lt 2, '' using 4 title \"Pending\" lt 7;" .378 "\n";379 380 close GP;381 438 } 382 439 -
branches/eam_branches/ipp-20100823/tools/definetargets
r26097 r29515 33 33 34 34 my @all_filters = qw( g r i z y ); 35 my @all_stages = qw( raw chip camera fake warp stack diff );35 my @all_stages = qw( raw chip camera fake warp stack diff SSdiff ); 36 36 37 37 my @filters; -
branches/eam_branches/ipp-20100823/tools/roboczar.pl
r29124 r29515 14 14 use czartool::Burntool; 15 15 16 my $period = 60;17 16 my $czarDbName = "czardb"; # TODO variables for other Db stuff, host etc 18 17 my $save_temps = 0; 19 18 20 19 GetOptions ( 21 "period|p=s" => \$period, # TODO more Db args22 20 "dbname|d=s" => \$czarDbName, 23 21 ); 24 22 25 23 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 26 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser");27 my $nebulous = new czartool::Nebulous($czarDb);28 my $pantasks = new czartool::Pantasks();29 my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path30 my $burntool = new czartool::Burntool();31 24 32 25 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 33 26 34 27 my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); 28 my @serversWeCareAbout = ("stdscience", "distribution", "summitcopy", "registration"); 35 29 36 30 37 timePoll($period); 31 while(1) { 38 32 39 ########################################################################### 40 # 41 # Updates the labels from pantasks for all interested servers 42 # 43 ########################################################################### 44 sub updateLabels { 45 46 print "* Updating labels\n"; 47 my @servers = ("stdscience", "distribution", "publishing", "update"); 48 49 my $server = undef; 50 foreach $server (@servers) { 51 52 my @labels = @{$pantasks->getLabels($server)}; 53 if (@labels) { 54 55 $czarDb->updateCurrentLabels($server, \@labels); 56 } 57 else { 58 59 print "WARNING: No labels to update for '$server'\n"; 60 } 61 } 33 checkServers("20 MINUTE"); 34 sleep(1200); 62 35 } 63 36 64 37 ########################################################################### 65 38 # 66 # Updates pantasks server status TODO should really get info for all servers at once39 # Checks tha the important servers are running 67 40 # 68 41 ########################################################################### 69 sub updateServerStatus {70 print "* Checking all pantasks servers\n";42 sub checkServers { 43 my ($interval) = @_; 71 44 72 my $servers = $pantasks->getServerList(); 45 my $server; 46 foreach $server (@serversWeCareAbout) { 73 47 74 my $server = undef; 75 my $alive = undef; 76 my $running = undef; 77 foreach $server (@{$servers}) { 48 if ($czarDb->isServerDown($server, $interval)) { 78 49 79 $pantasks->getServerStatus($server, \$alive, \$running); 80 $czarDb->updateServerStatus($server, $alive, $running); 81 } 82 } 83 84 ########################################################################### 85 # 86 # Polls with provided period (seconds) 87 # 88 ########################################################################### 89 sub timePoll { 90 my ($period) = @_; 91 92 my $label; 93 my $new; 94 my $full; 95 my $faults; 96 my $stage; 97 my $query = undef; 98 my $str = undef; 99 my $labels = undef; 100 my $updateLabels = undef; 101 my $row = undef; 102 my $begin = undef; 103 my $end = undef; 104 my $priority = undef; 105 my $newState = undef; 106 my $nsStatus = undef; 107 108 while (1) { 109 110 # sort out times 111 $begin = strftime('%Y-%m-%d 06:35',localtime); 112 $end = $czarDb->getNowTimestamp(); 113 114 if ($czarDb->isBefore($end, $begin)) { 115 116 $begin = $czarDb->subtractInterval($begin, "1 DAY"); 50 print "$server has been down for the last $interval\n"; 51 sendEmail( 52 "roydhenderson\@gmail.com", 53 "roboczar\@ipp.com", 54 "Roboczar update", 55 "\n\n* '$server' server has been down for the last $interval\n\n"); 117 56 } 118 119 # check nightly science status 120 print "* Checking nightly science status\n"; 121 if (!$pantasks->getNightlyScienceStatus(\$nsStatus)) {$nsStatus = "Unknown";} 122 $czarDb->updateNightlyScience($nsStatus); 123 124 # check nebulous 125 print "* Checking Nebulous\n"; 126 $nebulous->updateClusterSpaceInfo(); 127 $plotter->plotDiskUsageHistogram(); 128 updateServerStatus(); 129 130 # check labels 131 updateLabels(); 132 133 # servers to check 134 my @serversToCheck = ("stdscience", "update"); 135 136 my $thisServer = undef; 137 foreach $thisServer (@serversToCheck) { 138 139 if ($thisServer eq "update") {$newState = "update";} 140 else {$newState = "new";} 141 142 # deal with stdscience labels 143 if (!$czarDb->getCurrentLabels($thisServer, \$labels)) {next;} 144 my $size = @{$labels}; 145 if($size > 0) { 146 147 # get priority 148 foreach $row ( @{$labels} ) { 149 my ($label) = @{$row}; 150 $priority = $gpc1Db->getPriority($label); 151 $czarDb->setLabelPriority($label, $priority); 152 } 153 154 updateAllStages($thisServer, $newState, $labels, $begin, $end); 155 createPlots($thisServer, $labels, $begin, $end); 156 } 157 else { print "* WARNING: no $thisServer labels found in Db\n";} 158 } 159 160 print "--------------------------------------------------------------------------\n"; 161 print "* Going to sleep\n"; 162 sleep($period); 163 print "* Waking up\n"; 164 165 #sendEmail("roydhenderson\@gmail.com", "roboczar\@ipp.com", "Roboczar update", "Some content"); 166 }; 167 } 168 169 ########################################################################### 170 # 171 # Loops through labels and creates time series and histogram plots 172 # 173 ########################################################################### 174 sub createPlots { 175 my ($server, $rows, $begin, $end) = @_; 176 177 my $stage = undef; 178 my $row = undef; 179 180 print "* Generating plots\n"; 181 182 # create plots for each label for each stage 183 foreach $stage (@stages) { 184 foreach $row ( @{$rows} ) { 185 my ($label) = @{$row}; 186 187 chomp($label); 188 $plotter->createLogAndLinearTimeSeries($label, $stage, $begin, $end); 57 else { 58 #print "$server has been running for some of the last $interval\n"; 189 59 } 190 60 } 191 192 # create plots for each label for all stages 193 foreach $row ( @{$rows} ) { 194 my ($label) = @{$row}; 195 196 $plotter->createLogAndLinearTimeSeries($label, undef, $begin, $end); 197 $plotter->createHistogram($label, $begin, $end); 198 199 #routineChecks($label, "1 HOUR"); 200 } 201 $plotter->createLogAndLinearTimeSeries("all_".$server."_labels", undef, $begin, $end); 202 $plotter->createHistogram("all_".$server."_labels", $begin, $end); 203 foreach $stage (@stages) { 204 205 $plotter->createLogAndLinearTimeSeries("all_".$server."_labels", $stage, $begin, $end); # TODO must be a neater way... 206 } 207 } 208 209 ########################################################################### 210 # 211 # Loops through some labels and updates processed/pending/faults in the Db 212 # 213 ########################################################################### 214 sub updateAllStages { 215 my ($labelServer, $newState, $rows, $begin, $end) = @_; 216 217 print "* Updating stage data\n"; 218 my $totalNew = undef; 219 my $totalFaults = undef; 220 my $totalFull = undef; 221 my $stage = undef; 222 my $reverting = 0; 223 my $row = undef; 224 my $new = undef; 225 my $full = undef; 226 my $faults = undef; 227 my $server = undef; 228 my $state = undef; 229 230 foreach $stage (@stages) { 231 232 $server = $pantasks->getServerForThisStage($stage); 233 $pantasks->getRevertStatus($stage, \$reverting); 234 $czarDb->updateRevertStatus($stage, $reverting); 235 236 print "* Checking labels for $stage stage\n"; 237 238 $totalNew=$totalFaults=$totalFull=0; 239 foreach $row ( @{$rows} ) { 240 my ($label) = @{$row}; 241 242 chomp($label); 243 244 if ($stage eq "burntool") { 245 246 if ($labelServer eq "stdscience") { 247 248 $burntool->getPendingAndProcessed($label, \$new, \$full); 249 $faults = 0; 250 } 251 else { $new = $full = $faults = 0;} 252 } 253 else { 254 255 $new = $gpc1Db->countExposures($label, $stage, $newState); 256 $full = $gpc1Db->countExposures($label, $stage, "full"); 257 $faults = $gpc1Db->countFaults($label, $stage, $newState); 258 } 259 #printf("%s %s, %s, %d, %d\n", $labelServer, $label, $stage, $new, $faults); 260 $totalNew += $new; 261 $totalFull += $full; 262 $totalFaults += $faults; 263 264 $czarDb->insertNewTimeData($stage, $label, $new, $full, $faults); 265 } 266 267 $czarDb->insertNewTimeData($stage, "all_".$labelServer."_labels", $totalNew, $totalFull, $totalFaults); 268 } 269 } 270 271 ########################################################################### 272 # 273 # Performs some routine checks on processing status and sends alerts if it needs to 274 # 275 ########################################################################### 276 sub routineChecks { 277 my ($label, $interval) = @_; 278 279 my $faultsNow; 280 my $faultsInPast; 281 my $newFaults; 282 my $pendingNow; 283 my $processedRecently; 284 my $stage = undef; 285 286 print "* Checking all stages for label $label\n"; 287 288 foreach $stage (@stages) { 289 290 # check for increasing faults 291 $faultsNow = $czarDb->countFaultsInPast($label, $stage, "0 MINUTE"); 292 $faultsInPast = $czarDb->countFaultsInPast($label, $stage, $interval); 293 if ($faultsNow > $faultsInPast) { 294 $newFaults = $faultsNow - $faultsInPast; 295 print "There have been $newFaults new faults in the last $interval (label='$label', stage='$stage')\n"; 296 } 297 298 # check for lack of processing 299 $pendingNow = $czarDb->countPendingNow($label, $stage); 300 $processedRecently = $czarDb->countProcessed($label, $stage, $interval); 301 if ($pendingNow > 0 && $processedRecently < 1) { 302 303 print "Only $processedRecently exposures have processed out of $pendingNow($faultsNow) pending in the last $interval (label='$label', stage='$stage')\n"; 304 305 } 306 } 307 } 61 } 308 62 309 63 ###########################################################################
Note:
See TracChangeset
for help on using the changeset viewer.
