IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30049


Ignore:
Timestamp:
Dec 15, 2010, 1:29:28 PM (15 years ago)
Author:
watersc1
Message:

Merge of realtime burntool and new nightly science code into trunk.

Location:
trunk
Files:
41 edited
5 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/dbconfig/changes.txt

    r29971 r30049  
    19941994
    19951995-- Version 1.1.67
     1996
     1997ALTER TABLE rawImfile ADD column video_cells TINYINT AFTER burntool_state;
  • trunk/dbconfig/raw.md

    r27149 r30049  
    141141    md5sum      STR         32
    142142    burntool_state  S16     0
     143    video_cells BOOL        f
    143144END
  • trunk/ippScripts/Build.PL

    r29530 r30049  
    105105        scripts/whichimage
    106106        scripts/automate_stacks.pl
     107        scripts/nightly_science.pl
    107108        scripts/lossy_compress_imfile.pl
    108109        scripts/ipp_apply_burntool.pl
     110        scripts/ipp_apply_burntool_single.pl
    109111        scripts/make_burntool_pcontrol.pl
    110112        scripts/bundle_detrends.pl
  • trunk/ippScripts/MANIFEST

    r28375 r30049  
    3737scripts/ds9_cmf_regions.pl
    3838scripts/automate_stacks.pl
     39scripts/nightly_science.pl
    3940scripts/lossy_compress_imfile.pl
    4041scripts/ipp_apply_burntool.pl
     42scripts/ipp_apply_burntool_single.pl
    4143scripts/make_burntool_pcontrol.pl
    4244scripts/bundle_detrends.pl
  • trunk/ippScripts/scripts/register_exp.pl

    r27891 r30049  
    3030my $regtool = can_run('regtool') or (warn "can't find regtool" and $missing_tools = 1);
    3131my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
     32my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    3233if ($missing_tools) {
    3334    warn ("Can't find required tools");
     
    118119if (uc($exp_type) eq "NULL") { &my_die ("exp_type  not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
    119120
     121my ($data_group,$dist_group,$chip_workdir,$reduction);
     122($label,$data_group,$dist_group,$end_stage,
     123 $tess_id,$chip_workdir,$reduction) = advance_decisions(&value_for_flag($cmdflags,"-dateobs"),
     124                                                        &value_for_flag($cmdflags,"-exp_type"),
     125                                                        &value_for_flag($cmdflags,"-obs_mode"),
     126                                                        &value_for_flag($cmdflags,"-object"),
     127                                                        &value_for_flag($cmdflags,"-comment"),
     128                                                        $dbname);
    120129my $command = "$regtool -addprocessedexp";
    121130$command .= " -exp_id $exp_id";
     
    127136$command .= " -end_stage $end_stage" if defined $end_stage;
    128137$command .= " -tess_id   $tess_id"   if defined $tess_id;
     138$command .= " -data_group $data_group" if defined $data_group;
     139$command .= " -dist_group $dist_group" if defined $dist_group;
     140$command .= " -chip_workdir $chip_workdir" if defined $chip_workdir;
     141$command .= " -reduction  $reduction"  if defined $reduction;
    129142$command .= " -state full";
    130143$command .= " $cmdflags";
     
    156169
    157170### Pau.
     171sub advance_decisions {
     172    my $dateobs = shift;
     173    my $exptype = shift;
     174    my $obsmode = shift;
     175    my $object  = shift;
     176    my $comment = shift;
     177    my $dbname  = shift;
     178
     179    # The strings come pre-quoted.
     180    $dateobs =~ s/\'//g;
     181    $exptype =~ s/\'//g;
     182    $obsmode =~ s/\'//g;
     183    $object =~ s/\'//g;
     184    $comment =~ s/\'//g;
     185
     186    print "Inside decision engine\n";
     187    my ($label,$data_group,$dist_group,$end_stage,$tess_id,$chip_workdir,$reduction);
     188    my $target;
     189
     190    if ($exptype ne 'OBJECT') {
     191        print "Aborting because exptype doesn't claim to be OBJECT: $exptype\n";
     192        return(undef,undef,undef,"reg",undef,undef,undef);
     193    }
     194    if ($obsmode eq 'ENGINEERING') {
     195        print "Aborting because we don't queue engineering data to chip\n";
     196        return(undef,undef,undef,"reg",undef,undef,undef);
     197    }
     198    # Grab the configuration data.
     199    my %nightlyscience_config = ();
     200    my $conf_cmd = "$ppConfigDump -dump-recipe NIGHTLY_SCIENCE -";
     201    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     202        run(command => $conf_cmd, verbose => $verbose);
     203    unless ($success) {
     204        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     205        &my_die("Unable to perform ppConfigDump: $error_code", $date, $PS_EXIT_SYS_ERROR);
     206    }
     207    print "data loaded\n";
     208    my $mdcParser = PS::IPP::Metadata::Config->new;
     209    my $metadata = $mdcParser->parse(join "", @$stdout_buf);
     210    foreach my $entry (@{ $metadata }) {
     211        if (${ $entry }{name} eq 'TARGETS') {
     212            my @target_data = @{ ${ $entry }{value} };
     213            my $this_target = '';
     214            foreach my $tentry (@target_data) {
     215                if (${ $tentry }{name} eq 'NAME') {
     216                    $this_target = ${ $tentry }{value};
     217                    $nightlyscience_config{$this_target}{DISTRIBUTION} = $this_target;
     218                }
     219                elsif (${ $tentry }{name} eq 'DISTRIBUTION') {
     220                    $nightlyscience_config{$this_target}{DISTRIBUTION} = ${ $tentry }{value};
     221                }
     222                elsif (${ $tentry }{name} eq 'TESS') {
     223                    $nightlyscience_config{$this_target}{TESS_ID} = ${ $tentry }{value};
     224                }
     225                elsif (${ $tentry }{name} eq 'OBSMODE') {
     226                    $nightlyscience_config{$this_target}{OBSMODE} = ${ $tentry }{value};
     227                    $nightlyscience_config{$this_target}{OBSMODE} =~ s/%/\.\*/g;
     228                }
     229                elsif (${ $tentry }{name} eq 'OBJECT') {
     230                    $nightlyscience_config{$this_target}{OBJECT} = ${ $tentry }{value};
     231                    $nightlyscience_config{$this_target}{OBJECT} =~ s/%/\.\*/g;
     232                }
     233                elsif (${ $tentry }{name} eq 'COMMENT') {
     234                    $nightlyscience_config{$this_target}{COMMENT} = ${ $tentry }{value};
     235                    $nightlyscience_config{$this_target}{COMMENT} =~ s/%/\.\*/g;
     236                }
     237                elsif (${ $tentry }{name} eq 'STACKABLE') {
     238                    $nightlyscience_config{$this_target}{STACKABLE} = ${ $tentry }{value};
     239                }
     240                elsif (${ $tentry }{name} eq 'DIFFABLE') {
     241                    $nightlyscience_config{$this_target}{DIFFABLE} = ${ $tentry }{value};
     242                }
     243                elsif (${ $tentry }{name} eq 'REDUCTION') {
     244                    $nightlyscience_config{$this_target}{REDUCTION} = ${ $tentry }{value};
     245                }
     246            }
     247        }
     248    }
     249    print "data parsed\n";
     250    my $found_target;
     251    foreach $target (keys %nightlyscience_config) {
     252#       print "TEST: $target ($obsmode $object $comment) ($nightlyscience_config{$target}{OBSMODE} $nightlyscience_config{$target}{OBJECT} $nightlyscience_config{$target}{COMMENT}\t";
     253        my $match = 0;
     254        my $possible = 0;
     255        if (exists($nightlyscience_config{$target}{OBSMODE})) {
     256            $possible++;
     257            if ($obsmode =~ /$nightlyscience_config{$target}{OBSMODE}/) {
     258                $match++;
     259            }
     260        }
     261        if (exists($nightlyscience_config{$target}{OBJECT})) {
     262            $possible++;
     263            if ($object =~ /$nightlyscience_config{$target}{OBJECT}/) {
     264                $match++;
     265            }
     266        }
     267        if (exists($nightlyscience_config{$target}{COMMENT})) {
     268            $possible++;
     269            if ($comment =~ /$nightlyscience_config{$target}{COMMENT}/) {
     270                $match++;
     271            }
     272        }
     273        print "$possible $match\n";
     274        if (($possible > 0)&&($match == $possible)) {
     275            $found_target = $target;
     276            last;
     277        }
     278    }
     279    unless ($found_target) {
     280        print "No acceptible target found.\n";
     281        return(undef,undef,undef,"reg",undef,undef,undef);
     282    }
     283    print "Found this target: $found_target\n";
     284    print "$dateobs\n";
     285    $target = $found_target;
     286   
     287    my $date  = $dateobs;
     288    $date =~ s/T.*//;
     289    my $workdir_date = $date;
     290    $date =~ s/-//g;
     291    $workdir_date =~ s%-%/%g;
     292    print "$dateobs $date $workdir_date\n";   
     293    $label = "${target}.nightlyscience";
     294    $data_group = "${target}.${date}";
     295    $dist_group = $nightlyscience_config{$target}{DISTRIBUTION};
     296    $end_stage  = 'warp';
     297    $tess_id    = $nightlyscience_config{$target}{TESS_ID};
     298    $chip_workdir = "neb://\@HOST\@.0/${dbname}/${target}.nt/${workdir_date}/";
     299    if (exists($nightlyscience_config{$target}{REDUCTION})) {
     300        $reduction  = $nightlyscience_config{$target}{REDUCTION};
     301    }
     302    else {
     303        undef($reduction);
     304    }
     305
     306   
     307    return ($label,$data_group,$dist_group,$end_stage,$tess_id,$chip_workdir,$reduction);
     308}
     309           
     310           
     311           
    158312
    159313sub cache_run
  • trunk/ippScripts/scripts/register_imfile.pl

    r27891 r30049  
    1919use File::Basename qw( basename);
    2020use IPC::Run;
    21 use IPC::Cmd 0.36 qw( can_run );
     21use IPC::Cmd 0.36 qw( can_run run );
    2222use PS::IPP::Config 1.01 qw( :standard );
     23use PS::IPP::Metadata::List qw( parse_md_list );
    2324use PS::IPP::Metadata::Config;
    2425use Math::Trig;
     
    3536my $ppStatsFromMetadata = can_run( 'ppStatsFromMetadata' ) or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    3637my $ppConfigDump = can_run( 'ppConfigDump' ) or (warn "Can't find ppConfigDump" and $missing_tools = 1);
     38my $ippApplyBurntoolSingle = can_run( 'ipp_apply_burntool_single.pl' ) or (warn "Can't find ipp_apply_burntool_single" and $missing_tools = 1);
    3739
    3840my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $bytes, $md5sum, $dbname, $verbose, $no_update, $no_op, $logfile);
     
    8284
    8385my $cmdflags;
     86my $burntoolStateGood;
    8487# Run ppStats on the input file
    8588{
     
    114117    my $burntoolState = 0;
    115118    my $isGPC1 = 0;
    116     my $burntoolStateGood = 0;
     119    $burntoolStateGood = 0;
    117120    foreach my $line (split /\n/, $out1) {
    118121        if ($line =~ /FPA.BURNTOOL.APPLIED/) {
     
    174177$command .= " -hostname $host" if defined $host;
    175178$command .= " -dbname $dbname" if defined $dbname;
    176 $command .= " -data_state full";
     179$command .= " -data_state check_burntool";
    177180$command .= " $cmdflags";
    178181
     182print "$command\n";
    179183# determine solar-system parameters
    180184my $longitude = &value_for_flag($cmdflags, 0.0, "-longitude");
     
    206210    }
    207211}
     212
     213# This might have a race condition
     214# $date_end = $dateobs;
     215# $date_start = $dateobs - 30 minutes ? dateobs_UTC_midnight?
     216# lock file?
     217# if exp_type = DARK and date > MIDNIGHT HST { wait }
     218# system("ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $date_start --dateobs_end $date_end --dbname gpc1 --logfile /data/$host.0/burntool_logs/$class_id.$start_date.log");
    208219
    209220$now_time = localtime();
     
    222233    print "skipping command: $command\n";
    223234}
     235
     236# We now have an imfile in the database, check if we can burntool it.  If not, continue on.
     237
     238{
     239    my $mdcParser  = PS::IPP::Metadata::Config->new;
     240
     241    my $class_id   = &value_for_flag($cmdflags, 0.0, "-class_id");
     242    my $check_date       = &value_for_flag($cmdflags, 0.0, "-dateobs");
     243    $check_date =~ s/T.*$//;
     244    my $exp_name   = $tmp_exp_name;
     245   
     246
     247    my $bt_check_command = "$regtool -checkburntoolimfile ";
     248    $bt_check_command .= " -class_id $class_id ";
     249    $bt_check_command .= " -date $check_date ";
     250    $bt_check_command .= " -valid_burntool $burntoolStateGood ";
     251    $bt_check_command .= " -exp_name $exp_name ";
     252    $bt_check_command .= " -dbname $dbname" if defined $dbname;
     253
     254    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     255        run ( command => $bt_check_command, verbose => $verbose);
     256    unless ($success) {
     257        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     258        &my_die("Unable to perform regtool: $error_code",
     259                $class_id, $exp_name, $date, $PS_EXIT_SYS_ERROR);
     260    }
     261
     262    my @whole = split /\n/, (join "", @$stdout_buf);
     263    my @single = ();
     264    my $exposures;
     265    while ( scalar @whole > 0 ) {
     266        my $value = shift @whole;
     267        push @single, $value;
     268        if ($value =~ /^\s*END\s*$/) {
     269            push @single, "\n";
     270           
     271            my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) );
     272            &my_die("Unable to parse output from regtool",
     273                    $class_id, $exp_name, $date, $PS_EXIT_SYS_ERROR) unless
     274                        defined $list;
     275            push @{ $exposures }, @$list;
     276            @single = ();
     277        }
     278    }
     279   
     280    # We only care about the final entry, as that contains the exposure we are.
     281   
     282    my $regtool_update = "$regtool -updateprocessedimfile ";
     283    $regtool_update .= "-dbname $dbname " if defined $dbname;
     284    $regtool_update .= "-exp_id $exp_id -class_id $class_id ";
     285
     286    my $burntool_data = pop(@{ $exposures });
     287    if ($burntool_data->{burnable} == 0) {
     288        $regtool_update .= " -burntool_state 0 -set_state pending_burntool ";
     289    }
     290    else {
     291        my $apply_command = "$ippApplyBurntoolSingle --dbname $dbname ";
     292        $apply_command .= " --class_id $class_id --exp_id $exp_id ";
     293        $apply_command .= " --this_uri $burntool_data->{uri} ";
     294        $apply_command .= " --previous_uri $burntool_data->{previous_uri} " if defined $burntool_data->{previous_uri};
     295        $apply_command .= " --imfile_state $burntool_data->{imfile_state} ";
     296        $apply_command .= " --verbose " if $verbose;
     297        print "$apply_command\n";
     298        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     299            IPC::Cmd::run(command => $apply_command, verbose => $verbose);
     300        unless ($success) {
     301            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     302            warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code");
     303            exit($error_code);
     304        }
     305    }   
     306
     307    unless ($no_update) {
     308        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     309            IPC::Cmd::run(command => $regtool_update, verbose => $verbose);
     310        unless ($success) {
     311            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     312            warn ("Unable to perform regtool -addprocessedimfile: $error_code");
     313            exit($error_code);
     314        }
     315    } else {
     316        print "skipping command: $command\n";
     317    }
     318
     319}
     320
     321
    224322
    225323$now_time = localtime();
  • trunk/ippTasks/Makefile.am

    r29614 r30049  
    3636        minidvodb.pro \
    3737        minidvodbcopy.pro \
    38         nightly_stacks.pro \
     38        nightly_science.pro \
    3939        burntool.pro \
    4040        lossy_compress.pro \
     
    4747        site.manoa.pro \
    4848        site.mhpcc.pro \
     49        site.mhpcc_testing.pro \
    4950        surveys.mhpcc.config \
    5051        simtest.pro \
  • trunk/ippTasks/nightly_stacks.pro

    r29656 r30049  
    77    ns.detrends.off
    88    ns.dqstats.on
    9     ns.sweetspot.on
    10     ns.registration.on
    11     ns.burntool.on
    12     ns.chips.on
     9#    ns.sweetspot.on
     10#    ns.registration.on
     11#    ns.burntool.on
     12#    ns.chips.on
    1313    ns.stacks.on
     14    ns.diffs.on
    1415end
    1516
     
    1819    ns.detrends.off
    1920    ns.dqstats.off
    20     ns.sweetspot.off
    21     ns.registration.off
    22     ns.burntool.off
    23     ns.chips.off
     21#    ns.sweetspot.off
     22#    ns.registration.off
     23#    ns.burntool.off
     24#    ns.chips.off
    2425    ns.stacks.off
     26    ns.diffs.off
    2527end
    2628
     
    5153end
    5254
    53 macro ns.sweetspot.on
    54   task ns.sweetspot.load
    55     active true
    56   end
    57 end
    58 
    59 macro ns.registration.on
    60   task ns.registration.load
    61     active true
    62   end
    63 end
    64 
    65 macro ns.burntool.on
    66   task ns.burntool.load
    67     active true
    68   end
    69   task ns.burntool.run
    70     active true
    71   end
    72 end
    73 
    74 macro ns.chips.on
    75   task ns.chips.load
    76     active true
    77   end
    78   task ns.chips.run
    79     active true
    80   end
    81 end
     55# macro ns.sweetspot.on
     56#   task ns.sweetspot.load
     57#     active true
     58#   end
     59# end
     60
     61# macro ns.registration.on
     62#   task ns.registration.load
     63#     active true
     64#   end
     65# end
     66
     67# macro ns.burntool.on
     68#   task ns.burntool.load
     69#     active true
     70#   end
     71#   task ns.burntool.run
     72#     active true
     73#   end
     74# end
     75
     76# macro ns.chips.on
     77#   task ns.chips.load
     78#     active true
     79#   end
     80#   task ns.chips.run
     81#     active true
     82#   end
     83# end
    8284
    8385macro ns.stacks.on
     
    9395end
    9496
     97macro ns.diffs.on
     98  task ns.diffs.load
     99    active false
     100  end
     101  task ns.diffs.run
     102    active true
     103  end
     104end
     105
    95106macro ns.initday.off
    96107  task ns.initday.load
     
    111122end
    112123
    113 macro ns.sweetspot.off
    114   task ns.sweetspot.load
    115     active false
    116   end
    117 end
    118 
    119 macro ns.registration.off
    120   task ns.registration.load
    121     active false
    122   end
    123 end
    124 
    125 macro ns.burntool.off
    126   task ns.burntool.load
    127     active false
    128   end
    129   task ns.burntool.run
    130     active false
    131   end
    132 end
    133 
    134 macro ns.chips.off
    135   task ns.chips.load
    136     active false
    137   end
    138   task ns.chips.run
    139     active false
    140   end
    141 end
     124# macro ns.sweetspot.off
     125#   task ns.sweetspot.load
     126#     active false
     127#   end
     128# end
     129
     130# macro ns.registration.off
     131#   task ns.registration.load
     132#     active false
     133#   end
     134# end
     135
     136# macro ns.burntool.off
     137#   task ns.burntool.load
     138#     active false
     139#   end
     140#   task ns.burntool.run
     141#     active false
     142#   end
     143# end
     144
     145# macro ns.chips.off
     146#   task ns.chips.load
     147#     active false
     148#   end
     149#   task ns.chips.run
     150#     active false
     151#   end
     152# end
    142153
    143154macro ns.stacks.off
     
    150161end
    151162
    152 $ns_regPAGE = 0
    153 $ns_burnPAGE = 0
    154 $ns_RburnPAGE = 0
    155 $ns_RburnCELL = 0
    156 $ns_chipPAGE = 0
    157 $ns_RchipPAGE = 0
     163macro ns.diffs.off
     164  task ns.diffs.load
     165    active false
     166  end
     167  task ns.diffs.run
     168    active false
     169  end
     170end
     171
     172# $ns_regPAGE = 0
     173# $ns_burnPAGE = 0
     174# $ns_RburnPAGE = 0
     175# $ns_RburnCELL = 0
     176# $ns_chipPAGE = 0
     177# $ns_RchipPAGE = 0
    158178$ns_stackPAGE = 0
    159179$ns_RstackPAGE = 0
    160180$ns_CstackPAGE = 0
     181$ns_diffPAGE = 0
     182$ns_RdiffPAGE = 0
    161183
    162184book init nsData
    163 book init nsBurntool
     185# book init nsBurntool
    164186#
    165187# Macros to control the book.
     
    177199       echo $date $state
    178200    end
    179     book npages nsBurntool -var Npages
     201#    book npages nsBurntool -var Npages
    180202end
    181203
     
    198220  periods         -exec $LOADEXEC
    199221  periods         -timeout 30
    200   trange          16:30:00 17:30:00 -nmax 1
     222  trange          0:00:00 1:00:00 -nmax 1
    201223  npending        1
    202224
     
    204226    stdout $LOGDIR/ns.initday.log
    205227    stderr $LOGDIR/ns.initday.log
    206     $today = `date +%Y-%m-%d`
     228    $today = `date -u +%Y-%m-%d`
    207229    book newpage nsData $today
    208230    book setword nsData $today nsState NEW
     
    242264    stdout $LOGDIR/ns.detrends.log
    243265    stdout $LOGDIR/ns.detrends.log
    244     $today = `date +%Y-%m-%d`
     266    $today = `date -u +%Y-%m-%d`
    245267
    246268    command automate_stacks.pl --queue_detrends --date $today
     
    278300    stdout $LOGDIR/ns.dqstats.log
    279301    stderr $LOGDIR/ns.dqstats.log
    280     $today = `date +%Y-%m-%d`
     302    $today = `date -u +%Y-%m-%d`
    281303
    282304    command automate_stacks.pl --queue_dqstats --date $today
     
    313335    stdout $LOGDIR/ns.sweetspot.log
    314336    stderr $LOGDIR/ns.sweetspot.log
    315     $today = `date +%Y-%m-%d`
     337    $today = `date -u +%Y-%m-%d`
    316338
    317339    command automate_stacks.pl --queue_sweetspot --date $today
     
    337359# Check to see if registration is complete
    338360#
    339 task              ns.registration.load
    340   host            local
    341   periods         -poll $LOADPOLL
    342   periods         -exec $LOADEXEC
    343   periods         -timeout 30
    344   npending        1
    345 
    346   task.exec
    347     stdout NULL
    348     stderr $LOGDIR/ns.registration.log
    349 
    350     book getpage nsData $ns_regPAGE -var date
    351     book getword nsData $date nsState -var ns_STATE
    352     book npages nsData -var Npages
    353 
    354     if ($VERBOSE > 5)
    355        echo "ns.registration.load: " $ns_regPAGE $date $ns_STATE $Npages
    356     end
    357 
    358     $ns_regPAGE ++
    359     if ($ns_regPAGE >= $Npages) set ns_regPAGE = 0
    360     option $date
    361 
    362     if ("$ns_STATE" != "NEW") break
    363     $run = automate_stacks.pl --check_registration --date $date
    364     command $run
    365   end
    366 
    367   # success
    368   task.exit   0
    369 #    convert 'stdout' to book format
    370     book delpage nsData $options:0
    371     ipptool2book stdout nsData -uniq -key date
    372 
    373     if ($VERBOSE > 2)
    374         book listbook nsData
    375     end
    376   end
    377 
    378   # locked list
    379   task.exit    default
    380     showcommand failure
    381   end
    382   task.exit    crash
    383     showcommand crash
    384   end
    385   #operation times out?
    386   task.exit    timeout
    387     showcommand timeout
    388   end
    389 end
    390 
    391 #
    392 # Check to see if the chips have been properly burntooled and are ready for queueing
    393 #
    394 task              ns.chips.load
    395   host            local
    396   periods         -poll $LOADPOLL
    397   periods         -exec $LOADEXEC
    398   periods         -timeout 300
    399   npending        1
    400 
    401   task.exec
    402      stdout NULL
    403      stderr $LOGDIR/ns.chips.log
    404 
    405      book getpage nsData $ns_chipPAGE -var date
    406      book getword nsData $date nsState -var ns_STATE
    407      book npages nsData -var Npages
    408 
    409      if ($VERBOSE > 5)
    410         echo "ns.chips.load: " $ns_chipPAGE $date $ns_STATE $Npages
    411      end
    412 
    413      $ns_chipPAGE ++
    414      if ($ns_chipPAGE >= $Npages) set ns_chipPAGE = 0
    415      option $date
    416 
    417      if (("$ns_STATE" != "REGISTERED")&&("$ns_STATE" != "BURNING")) break
    418      $run = automate_stacks.pl --check_chips --date $date
    419 
    420      if ("$ns_STATE" == "BURNING")
    421         $run = $run --isburning
    422      end
    423      command $run
    424    end
    425   # success
    426   task.exit   0
    427 #   convert 'stdout' to book format
    428     book delpage nsData $options:0
    429     ipptool2book stdout nsData -uniq -key date
    430 
    431     # remove the burntool page if we're done with it.
    432     book getword nsData $options:0 nsState -var ns_STATE
    433     if ("$ns_STATE" == "QUEUECHIPS")
    434         book delpage nsBurntool $options:0
    435     end
    436 
    437     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    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
    444     end
    445 
    446     if ($VERBOSE > 2)
    447         book listbook nsData
    448     end
    449   end
    450 
    451   # locked list
    452   task.exit    default
    453     showcommand failure
    454   end
    455   task.exit    crash
    456     showcommand crash
    457   end
    458   #operation times out?
    459   task.exit    timeout
    460     showcommand timeout
    461   end
    462 end
    463 
    464 #
    465 # Check to see if the chips have been properly burntooled and are ready for queueing
    466 #
    467 task              ns.chips.run
    468   host            local
    469   periods         -poll $LOADPOLL
    470   periods         -exec $LOADEXEC
    471   periods         -timeout 120
    472   npending        1
    473 
    474   task.exec
    475      stdout NULL
    476      stderr $LOGDIR/ns.chips.log
    477 
    478      book getpage nsData $ns_RchipPAGE -var date
    479      book getword nsData $date nsState -var ns_STATE
    480      book npages nsData -var Npages
    481 
    482     if ($VERBOSE > 5)
    483        echo "ns.chips.run: " $ns_RchipPAGE $date $ns_STATE $Npages
    484     end
     361# task              ns.registration.load
     362#   host            local
     363#   periods         -poll $LOADPOLL
     364#   periods         -exec $LOADEXEC
     365#   periods         -timeout 30
     366#   npending        1
     367
     368#   task.exec
     369#     stdout NULL
     370#     stderr $LOGDIR/ns.registration.log
     371
     372#     book getpage nsData $ns_regPAGE -var date
     373#     book getword nsData $date nsState -var ns_STATE
     374#     book npages nsData -var Npages
     375
     376#     if ($VERBOSE > 5)
     377#        echo "ns.registration.load: " $ns_regPAGE $date $ns_STATE $Npages
     378#     end
     379
     380#     $ns_regPAGE ++
     381#     if ($ns_regPAGE >= $Npages) set ns_regPAGE = 0
     382#     option $date
     383
     384#     if ("$ns_STATE" != "NEW") break
     385#     $run = automate_stacks.pl --check_registration --date $date
     386#     command $run
     387#   end
     388
     389#   # success
     390#   task.exit   0
     391# #    convert 'stdout' to book format
     392#     book delpage nsData $options:0
     393#     ipptool2book stdout nsData -uniq -key date
     394
     395#     if ($VERBOSE > 2)
     396#       book listbook nsData
     397#     end
     398#   end
     399
     400#   # locked list
     401#   task.exit    default
     402#     showcommand failure
     403#   end
     404#   task.exit    crash
     405#     showcommand crash
     406#   end
     407#   #operation times out?
     408#   task.exit    timeout
     409#     showcommand timeout
     410#   end
     411# end
     412
     413# #
     414# # Check to see if the chips have been properly burntooled and are ready for queueing
     415# #
     416# task              ns.chips.load
     417#   host            local
     418#   periods         -poll $LOADPOLL
     419#   periods         -exec $LOADEXEC
     420#   periods         -timeout 300
     421#   npending        1
     422
     423#   task.exec
     424#      stdout NULL
     425#      stderr $LOGDIR/ns.chips.log
     426
     427#      book getpage nsData $ns_chipPAGE -var date
     428#      book getword nsData $date nsState -var ns_STATE
     429#      book npages nsData -var Npages
     430
     431#      if ($VERBOSE > 5)
     432#       echo "ns.chips.load: " $ns_chipPAGE $date $ns_STATE $Npages
     433#      end
     434
     435#      $ns_chipPAGE ++
     436#      if ($ns_chipPAGE >= $Npages) set ns_chipPAGE = 0
     437#      option $date
     438
     439#      if (("$ns_STATE" != "REGISTERED")&&("$ns_STATE" != "BURNING")) break
     440#      $run = automate_stacks.pl --check_chips --date $date
     441
     442#      if ("$ns_STATE" == "BURNING")
     443#       $run = $run --isburning
     444#      end
     445#      command $run
     446#    end
     447#   # success
     448#   task.exit   0
     449# #   convert 'stdout' to book format
     450#     book delpage nsData $options:0
     451#     ipptool2book stdout nsData -uniq -key date
     452
     453#     # remove the burntool page if we're done with it.
     454#     book getword nsData $options:0 nsState -var ns_STATE
     455#     if ("$ns_STATE" == "QUEUECHIPS")
     456#       book delpage nsBurntool $options:0
     457#     end
     458
     459#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     460#     if ("$ns_Nmacros" != "NULL")
     461#       for i 0 $ns_Nmacros
     462#           sprintf macroName "ns%dMacro" $i
     463#           book getword nsData $options:0 $macroName -var macroCmd
     464#           $macroCmd
     465#       end
     466#     end
     467
     468#     if ($VERBOSE > 2)
     469#       book listbook nsData
     470#     end
     471#   end
     472
     473#   # locked list
     474#   task.exit    default
     475#     showcommand failure
     476#   end
     477#   task.exit    crash
     478#     showcommand crash
     479#   end
     480#   #operation times out?
     481#   task.exit    timeout
     482#     showcommand timeout
     483#   end
     484# end
     485
     486# #
     487# # Check to see if the chips have been properly burntooled and are ready for queueing
     488# #
     489# task              ns.chips.run
     490#   host            local
     491#   periods         -poll $LOADPOLL
     492#   periods         -exec $LOADEXEC
     493#   periods         -timeout 120
     494#   npending        1
     495
     496#   task.exec
     497#      stdout NULL
     498#      stderr $LOGDIR/ns.chips.log
     499
     500#      book getpage nsData $ns_RchipPAGE -var date
     501#      book getword nsData $date nsState -var ns_STATE
     502#      book npages nsData -var Npages
     503
     504#     if ($VERBOSE > 5)
     505#        echo "ns.chips.run: " $ns_RchipPAGE $date $ns_STATE $Npages
     506#     end
    485507     
    486      $ns_RchipPAGE ++
    487      if ($ns_RchipPAGE >= $Npages) set ns_RchipPAGE = 0
    488      option $date
    489 
    490      if ("$ns_STATE" != "QUEUECHIPS") break
    491      $BURNTOOLING = 0
    492      $run = automate_stacks.pl --queue_chips --date $date
    493      command $run
    494    end
    495   # success
    496   task.exit   0
    497 #    convert 'stdout' to book format
    498     book delpage nsData $options:0
    499     ipptool2book stdout nsData -uniq -key date
    500 
    501     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    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
    508     end
    509 
    510     if ($VERBOSE > 2)
    511         book listbook nsData
    512     end
    513   end
    514 
    515   # locked list
    516   task.exit    default
    517     showcommand failure
    518   end
    519   task.exit    crash
    520     showcommand crash
    521   end
    522   #operation times out?
    523   task.exit    timeout
    524     showcommand timeout
    525   end
    526 end
     508#      $ns_RchipPAGE ++
     509#      if ($ns_RchipPAGE >= $Npages) set ns_RchipPAGE = 0
     510#      option $date
     511
     512#      if ("$ns_STATE" != "QUEUECHIPS") break
     513#      $BURNTOOLING = 0
     514#      $run = automate_stacks.pl --queue_chips --date $date
     515#      command $run
     516#    end
     517#   # success
     518#   task.exit   0
     519# #    convert 'stdout' to book format
     520#     book delpage nsData $options:0
     521#     ipptool2book stdout nsData -uniq -key date
     522
     523#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     524#     if ("$ns_Nmacros" != "NULL")
     525#       for i 0 $ns_Nmacros
     526#           sprintf macroName "ns%dMacro" $i
     527#           book getword nsData $options:0 $macroName -var macroCmd
     528#           $macroCmd
     529#       end
     530#     end
     531
     532#     if ($VERBOSE > 2)
     533#       book listbook nsData
     534#     end
     535#   end
     536
     537#   # locked list
     538#   task.exit    default
     539#     showcommand failure
     540#   end
     541#   task.exit    crash
     542#     showcommand crash
     543#   end
     544#   #operation times out?
     545#   task.exit    timeout
     546#     showcommand timeout
     547#   end
     548# end
    527549
    528550
     
    557579     command $run
    558580   end
     581
    559582  # success
    560583  task.exit   0
     
    718741end
    719742
    720 #
    721 # Generate a list of date ranges and chips that need to be processed with burntool
    722 #
    723 task              ns.burntool.load
    724   host            local
    725   periods         -poll $LOADPOLL
    726   periods         -exec $LOADEXEC
    727   periods         -timeout 30
    728   npending        1
    729 
    730   task.exec
    731     stdout NULL
    732     stderr $LOGDIR/ns.burntool.log
    733 
    734     book getpage nsData $ns_burnPAGE -var date
    735     book getword nsData $date nsState -var ns_STATE
    736     book npages nsData -var Npages
    737 
    738     if ($VERBOSE > 5)
    739         echo "ns.burntool.load: " $ns_burnPAGE $date $ns_STATE $Npages
    740     end
    741 
    742     $ns_burnPAGE ++
    743     if ($ns_burnPAGE >= $Npages) set ns_burnPAGE = 0
    744     option $date
     743# #
     744# # Generate a list of date ranges and chips that need to be processed with burntool
     745# #
     746# task              ns.burntool.load
     747#   host            local
     748#   periods         -poll $LOADPOLL
     749#   periods         -exec $LOADEXEC
     750#   periods         -timeout 30
     751#   npending        1
     752
     753#   task.exec
     754#     stdout NULL
     755#     stderr $LOGDIR/ns.burntool.log
     756
     757#     book getpage nsData $ns_burnPAGE -var date
     758#     book getword nsData $date nsState -var ns_STATE
     759#     book npages nsData -var Npages
     760
     761#     if ($VERBOSE > 5)
     762#         echo "ns.burntool.load: " $ns_burnPAGE $date $ns_STATE $Npages
     763#     end
     764
     765#     $ns_burnPAGE ++
     766#     if ($ns_burnPAGE >= $Npages) set ns_burnPAGE = 0
     767#     option $date
    745768   
    746     if ("$ns_STATE" != "NEEDSBURNING") break
    747 
    748     $run = automate_stacks.pl --define_burntool --date $date
    749     command $run
    750   end
    751   # success
    752   task.exit   0
    753 #    convert 'stdout' to book format
    754 #    book delpage nsBurntool $options:0
    755     ipptool2book stdout nsBurntool -uniq -key date
    756     book setword nsData $options:0 nsState "QUEUEBURNING"
    757 
    758     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    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
    765     end
    766 
    767     if ($VERBOSE > 2)
    768         book listbook nsData
    769     end
    770   end
    771 
    772   # locked list
    773   task.exit    default
    774     showcommand failure
    775   end
    776   task.exit    crash
    777     showcommand crash
    778   end
    779   #operation times out?
    780   task.exit    timeout
    781     showcommand timeout
    782   end
    783 end
    784 
    785 #
    786 # Magically run burntool on the data, based on the information stored in our book.
    787 #
    788 task              ns.burntool.run
    789   periods         -poll $LOADPOLL
    790   periods         -exec $LOADEXEC
    791   periods         -timeout 10800
    792   npending        30
    793   task.exec
    794      stdout NULL
    795      stderr $LOGDIR/ns.burntool.log
    796 
    797      book getpage nsData $ns_RburnPAGE -var date
    798      book getword nsData $date nsState -var ns_STATE
    799      book npages nsData -var Npages
    800 
    801     if ($VERBOSE > 5)
    802         echo "ns.burntool.run: " $ns_RburnPAGE $date $ns_STATE $Npages
    803     end
    804 
    805     $ns_RburnPAGE ++
    806     if ($ns_RburnPAGE >= $Npages) set ns_RburnPAGE = 0
    807     if (("$ns_STATE" != "QUEUEBURNING")&&("$ns_STATE" != "BURNING")) break
    808     $BURNTOOLING = 1
    809     # Find out where in the list of jobs we are
    810     book getword nsBurntool $date btN -var btN
    811     book getword nsBurntool $date btNCounter -var btNcounter
    812 
    813     if ($VERBOSE > 5)
    814         echo "ns.burntool.run: Status: " $btNcounter $date
    815     end
    816 
    817     if ("$ns_STATE" == "QUEUEBURNING")
    818         $new_state = "QUEUEBURNING"
    819     end
    820     if ("$ns_STATE" == "BURNING")
    821         $new_state = "BURNING"
    822     end
    823     if ($btNcounter + 1 > $btN)
    824         $new_state = "BURNING"
    825     end
    826     if ($btNcounter > $btN)
    827         $btNcounter = 0
    828     end
    829     if ($VERBOSE > 5)
    830         echo "ns.burntool.run: Status: " $btNcounter $new_state
    831     end
     769#     if ("$ns_STATE" != "NEEDSBURNING") break
     770
     771#     $run = automate_stacks.pl --define_burntool --date $date
     772#     command $run
     773#   end
     774#   # success
     775#   task.exit   0
     776# #    convert 'stdout' to book format
     777# #    book delpage nsBurntool $options:0
     778#     ipptool2book stdout nsBurntool -uniq -key date
     779#     book setword nsData $options:0 nsState "QUEUEBURNING"
     780
     781#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     782#     if ("$ns_Nmacros" != "NULL")
     783#       for i 0 $ns_Nmacros
     784#           sprintf macroName "ns%dMacro" $i
     785#           book getword nsData $options:0 $macroName -var macroCmd
     786#           $macroCmd
     787#       end
     788#     end
     789
     790#     if ($VERBOSE > 2)
     791#       book listbook nsData
     792#     end
     793#   end
     794
     795#   # locked list
     796#   task.exit    default
     797#     showcommand failure
     798#   end
     799#   task.exit    crash
     800#     showcommand crash
     801#   end
     802#   #operation times out?
     803#   task.exit    timeout
     804#     showcommand timeout
     805#   end
     806# end
     807
     808# #
     809# # Magically run burntool on the data, based on the information stored in our book.
     810# #
     811# task              ns.burntool.run
     812#   periods         -poll $LOADPOLL
     813#   periods         -exec $LOADEXEC
     814#   periods         -timeout 10800
     815#   npending        30
     816#   task.exec
     817#      stdout NULL
     818#      stderr $LOGDIR/ns.burntool.log
     819
     820#      book getpage nsData $ns_RburnPAGE -var date
     821#      book getword nsData $date nsState -var ns_STATE
     822#      book npages nsData -var Npages
     823
     824#     if ($VERBOSE > 5)
     825#         echo "ns.burntool.run: " $ns_RburnPAGE $date $ns_STATE $Npages
     826#     end
     827
     828#     $ns_RburnPAGE ++
     829#     if ($ns_RburnPAGE >= $Npages) set ns_RburnPAGE = 0
     830#     if (("$ns_STATE" != "QUEUEBURNING")&&("$ns_STATE" != "BURNING")) break
     831#     $BURNTOOLING = 1
     832#     # Find out where in the list of jobs we are
     833#     book getword nsBurntool $date btN -var btN
     834#     book getword nsBurntool $date btNCounter -var btNcounter
     835
     836#     if ($VERBOSE > 5)
     837#       echo "ns.burntool.run: Status: " $btNcounter $date
     838#     end
     839
     840#     if ("$ns_STATE" == "QUEUEBURNING")
     841#       $new_state = "QUEUEBURNING"
     842#     end
     843#     if ("$ns_STATE" == "BURNING")
     844#       $new_state = "BURNING"
     845#     end
     846#     if ($btNcounter + 1 > $btN)
     847#       $new_state = "BURNING"
     848#     end
     849#     if ($btNcounter > $btN)
     850#       $btNcounter = 0
     851#     end
     852#     if ($VERBOSE > 5)
     853#       echo "ns.burntool.run: Status: " $btNcounter $new_state
     854#     end
    832855   
    833     # Increment the counter in the book for the next job.
    834     $counter_update = $btNcounter + 1
    835     book setword nsBurntool $date btNCounter $counter_update
    836 #    book setword nsData $options:0 nsState $options:1
    837     book setword nsData $date nsState $new_state
    838 
    839     # Get the current status of this job, and skip if it doesn't need to process.
    840     sprintf status_label     "bt%dStatus"  $btNcounter
    841     book getword nsBurntool $date $status_label   -var status
    842 
    843     if ($VERBOSE > 5)
    844         echo "ns.burntool.run: Status: " $btNcounter $status $date $status_label
    845     end
    846     if (("$status" == "FINISHED")||("$status" == "RUN")) break 
     856#     # Increment the counter in the book for the next job.
     857#     $counter_update = $btNcounter + 1
     858#     book setword nsBurntool $date btNCounter $counter_update
     859# #    book setword nsData $options:0 nsState $options:1
     860#     book setword nsData $date nsState $new_state
     861
     862#     # Get the current status of this job, and skip if it doesn't need to process.
     863#     sprintf status_label     "bt%dStatus"  $btNcounter
     864#     book getword nsBurntool $date $status_label   -var status
     865
     866#     if ($VERBOSE > 5)
     867#       echo "ns.burntool.run: Status: " $btNcounter $status $date $status_label
     868#     end
     869#     if (("$status" == "FINISHED")||("$status" == "RUN")) break       
    847870   
    848     # Continue loading information to process this job
    849     sprintf start_date_label "bt%dBegin"   $btNcounter
    850     sprintf end_date_label   "bt%dEnd"     $btNcounter
    851     sprintf class_count_label "bt%dClass"   $btNcounter
    852 
    853     book getword nsBurntool $date $start_date_label -var start_date
    854     book getword nsBurntool $date $end_date_label -var end_date
    855     book getword nsBurntool $date $class_count_label -var chip_counter
    856 
    857     # Lookup class_id/host pairs
    858     list word -split $hostmatch:$chip_counter
    859     $class_id = $word:0
    860     $host = $word:1
    861     host $host
    862 #    set.host.for.camera GPC1 $class_id
    863     $logfile = "/data/$host.0/burntool_logs/$class_id.$start_date.log"
    864 
    865     $run = ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $start_date --dateobs_end $end_date --dbname gpc1 --logfile $logfile
     871#     # Continue loading information to process this job
     872#     sprintf start_date_label "bt%dBegin"   $btNcounter
     873#     sprintf end_date_label   "bt%dEnd"     $btNcounter
     874#     sprintf class_count_label "bt%dClass"   $btNcounter
     875
     876#     book getword nsBurntool $date $start_date_label -var start_date
     877#     book getword nsBurntool $date $end_date_label -var end_date
     878#     book getword nsBurntool $date $class_count_label -var chip_counter
     879
     880#     # Lookup class_id/host pairs
     881#     list word -split $hostmatch:$chip_counter
     882#     $class_id = $word:0
     883#     $host = $word:1
     884#     host $host
     885# #    set.host.for.camera GPC1 $class_id
     886#     $logfile = "/data/$host.0/burntool_logs/$class_id.$start_date.log"
     887
     888#     $run = ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $start_date --dateobs_end $end_date --dbname gpc1 --logfile $logfile
    866889       
    867     echo "ns.burntool.run: " $date $btN $btNcounter $start_date $end_date $chip_counter $class_id $host $logfile $run
    868     echo "ns.burntool.run: " $date $btN $btNcounter $chip_counter $new_state
    869 
    870     book setword nsBurntool $date $status_label RUN
    871     option $date $new_state $status_label
    872 
    873     command $run
    874 #     command /bin/true
    875    end
    876   # success
    877   task.exit   0
    878 #    convert 'stdout' to book format
    879     # Set data state based on if we're queueing or waiting
    880     # Set the job state for success.
    881     book setword nsBurntool $options:0 $options:2 FINISHED
    882 
    883     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    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
    890     end
    891 
    892     if ($VERBOSE > 2)
    893         book listbook nsData
    894     end
    895   end
    896 
    897   # locked list
    898   task.exit    default
    899     book setword nsBurntool $options:0 $options:2 FAIL
    900     showcommand failure
    901   end
    902   task.exit    crash
    903     book setword nsBurntool $options:0 $options:2 FAIL
    904     showcommand crash
    905   end
    906   #operation times out?
    907   task.exit    timeout
    908     book setword nsBurntool $options:0 $options:2 FAIL
    909     showcommand timeout
    910   end
    911 end
    912 
    913 
    914 #
    915 # This is all burntool related stuff.
    916 #
    917 
    918 macro burntool
    919   if ($0 != 3)
    920     echo "USAGE: burntool (dateobs_begin) (dateobs_end)"
    921     break
    922   end
    923 
    924   for i 0 $hostmatch:n
    925     job -host $word:1 ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $1 --dateobs_end $2 --dbname gpc1 --logfile $logfile
    926   end
    927 end
    928 macro loadhosts
    929   for i 0 $allhosts:n
    930     controller host add $allhosts:$i
    931   end
    932 end
    933 
    934 # sorry this list is messy, it's supposed to be that way to try and keep to burntools from running on the same host at the same time.
    935 
    936 list hostmatch
    937   XY01    ipp014
    938   XY03    ipp038
    939   XY05    ipp023
    940   XY10    ipp039
    941   XY12    ipp024
    942   XY15    ipp040
    943   XY17    ipp020
    944   XY21    ipp041
    945   XY23    ipp042
    946   XY25    ipp043
    947   XY27    ipp028
    948   XY31    ipp044
    949   XY33    ipp029
    950   XY35    ipp045
    951   XY37    ipp030
    952   XY41    ipp046
    953   XY43    ipp031
    954   XY45    ipp047
    955   XY47    ipp032
    956   XY51    ipp048
    957   XY53    ipp033
    958   XY55    ipp049
    959   XY57    ipp034
    960   XY61    ipp050
    961   XY63    ipp035
    962   XY65    ipp051
    963   XY67    ipp036
    964   XY72    ipp052
    965   XY74    ipp015
    966   XY76    ipp053
    967   XY02    ipp014
    968   XY04    ipp038
    969   XY06    ipp023
    970   XY11    ipp039
    971   XY13    ipp024
    972   XY14    ipp040
    973   XY16    ipp020
    974   XY20    ipp041
    975   XY22    ipp042
    976   XY24    ipp043
    977   XY26    ipp028
    978   XY30    ipp044
    979   XY32    ipp029
    980   XY34    ipp045
    981   XY36    ipp030
    982   XY40    ipp046
    983   XY42    ipp031
    984   XY44    ipp047
    985   XY46    ipp032
    986   XY50    ipp048
    987   XY52    ipp033
    988   XY54    ipp049
    989   XY56    ipp034
    990   XY60    ipp050
    991   XY62    ipp035
    992   XY64    ipp051
    993   XY66    ipp036
    994   XY71    ipp052
    995   XY73    ipp015
    996   XY75    ipp053
    997 end
    998 
    999 list allhosts
    1000   ipp043
    1001   ipp014
    1002   ipp015
    1003   ipp023
    1004   ipp024
    1005   ipp020
    1006   ipp028
    1007   ipp029
    1008   ipp030
    1009   ipp031
    1010   ipp032
    1011   ipp033
    1012   ipp034
    1013   ipp035
    1014   ipp036
    1015   ipp038
    1016   ipp039
    1017   ipp040
    1018   ipp041
    1019   ipp042
    1020   ipp044
    1021   ipp045
    1022   ipp046
    1023   ipp047
    1024   ipp048
    1025   ipp049
    1026   ipp050
    1027   ipp051
    1028   ipp052
    1029   ipp053
    1030 end
     890#     echo "ns.burntool.run: " $date $btN $btNcounter $start_date $end_date $chip_counter $class_id $host $logfile $run
     891#     echo "ns.burntool.run: " $date $btN $btNcounter $chip_counter $new_state
     892
     893#     book setword nsBurntool $date $status_label RUN
     894#     option $date $new_state $status_label
     895
     896#     command $run
     897# #     command /bin/true
     898#    end
     899#   # success
     900#   task.exit   0
     901# #    convert 'stdout' to book format
     902#     # Set data state based on if we're queueing or waiting
     903#     # Set the job state for success.
     904#     book setword nsBurntool $options:0 $options:2 FINISHED
     905
     906#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     907#     if ("$ns_Nmacros" != "NULL")
     908#       for i 0 $ns_Nmacros
     909#           sprintf macroName "ns%dMacro" $i
     910#           book getword nsData $options:0 $macroName -var macroCmd
     911#           $macroCmd
     912#       end
     913#     end
     914
     915#     if ($VERBOSE > 2)
     916#       book listbook nsData
     917#     end
     918#   end
     919
     920#   # locked list
     921#   task.exit    default
     922#     book setword nsBurntool $options:0 $options:2 FAIL
     923#     showcommand failure
     924#   end
     925#   task.exit    crash
     926#     book setword nsBurntool $options:0 $options:2 FAIL
     927#     showcommand crash
     928#   end
     929#   #operation times out?
     930#   task.exit    timeout
     931#     book setword nsBurntool $options:0 $options:2 FAIL
     932#     showcommand timeout
     933#   end
     934# end
     935
     936
     937# #
     938# # This is all burntool related stuff.
     939# #
     940
     941# macro burntool
     942#   if ($0 != 3)
     943#     echo "USAGE: burntool (dateobs_begin) (dateobs_end)"
     944#     break
     945#   end
     946
     947#   for i 0 $hostmatch:n
     948#     job -host $word:1 ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $1 --dateobs_end $2 --dbname gpc1 --logfile $logfile
     949#   end
     950# end
     951# macro loadhosts
     952#   for i 0 $allhosts:n
     953#     controller host add $allhosts:$i
     954#   end
     955# end
     956
     957# # sorry this list is messy, it's supposed to be that way to try and keep to burntools from running on the same host at the same time.
     958
     959# list hostmatch
     960#   XY01    ipp014
     961#   XY03    ipp038
     962#   XY05    ipp023
     963#   XY10    ipp039
     964#   XY12    ipp024
     965#   XY15    ipp040
     966#   XY17    ipp020
     967#   XY21    ipp041
     968#   XY23    ipp042
     969#   XY25    ipp043
     970#   XY27    ipp028
     971#   XY31    ipp044
     972#   XY33    ipp029
     973#   XY35    ipp045
     974#   XY37    ipp030
     975#   XY41    ipp046
     976#   XY43    ipp031
     977#   XY45    ipp047
     978#   XY47    ipp032
     979#   XY51    ipp048
     980#   XY53    ipp033
     981#   XY55    ipp049
     982#   XY57    ipp034
     983#   XY61    ipp050
     984#   XY63    ipp035
     985#   XY65    ipp051
     986#   XY67    ipp036
     987#   XY72    ipp052
     988#   XY74    ipp015
     989#   XY76    ipp053
     990#   XY02    ipp014
     991#   XY04    ipp038
     992#   XY06    ipp023
     993#   XY11    ipp039
     994#   XY13    ipp024
     995#   XY14    ipp040
     996#   XY16    ipp020
     997#   XY20    ipp041
     998#   XY22    ipp042
     999#   XY24    ipp043
     1000#   XY26    ipp028
     1001#   XY30    ipp044
     1002#   XY32    ipp029
     1003#   XY34    ipp045
     1004#   XY36    ipp030
     1005#   XY40    ipp046
     1006#   XY42    ipp031
     1007#   XY44    ipp047
     1008#   XY46    ipp032
     1009#   XY50    ipp048
     1010#   XY52    ipp033
     1011#   XY54    ipp049
     1012#   XY56    ipp034
     1013#   XY60    ipp050
     1014#   XY62    ipp035
     1015#   XY64    ipp051
     1016#   XY66    ipp036
     1017#   XY71    ipp052
     1018#   XY73    ipp015
     1019#   XY75    ipp053
     1020# end
     1021
     1022# list allhosts
     1023#   ipp043
     1024#   ipp014
     1025#   ipp015
     1026#   ipp023
     1027#   ipp024
     1028#   ipp020
     1029#   ipp028
     1030#   ipp029
     1031#   ipp030
     1032#   ipp031
     1033#   ipp032
     1034#   ipp033
     1035#   ipp034
     1036#   ipp035
     1037#   ipp036
     1038#   ipp038
     1039#   ipp039
     1040#   ipp040
     1041#   ipp041
     1042#   ipp042
     1043#   ipp044
     1044#   ipp045
     1045#   ipp046
     1046#   ipp047
     1047#   ipp048
     1048#   ipp049
     1049#   ipp050
     1050#   ipp051
     1051#   ipp052
     1052#   ipp053
     1053# end
  • trunk/ippTasks/register.pro

    r25418 r30049  
    88book init regPendingImfile
    99book init regPendingExp
     10book init regPendingBurntoolImfile
    1011
    1112macro register.reset
    1213  book init regPendingImfile
    1314  book init regPendingExp
     15  book init regPendingBurntoolImfile
    1416end
    1517
     
    1820  book listbook regPendingImfile
    1921  book listbook regPendingExp
     22  book listbook regPendingBurntoolImfile
    2023end
    2124
     
    3336    active true
    3437  end
     38  task register.burntool.load
     39    active true
     40  end
     41  task register.burntool.run
     42    active true
     43  end
    3544end
    3645
     
    4857    active false
    4958  end
    50 end
     59  task register.burntool.load
     60    active false
     61  end
     62  task register.burntool.run
     63    active false
     64  end
     65end
     66
     67$valid_burntool_value = 14
    5168
    5269macro replace.survey.values
     
    129146# these variables will cycle through the known database names
    130147$regPendingImfile_DB = 0
     148$regPendingBurntoolImfile_DB = 0
    131149$regPendingExp_DB = 0
    132150
     
    429447end
    430448
     449
     450# select imfiles that can now be burntooled.
     451task       register.burntool.load
     452  host     local
     453
     454  periods  -poll $LOADPOLL
     455  periods  -exec $LOADEXEC
     456  periods  -timeout 30
     457  npending 1
     458
     459  # silently drop stdout
     460  stdout NULL
     461  stderr $LOGDIR/register.burntool.load.log
     462 
     463  # select entried from the current DB; cycle to the next DB, if it exists
     464  task.exec
     465    $run = regtool -pendingburntoolimfile
     466    $today = `date -u +%Y-%m-%d`
     467# debugging purposes
     468    $today = "2010-12-06"
     469    $run = $run -date $today -valid_burntool $valid_burntool_value
     470    if ($DB:n == 0)
     471      option DEFAULT
     472    else
     473      # save the DB name for the exit tasks
     474      option $DB:$regPendingBurntoolImfile_DB
     475      $run = $run -dbname $DB:$regPendingBurntoolImfile_DB
     476      $regPendingBurntoolImfile_DB ++
     477      if ($regPendingBurntoolImfile_DB >= $DB:n) set regPendingBurntoolImfile_DB = 0
     478    end
     479
     480    echo $run
     481    add_poll_args run
     482    command $run
     483  end
     484
     485  # success
     486  task.exit $EXIT_SUCCESS
     487    # convert 'stdout' to book format
     488    ipptool2book stdout regPendingBurntoolImfile -key exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     489    book shuffle regPendingBurntoolImfile
     490    if ($VERBOSE > 2)
     491      book listbook regPendingBurntoolImfile
     492    end
     493
     494    # delete existing entries in the appropriate pantasksStates
     495    process_cleanup regPendingBurntoolImfile
     496  end
     497
     498  # locked list
     499  task.exit   default
     500    showcommand failure
     501  end
     502  task.exit   crash
     503    showcommand crash
     504  end
     505  task.exit   timeout
     506    showcommand timeout
     507  end
     508end
     509
     510# run the ipp_apply_burntool_single.pl script on the pending images
     511task          register.burntool.run
     512  periods     -poll $RUNPOLL
     513  periods     -exec $RUNEXEC
     514  periods     -timeout 30
     515
     516  task.exec
     517    if ($NETWORK == 0) break
     518    book npages regPendingBurntoolImfile -var N
     519    if ($N == 0)
     520      periods -exec $RUNEXEC
     521      break
     522    end
     523    periods -exec 0.05
     524
     525    # look for new images to burn in regPendingBurntoolImfile
     526    book getpage regPendingBurntoolImfile 0 -var pageName -key pantaskState INIT
     527    if ("$pageName" == "NULL") break
     528
     529    book setword regPendingBurntoolImfile $pageName pantaskState RUN
     530
     531    book getword regPendingBurntoolImfile $pageName exp_id      -var EXP_ID
     532    book getword regPendingBurntoolImfile $pageName class_id    -var CLASS_ID
     533    book getword regPendingBurntoolImfile $pageName uri         -var THIS_URI
     534    book getword regPendingBurntoolImfile $pageName previous_uri -var PREVIOUS_URI
     535    book getword regPendingBurntoolImfile $pageName camera      -var CAMERA
     536    book getword regPendingBurntoolImfile $pageName dbname      -var DBNAME
     537    set.host.for.camera $CAMERA $CLASS_ID
     538
     539    stdout $LOGDIR/register.burntool.run.log
     540    stderr $LOGDIR/register.burntool.run.log
     541
     542    $run = ipp_apply_burntool_single.pl --exp_id $EXP_ID --class_id $CLASS_ID --this_uri $THIS_URI
     543    if ("$PREVIOUS_URI" != "NULL")
     544      $run = $run --previous_uri $PREVIOUS_URI
     545    end
     546
     547    add_standard_args run
     548
     549    options $pageName
     550
     551    if ($VERBOSE > 1)
     552      echo command $run
     553    end
     554    command $run
     555  end
     556
     557  # default exit status
     558  task.exit default
     559    process_exit regPendingBurntoolImfile $options:0 $JOB_STATUS
     560  end
     561
     562  # locked list
     563  task.exit crash
     564    showcommand crash
     565    echo "hostname: $JOB_HOSTNAME"
     566    book setword regPendingBurntoolImfile $options:0 pantaskState CRASH
     567  end
     568
     569  # operation timed out
     570  task.exit  timeout
     571    showcommand timeout
     572    book setword regPendingBurntoolImfile $options:0 pantaskState TIMEOUT
     573  end
     574end
     575
     576   
     577   
     578 
    431579## XXX add a global path to output files 
  • trunk/ippTools/share/Makefile.am

    r29717 r30049  
    316316        receivetool_revert.sql \
    317317        receivetool_toadvance.sql \
     318        regtool_checkburntoolimfile.sql \
    318319        regtool_create_dup_table.sql \
    319320        regtool_export_exp.sql \
     
    331332        regtool_updatebyquery.sql \
    332333        regtool_updatebyqueryimfile.sql \
     334        regtool_pendingburntoolimfile.sql \
    333335        stacktool_associationdefine_select.sql \
    334336        stacktool_definebyquery_insert.sql \
  • trunk/ippTools/share/camtool_find_pendingimfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ippTools/share/chiptool_find_rawexp.sql

    r23917 r30049  
    11-- this query is used to find potental rawExps to be queued for chiptool
    22-- processeing
    3 SELECT
     3SELECT DISTINCT
    44    rawExp.*,
    55    newExp.label
    66FROM rawExp
    77JOIN newExp using (exp_id)
     8LEFT JOIN chipRun USING (exp_id)
    89WHERE
    910    rawExp.fault = 0
  • trunk/ippTools/share/pxadmin_create_tables.sql

    r29962 r30049  
    99    uri VARCHAR(255),
    1010    epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     11    use_compress SMALLINT,
    1112    PRIMARY KEY(camera, telescope)
    1213) ENGINE=innodb DEFAULT CHARSET=latin1;
     
    251252    md5sum VARCHAR(32),
    252253    burntool_state SMALLINT,
     254    video_cells TINYINT DEFAULT 0,
    253255    PRIMARY KEY(exp_id, class_id),
    254256    KEY(tmp_class_id),
  • trunk/ippTools/share/regtool_pendingexp.sql

    r20759 r30049  
    3939        newExp.state = 'run'
    4040        AND rawExp.exp_id IS NULL
     41        AND rawImfile.data_state = 'full'
    4142-- where hook %s
    4243    GROUP BY
  • trunk/ippTools/src

  • trunk/ippTools/src/chiptool.c

    r29902 r30049  
    271271
    272272    // default
     273    PXOPT_LOOKUP_BOOL(unique, config->args, "-unique", false);
    273274    PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
    274275    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    275 
     276   
    276277    // find the exp_id of all the exposures that we want to queue up.
    277278    psString query = pxDataGet("chiptool_find_rawexp.sql");
     
    288289    psFree(where);
    289290
     291    if (unique) {
     292      psStringAppend(&query, "AND chip_id IS NULL");
     293    }
     294   
    290295    if (!p_psDBRunQuery(config->dbh, query)) {
    291296        psError(PS_ERR_UNKNOWN, false, "database error");
  • trunk/ippTools/src/chiptoolConfig.c

    r29902 r30049  
    6161    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_dist_group",  0,      "define distribution group", NULL);
    6262    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_note",  0,           "define note", NULL);
     63    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-unique",   0,           "only queue exposures that have no previous chipRun", false);
    6364    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",  0,            "do not actually modify the database", false);
    6465    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple",  0,            "use the simple output format", false);
  • trunk/ippTools/src/pztool.c

    r27053 r30049  
    112112    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
    113113    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    114 
     114   
    115115    if (!pzDataStoreInsert(config->dbh,
    116116            camera,
  • trunk/ippTools/src/regtool.c

    r27748 r30049  
    3434static bool pendingimfileMode(pxConfig *config);
    3535static bool addprocessedimfileMode(pxConfig *config);
     36static bool checkburntoolimfileMode(pxConfig *config);
     37static bool pendingburntoolimfileMode(pxConfig *config);
    3638static bool processedimfileMode(pxConfig *config);
    3739static bool revertprocessedimfileMode(pxConfig *config);
     
    7274        // imfile
    7375        MODECASE(REGTOOL_MODE_PENDINGIMFILE,         pendingimfileMode);
     76        MODECASE(REGTOOL_MODE_CHECKBURNTOOLIMFILE,   checkburntoolimfileMode);
     77        MODECASE(REGTOOL_MODE_PENDINGBURNTOOLIMFILE, pendingburntoolimfileMode);
    7478        MODECASE(REGTOOL_MODE_ADDPROCESSEDIMFILE,    addprocessedimfileMode);
    7579        MODECASE(REGTOOL_MODE_PROCESSEDIMFILE,       processedimfileMode);
     
    176180}
    177181
     182static bool checkburntoolimfileMode(pxConfig *config)
     183{
     184  PS_ASSERT_PTR_NON_NULL(config,false);
     185
     186  // required
     187  PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false);
     188  PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
     189  PXOPT_LOOKUP_STR(date,     config->args, "-date", true, false);
     190  PXOPT_LOOKUP_S32(valid_burntool, config->args, "-valid_burntool", true, false);
     191  // optional
     192  PXOPT_LOOKUP_STR(camera, config->args, "-inst", false, false);
     193  PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", false, false);
     194  PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     195  psString query = pxDataGet("regtool_checkburntoolimfile.sql");
     196  if (!query) {
     197    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     198    return false;
     199  }
     200  psString rep = psStringCopy(query);
     201  psFree(query);
     202  query = rep;
     203 
     204  psStringSubstitute(&query,exp_name,"@EXP_NAME@");
     205  psStringSubstitute(&query,class_id,"@CLASS_ID@");
     206  psStringSubstitute(&query,date,"@DATE@");
     207
     208  fprintf(stderr,"%s",query);
     209
     210  if (!p_psDBRunQuery(config->dbh, query)) {
     211    // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms)
     212    psError(PXTOOLS_ERR_PROG, false, "database error");
     213    psFree(query);
     214    return false;
     215  }
     216  psFree(query);
     217 
     218  psArray *output = p_psDBFetchResult(config->dbh);
     219  if (!output) {
     220    psErrorCode err = psErrorCodeLast();
     221    switch (err) {
     222    case PS_ERR_DB_CLIENT:
     223      psError(PXTOOLS_ERR_SYS, false, "database error");
     224    case PS_ERR_DB_SERVER:
     225      psError(PXTOOLS_ERR_PROG, false, "database error");
     226    default:
     227      psError(PXTOOLS_ERR_PROG, false, "unknown error");
     228    }
     229   
     230    return false;
     231  }
     232  if (!psArrayLength(output)) {
     233    psTrace("regtool", PS_LOG_INFO, "no rows found");
     234    psFree(output);
     235    return true;
     236  }
     237
     238  psString previous_uri = NULL;
     239  bool ok_to_burn = true;
     240  bool already_burned = true;
     241  for (long i = 0; i < output->n; i++) {
     242    psMetadata *row = output->data[i];
     243
     244    if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)||
     245        (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {
     246      ok_to_burn = false;
     247    }
     248    if (already_burned == false) {
     249      ok_to_burn = false;
     250    }
     251    if (abs(psMetadataLookupS32(NULL,row,"burntool_state")) == valid_burntool) {
     252      already_burned = true;
     253    }
     254    else {
     255      already_burned = false;
     256    }
     257   
     258    if (previous_uri) {
     259      psMetadataAddStr(row,PS_LIST_TAIL,"previous_uri",PS_META_REPLACE,"",previous_uri);
     260      psFree(previous_uri);
     261    }
     262    psMetadataAddBool(row,PS_LIST_TAIL,"burnable",PS_META_REPLACE,"",ok_to_burn);
     263    psMetadataAddBool(row,PS_LIST_TAIL,"already_burned",PS_META_REPLACE,"",already_burned);
     264    previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri"));
     265  }
     266 
     267  // negate simple so the default is true
     268  if (!ippdbPrintMetadatas(stdout, output, "regBurntoolImfile", !simple)) {
     269    psError(PXTOOLS_ERR_PROG, false, "failed to print array");
     270    psFree(output);
     271    return false;
     272  }
     273 
     274  psFree(output);
     275 
     276
     277  return(true);
     278 
     279}
     280
     281static bool pendingburntoolimfileMode(pxConfig *config)
     282{
     283  PS_ASSERT_PTR_NON_NULL(config,false);
     284
     285  // required
     286  PXOPT_LOOKUP_STR(date,     config->args, "-date", true, false);
     287  PXOPT_LOOKUP_S32(valid_burntool, config->args, "-valid_burntool", true, false);
     288  // optional
     289  PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     290  PXOPT_LOOKUP_BOOL(ignore_state, config->args, "-ignore_state", false);
     291  psString query = pxDataGet("regtool_pendingburntoolimfile.sql");
     292  if (!query) {
     293    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     294    return false;
     295  }
     296  psString rep = psStringCopy(query);
     297  psFree(query);
     298  query = rep;
     299 
     300  psStringSubstitute(&query,date,"@DATE@");
     301
     302  fprintf(stderr,"%s",query);
     303
     304  if (!p_psDBRunQuery(config->dbh, query)) {
     305    // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms)
     306    psError(PXTOOLS_ERR_PROG, false, "database error");
     307    psFree(query);
     308    return false;
     309  }
     310  psFree(query);
     311 
     312  psArray *output = p_psDBFetchResult(config->dbh);
     313  if (!output) {
     314    psErrorCode err = psErrorCodeLast();
     315    switch (err) {
     316    case PS_ERR_DB_CLIENT:
     317      psError(PXTOOLS_ERR_SYS, false, "database error");
     318    case PS_ERR_DB_SERVER:
     319      psError(PXTOOLS_ERR_PROG, false, "database error");
     320    default:
     321      psError(PXTOOLS_ERR_PROG, false, "unknown error");
     322    }
     323   
     324    return false;
     325  }
     326  if (!psArrayLength(output)) {
     327    psTrace("regtool", PS_LOG_INFO, "no rows found");
     328    psFree(output);
     329    return true;
     330  }
     331
     332  psString previous_uri = NULL;
     333  psString this_uri = NULL;
     334  bool ok_to_burn = true;
     335  bool already_burned = true;
     336  psString previous_class_id = NULL;
     337  psString this_class_id = NULL;
     338  psArray *results = psArrayAllocEmpty(60); // List of suggested imfiles to burntool.
     339 
     340  for (long i = 0; i < output->n; i++) {
     341    psMetadata *row = output->data[i];
     342
     343    // Add the information about this row and the previous, if it exists.
     344    // Write the class_id stuff for debugging.
     345    this_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
     346    psStringSubstitute(&this_class_id,"XY","ota");
     347    psMetadataAddStr(row,PS_LIST_TAIL,"this_class_id",PS_META_REPLACE,"",this_class_id);
     348    if (previous_class_id) {
     349      psMetadataAddStr(row,PS_LIST_TAIL,"previous_class_id",PS_META_REPLACE,"",previous_class_id);
     350    }
     351   
     352    // Determine if we've crossed a class_id boundary, as this resets the bits.
     353    if (previous_class_id) {
     354      if (strcmp(this_class_id,previous_class_id) != 0) {
     355        ok_to_burn = true;
     356        already_burned = true;
     357        previous_uri = NULL;
     358      }
     359    }
     360
     361    // Write the URIs as well.
     362    this_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Duplicate, but helpful for my debugging.
     363    psMetadataAddStr(row,PS_LIST_TAIL,"this_uri",PS_META_REPLACE,"",this_uri);
     364    if (previous_uri) {
     365      psMetadataAddStr(row,PS_LIST_TAIL,"previous_uri",PS_META_REPLACE,"",previous_uri);
     366    }
     367
     368    // Check the two status variables
     369    // Convert bits of the SQL query into booleans describing the data state
     370    if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)||
     371        (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {
     372      ok_to_burn = false;
     373    }
     374    if (already_burned == false) {
     375      ok_to_burn = false;
     376    }
     377    if (abs(psMetadataLookupS32(NULL,row,"burntool_state")) == valid_burntool) {
     378      already_burned = true;
     379    }
     380    else {
     381      already_burned = false;
     382    }
     383    psMetadataAddBool(row,PS_LIST_TAIL,"burnable",PS_META_REPLACE,"",ok_to_burn);
     384    psMetadataAddBool(row,PS_LIST_TAIL,"already_burned",PS_META_REPLACE,"",already_burned);
     385
     386    // Check the uri for this exposure
     387    if (!this_uri) {
     388        ok_to_burn = false;
     389        already_burned = false;
     390
     391        // Save this round for next round.
     392        psFree(previous_class_id);
     393        psFree(previous_uri);
     394        previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
     395        psStringSubstitute(&previous_class_id,"XY","ota");
     396        previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
     397        continue;
     398    }     
     399
     400    //    printf("STATUS: %s %s %s %s (%d %d)\n",this_uri,previous_uri,this_class_id,previous_class_id,ok_to_burn,already_burned);
     401
     402    // If the state of this imfile is not "pending_burntool" then we can't burn it.
     403    if (!ignore_state) {
     404      psString imfile_state = psMetadataLookupStr(NULL,row,"imfile_state");
     405
     406      if (!imfile_state) { // imfile state is NULL, so we probably aren't registered.
     407        ok_to_burn = false;
     408
     409        // Save this round for next round.
     410        psFree(previous_class_id);
     411        psFree(previous_uri);
     412        previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
     413        psStringSubstitute(&previous_class_id,"XY","ota");
     414        previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
     415        continue;
     416      }
     417      if (strcmp("pending_burntool",imfile_state) != 0) { // Probably the state is full, do not twiddle states 
     418        // Save this round for next round.
     419        psFree(previous_class_id);
     420        psFree(previous_uri);
     421        previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
     422        psStringSubstitute(&previous_class_id,"XY","ota");
     423        previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
     424        continue;
     425      }
     426    }
     427   
     428    // Determine if we've already suggested an entry for this ota, and if not, copy this
     429    // suggestion into our output result list.
     430    if (!ok_to_burn || already_burned) {
     431      // Save this round for next round.
     432      psFree(previous_class_id);
     433      psFree(previous_uri);
     434      previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
     435      psStringSubstitute(&previous_class_id,"XY","ota");
     436      previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
     437      continue;
     438    }
     439    // If we're here, then we think we could potentially burntool this file.
     440    psArrayAdd(results,results->n,row);
     441
     442    // Save this round for next round.
     443    psFree(previous_class_id);
     444    psFree(previous_uri);
     445    previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
     446    psStringSubstitute(&previous_class_id,"XY","ota");
     447    previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.         
     448  }
     449 
     450  // negate simple so the default is true
     451  if (!ippdbPrintMetadatas(stdout, results, "regPendingBurntoolImfile", !simple)) {
     452    psError(PXTOOLS_ERR_PROG, false, "failed to print array");
     453    psFree(output);
     454    psFree(results);
     455    return false;
     456  }
     457 
     458  psFree(output);
     459  psFree(results);
     460 
     461
     462  return(true);
     463 
     464}
     465
     466     
    178467
    179468static bool addprocessedimfileMode(pxConfig *config)
     
    250539    PXOPT_LOOKUP_S32(bytes, config->args,  "-bytes", false, false);
    251540    PXOPT_LOOKUP_STR(md5sum, config->args, "-md5sum", false, false);
    252 
     541    PXOPT_LOOKUP_BOOL(video_cells, config->args, "-video_cells", false);
     542   
    253543    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    254544    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
     
    323613        bytes,
    324614        md5sum,
     615        video_cells,
    325616        0   // burntool_state
    326617    )) {
     
    8091100    PXOPT_LOOKUP_F32(moon_phase, config->args, "-moon_phase", false, false);
    8101101    PXOPT_LOOKUP_STR(label,  config->args, "-label", false, false);
     1102    PXOPT_LOOKUP_STR(data_group,  config->args, "-data_group", false, false);
     1103    PXOPT_LOOKUP_STR(dist_group,  config->args, "-dist_group", false, false);
     1104    PXOPT_LOOKUP_STR(chip_workdir,config->args, "-chip_workdir", false, false);
    8111105    PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false);
    8121106
     
    10081302    // else continue on...
    10091303
    1010 
     1304    chip_workdir = chip_workdir ? chip_workdir : workdir;
    10111305    // insert an entry into the chipPendingExp table
    10121306    // this can only be run as the newExp's state has been set to stop
    10131307    if (!pxchipQueueByExpTag(config,
    10141308                exp_id,
    1015                 workdir,
     1309                             chip_workdir,
    10161310                label,
    1017                 NULL,       // data_group
    1018                 NULL,       // dist_group
     1311                             data_group,
     1312                             dist_group,
    10191313                reduction,
    10201314                NULL,       // expgroup
     
    10921386    PXOPT_COPY_F64(config->args,   where,  "-posang_min", "posang", ">=");
    10931387    PXOPT_COPY_F64(config->args,   where,  "-posang_max", "posang", "<");
    1094     PXOPT_COPY_STR(config->args,   where,  "-object", "object", "==");
     1388    PXOPT_COPY_STR(config->args,   where,  "-object", "object", "LIKE");
     1389    PXOPT_COPY_STR(config->args,   where,  "-obs_mode", "obs_mode", "LIKE");
     1390    PXOPT_COPY_STR(config->args,   where,  "-comment", "comment", "LIKE");
    10951391    PXOPT_COPY_F32(config->args,   where,  "-sun_angle_min", "sun_angle", ">=");
    10961392    PXOPT_COPY_F32(config->args,   where,  "-sun_angle_max", "sun_angle", "<");
  • trunk/ippTools/src/regtool.h

    r27149 r30049  
    2626    REGTOOL_MODE_NONE      = 0x0,
    2727    REGTOOL_MODE_PENDINGIMFILE,
     28    REGTOOL_MODE_CHECKBURNTOOLIMFILE,
     29    REGTOOL_MODE_PENDINGBURNTOOLIMFILE,
    2830    REGTOOL_MODE_ADDPROCESSEDIMFILE,
    2931    REGTOOL_MODE_PROCESSEDIMFILE,
  • trunk/ippTools/src/regtoolConfig.c

    r27748 r30049  
    5353    ADD_OPT(Bool, pendingimfileArgs, "-simple",    "use the simple output format", false);
    5454
     55    // -checkburntoolimfile
     56    psMetadata *checkburntoolimfileArgs = psMetadataAlloc();
     57    ADD_OPT(Str,  checkburntoolimfileArgs, "-exp_name",       "define the exp_name (required)",         NULL);
     58    ADD_OPT(Str,  checkburntoolimfileArgs, "-class_id",       "define class ID (required)",         NULL);
     59    ADD_OPT(Str,  checkburntoolimfileArgs, "-date",           "select the date to process (required)", NULL);
     60    ADD_OPT(S32,  checkburntoolimfileArgs, "-valid_burntool", "define the good burntool value (required)", 0);
     61    ADD_OPT(Str,  checkburntoolimfileArgs, "-inst",           "define the camera name",     NULL);
     62    ADD_OPT(Str,  checkburntoolimfileArgs, "-telescope",      "define the telescope name",     NULL);
     63    ADD_OPT(Bool, checkburntoolimfileArgs, "-simple",    "use the simple output format",          false);
     64
     65    // -pendingburntoolimfile
     66    psMetadata *pendingburntoolimfileArgs = psMetadataAlloc();
     67    ADD_OPT(Str,  pendingburntoolimfileArgs, "-date",           "select the date to process (required)", NULL);
     68    ADD_OPT(S32,  pendingburntoolimfileArgs, "-valid_burntool", "define the good burntool value (required)", 0);
     69    ADD_OPT(Bool, pendingburntoolimfileArgs, "-simple",    "use the simple output format",          false);
     70    ADD_OPT(Bool, pendingburntoolimfileArgs, "-ignore_state",   "ignore the data_state when deciding what to work on",  false);
     71    ADD_OPT(U64,  pendingburntoolimfileArgs, "-limit",     "limit result set to N items",  0);
     72   
    5573    // -addprocessedimfile
    5674    psMetadata *addprocessedimfileArgs = psMetadataAlloc();
     
    128146    ADD_OPT(S32,  addprocessedimfileArgs, "-bytes",          "define bytes",                0);
    129147    ADD_OPT(S16,  addprocessedimfileArgs, "-burntool_state",        "set burntool state", 0);
     148    ADD_OPT(Bool, addprocessedimfileArgs, "-video_cells",    "define if chip has video cells", false);
    130149    ADD_OPT(S16,  addprocessedimfileArgs, "-fault",           "set fault code",                  0);
    131150    ADD_OPT(S16,  addprocessedimfileArgs, "-quality",        "set quality flag", 0);
     
    249268    ADD_OPT(F32,  addprocessedexpArgs, "-moon_phase",       "define moon phase (0.0 = new)",   NAN);
    250269    ADD_OPT(Str,  addprocessedexpArgs, "-label",            "define label for chip stage (non-detrend data only)", NULL);
     270    ADD_OPT(Str,  addprocessedexpArgs, "-data_group",       "define data_group for chip stage (non-detrend data only)", NULL);
     271    ADD_OPT(Str,  addprocessedexpArgs, "-dist_group",       "define dist_group for chip stage (non-detrend data only)", NULL);
     272    ADD_OPT(Str,  addprocessedexpArgs, "-chip_workdir",     "define workdir for chip stage (non-detrend data only)", NULL);
    251273    ADD_OPT(Str,  addprocessedexpArgs, "-hostname",         "define host name", NULL);
    252274    ADD_OPT(S16,  addprocessedexpArgs, "-fault",             "set fault code", 0);
     
    291313    psMetadataAddF64(processedexpArgs,  PS_LIST_TAIL, "-posang_max",    0,            "search by max rotator position angle", NAN);
    292314    psMetadataAddStr(processedexpArgs,  PS_LIST_TAIL, "-object",        0,            "search by exposure object", NULL);
     315    psMetadataAddStr(processedexpArgs,  PS_LIST_TAIL, "-obs_mode",      0,            "search by exposure obs_mode", NULL);
     316    psMetadataAddStr(processedexpArgs,  PS_LIST_TAIL, "-comment",       0,            "search by exposure comment", NULL);
     317   
    293318    psMetadataAddF32(processedexpArgs,  PS_LIST_TAIL, "-sun_angle_min",    0,         "define min solar angle", NAN);
    294319    psMetadataAddF32(processedexpArgs,  PS_LIST_TAIL, "-sun_angle_max",    0,         "define max solar angle", NAN);
     
    395420
    396421    PXOPT_ADD_MODE("-pendingimfile",           "", REGTOOL_MODE_PENDINGIMFILE, pendingimfileArgs);
     422    PXOPT_ADD_MODE("-checkburntoolimfile",     "", REGTOOL_MODE_CHECKBURNTOOLIMFILE, checkburntoolimfileArgs);
     423    PXOPT_ADD_MODE("-pendingburntoolimfile",   "", REGTOOL_MODE_PENDINGBURNTOOLIMFILE, pendingburntoolimfileArgs);
    397424    PXOPT_ADD_MODE("-addprocessedimfile",      "", REGTOOL_MODE_ADDPROCESSEDIMFILE, addprocessedimfileArgs);
    398425    PXOPT_ADD_MODE("-processedimfile",         "", REGTOOL_MODE_PROCESSEDIMFILE, processedimfileArgs);
  • trunk/ippconfig

  • trunk/ippconfig/gpc1/format_20080925.config

    r27664 r30049  
    235235        CELL.YPARITY    STR     ATM2_2
    236236
     237        CHIP.VIDEOCELL  STR     CELLMODE
    237238        # XY24 is bad, so get it from the database; all others from header
    238239        CHIP.TEMP.DEPEND        STR     CHIP.NAME
  • trunk/ippconfig/gpc1/format_20080929.config

    r27664 r30049  
    230230        CELL.YPARITY    STR     ATM2_2
    231231
     232        CHIP.VIDEOCELL  STR     CELLMODE
    232233        # XY24 is bad, so get it from the database; all others from header
    233234        CHIP.TEMP.DEPEND        STR     CHIP.NAME
  • trunk/ippconfig/gpc1/format_20081011.config

    r27664 r30049  
    221221        CELL.YPARITY    STR     ATM2_2
    222222
     223        CHIP.VIDEOCELL  STR     CELLMODE
    223224        # XY24 is bad, so get it from the database; all others from header
    224225        CHIP.TEMP.DEPEND        STR     CHIP.NAME
  • trunk/ippconfig/gpc1/format_20090120.config

    r27664 r30049  
    209209
    210210        FPA.BURNTOOL.APPLIED STR BTOOLAPP
     211        CHIP.VIDEOCELL  STR     CELLMODE
    211212
    212213        FPA.PON.TIME    STR     PONTIME
  • trunk/ippconfig/gpc1/format_20090220.config

    r27664 r30049  
    209209
    210210        FPA.BURNTOOL.APPLIED STR BTOOLAPP
     211        CHIP.VIDEOCELL  STR     CELLMODE
    211212
    212213        FPA.PON.TIME    STR     PONTIME
  • trunk/ippconfig/gpc1/format_20100122.config

    r28552 r30049  
    209209
    210210        FPA.BURNTOOL.APPLIED STR BTOOLAPP
     211        CHIP.VIDEOCELL  STR     CELLMODE
    211212
    212213        FPA.PON.TIME    STR     PONTIME
  • trunk/ippconfig/gpc1/format_orig.config

    r27664 r30049  
    217217
    218218        FPA.BURNTOOL.APPLIED STR BTOOLAPP
     219        CHIP.VIDEOCELL  STR     CELLMODE
    219220
    220221        FPA.PON.TIME    STR     PONTIME
  • trunk/ippconfig/recipes/nightly_science.config

    r29985 r30049  
    1 RETENTION_TIME   U16    9000
    2 
    31CLEAN_MODES MULTI
    42CLEAN_MODES METADATA
    5   MODE STR CHIP
    6   COMMAND STR chiptool
     3  MODE           STR CHIP
     4  COMMAND        STR chiptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -data_group @DATA_GROUP@
    75  RETENTION_TIME U16 30
    86END
    97CLEAN_MODES METADATA
    10   MODE STR WARP
    11   COMMAND STR warptool
     8  MODE           STR WARP
     9  COMMAND        STR warptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -data_group @DATA_GROUP@
    1210  RETENTION_TIME U16 7
    1311END
    1412CLEAN_MODES METADATA
    15   MODE STR DIFF
    16   COMMAND STR difftool
     13  MODE           STR DIFF
     14  COMMAND        STR difftool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -data_group @DATA_GROUP@
    1715  RETENTION_TIME S16 30
    18 #  RETENTION_TIME S16 -1
    19 END
    20 CLEAN_MODES METADATA
    21   MODE STR DIST
    22   COMMAND STR disttool
     16END
     17CLEAN_MODES METADATA
     18  MODE           STR DIST
     19  COMMAND        STR disttool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -full -set_label goto_cleaned -label @LABEL@ -time_stamp_end @CURRENT_DATE@
    2320  RETENTION_TIME S16 10
    24   ALTERNATE_CMD STR A
    25 END
    26 CLEAN_MODES METADATA
    27   MODE STR MAGICDS
    28   COMMAND STR magicdstool
     21END
     22CLEAN_MODES METADATA
     23  MODE           STR MAGICDS
     24  COMMAND        STR magicdstool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@
    2925  RETENTION_TIME S16 1
    30   ALTERNATE_CMD STR B
     26END
     27
     28END_OF_NIGHT MULTI
     29END_OF_NIGHT METADATA
     30  NAME           STR MORNING_DARKS
     31  OBSMODE        STR ENGINEERING
     32  EXPTYPE        STR DARK
     33  OBJECT         STR ENGINEERING
     34  COMMENT        STR darks_morn%
    3135END
    3236
     
    4347
    4448MACRO_DEFINITIONS MULTI
    45 #MACRO_DEFINITIONS METADATA
    46 #  PROC_MODE STR check_chips
    47 #  MACRO     STR echo survey.del.destreak @LABEL@
    48 #END
    4949MACRO_DEFINITIONS METADATA
    5050  PROC_MODE STR queue_chips
     
    5555  MACRO     STR survey.add.destreak @LABEL@ /data/ipp053.0/gpc1_destreak
    5656END
    57 #MACRO_DEFINITIONS METADATA
    58 #  PROC_MODE STR check_confirm_stacks
    59 #  MACRO     STR echo survey.add.destreak @LABEL@ /data/ipp053.0/gpc1_destreak
    60 #END
    61 # MACRO_DEFINITIONS METADATA
    62 #   PROC_MODE STR clean_old
    63 #   MACRO     STR
     57
     58TARGETS MULTI
     59TARGETS METADATA
     60  NAME      STR  M31
     61  DISTRIBUTION STR M31
     62  TESS      STR  M31
     63  OBSMODE   STR  M31
     64  OBJECT    STR  M31%
     65  STACKABLE BOOL TRUE
     66  MIN_STACK U16 8
     67  DIFFABLE  BOOL FALSE
     68  DIST      S16  30
     69END
     70TARGETS METADATA
     71  NAME      STR  MD01
     72  DISTRIBUTION STR MD01
     73  TESS      STR  MD01.V2
     74  OBSMODE   STR  MD
     75  OBJECT    STR  MD01%
     76  STACKABLE BOOL TRUE
     77  MIN_STACK U16 8
     78  DIFFABLE  BOOL FALSE
     79  DIST      S16  30
     80END
     81TARGETS METADATA
     82  NAME      STR  MD02
     83  DISTRIBUTION STR MD02
     84  TESS      STR MD02
     85  OBSMODE   STR MD
     86  OBJECT    STR MD02%
     87  STACKABLE BOOL TRUE
     88  MIN_STACK U16 8
     89  DIFFABLE  BOOL FALSE
     90  DIST      S16 30
     91END
     92TARGETS METADATA
     93  NAME      STR MD03
     94  DISTRIBUTION STR MD03
     95  TESS      STR MD03
     96  OBSMODE   STR MD
     97  OBJECT    STR MD03%
     98  STACKABLE BOOL TRUE
     99  MIN_STACK U16 8
     100  DIFFABLE  BOOL FALSE
     101  DIST      S16 30
     102END
     103TARGETS METADATA
     104  NAME      STR MD04
     105  DISTRIBUTION STR MD04
     106  TESS      STR MD04
     107  OBSMODE   STR MD
     108  OBJECT    STR MD04%
     109  STACKABLE BOOL TRUE
     110  MIN_STACK U16 8
     111  DIFFABLE  BOOL FALSE
     112  DIST      S16 30
     113END
     114TARGETS METADATA
     115  NAME      STR MD05
     116  DISTRIBUTION STR MD05
     117  TESS      STR MD05
     118  OBSMODE   STR MD
     119  OBJECT    STR MD05%
     120  STACKABLE BOOL TRUE
     121  MIN_STACK U16 8
     122  DIFFABLE  BOOL FALSE
     123  DIST      S16 30
     124END
     125TARGETS METADATA
     126  NAME      STR MD06
     127  DISTRIBUTION STR MD06
     128  TESS      STR MD06
     129  OBSMODE   STR MD
     130  OBJECT    STR MD06%
     131  STACKABLE BOOL TRUE
     132  MIN_STACK U16 8
     133  DIFFABLE  BOOL FALSE
     134  DIST      S16 30
     135END
     136TARGETS METADATA
     137  NAME      STR MD07
     138  DISTRIBUTION STR MD07
     139  TESS      STR MD07
     140  OBSMODE   STR MD
     141  OBJECT    STR MD07%
     142  STACKABLE BOOL TRUE
     143  MIN_STACK U16 8
     144  DIFFABLE  BOOL FALSE
     145  DIST      S16 30
     146END
     147TARGETS METADATA
     148  NAME      STR MD08
     149  DISTRIBUTION STR MD08
     150  TESS      STR MD08.V2
     151  OBSMODE   STR MD
     152  OBJECT    STR MD08%
     153  STACKABLE BOOL TRUE
     154  MIN_STACK U16 8
     155  DIFFABLE  BOOL FALSE
     156  DIST      S16 30
     157END
     158TARGETS METADATA
     159  NAME      STR MD09
     160  DISTRIBUTION STR MD09
     161  TESS      STR MD09.V2
     162  OBSMODE   STR MD
     163  OBJECT    STR MD09%
     164  STACKABLE BOOL TRUE
     165  MIN_STACK U16 8
     166  DIFFABLE  BOOL FALSE
     167  DIST      S16 30
     168END
     169TARGETS METADATA
     170  NAME      STR MD10
     171  DISTRIBUTION STR MD10
     172  TESS      STR MD10.V2
     173  OBSMODE   STR MD
     174  OBJECT    STR MD10%
     175  STACKABLE BOOL TRUE
     176  MIN_STACK U16 8
     177  DIFFABLE  BOOL FALSE
     178  DIST      S16 30
     179END
     180TARGETS METADATA
     181  NAME      STR MD11
     182  DISTRIBUTION STR MD11
     183  TESS      STR MD11.V2
     184  OBSMODE   STR MD
     185  OBJECT    STR MD11%
     186  STACKABLE BOOL TRUE
     187  MIN_STACK U16 8
     188  DIFFABLE  BOOL FALSE
     189  DIST      S16 30
     190END
     191TARGETS METADATA
     192  NAME      STR STS
     193  DISTRIBUTION STR STS
     194  TESS      STR STS
     195  OBSMODE   STR STS%
     196  OBJECT    STR STS%
     197  STACKABLE BOOL FALSE
     198  DIFFABLE  BOOL FALSE
     199END
     200TARGETS METADATA
     201  NAME      STR SweetSpot
     202  DISTRIBUTION STR SweetSpot
     203  TESS      STR RINGS.V0
     204  OBSMODE   STR SS
     205  STACKABLE BOOL FALSE
     206  DIFFABLE  BOOL TRUE
     207  WARP      S16 60
     208END
     209TARGETS METADATA
     210  NAME         STR OSS
     211  DISTRIBUTION STR SweetSpot
     212  TESS         STR RINGS.V0
     213  OBSMODE      STR OSS
     214  STACKABLE   BOOL FALSE
     215  DIFFABLE    BOOL TRUE
     216END
     217TARGETS METADATA
     218  NAME         STR CNP
     219  DISTRIBUTION STR CNP
     220  TESS         STR RINGS.V0
     221  OBSMODE      STR CNP
     222  STACKABLE   BOOL FALSE
     223  DIFFABLE    BOOL FALSE
     224END
     225TARGETS METADATA
     226  NAME         STR ThreePi
     227  DISTRIBUTION STR ThreePi
     228  TESS         STR RINGS.V0
     229  OBSMODE      STR 3PI
     230  STACKABLE   BOOL FALSE
     231  DIFFABLE    BOOL TRUE
     232  CHIP         S16 14
     233  DIFF         S16 14
     234END
     235# This is a hack, and I freely admit it.
     236# Removed the rest because we do not regularly run microtests.
     237# TARGETS METADATA
     238#   NAME STR microtestMD01
     239#   TESS STR MD01
     240#   OBJECT STR MD01%
     241#   COMMENT STR Microtest Obs%
     242#   STACKABLE BOOL TRUE
    64243# END
    65 # MACRO_DEFINITIONS METADATA
    66 #   PROC_MODE STR check_registration
    67 #   MACRO     STR
     244# TARGETS METADATA
     245#   NAME STR microtestMD01.noPattern
     246#   TESS STR MD01
     247#   OBJECT STR MD01%
     248#   COMMENT STR Microtest Obs%
     249#   REDUCTION STR MICROTEST_NOPATTERN
     250#   STACKABLE BOOL TRUE
    68251# END
    69 # MACRO_DEFINITIONS METADATA
    70 #   PROC_MODE STR define_burntool
    71 #   MACRO     STR
    72 # END
    73 # MACRO_DEFINITIONS METADATA
    74 #   PROC_MODE STR queue_burntool
    75 #   MACRO     STR
    76 # END
    77 # MACRO_DEFINITIONS METADATA
    78 #   PROC_MODE STR check_stacks
    79 #   MACRO     STR
    80 # END
    81 # MACRO_DEFINITIONS METADATA
    82 #   PROC_MODE STR queue_stacks
    83 #   MACRO     STR
    84 # END
    85 # MACRO_DEFINITIONS METADATA
    86 #   PROC_MODE STR check_sweetspot
    87 #   MACRO     STR
    88 # END
    89 # MACRO_DEFINITIONS METADATA
    90 #   PROC_MODE STR queue_sweetspot
    91 #   MACRO     STR
    92 # END
    93 # MACRO_DEFINITIONS METADATA
    94 #   PROC_MODE STR check_dqstats
    95 #   MACRO     STR
    96 # END
    97 # MACRO_DEFINITIONS METADATA
    98 #   PROC_MODE STR queue_dqstats
    99 #   MACRO     STR
    100 # END
    101 # MACRO_DEFINITIONS METADATA
    102 #   PROC_MODE STR check_detrends
    103 #   MACRO     STR
    104 # END
    105 # MACRO_DEFINITIONS METADATA
    106 #   PROC_MODE STR queue_detrends
    107 #   MACRO     STR
    108 # END
    109 
    110 TARGETS MULTI
    111 TARGETS METADATA
    112   NAME STR M31
    113   TESS STR M31
    114   OBSMODE STR M31
    115   OBJECT STR M31%
    116 #  COMMENT STR M31%
    117   STACKABLE BOOL TRUE
    118   DIST S16 30
    119 END
    120 TARGETS METADATA
    121   NAME STR MD01
    122   TESS STR MD01.V2
    123   OBSMODE STR MD
    124   OBJECT STR MD01%
    125 #  COMMENT STR %MD01%
    126   STACKABLE BOOL TRUE
    127   DIST S16 30
    128 END
    129 TARGETS METADATA
    130   NAME STR MD02
    131   TESS STR MD02.V2
    132   OBSMODE STR MD
    133   OBJECT STR MD02%
    134 #  COMMENT STR %MD02%
    135   STACKABLE BOOL TRUE
    136   DIST S16 30
    137 END
    138 TARGETS METADATA
    139   NAME STR MD03
    140   TESS STR MD03
    141   OBSMODE STR MD
    142   OBJECT STR MD03%
    143 #  COMMENT STR %MD03%
    144   STACKABLE BOOL TRUE
    145   DIST S16 30
    146 END
    147 TARGETS METADATA
    148   NAME STR MD04
    149   TESS STR MD04
    150   OBSMODE STR MD
    151   OBJECT STR MD04%
    152 #  COMMENT STR %MD04%
    153   STACKABLE BOOL TRUE
    154   DIST S16 30
    155 END
    156 TARGETS METADATA
    157   NAME STR MD05
    158   TESS STR MD05
    159   OBSMODE STR MD
    160   OBJECT STR MD05%
    161 #  COMMENT STR %MD05%
    162   STACKABLE BOOL TRUE
    163   DIST S16 30
    164 END
    165 TARGETS METADATA
    166   NAME STR MD06
    167   TESS STR MD06
    168   OBSMODE STR MD
    169   OBJECT STR MD06%
    170 #  COMMENT STR %MD06%
    171   STACKABLE BOOL TRUE
    172   DIST S16 30
    173 END
    174 TARGETS METADATA
    175   NAME STR MD07
    176   TESS STR MD07
    177   OBSMODE STR MD
    178   OBJECT STR MD07%
    179 #  COMMENT STR %MD07%
    180   STACKABLE BOOL TRUE
    181   DIST S16 30
    182 END
    183 TARGETS METADATA
    184   NAME STR MD08
    185   TESS STR MD08.V2
    186   OBSMODE STR MD
    187   OBJECT STR MD08%
    188 #  COMMENT STR %MD08%
    189   STACKABLE BOOL TRUE
    190   DIST S16 30
    191 END
    192 TARGETS METADATA
    193   NAME STR MD09
    194   TESS STR MD09.V2
    195   OBSMODE STR MD
    196   OBJECT STR MD09%
    197 #  COMMENT STR %MD09%
    198   STACKABLE BOOL TRUE
    199   DIST S16 30
    200 END
    201 TARGETS METADATA
    202   NAME STR MD10
    203   TESS STR MD10.V2
    204   OBSMODE STR MD
    205   OBJECT STR MD10%
    206 #  COMMENT STR %MD10%
    207   STACKABLE BOOL TRUE
    208   DIST S16 30
    209 END
    210 TARGETS METADATA
    211   NAME STR MD11
    212   TESS STR MD11.V2
    213   OBSMODE STR MD
    214   OBJECT STR MD11%
    215 #  COMMENT STR %MD11%
    216   STACKABLE BOOL TRUE
    217   DIST S16 30
    218 END
    219 TARGETS METADATA
    220   NAME STR STS
    221   TESS STR STS
    222   OBSMODE STR STS%
    223   OBJECT STR STS%
    224 #  COMMENT STR Stellar Transit%
    225   STACKABLE BOOL FALSE
    226 END
    227 TARGETS METADATA
    228   NAME STR SweetSpot
    229   TESS STR RINGS.V0
    230   OBSMODE STR SS
    231 # OBJECT STR SS
    232   STACKABLE BOOL FALSE
    233   EXTRA_PROCESSING BOOL TRUE
    234 #  NOCLEAN BOOL TRUE
    235   WARP S16 60
    236 END
    237 TARGETS METADATA
    238   NAME STR OSS
    239   DISTRIBUTION STR SweetSpot
    240   TESS STR RINGS.V0
    241   OBSMODE STR OSS
    242   STACKABLE BOOL FALSE
    243   EXTRA_PROCESSING BOOL TRUE
    244 END
    245 TARGETS METADATA
    246   NAME STR CNP
    247   DISTRIBUTION STR CNP
    248   TESS STR RINGS.V0
    249   OBSMODE STR CNP
    250   STACKABLE BOOL FALSE
    251   EXTRA_PROCESSING BOOL FALSE
    252 END
    253 TARGETS METADATA
    254   NAME STR ThreePi
    255   TESS STR RINGS.V0
    256   OBSMODE STR 3PI
    257 # OBJECT STR 3PI
    258   STACKABLE BOOL FALSE
    259   CHIP S16 14
    260   DIFF S16 14
    261 END
    262 # This is a hack, and I freely admit it.
    263 TARGETS METADATA
    264   NAME STR microtestMD01
    265   TESS STR MD01
    266   OBJECT STR MD01%
    267   COMMENT STR Microtest Obs%
    268   STACKABLE BOOL TRUE
    269 END
    270 TARGETS METADATA
    271   NAME STR microtestMD01.noPattern
    272   TESS STR MD01
    273   OBJECT STR MD01%
    274   COMMENT STR Microtest Obs%
    275   REDUCTION STR MICROTEST_NOPATTERN
    276   STACKABLE BOOL TRUE
    277 END
    278 TARGETS METADATA
    279   NAME STR microtestMD02
    280   TESS STR MD02
    281   OBJECT STR MD02%
    282   COMMENT STR Microtest Obs%
    283   STACKABLE BOOL TRUE
    284 END
    285 TARGETS METADATA
    286   NAME STR microtestMD02.noPattern
    287   TESS STR MD02
    288   OBJECT STR MD02%
    289   COMMENT STR Microtest Obs%
    290   REDUCTION STR MICROTEST_NOPATTERN
    291   STACKABLE BOOL TRUE
    292 END
    293 TARGETS METADATA
    294   NAME STR microtestMD03
    295   TESS STR MD03
    296   OBJECT STR MD03%
    297   COMMENT STR Microtest Obs%
    298   STACKABLE BOOL TRUE
    299 END
    300 TARGETS METADATA
    301   NAME STR microtestMD03.noPattern
    302   TESS STR MD03
    303   OBJECT STR MD03%
    304   COMMENT STR Microtest Obs%
    305   REDUCTION STR MICROTEST_NOPATTERN
    306   STACKABLE BOOL TRUE
    307 END
    308 TARGETS METADATA
    309   NAME STR microtestMD04
    310   TESS STR MD04
    311   OBJECT STR MD04%
    312   COMMENT STR Microtest Obs%
    313   STACKABLE BOOL TRUE
    314 END
    315 TARGETS METADATA
    316   NAME STR microtestMD04.noPattern
    317   TESS STR MD04
    318   OBJECT STR MD04%
    319   COMMENT STR Microtest Obs%
    320   REDUCTION STR MICROTEST_NOPATTERN
    321   STACKABLE BOOL TRUE
    322 END
    323 TARGETS METADATA
    324   NAME STR microtestMD05
    325   TESS STR MD05
    326   OBJECT STR MD05%
    327   COMMENT STR Microtest Obs%
    328   STACKABLE BOOL TRUE
    329 END
    330 TARGETS METADATA
    331   NAME STR microtestMD05.noPattern
    332   TESS STR MD05
    333   OBJECT STR MD05%
    334   COMMENT STR Microtest Obs%
    335   REDUCTION STR MICROTEST_NOPATTERN
    336   STACKABLE BOOL TRUE
    337 END
    338 TARGETS METADATA
    339   NAME STR microtestMD06
    340   TESS STR MD06
    341   OBJECT STR MD06%
    342   COMMENT STR Microtest Obs%
    343   STACKABLE BOOL TRUE
    344 END
    345 TARGETS METADATA
    346   NAME STR microtestMD06.noPattern
    347   TESS STR MD06
    348   OBJECT STR MD06%
    349   COMMENT STR Microtest Obs%
    350   REDUCTION STR MICROTEST_NOPATTERN
    351   STACKABLE BOOL TRUE
    352 END
    353 TARGETS METADATA
    354   NAME STR microtestMD07
    355   TESS STR MD07
    356   OBJECT STR MD07%
    357   COMMENT STR Microtest Obs%
    358   STACKABLE BOOL TRUE
    359 END
    360 TARGETS METADATA
    361   NAME STR microtestMD07.noPattern
    362   TESS STR MD07
    363   OBJECT STR MD07%
    364   COMMENT STR Microtest Obs%
    365   REDUCTION STR MICROTEST_NOPATTERN
    366   STACKABLE BOOL TRUE
    367 END
    368 TARGETS METADATA
    369   NAME STR microtestMD08
    370   TESS STR MD08
    371   OBJECT STR MD08%
    372   COMMENT STR Microtest Obs%
    373   STACKABLE BOOL TRUE
    374 END
    375 TARGETS METADATA
    376   NAME STR microtestMD08.noPattern
    377   TESS STR MD08
    378   OBJECT STR MD08%
    379   COMMENT STR Microtest Obs%
    380   REDUCTION STR MICROTEST_NOPATTERN
    381   STACKABLE BOOL TRUE
    382 END
    383 TARGETS METADATA
    384   NAME STR microtestMD09
    385   TESS STR MD09
    386   OBJECT STR MD09%
    387   COMMENT STR Microtest Obs%
    388   STACKABLE BOOL TRUE
    389 END
    390 TARGETS METADATA
    391   NAME STR microtestMD09.noPattern
    392   TESS STR MD09
    393   OBJECT STR MD09%
    394   COMMENT STR Microtest Obs%
    395   REDUCTION STR MICROTEST_NOPATTERN
    396   STACKABLE BOOL TRUE
    397 END
    398 TARGETS METADATA
    399   NAME STR microtestMD10
    400   TESS STR MD10
    401   OBJECT STR MD10%
    402   COMMENT STR Microtest Obs%
    403   STACKABLE BOOL TRUE
    404 END
    405 TARGETS METADATA
    406   NAME STR microtestMD10.noPattern
    407   TESS STR MD10
    408   OBJECT STR MD10%
    409   COMMENT STR Microtest Obs%
    410   REDUCTION STR MICROTEST_NOPATTERN
    411   STACKABLE BOOL TRUE
    412 END
    413252
    414253# Detrend verification data
     
    420259  REF_ID   S64 299
    421260  REF_ITER S32 0
    422 #  FILTER   STR
    423   MAX      S32 10
     261  MAX_EXP  S32 10
    424262END
    425263
     
    431269  REF_ITER S32 0
    432270  FILTER   STR g.00000
    433   MAX      S32 10
     271  MAX_EXP  S32 10
    434272END
    435273
     
    441279  REF_ITER S32 0
    442280  FILTER   STR r.00000
    443   MAX      S32 10
     281  MAX_EXP  S32 10
    444282END
    445283
     
    451289  REF_ITER S32 0
    452290  FILTER   STR i.00000
    453   MAX      S32 10
     291  MAX_EXP  S32 10
    454292END
    455293
     
    461299  REF_ITER S32 0
    462300  FILTER   STR z.00000
    463   MAX      S32 10
     301  MAX_EXP  S32 10
    464302END
    465303
     
    471309  REF_ITER S32 0
    472310  FILTER   STR y.00000
    473   MAX      S32 10
     311  MAX_EXP  S32 10
    474312END
    475313
     
    481319  REF_ITER S32 0
    482320  FILTER   STR w.00000
    483   MAX      S32 10
    484 END
    485 
     321  MAX_EXP  S32 10
     322END
     323
  • trunk/ippconfig/recipes/ppStats.config

    r29902 r30049  
    236236  CONCEPT       STR     FPA.BURNTOOL.APPLIED
    237237
     238
    238239  CONCEPT       STR     FPA.PON.TIME    # time since last power on
     240
     241  CONCEPT       STR     CHIP.VIDEOCELL 
    239242
    240243  STAT          STR     ROBUST_MEDIAN   # Background estimator
  • trunk/ippconfig/recipes/ppStatsFromMetadata.config

    r29902 r30049  
    4545  ENTRY  VAL  FPA.PON.TIME        F32  CONSTANT          -pon_time            # time since last power on
    4646#  ENTRY  VAL  FPA.BURNTOOL.APPLIED S32 CONSTANT          -burntool_state      #
     47  ENTRY  VAL  CHIP.VIDEOCELL      BOOL CONSTANT          -video_cells         # This chip contains a video cell
    4748  ENTRY  VAL  CHIP.TEMP           F32  SAMPLE_MEAN       -ccd_temp            # CCD temperature
    4849  ENTRY  VAL  CELL.EXPOSURE       F32  SAMPLE_MEAN       -exp_time            # Exposure time
  • trunk/psLib/src/imageops

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psModules/src/concepts/pmConcepts.c

    r28552 r30049  
    249249CONCEPT_REGISTER_FUNCTION(S32, Enum, -1); // For enums: set default to -1
    250250CONCEPT_REGISTER_FUNCTION(S32, S32, 0); // For values: set default to 0
    251 //CONCEPT_REGISTER_FUNCTION(Bool, Bool, NULL); // For values: set default to 0
     251CONCEPT_REGISTER_FUNCTION(Bool, Bool, NULL); // For values: set default to 0
    252252
    253253static void conceptRegisterTime(const char *name, /* Name of concept */ \
     
    353353        conceptRegisterStr("CHIP.ID", "Chip identifier", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP);
    354354        conceptRegisterF32("CHIP.SEEING", "Seeing FWHM (pixels)", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP);
     355        conceptRegisterBool("CHIP.VIDEOCELL", "Does this OTA have any video cells", p_pmConceptParse_VideoCell,NULL,NULL,false,PM_FPA_LEVEL_CHIP);
    355356    }
    356357
  • trunk/psModules/src/concepts/pmConceptsStandard.c

    r28690 r30049  
    737737    return psMetadataItemAllocS32(pattern->name, pattern->comment, binning);
    738738}
     739
     740// VIDEOCELLS
     741psMetadataItem *p_pmConceptParse_VideoCell(const psMetadataItem *concept,
     742                                          const psMetadataItem *pattern,
     743                                          pmConceptSource source,
     744                                          const psMetadata *cameraFormat,
     745                                          const pmFPA *fpa,
     746                                          const pmChip *chip,
     747                                          const pmCell *cell)
     748{
     749  assert(concept);
     750  assert(pattern);
     751  bool has_video_cell = false;
     752
     753  if (concept->type != PS_DATA_STRING) {
     754    psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not string\n",
     755            concept->name, concept->type);
     756    return NULL;
     757  }
     758
     759  char *Vptr = strchr(concept->data.V,'V');
     760  if (Vptr) {
     761    has_video_cell = true;
     762  }
     763
     764  return psMetadataItemAllocBool(pattern->name, pattern->comment, has_video_cell);
     765}
     766 
     767   
    739768
    740769// BTOOLAPP
  • trunk/psModules/src/concepts/pmConceptsStandard.h

    r25930 r30049  
    136136    );
    137137
     138// Parse the CHIP.VIDEOCELL concept
     139psMetadataItem *p_pmConceptParse_VideoCell(
     140   const psMetadataItem *concept, ///< Concept to parse
     141   const psMetadataItem *pattern, ///< Pattern to use in parsing
     142   pmConceptSource source, ///< Source for concept
     143   const psMetadata *cameraFormat, ///< Camera format definition
     144   const pmFPA *fpa, ///< FPA for concept, or NULL
     145   const pmChip *chip, ///< Chip for concept, or NULL
     146   const pmCell *cell ///< Cell for concept, or NULL
     147   );
     148
    138149/// Format for the BTOOLAPP conceptn
    139150psMetadataItem *p_pmConceptParse_BTOOLAPP(
  • trunk/psModules/src/objects

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psphot

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psphot/src/psphotApResid.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psphot/src/psphotMakeFluxScale.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.