Changeset 30294
- Timestamp:
- Jan 18, 2011, 6:45:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20101215/ippScripts/scripts/nightly_science.pl
r30281 r30294 278 278 279 279 $metadata_out{nsObservingState} = &get_observing_state($date); 280 $metadata_out{nsRegistrationState} = &get_registration_state($date); 280 281 # 281 282 # Mode selection … … 1100 1101 my $Nqueued = 0; 1101 1102 my $is_processing = 0; 1103 my $is_registering; 1104 if ($metadata_out{nsRegistrationState} eq 'REGISTERED') { 1105 $is_registering = 0; 1106 } 1107 else { 1108 $is_registering = 1; 1109 } 1110 1102 1111 foreach my $target (sort (keys %science_config)) { 1103 1112 if ($science_config{$target}{STACKABLE} == 1) { … … 1161 1170 $metadata_out{nsStackPotential} = $Npotential; 1162 1171 $metadata_out{nsStackQueued} = $Nqueued; 1163 if (($Npotential == $Nqueued)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0) ) {1172 if (($Npotential == $Nqueued)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0)&&($is_registering == 0)) { 1164 1173 $metadata_out{nsStackState} = 'FINISHED_STACKS'; 1165 1174 } … … 1294 1303 my $Nnoexp = 0; 1295 1304 my $is_processing = 0; 1305 my $is_registering; 1306 if ($metadata_out{nsRegistrationState} eq 'REGISTERED') { 1307 $is_registering = 0; 1308 } 1309 else { 1310 $is_registering = 1; 1311 } 1312 1296 1313 foreach my $target (sort (keys %science_config)) { 1297 1314 if ($science_config{$target}{DIFFABLE} == 1) { … … 1334 1351 } 1335 1352 } 1336 if (($Npotential == $Nnoexp)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0)) { 1337 $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1338 } 1339 1353 if ($metadata_out{nsObservingState} eq 'END_OF_NIGHT') { 1354 if ($is_processing == 0) { 1355 $metadata_out{nsDiffState} = 'DIFFING'; 1356 } 1357 elsif ($is_registering == 0) { 1358 if ($Npotential == $Nnoexp) { 1359 $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1360 } 1361 elsif ($metadata_out{nsDiffPotential} == $metadata_out{nsDiffQueued}) { 1362 $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1363 } 1364 } 1365 else { 1366 $metadata_out{nsDiffState} = 'DIFFING'; 1367 } 1368 } 1369 else { 1370 $metadata_out{nsDiffState} = 'DIFFING'; 1371 } 1372 1373 # if (($Npotential == $Nnoexp)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0)) { 1374 # $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1375 # } 1376 1377 # if ($is_processing == 1) { 1378 # $metadata_out{nsDiffState} = 'DIFFING'; 1379 # } 1340 1380 } 1341 1381 … … 1461 1501 $metadata_out{nsDiffPotential} += $Npotential; 1462 1502 $metadata_out{nsDiffQueued} += $Nqueued; 1463 if (($metadata_out{nsDiffPotential} == $metadata_out{nsDiffQueued})&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')) {1464 $metadata_out{nsDiffState} = 'FINISHED_DIFFS';1465 }1503 # if (($metadata_out{nsDiffPotential} == $metadata_out{nsDiffQueued})&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')) { 1504 # $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1505 # } 1466 1506 1467 1507 } … … 1580 1620 } 1581 1621 } 1582 1622 # print "$datetime $eon_dt\n"; 1583 1623 if (DateTime->compare($datetime,$eon_dt) < 1) { 1584 1624 return("OBSERVING"); … … 1588 1628 } 1589 1629 } 1630 1631 # This basically does the end of night check, but does it "the hard way," to prevent the time from fooling us. 1632 sub get_registration_state { 1633 my $date = shift; 1634 1635 foreach my $eon (keys %eon_config) { 1636 my $command = "$regtool -processedexp -simple "; 1637 $command .= " -dbname $dbname "; 1638 $command .= " -dateobs_begin ${date}T00:00:00 -dateobs_end ${date}T23:59:59 "; 1639 $command .= " -object $eon_config{$eon}{OBJECT} " if defined($eon_config{$eon}{OBJECT}); 1640 $command .= " -obs_mode $eon_config{$eon}{OBSMODE} " if defined($eon_config{$eon}{OBSMODE}); 1641 $command .= " -exp_type $eon_config{$eon}{EXPTYPE} " if defined($eon_config{$eon}{EXPTYPE}); 1642 $command .= " -comment $eon_config{$eon}{COMMENT} " if defined($eon_config{$eon}{COMMENT}); 1643 1644 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1645 run ( command => $command, verbose => $verbose ); 1646 unless ($success) { 1647 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1648 &my_die("Unable to perform regtool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1649 } 1650 my @eon_exposures = split /\n/, (join '', @$stdout_buf); 1651 if ($#eon_exposures >= 0) { 1652 return("REGISTERED"); 1653 } 1654 } 1655 return("NOT_REGISTERED"); 1656 } 1657 1658 1590 1659 1591 1660 sub get_tool_parameters {
Note:
See TracChangeset
for help on using the changeset viewer.
