IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 20, 2010, 2:30:45 PM (16 years ago)
Author:
watersc1
Message:

Attempting to bring branch in sync with trunk

Location:
branches/czw_branch/20101203
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20101203

  • branches/czw_branch/20101203/ippScripts

    • Property svn:mergeinfo deleted
  • branches/czw_branch/20101203/ippScripts/scripts/automate_stacks.pl

    r29700 r30118  
    13551355    my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target);
    13561356
    1357     if ($target eq 'OSS') {
     1357    if (($target eq 'OSS')||($target eq 'SweetSpot')) {
    13581358        my $db = init_gpc_db();
    13591359
     
    13721372           
    13731373            if (($#{ $warps } + 1) % 2 != 0) {
    1374                 print STDERR "Number of input warps to make OSS diffs is not even! $#{ $warps }\n";
    1375                 last;
     1374                print STDERR "Number of input warps to make OSS diffs is not even! $this_object $#{ $warps }\n";
     1375#               last;
     1376                next;
    13761377            }
    13771378           
  • branches/czw_branch/20101203/ippScripts/scripts/camera_exp.pl

    r29893 r30118  
    378378        $ipprc->file_exists($file);
    379379
    380     if ($replicate and (file_scheme($file) eq 'neb')) {
     380    my $scheme = file_scheme($file);
     381    if ($replicate and $scheme and (file_scheme($file) eq 'neb')) {
    381382        $ipprc->replicate_file($file) or &my_die("failed to replicate: $file\n",  $cam_id, $PS_EXIT_SYS_ERROR);
    382383    }
  • branches/czw_branch/20101203/ippScripts/scripts/chip_imfile.pl

    r29896 r30118  
    159159        if (storage_object_exists($configuration, \$gone)) {
    160160            if ($gone) {
    161                 rename_gone_file($configuration);
    162161                $configuration = prepare_output('PPIMAGE.CONFIG', $outroot, $class_id, 1);
    163162                # if we dump the config we need to insure that the config dump represents
     
    177176    $ipprc->delete_destreak_backup_file($outputWeight)
    178177        or &my_die("failed to delete existing destreak backup weight file", $exp_id, $chip_id, $class_id, $PS_EXIT_UNKNOWN_ERROR);
     178
     179    # don't do binned images when updating unless we are starting from scratch.
     180    $do_binned_images = 0 unless $dump_config;
    179181}
    180182if ($do_binned_images) {
     
    491493        check_output($configuration, 1) if $dump_config;
    492494        check_output($backmdl, 1) if $outputBackmdlExpect;
    493         check_output($pattern, 1) if $outputPatternExpect;
     495        # allow the pattern file to be missing if run state is update older data doesn't have one
     496        # I should parse the config dump file to calculate the 'Expect' variables
     497        check_output($pattern, 1, $run_state eq 'update') if $outputPatternExpect;
    494498        if ($do_photom) {
    495499            check_output($outputSources, 1);
     
    556560            if ($gone) {
    557561                carp "WARNING: photometry sources storage object exists but all instances are permanently gone";
    558                 rename_gone_file($outputSources);
    559562                $make_sources = 1;
    560563            }
     
    579582            if ($gone) {
    580583                carp "WARNING: PSF storage object exists but all instances are permanently gone";
    581                 rename_gone_file($outputPsf);
    582584                $make_psf = 1;
    583585            }
     
    613615sub storage_object_exists
    614616{
     617    return 0 if !$neb;
     618
    615619    my $file = shift;
    616620    my $ref_all_gone = shift;
     621
    617622
    618623    my $exists = $neb->storage_object_exists($file);
     
    678683    return 1;
    679684}
    680 sub rename_gone_file
    681 {
    682     # check whether the only instance of file is on a lost volume
    683     # XXX: we don't have a proper interface for this.
    684     # For now try to use Bill's hack: the script 'whichnode'
    685 
    686     my $file = shift;
    687     $neb->move($file, "$file.gone") or
    688                     &my_die("failed to rename: $file", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    689 }
    690685
    691686# Prepare to write to an output file
     
    711706    my $file = shift;
    712707    my $replicate = shift;
     708    my $allow_missing = shift;
    713709
    714710    if (!defined $file) {
     
    716712    }
    717713
    718     &my_die("Couldn't find expected output file: $file",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($file);
    719 
    720     if ($replicate and (file_scheme($file) eq 'neb')) {
     714    my $exists = $ipprc->file_exists($file);
     715
     716    if (!$exists) {
     717        if ($allow_missing) {
     718            carp("Couldn't find expected output_file: $file but continuing anyways\n");
     719            return 1;
     720        }
     721        &my_die("Couldn't find expected output file: $file",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     722    }
     723
     724    if ($replicate and $neb) {
    721725        $ipprc->replicate_file($file) or &my_die("failed to replicate: $file\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    722726    }
  • branches/czw_branch/20101203/ippScripts/scripts/dist_bundle.pl

    r29063 r30118  
    6262my $streaksrelease   = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1);
    6363my $bgtool   = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1);
     64my $file_cmd   = can_run('file') or (warn "can't find program file" and $missing_tools = 1);
     65my $zcat   = can_run('zcat') or (warn "can't find program zcat" and $missing_tools = 1);
    6466if ($missing_tools) {
    6567    warn("Can't find required tools.");
     
    526528                    $PS_EXIT_CONFIG_ERROR) if (!$resolved);
    527529
     530    &my_die("config dump file resolved but not accessible: $config_file_rule", $component,
     531                    $PS_EXIT_CONFIG_ERROR) if !$ipprc->file_exists($resolved);
     532
     533    my $mdc_compressed;
     534    {
     535        my $command = "$file_cmd $resolved";
     536        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     537            run(command => $command, verbose => $verbose);
     538        unless ($success) {
     539            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     540            &my_die("Unable to perform $command: $error_code", $component, $error_code);
     541        }
     542        my $output = join "", @$stdout_buf;
     543        # XXX: may need to to make this more robust
     544        $mdc_compressed = ($output =~ /gzip/);
     545    }
     546    my $inName;
     547    if ($mdc_compressed) {
     548        my $tmpfile;
     549        ($tmpfile, $inName) = tempfile( "/tmp/bundle.XXXX", UNLINK => !$save_temps );
     550        close($tmpfile) or &my_die("failed to close $inName", $component, $PS_EXIT_UNKNOWN_ERROR);
     551
     552        my $command = "$zcat $resolved > $inName";
     553        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     554            run(command => $command, verbose => $verbose);
     555        unless ($success) {
     556            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     557            &my_die("Unable to perform $command: $error_code", $component, $error_code);
     558        }
     559
     560
     561    } else {
     562        $inName = $resolved;
     563    }
     564    my $in = open_with_retries($inName);
     565
    528566    # we don't use the mdc parser because the perl parser is way is too slow for complicated config
    529567    # files like this
    530     my $in = open_with_retries($resolved);
    531 
    532568    my $line;
    533569    while ($line = <$in>) {
  • branches/czw_branch/20101203/ippScripts/scripts/magic_destreak.pl

    r29571 r30118  
    309309        }
    310310
    311         $sources = $ipprc->filename("PSPHOT.OUTPUT",  $path_base, $class_id);
     311        # only destreak cmf file if this is a new run
     312        if ($run_state eq 'new') {
     313            $sources = $ipprc->filename("PSPHOT.OUTPUT",  $path_base, $class_id);
     314        }
    312315
    313316    } elsif ($stage eq "chip_bg") {
  • branches/czw_branch/20101203/ippScripts/scripts/magic_destreak_defineruns.pl

    r27718 r30118  
    7878    foreach my $label (@labels) {
    7979        my $command = "$magicdstool -definebyquery -stage $stage -workdir $workdir -label $label";
    80         $command .= " -dry_run" if $no_update;
     80        $command .= " -pretend" if $no_update;
    8181        $command .= " -limit $stage_limit" if $stage_limit;
    8282        $command .= " -set_label $label";
  • branches/czw_branch/20101203/ippScripts/scripts/magic_destreak_revert.pl

    r29573 r30118  
    191191    $image  = $ipprc->filename("PPIMAGE.CHIP", $path_base, $class_id);
    192192    $weight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $path_base, $class_id);
    193     $sources = $ipprc->filename("PSPHOT.OUTPUT", $path_base, $class_id);
    194193
    195194    # we use the mask output from the camera stage for input and replace
     
    204203    }
    205204
     205    # only revert sources if this is a new run, not one being updated
     206    if ($run_state eq 'new') {
     207        $sources = $ipprc->filename("PSPHOT.OUTPUT", $path_base, $class_id);
     208        $bsources = $ipprc->filename("PSPHOT.OUTPUT", $backup_path_base, $class_id);
     209    }
     210
    206211    $bimage  = $ipprc->filename("PPIMAGE.CHIP", $backup_path_base, $class_id);
    207212    # This is somewhat kludgey but it works whether the mask is camera mask or chip mask
     
    209214    $bch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $backup_path_base, $class_id);
    210215    $bweight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $backup_path_base, $class_id);
    211     $bsources = $ipprc->filename("PSPHOT.OUTPUT", $backup_path_base, $class_id);
    212216} elsif ($stage eq "camera") {
    213217    $astrom =  $ipprc->filename("PSASTRO.OUTPUT", $path_base);
  • branches/czw_branch/20101203/ippScripts/scripts/publish_file.pl

    r29622 r30118  
    4444my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir );
    4545my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect );
     46my ( $output_format );
    4647
    4748GetOptions(
     
    5960    'save-temps'        => \$save_temps, # Save temporary files?
    6061    'redirect-output'   => \$redirect,   # Redirect output to log file?
     62    'output_format=i'   => \$output_format, # Output format for ppMops
    6163    ) or pod2usage( 2 );
    6264
     
    191193                     warp_id => $comp->{warp1},
    192194                     diff_id => $comp->{diff_id},
     195                     output_format => $comp->{output_format},
    193196                     direction => 1,
    194197        };
     
    323326
    324327    my $command = "$ppMops $input $output";
    325     $command .= " -version 1"; # XXX : NOTE: for now, MOPS just wants PS1_DV1 (remove this eventually...)
    326328    $command .= " -exp_name " . $data->{exp_name} if defined $data->{exp_name};
    327329    $command .= " -exp_id " . $data->{exp_id} if defined $data->{exp_id};
     
    335337    $command .= " -zp_error " . $data->{zp_err} if defined $data->{zp_err};
    336338    $command .= " -astrom_rms " . $data->{astrom} if defined $data->{astrom};
     339    $command .= " -version " . $data->{output_format} if defined $data->{output_format};
    337340
    338341    unless ($no_op) {
  • branches/czw_branch/20101203/ippScripts/scripts/receive_file.pl

    r29574 r30118  
    3232my $receivetool = can_run('receivetool') or (warn "Can't find receivetool" and $missing_tools = 1);
    3333my $dsproductls = can_run('dsfilesetls') or (warn "Can't find dsfilesetls" and $missing_tools = 1);
     34my $gunzip = can_run('gunzip') or (warn "Can't find gunzip" and $missing_tools = 1);
    3435if ($missing_tools) {
    3536    warn("Can't find required tools.");
     
    404405    my $workdir = shift;
    405406
     407    my $filecmd_output = `file $src`;
     408    &my_die("failed to determinte file type of $src", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$filecmd_output;
     409    chomp $filecmd_output;
     410
     411    my $tmpName;
     412    if ($filecmd_output =~ /gzip/) {
     413        my $tmpfile;
     414        ($tmpfile, $tmpName) = tempfile( "/tmp/receive.XXXX", UNLINK => !$save_temps );
     415        close($tmpfile) or &my_die("failed to close $tmpName", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     416
     417        my $command = "$gunzip -c $src > $tmpName";
     418        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     419            run(command => $command, verbose => $verbose);
     420        unless ($success) {
     421            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     422            &my_die("Unable to perform $command: $error_code", $component, $error_code);
     423        }
     424        $src = $tmpName;
     425    }
     426
    406427    open my $IN,  "<$src" or &my_die("failed to open $src for input", $file_id, $PS_EXIT_UNKNOWN_ERROR);
    407428    open my $OUT, ">$dest" or &my_die("failed to open $dest for output", $file_id, $PS_EXIT_UNKNOWN_ERROR);
  • branches/czw_branch/20101203/ippScripts/scripts/register_imfile.pl

    r29982 r30118  
    287287    if ($burntool_data->{burnable} == 0) {
    288288        $regtool_update .= " -burntool_state 0 -set_state pending_burntool ";
     289        unless ($no_update) {
     290            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     291                IPC::Cmd::run(command => $regtool_update, verbose => $verbose);
     292            unless ($success) {
     293                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     294                warn ("Unable to perform regtool -addprocessedimfile: $error_code");
     295                exit($error_code);
     296            }
     297        } else {
     298            print "skipping command: $command\n";
     299        }
    289300    }
    290301    else {
     
    296307        $apply_command .= " --verbose " if $verbose;
    297308        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);
     309        unless ($no_update) {
     310            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     311                IPC::Cmd::run(command => $apply_command, verbose => $verbose);
     312            unless ($success) {
     313                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     314                warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code");
     315                exit($error_code);
     316            }
    304317        }
    305318    }   
    306319
    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     }
    318320
    319321}
Note: See TracChangeset for help on using the changeset viewer.