IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34447


Ignore:
Timestamp:
Sep 18, 2012, 3:52:27 PM (14 years ago)
Author:
bills
Message:

Start working on version 2 of the postage stamp fits interface

Location:
trunk/pstamp/scripts
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/psmkreq

    r29305 r34447  
    5252my $comment;
    5353
     54my $survey_name = 'null';
     55my $release = 'null';
     56my $stack_type = 'null';
     57my $bgrestore;
     58my $jpeg;
     59my $nocompress;
     60
    5461my $missing_tools;
    5562my $pstamp_request_file  = can_run('pstamp_request_file')  or (warn "Can't find required program pstamp_request_file"  and $missing_tools = 1);
     
    6875    'width=i'           => \$width,
    6976    'height=i'          => \$height,
    70     'pixcenter'         => \$pixcenter,
     77# pixcenter is deprecated
     78#    'pixcenter'         => \$pixcenter,
    7179    'arcseconds'        => \$arcseconds,
    7280    'coord_mask=i'      => \$coord_mask,
     
    8795    'comment=s'         => \$comment,
    8896
     97    # new columns for version 2
     98    'survey=s'          => \$survey_name,
     99    'release=s'         => \$release,
     100    'stack_type'        => \$stack_type,
     101
    89102    'option_mask=i'     => \$option_mask,
    90103    'image'             => \$image,
    91104    'mask'              => \$mask,
    92105    'variance'          => \$variance,
    93     'cmf'               => \$cmf,
     106    'sources'           => \$cmf,
    94107    'psf'               => \$psf,
    95108    'backmdl'           => \$backmdl,
     
    99112    'do_not_wait'       => \$no_wait,
    100113
     114    # new options for version 2
     115    'no_compress'       => \$nocompress,
     116    'bgrestore'         => \$bgrestore,
     117
    101118    'verbose'           => \$verbose,
    102119    'save-temps'        => \$save_temps,
     
    110127
    111128pod2usage( -msg => "Invalid job_type: $job_type", -exitval =>1 )
    112         unless ($job_type eq 'stamp' or $job_type eq 'get_image');
    113 
    114 if ($job_type eq 'stamp') {
     129        unless ($job_type eq 'stamp' or $job_type eq 'get_image' or $job_type eq 'listtargets');
     130
     131if (($job_type eq 'stamp') or ($job_type eq 'listtargets')) {
    115132    if (defined $list) {
    116133        pod2usage( -msg => "--ra --dec --x --y are not used with --list", -exitval =>1 )
     
    152169$id = 0 if !$id;
    153170
    154 unless ($stage eq 'raw' or $stage eq 'chip' or $stage eq 'warp' or $stage eq 'diff' or $stage eq 'stack') {
    155     die "$stage is not a valid value for stage\n";
     171
     172unless (($job_type eq 'listtargets' and $stage eq 'exposure') or $stage eq 'raw' or $stage eq 'chip' or $stage eq 'warp' or $stage eq 'diff' or $stage eq 'stack') {
     173    die "$stage is not a valid stage for $job_type jobs\n";
    156174}
    157175
     
    207225} else {
    208226    $rows = [];
    209     push @$rows, buildRow("", $comment, $x, $y, $filter, $mjd_min, $mjd_max);
     227    push @$rows, buildRow("", $comment, $x, $y, $filter, $mjd_min, $mjd_max, $survey_name, $release, $stack_type);
    210228}
    211229
    212230my ($tdf, $table_def_name) = tempfile ("/tmp/tabledef.XXXX", UNLINK => !$save_temps);
    213 print $tdf "$req_name 1\n";
     231print $tdf "$req_name 2\n";
    214232my $rownum = 0;
    215233foreach my $row (@$rows) {
    216234    $rownum++;
    217235    my $line = "$rownum $row->{ra}\t$row->{dec}\t$width $height"
    218         . " $coord_mask $job_type $option_mask $project $req_type"
     236        . " $coord_mask $job_type $option_mask $project $row->{survey_name} $row->{release} $req_type"
    219237        . " $stage $id $tess_id $component $data_group"
    220         . " $row->{filter} $row->{mjd_min} $row->{mjd_max}";
     238        . " $row->{filter} $row->{mjd_min} $row->{mjd_max} $row->{stack_type}";
    221239
    222240    if ($row->{comment} and $row->{comment} ne '') {
     
    230248}
    231249close $tdf;
     250
     251system "cat $table_def_name";
     252#exit 0;
    232253
    233254{
     
    277298    $row->{dec}     = checkDEC($vals[1], $linenumber);
    278299    $row->{filter}  = checkFilter($vals[2], $filter, $linenumber);
    279     $row->{mjd_min} = checkMJD($vals[3], $mjd_min, $linenumber);;
    280     $row->{mjd_max} = checkMJD($vals[4], $mjd_max, $linenumber);;
     300    $row->{mjd_min} = checkMJD($vals[3], $mjd_min, $linenumber);
     301    $row->{mjd_max} = checkMJD($vals[4], $mjd_max, $linenumber);
     302    $row->{survey_name}  = $vals[5];
     303    $row->{release} = $vals[6];
     304    $row->{stack_type} = $vals[7];
    281305    $row->{comment} = $comment;
    282306
  • trunk/pstamp/scripts/pstamp_finish.pl

    r33670 r34447  
    107107    my ($header, $rows) = read_request_file($req_file);
    108108
    109     if (!$header or !$rows) {
    110         # Since a request got queued, the request file must have been readable at some
    111         # point
     109    my $action = $header->{ACTION};
     110
     111    if (!$header or (($action eq 'PROCESS') and !$rows)) {
     112        # Since a request got queued, the request file must have been readable at some point
    112113        my_die("failed to read request file $req_file", $req_id, $PS_EXIT_CONFIG_ERROR);
    113114    }
     
    126127    }
    127128
    128     # The results table definition file
    129     my ($tdf, $table_def_name) = tempfile ("$outdir/tabledef.XXXX", UNLINK => !$save_temps);
    130 
    131     # data for the header
    132     print $tdf "$req_name|$req_id|\n";
    133 
    134     # get the list of jobs generated for this request
    135     my @jobs;
    136     {
    137         my $command = "$pstamptool -listjob -req_id $req_id";
    138         $command   .= " -dbname $dbname" if $dbname;
    139         $command   .= " -dbserver $dbserver" if $dbserver;
    140         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    141             run(command => $command, verbose => $verbose);
    142         unless ($success) {
    143             die("Unable to perform $command error code: $error_code");
    144         }
    145         my $output = join "", @$stdout_buf;
    146         if (!$output) {
    147             # This should not happen. A fake job should have been entered
    148             my_die("Request $req_id produced no jobs", $req_id, $PS_EXIT_PROG_ERROR);
    149         } else {
    150             my $jobs = parse_md_fast($mdcParser, $output);
    151 
    152             @jobs = @$jobs;
    153         }
    154     }
    155 
    156     my $exp_info;
    157     foreach my $job (@jobs) {
    158         my $job_id = $job->{job_id};
    159         my $job_type = $job->{jobType};
    160         my $rownum = $job->{rownum};
    161         my $fault = $job->{fault};
    162         my $exp_id = $job->{exp_id};
    163 
    164         my $error_string = get_error_string($fault);
    165 
    166         if (($fault eq $PSTAMP_DUP_REQUEST) and ($req_name eq "NULL")) {
    167             # this request had a duplicate request name yet the parser didn't give
    168             # it an "ERROR style name.
    169             my_die("duplicate request not given a request name", $req_id, $PS_EXIT_PROG_ERROR);
    170         }
    171         my ($row, $req_info, $project) = get_request_info($rows, $rownum);
    172 
    173         my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver);
    174         my $image_db = $proj_hash->{dbname};
    175         if (!$image_db and !$fault) {
    176             # if project isn't resolvable, the paser should have faulted this job
    177             my_die("failed to find imagedb for project $project", $req_id, $PS_EXIT_CONFIG_ERROR);
    178         }
    179 
    180         my $job_params = get_job_parameters($job);
    181         my $stage = "";
    182         if ($job_params) {
    183             $stage = $job_params->{stage};
    184         }
    185 
    186         if ($stage ne 'stack') {
    187             # get the metadata for the exposure (if any i.e. stack)
    188             # returns an appropriate string if !$exp_id
    189             $exp_info = get_exposure_info($job_params, $image_db, $exp_id);
    190         } else {
    191             my $filter = $job_params->{filter};
    192             $filter = "0" if !$filter;
    193             my $mjd_obs = $job_params->{mjd_obs};
    194             $mjd_obs = "0" if !$mjd_obs;
    195             $exp_info = "$mjd_obs|0|0|$filter|0|0";
    196         }
    197 
    198         if (($job_type eq "stamp") || ($job_type eq "get_image") || ($job_type eq "none")) {
    199             my $jreglist = "$outdir/reglist$job_id";
    200             if (open JRL, "<$jreglist") {;
    201                 # process the reglist file to get the list of files produced by this job
    202                 foreach my $line (<JRL>) {
    203 
    204                     # XXX: we are getting many cases where the size and/or md5sum calculated by
    205                     # the job has changed by the time the request_finish has run
    206                     # Don't
    207                     # add line to the requests's reglist
    208                     # ....
    209 #                    print $rlf $line;
    210 
    211 
    212                     chomp $line;
    213                     my ($img_name, $reported_size, $reported_sum, $filetype) = split '\|', $line;
    214                     # ... instead let dsreg compute the paramters by leaving them blank
    215                     print $rlf "$img_name|||$filetype|\n";
    216 
    217                     # add line to the table definition file
    218                     print $tdf "$rownum|$fault|$error_string|$img_name|$job_id|";
    219 
    220                     # ra_deg and dec_deg are the coordinates of center of the stamp
    221                     # first assume that the image is compressed and check the first extension.
    222                     # If not found check the PHU. If that doesn't work just set them to zero.
    223                     # XXX do this more cleanly
    224                     my (undef, $ra_deg, $dec_deg) = split " ", `echo $outdir/$img_name | fields -x 0 RA_DEG DEC_DEG`;
    225                     if (!defined $ra_deg) {
    226                         (undef, $ra_deg, $dec_deg) = split " ", `echo $outdir/$img_name | fields RA_DEG DEC_DEG`;
     129    my $request_fault = 0;
     130    if ($action eq 'PROCESS') {
     131        # The results table definition file
     132        my ($tdf, $table_def_name) = tempfile ("$outdir/tabledef.XXXX", UNLINK => !$save_temps);
     133        # data for the header
     134        print $tdf "$req_name|$req_id|\n";
     135        # get the list of jobs generated for this request
     136        my @jobs;
     137        {
     138            my $command = "$pstamptool -listjob -req_id $req_id";
     139            $command   .= " -dbname $dbname" if $dbname;
     140            $command   .= " -dbserver $dbserver" if $dbserver;
     141            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     142                run(command => $command, verbose => $verbose);
     143            unless ($success) {
     144                die("Unable to perform $command error code: $error_code");
     145            }
     146            my $output = join "", @$stdout_buf;
     147            if (!$output) {
     148                # This should not happen. A fake job should have been entered
     149                my_die("Request $req_id produced no jobs", $req_id, $PS_EXIT_PROG_ERROR);
     150            } else {
     151                my $jobs = parse_md_fast($mdcParser, $output);
     152
     153                @jobs = @$jobs;
     154            }
     155        }
     156
     157        my $exp_info;
     158        foreach my $job (@jobs) {
     159            my $job_id = $job->{job_id};
     160            my $job_type = $job->{jobType};
     161            my $rownum = $job->{rownum};
     162            my $fault = $job->{fault};
     163            my $exp_id = $job->{exp_id};
     164
     165            my $error_string = get_error_string($fault);
     166
     167            if (($fault eq $PSTAMP_DUP_REQUEST) and ($req_name eq "NULL")) {
     168                # this request had a duplicate request name yet the parser didn't give
     169                # it an "ERROR style name.
     170                my_die("duplicate request not given a request name", $req_id, $PS_EXIT_PROG_ERROR);
     171            }
     172            my ($row, $req_info, $project) = get_request_info($rows, $rownum);
     173
     174            my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver);
     175            my $image_db = $proj_hash->{dbname};
     176            if (!$image_db and !$fault) {
     177                # if project isn't resolvable, the paser should have faulted this job
     178                my_die("failed to find imagedb for project $project", $req_id, $PS_EXIT_CONFIG_ERROR);
     179            }
     180
     181            my $job_params = get_job_parameters($job);
     182            my $stage = "";
     183            if ($job_params) {
     184                $stage = $job_params->{stage};
     185            }
     186
     187            if ($stage ne 'stack') {
     188                # get the metadata for the exposure (if any i.e. stack)
     189                # returns an appropriate string if !$exp_id
     190                $exp_info = get_exposure_info($job_params, $image_db, $exp_id);
     191            } else {
     192                my $filter = $job_params->{filter};
     193                $filter = "0" if !$filter;
     194                my $mjd_obs = $job_params->{mjd_obs};
     195                $mjd_obs = "0" if !$mjd_obs;
     196                $exp_info = "$mjd_obs|0|0|$filter|0|0";
     197            }
     198
     199            if (($job_type eq "stamp") || ($job_type eq "get_image") || ($job_type eq "none")) {
     200                my $jreglist = "$outdir/reglist$job_id";
     201                if (open JRL, "<$jreglist") {;
     202                    # process the reglist file to get the list of files produced by this job
     203                    foreach my $line (<JRL>) {
     204
     205                        # XXX: we are getting many cases where the size and/or md5sum calculated by
     206                        # the job has changed by the time the request_finish has run
     207                        # Don't
     208                        # add line to the requests's reglist
     209                        # ....
     210    #                    print $rlf $line;
     211
     212
     213                        chomp $line;
     214                        my ($img_name, $reported_size, $reported_sum, $filetype) = split '\|', $line;
     215                        # ... instead let dsreg compute the paramters by leaving them blank
     216                        print $rlf "$img_name|||$filetype|\n";
     217
     218                        # add line to the table definition file
     219                        print $tdf "$rownum|$fault|$error_string|$img_name|$job_id|";
     220
     221                        # ra_deg and dec_deg are the coordinates of center of the stamp
     222                        # first assume that the image is compressed and check the first extension.
     223                        # If not found check the PHU. If that doesn't work just set them to zero.
     224                        # XXX do this more cleanly
     225                        my (undef, $ra_deg, $dec_deg) = split " ", `echo $outdir/$img_name | fields -x 0 RA_DEG DEC_DEG`;
     226                        if (!defined $ra_deg) {
     227                            (undef, $ra_deg, $dec_deg) = split " ", `echo $outdir/$img_name | fields RA_DEG DEC_DEG`;
     228                        }
     229                        $ra_deg = 0.0 if (!$ra_deg);
     230                        $dec_deg = 0.0 if (!$dec_deg);
     231                        print $tdf "$ra_deg|$dec_deg|";
     232
     233                        print $tdf "$exp_info|";
     234                        print $tdf "$req_info|";
     235                        print $tdf "\n";
    227236                    }
    228                     $ra_deg = 0.0 if (!$ra_deg);
    229                     $dec_deg = 0.0 if (!$dec_deg);
    230                     print $tdf "$ra_deg|$dec_deg|";
    231 
     237                    close JRL;
     238                } else {
     239                    my_die("No reglist for successful job: $job_id", $req_id, $PS_EXIT_PROG_ERROR)
     240                        if $fault eq $PSTAMP_SUCCESS;
     241                    print STDERR "no reglist file for job $job_id\n" if $verbose;
     242                    print $tdf "$rownum|$fault|$error_string|0|$job_id|";
     243                    print $tdf "0|0|";       # center of (non-existent) stamp
    232244                    print $tdf "$exp_info|";
    233245                    print $tdf "$req_info|";
    234246                    print $tdf "\n";
    235247                }
    236                 close JRL;
    237248            } else {
    238                 my_die("No reglist for successful job: $job_id", $req_id, $PS_EXIT_PROG_ERROR)
    239                     if $fault eq $PSTAMP_SUCCESS;
    240                 print STDERR "no reglist file for job $job_id\n" if $verbose;
    241                 print $tdf "$rownum|$fault|$error_string|0|$job_id|";
    242                 print $tdf "0|0|";       # center of (non-existent) stamp
    243                 print $tdf "$exp_info|";
    244                 print $tdf "$req_info|";
    245                 print $tdf "\n";
    246             }
    247         } else {
    248             # XXX do list jobs
    249             # we can probably arange things to use the code as above and skip the fileset registration
    250             print STDERR "Unknown jobType: $job_type";
    251             next;
    252         }
    253     }
    254     close $rlf;
    255     close $tdf;
    256     my $request_fault = 0;
    257     # make the results file
    258     {
    259         my $command = "$pstamp_results --input $table_def_name --output $outdir/results.fits";
    260         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    261             run(command => $command, verbose => $verbose);
    262         unless ($success) {
    263             print STDERR "Unable to perform $command error code: $error_code\n";
    264             $request_fault = $error_code >> 8;
    265         } else {
    266             # dump a textual representation
    267             my $command = "$pstampdump $outdir/results.fits > $outdir/results.mdc";
     249                # XXX do list jobs
     250                # we can probably arange things to use the code as above and skip the fileset registration
     251                print STDERR "Unknown jobType: $job_type";
     252                next;
     253            }
     254        }
     255        close $tdf;
     256        # make the results file
     257        {
     258            my $command = "$pstamp_results --input $table_def_name --output $outdir/results.fits";
    268259            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    269260                run(command => $command, verbose => $verbose);
    270261            unless ($success) {
     262                print STDERR "Unable to perform $command error code: $error_code\n";
    271263                $request_fault = $error_code >> 8;
    272                 my_die("Unable to perform $command error code: $error_code", $req_id, $request_fault);
    273             }
    274         }
    275     }
     264            } else {
     265                # dump a textual representation
     266                my $command = "$pstampdump $outdir/results.fits > $outdir/results.mdc";
     267                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     268                    run(command => $command, verbose => $verbose);
     269                unless ($success) {
     270                    $request_fault = $error_code >> 8;
     271                    my_die("Unable to perform $command error code: $error_code", $req_id, $request_fault);
     272                }
     273            }
     274        }
     275    } elsif ($action ne 'LIST') {
     276        my_die("Unexpected action $action found", $req_id, $PS_EXIT_PROG_ERROR);
     277    } else {
     278        # pstampparse did all of the work
     279    }
     280
     281    close $rlf;
     282
    276283    if (!$request_fault) {
    277284        # register the fileset
  • trunk/pstamp/scripts/pstamp_request_file

    r29673 r34447  
    4949                    value => undef
    5050        },
     51        { name => 'ACTION',
     52                    writetype => TSTRING,
     53                    comment => 'Action to perform: LIST or PROCESS',
     54                    value => undef
     55        },
     56        { name => 'USERNAME',
     57                    writetype => TSTRING,
     58                    comment => 'username for request (optional)',
     59                    value => undef
     60        },
     61        { name => 'EMAIL',
     62                    writetype => TSTRING,
     63                    comment => 'email for submittor (optional)',
     64                    value => undef
     65        },
    5166];
    5267
    5368# Specification of columns to write
    5469my $columns = [
     70        { name => 'ROWNUM',     type => 'J',   writetype => TULONG },
     71
     72        { name => 'CENTER_X',   type => 'D',  writetype => TDOUBLE },
     73        { name => 'CENTER_Y',   type => 'D',  writetype => TDOUBLE },
     74        { name => 'WIDTH',      type => 'D',  writetype => TDOUBLE },
     75        { name => 'HEIGHT',     type => 'D',  writetype => TDOUBLE },
     76        # 2 bits in COORD_MASK indicate what units of roi coords are
     77        { name => 'COORD_MASK', type => 'J',  writetype => TULONG },
     78
     79        { name => 'JOB_TYPE',   type => '16A', writetype => TSTRING },
     80        { name => 'OPTION_MASK',type => 'J',   writetype => TULONG },
     81
     82        # image selection parameters
     83        { name => 'PROJECT',    type => '16A', writetype => TSTRING },
     84        # new in version 2
     85        { name => 'SURVEY_NAME',type => '16A', writetype => TSTRING },
     86        { name => 'IPP_RELEASE', type => '16A', writetype => TSTRING },
     87        # end of new in version 2
     88        { name => 'REQ_TYPE',   type => '16A', writetype => TSTRING },
     89        { name => 'IMG_TYPE',   type => '16A', writetype => TSTRING },
     90        { name => 'ID',         type => '16A', writetype => TSTRING },           
     91        { name => 'TESS_ID',    type => '64A', writetype => TSTRING },
     92        { name => 'COMPONENT',  type => '64A', writetype => TSTRING },
     93
     94        { name => 'DATA_GROUP ',type => '64A', writetype => TSTRING },
     95
     96        { name => 'REQFILT',    type => '16A', writetype => TSTRING },
     97        { name => 'MJD_MIN',    type => 'D',   writetype => TDOUBLE },
     98        { name => 'MJD_MAX',    type => 'D',   writetype => TDOUBLE },
     99        { name => 'RUN_TYPE',   type => '16A', writetype => TSTRING },
     100
     101        { name => 'COMMENT ',   type => '64A', writetype => TSTRING },
     102];
     103my $columns_v1 = [
    55104        { name => 'ROWNUM',     type => 'J',   writetype => TULONG },
    56105
     
    89138}
    90139
     140# build array of arrays for the column data. Note if the input file is version 1 then
     141# some of thes will get dropped
    91142my @colData;
    92143foreach (@$columns) {
     
    96147
    97148my $minimum_cols = 6;
    98 my $numRows = read_data_for_table($in,'\s+', \@colData, $header, $minimum_cols);
     149my $extver = 2;
     150my $numRows = read_data_for_table($in,'\s+', \@colData, $header, $minimum_cols, \$extver);
    99151if (!$numRows) {
    100152    print STDERR "no data in $input\n";
     
    115167$output = $req_name . ".fits" if !$output;
    116168
    117 my $status = make_fits_table($output, EXTNAME, $numRows, \@colData, $columns, $header);
     169my $status = make_fits_table($output, EXTNAME, $numRows, \@colData, $extver > 1 ? $columns : $columns_v1, $header);
    118170
    119171exit $status;
     
    230282    my $header  = shift;    # rerence to array of header keyword descriptions
    231283    my $minimum_required_vals = shift;
     284    my $r_extver = shift;   # reference to extension version
    232285
    233286    my $line_num = 0;
     
    243296            my @vals = split /$sep/, $line;
    244297            my $nvals = @vals;
    245             die "number of header columns in input $nvals does not equal expected number of header words $nhead"
     298            die "two few columns $nvals in header definition. Require at least 2" if @vals < 2;
     299
     300            $$r_extver = $vals[1];
     301            if ($extver > 1) {
     302                die "number of header columns in input $nvals does not equal expected number of header words $nhead"
    246303                    if (@vals != @$header);
    247 
    248             for (my $i=0; $i < @$header; $i++) {
    249                 $header->[$i]->{value} = $vals[$i];
    250             }
    251 
    252             last; # only one header line
    253         }
     304            } else {
     305                # drop header keywords not used in version 1
     306                for (my $i = @$header - 1; $i >= $nvals; $i--) {
     307                    pop @$header;
     308                }
     309            }
     310
     311            for (my $i=0; $i < $nvals; $i++) {
     312                my $val = $vals[$i];
     313                if (defined $val) {
     314                    $header->[$i]->{value} = $val;
     315                } else {
     316                    $header->[$i]->{value} = 'null';
     317                }
     318            }
     319
     320            last; # one line defines the header
     321        }
     322    }
     323    if ($$r_extver == 1) {
     324        # pop off the colData arrays to account for the unused columns
     325        pop @colData;
     326        pop @colData;
     327        pop @colData;
    254328    }
    255329
     
    271345            exit 1;
    272346        }
     347        # trim leading whitespace from comment
     348        $comment =~ s/^\s+//;
    273349        if ($comment) {
    274350            if ($comment =~ /#/) {
     
    381457    print "If --output is omitted the output file name is set to REQ_NAME.fits\n\n";
    382458    print "Header 1 Line.  Format:\n\n";
    383     print "  REQ_NAME EXTVER\n\n";
     459    print "REQ_NAME EXTVER ACTION USERNAME EMAIL\n\n";
    384460    print "REQUEST specification (1 or more lines). Format:\n\n";
    385     print "  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX | COMMENT\n\n";
     461    print "ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE | COMMENT\n\n";
    386462
    387463    exit 0;
  • trunk/pstamp/scripts/pstampparse.pl

    r33670 r34447  
    9393my $fields_output;
    9494{
    95     my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME";
     95    my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION USER EMAIL";
    9696    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    9797        run(command => $command, verbose => $verbose);
     
    102102    $fields_output = join "", @$stdout_buf;
    103103}
    104 my (undef, $extname, $extver, $req_name) = split " ", $fields_output;
     104my (undef, $extname, $extver, $req_name, $action, $username, $email) = split " ", $fields_output;
    105105
    106106# make sure the file contains what we are expecting
     
    109109my_die("$request_file_name is not a PS1_PS_REQEST", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST";
    110110my_die("REQ_NAME not found in $request_file_name", $PS_EXIT_PROG_ERROR)  if (!$req_name);
    111 my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1");
     111my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2");
    112112
    113113
     
    230230    # the images of interest for this new row doesn't match the list.
    231231    # process the list ...
    232     $num_jobs += processRows(\@rowList);
     232    $num_jobs += processRows($action, \@rowList);
    233233
    234234    # and reset the list to contain just the new row
     
    238238# out of rows process the list
    239239if (scalar @rowList > 0) {
    240     $num_jobs += processRows(\@rowList);
    241 }
    242 
    243 if (($mode eq "queue_job") and ($num_jobs eq 0)) {
     240    $num_jobs += processRows($action, \@rowList);
     241}
     242
     243if (($action eq 'LIST' or $mode eq "queue_job") and ($num_jobs eq 0)) {
    244244    print STDERR "no jobs created for $req_name\n" if $verbose;
    245245    insertFakeJobForRow(undef, 0, $PSTAMP_INVALID_REQUEST);
     
    387387}
    388388
    389 sub processRows {
     389sub list_targets {
    390390    my $rowList = shift;
    391391    my $num_jobs = 0;
     392
     393    $num_jobs = 1;
     394    return $num_jobs;
     395}
     396
     397sub processRows {
     398    my $action = shift;
     399    my $rowList = shift;
     400    my $num_jobs = 0;
     401
     402    if ($action eq 'LIST') {
     403        return list_targets($rowList);
     404    }
    392405
    393406    # all rows in the list are compatible
Note: See TracChangeset for help on using the changeset viewer.