IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26204


Ignore:
Timestamp:
Nov 19, 2009, 5:32:10 PM (16 years ago)
Author:
bills
Message:

change "params" file for get_image jobs to be mdc doc that contains "all" of
the data for the component. Various other changes.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r26201 r26204  
    328328            $stage_id = $image->{exp_id};
    329329        } elsif ($img_type eq "chip") {
    330             $stage_id = $image->{chip};
     330            $stage_id = $image->{chip_id};
    331331        } elsif ($img_type eq "warp") {
    332332            $stage_id = $image->{warp_id};
     
    336336            $stage_id = $image->{stack_id};
    337337        }
    338         $image->{stage_id} = $stage_id;
    339         $image->{stage}    = $img_type;
    340         $image->{image_db} = $image_db;
     338        $out->{stage_id} = $stage_id;
     339        $out->{stage}    = $img_type;
     340        $out->{image_db} = $image_db;
    341341
    342342        # find the mask and weight images
  • trunk/pstamp/scripts/pstamp_get_image_job.pl

    r26151 r26204  
    5353die $err if $err;
    5454
    55 my $params_file = $output_base . ".params";
     55my $params_file = $output_base . ".mdc";
    5656if (! open(INPUT, "<$params_file") ) {
    5757    die("failed to open params file: $params_file");
    5858}
    5959
     60my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     61
    6062my $params = join "", (<INPUT>);
    6163
    62 print STDERR "\nparams is $params\n";
     64my $data = $mdcParser->parse($params) or die("failed to parse metadata config doc");
     65my $components = parse_md_list($data);
     66my $n = scalar @$components;
     67if ($n != 1) {
     68    die("params file $params_file contains unexpected number of components: $n");
     69}
     70my $comp = $components->[0];
     71my $stage = $comp->{stage};
     72my $stage_id = $comp->{stage_id};
     73my $component = $comp->{component};
     74my $path_base = $comp->{path_base};
     75my $camera = $comp->{camera};
     76my $magicked = $comp->{magicked};
    6377
    64 my ($stage, $stage_id, $component, $path_base, $camera) = split " ", $params;
    65 if (!$camera or !$path_base or !$component or !$stage_id or !$stage) {
    66    die "failed to parse params: $params";
     78if ($verbose) {
     79    print STDERR "\nstage is $stage\n";
     80    print STDERR "stage_id is $stage_id\n";
     81    print STDERR "path_base is $path_base\n";
     82    print STDERR "path_base is $path_base\n";
     83    print STDERR "CAMERA is $camera\n";
     84    print STDERR "magicked is " . (defined $magicked ? $magicked : "undefined") . "\n";
    6785}
    6886
    69 print STDERR "\nCAMERA is $camera\n";
     87if (!$camera or !$path_base or !$component or !$stage_id or !$stage) {
     88       die "failed to parse params from: $params_file";
     89}
     90
    7091
    7192my $out_dir = dirname($output_base);
    72 my $prefix = basename($output_base);
     93my $prefix = basename($output_base) . "_";
    7394my $results_file = $output_base . ".bundle_results";
    7495
     
    86107    $command .= " --path_base $path_base --outdir $out_dir --results_file $results_file";
    87108    $command .= " --prefix $prefix";
    88     # ignore magic for now
    89     $command .= " --no_magic";
    90 
     109    $command .= " --magicked" if $magicked;
    91110    $command .= " --dbname $dbname" if $dbname;
     111    $command .= " --verbose" if $verbose;
    92112    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    93113        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstamp_job_run.pl

    r26151 r26204  
    153153    $command .= " --dbname $dbname" if $dbname;
    154154    $command .= " --dbserver $dbserver" if $dbserver;
     155    $command .= " --verbose $verbose" if $verbose;
    155156    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    156157        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstampparse.pl

    r26151 r26204  
    394394        print ARGSLIST "$args\n";
    395395        close ARGSLIST or my_die("failed to close $argslist", $PS_EXIT_UNKNOWN_ERROR);
     396
     397        write_params($output_base, $image);
    396398
    397399        my $newState = "run";
     
    638640        my $exp_id = $image->{exp_id};
    639641           
    640         my $output_base = "$out_dir/${rownum}_${job_num}_";
    641         my $params = "${output_base}.params";
    642 
    643         # copy the argument list to a file
    644         open PARAMS, ">$params" or my_die("failed to open $params", $PS_EXIT_UNKNOWN_ERROR);
    645         print PARAMS "$stage $image->{stage_id} $image->{component} $image->{path_base} $image->{camera}\n";
    646         close PARAMS or my_die("failed to close $params", $PS_EXIT_UNKNOWN_ERROR);
     642        my $output_base = "$out_dir/${rownum}_${job_num}";
     643
     644        write_params($output_base, $image);
    647645
    648646        my $newState = "run";
     
    877875}
    878876
     877sub write_params {
     878    my $output_base = shift;
     879    my $image = shift;
     880
     881    # write the contents of this "image" as a metadata config doc
     882    # Simply treat all values as strings. This is ok since we are only going to
     883    # read it from another perl script
     884    my $mdc_file = "${output_base}.mdc";
     885    open P, ">$mdc_file" or my_die("failed to open $mdc_file", $PS_EXIT_UNKNOWN_ERROR);
     886
     887    print P "params METADATA\n";
     888
     889    foreach my $key (keys %$image) {
     890        my $value = $image->{$key};
     891        if (defined $value) {
     892            printf P "  %-20s STR     %s\n", $key, $value;
     893        } else {
     894            printf STDERR "skipping undefined value for $key\n";
     895        }
     896    }
     897
     898    print P "END\n";
     899    close P or my_die("failed to close $mdc_file", $PS_EXIT_UNKNOWN_ERROR);
     900}
     901
    879902sub my_die
    880903{
Note: See TracChangeset for help on using the changeset viewer.