Changeset 28887
- Timestamp:
- Aug 10, 2010, 4:22:42 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
ippScripts/scripts/automate_stacks.pl (modified) (12 diffs)
-
ippTasks/nightly_stacks.pro (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/automate_stacks.pl
r28875 r28887 25 25 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 26 26 my $mkBTpcontrol = can_run('make_burntool_pcontrol.pl') or (warn "Can't find make_burntool_pcontrol.pl" and $missing_tools = 1); 27 my $moondata = can_run('moondata') or (warn "Can't find moondata" and $missing_tools = 1); 27 28 28 29 if ($missing_tools) { … … 43 44 my ( $help, $isburning, $force_stack_count, $test_mode, $this_target_only, $this_filter_only, $this_mode_only, $check_mode, $burntool_stats); 44 45 my ( $check_registration, $define_burntool, $queue_burntool, $check_chips, $queue_chips); 45 my ( $check_stacks, $queue_stacks, $check_ diffs, $queue_diffs, $clean_old);46 my ( $check_stacks, $queue_stacks, $check_sweetspot, $queue_sweetspot, $check_diffs, $queue_diffs, $clean_old); 46 47 my ( $check_detrends, $queue_detrends, $check_dqstats, $queue_dqstats); 47 48 … … 69 70 'check_stacks' => \$check_stacks, 70 71 'queue_stacks' => \$queue_stacks, 72 'check_sweetspot' => \$check_sweetspot, 73 'queue_sweetspot' => \$queue_sweetspot, 71 74 'check_detrends' => \$check_detrends, 72 75 'queue_detrends' => \$queue_detrends, … … 99 102 --check_stacks Confirm that stacks can be built. 100 103 --queue_stacks Issue stacktool commands to queue stacks. 104 --check_sweetspot See if we should queue SweetSpot stacks. 105 --queue_sweetspot Issue stacktool commands to queue SweetSpot stacks. 101 106 --check_detrends Confirm that detrend verify runs can be built. 102 107 --queue_detrends Issue dettool commands to queue detrend verify runs. … … 113 118 ) unless 114 119 defined $check_registration or defined $define_burntool or defined $queue_burntool or 115 defined $queue_chips or defined $queue_stacks or $queue_ detrends or $queue_dqstats or116 defined $check_chips or defined $check_stacks or $check_ detrends or $check_dqstats or120 defined $queue_chips or defined $queue_stacks or $queue_sweetspot or $queue_detrends or $queue_dqstats or 121 defined $check_chips or defined $check_stacks or $check_sweetspot or $check_detrends or $check_dqstats or 117 122 defined $test_mode or defined $clean_old or defined $check_mode; 118 123 … … 306 311 unless (defined($test_mode) || defined($check_mode)) { exit(0); } 307 312 } 313 308 314 if (defined($check_dqstats) || defined($test_mode)) { 309 315 $metadata_out{nsState} = 'CHECKDQSTATS'; … … 318 324 unless (defined($test_mode)) { exit(0); } 319 325 } 326 320 327 if (defined($check_detrends) || defined($test_mode) || defined($check_mode)) { 321 328 $metadata_out{nsState} = 'CHECKDETRENDS'; … … 330 337 exit(0); 331 338 } 339 332 340 if (defined($define_burntool) || defined($test_mode)) { 333 341 $metadata_out{nsState} = 'QUEUEBURNING'; … … 341 349 unless (defined($test_mode)) { exit(0); } 342 350 } 351 343 352 if (defined($check_chips) || defined($test_mode) || defined($check_mode)) { 344 353 $metadata_out{nsState} = 'QUEUECHIPS'; … … 356 365 exit(0); 357 366 } 367 358 368 if (defined($check_stacks) || defined($test_mode) || defined($check_mode)) { 359 369 $metadata_out{nsState} = 'TOWARP'; … … 374 384 exit(0); 375 385 } 386 387 if (defined($check_sweetspot) || defined($test_mode) || defined($check_mode)) { 388 $metadata_out{nsState} = 'CHECKSWEETSPOT'; 389 &execute_sweetspot($date,"pretend"); 390 return_metadata($date); 391 unless (defined($test_mode) || defined($check_mode)) { exit(0); } 392 } 393 if (defined($queue_sweetspot)) { 394 $metadata_out{nsState} = 'CHECKSWEETSPOT'; 395 &execute_sweetspot($date); 396 return_metadata($date); 397 exit(0); 398 } 399 376 400 if (defined($check_diffs) || defined($queue_diffs)) { 377 401 die("Diffs are currently not implemented."); 378 402 } 403 379 404 if (defined($clean_old) || defined($test_mode)) { 380 405 if (defined($test_mode)) { … … 864 889 if (($metadata_out{nsState} eq 'CHECKDETRENDS') && ($exposures > 0)) { 865 890 $metadata_out{nsState} eq 'QUEUEDETRENDS'; 891 } 892 } 893 894 # 895 # SweetSpot Stacking 896 ################################################################################ 897 sub construct_sweetspot_cmd { 898 my $date = shift; 899 my $target = 'SweetSpot'; 900 my $filter = 'w.00000'; 901 902 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 903 904 # Dateobs begin end? 905 my ($dateobs_begin,$dateobs_end) = get_lunation_extent($date); 906 my $select = "-select_dateobs_begin ${dateobs_begin}T00:00:00 -select_dateobs_end ${dateobs_end}T00:00:00"; 907 my $cmd = "$stacktool"; 908 $cmd .= " -simple -dbname $dbname -definebyquery "; 909 $cmd .= " -set_label SweetSpot.refstack -select_label $label "; 910 $cmd .= " -set_workdir $workdir -set_dist_group $dist_group "; 911 $cmd .= " -select_filter $filter -set_data_group $data_group "; 912 $cmd .= " -select_good_frac_min 0.1 -select_fwhm_major_max 8.0 "; 913 $cmd .= " -min_num 7 -min_new 4"; 914 $cmd .= " $select "; 915 if ($debug == 1) { 916 $cmd .= ' -pretend '; 917 } 918 print STDERR "$cmd\n"; 919 return($cmd); 920 } 921 922 sub get_lunation_extent { 923 my $date = shift; 924 my ($year,$month,$day) = split /-/,$date; 925 my $dateobs_begin; 926 my $dateobs_end; 927 928 my $dt = DateTime->new(year => $year, month => $month, day => $day, 929 hour => 0, minute => 0, second => 0, nanosecond => 0, 930 time_zone => 'Pacific/Honolulu'); 931 do { 932 $dt->subtract(days => 1); 933 my $ymd = $dt->ymd; 934 my $md_cmd = "moondata $ymd 0 0"; 935 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 936 run ( command => $md_cmd, verbose => $verbose); 937 unless ($success) { 938 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 939 &my_die("Unable to perform moondata: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR); 940 } 941 my @result = split /\s+/,(join "\n", @$stdout_buf); 942 if (abs($result[6]) <= 0.5) { 943 $dateobs_end = $ymd; 944 } 945 } while (!defined($dateobs_end)); 946 947 do { 948 $dt->subtract(days => 1); 949 my $ymd = $dt->ymd; 950 my $md_cmd = "moondata $ymd 0 0"; 951 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 952 run ( command => $md_cmd, verbose => $verbose); 953 unless ($success) { 954 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 955 &my_die("Unable to perform moondata: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR); 956 } 957 my @result = split /\s+/,(join "", @$stdout_buf); 958 if (abs($result[6]) <= 0.5) { 959 $dateobs_begin = $ymd; 960 } 961 } while (!defined($dateobs_begin)); 962 963 return($dateobs_begin,$dateobs_end); 964 } 965 966 sub pre_sweetspot_queue { 967 my $date = shift; 968 my $command = construct_sweetspot_cmd($date) . ' -pretend '; 969 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 970 run ( command => $command, verbose => $verbose ); 971 unless ($success) { 972 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 973 &my_die("Unable to perform sweetspot stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 974 } 975 my @stacks = split /\n/, (join '', @$stdout_buf); 976 my $Nstacks = $#stacks + 1; 977 978 return(1,$Nstacks); 979 } 980 981 sub sweetspot_queue { 982 my $date = shift; 983 my $command = construct_sweetspot_cmd($date); 984 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 985 run ( command => $command, verbose => $verbose ); 986 unless ($success) { 987 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 988 &my_die("Unable to perform sweetspot stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 989 } 990 my @stacks = split /\n/, (join '', @$stdout_buf); 991 my $Nstacks = $#stacks + 1; 992 993 return(1,$Nstacks); 994 } 995 996 sub execute_sweetspot { 997 my $date = shift; 998 my $pretend = shift; 999 1000 my ($is_lunation_date,$Nstacks) = pre_sweetspot_queue($date); 1001 if ($Nstacks == 0) { 1002 print STDERR "execute_sweetspot: No new stacks to make ($Nstacks)\n"; 1003 $metadata_out{nsState} = 'SS_EMPTY'; 1004 return(); 1005 } 1006 if ($Nstacks < 10) { 1007 print STDERR "execute_sweetspot: Too few new stacks to make ($Nstacks)\n"; 1008 $metadata_out{nsState} = 'SS_FEW'; 1009 return(); 1010 } 1011 if ($is_lunation_date == 0) { 1012 print STDERR "execute_sweetspot: Invalid lunation date. ($date $is_lunation_date)\n"; 1013 $metadata_out{nsState} = 'SS_ERROR'; 1014 return(); 1015 } 1016 $metadata_out{nsState} = 'SS_QUEUE'; 1017 $metadata_out{nsSweetSpot} = $Nstacks; 1018 unless(defined($pretend)) { 1019 $metadata_out{nsState} = 'SS_DONE'; 1020 sweetspot_queue($date); 866 1021 } 867 1022 } -
trunk/ippTasks/nightly_stacks.pro
r28538 r28887 7 7 ns.detrends.off 8 8 ns.dqstats.on 9 ns.sweetspot.on 9 10 ns.registration.on 10 11 ns.burntool.on … … 17 18 ns.detrends.off 18 19 ns.dqstats.off 20 ns.sweetspot.off 19 21 ns.registration.off 20 22 ns.burntool.off … … 49 51 end 50 52 53 macro ns.sweetspot.on 54 task ns.sweetspot.load 55 active true 56 end 57 end 58 51 59 macro ns.registration.on 52 60 task ns.registration.load … … 96 104 macro ns.dqstats.off 97 105 task ns.dqstats.load 106 active false 107 end 108 end 109 110 macro ns.sweetspot.off 111 task ns.sweetspot.load 98 112 active false 99 113 end … … 263 277 264 278 command automate_stacks.pl --queue_dqstats --date $today 279 end 280 281 task.exit 0 282 # nothing to do here 283 end 284 # locked list 285 task.exit default 286 showcommand failure 287 end 288 task.exit crash 289 showcommand crash 290 end 291 # operation times out 292 task.exit timeout 293 showcommand timeout 294 end 295 end 296 297 # 298 # Queue sweetspot runs 299 # 300 task ns.sweetspot.load 301 host local 302 periods -poll 3600 303 periods -exec $LOADEXEC 304 periods -timeout 30 305 trange 02:00:00 02:59:59 -nmax 1 306 npending 1 307 308 task.exec 309 stdout $LOGDIR/ns.sweetspot.log 310 stderr $LOGDIR/ns.sweetspot.log 311 $today = `date +%Y-%m-%d` 312 313 command automate_stacks.pl --queue_sweetspot --date $today 265 314 end 266 315
Note:
See TracChangeset
for help on using the changeset viewer.
