IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18547


Ignore:
Timestamp:
Jul 15, 2008, 10:13:31 AM (18 years ago)
Author:
bills
Message:

adapt web interface to new system

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstamp_webrequest.pl

    r18247 r18547  
    2424my $verbose = 0;
    2525my $dbname;
     26my $project;
     27my $job_type;
    2628
    2729GetOptions(
    28     'verbose'   =>  \$verbose,
    29     'dbname=s'  =>  \$dbname,
     30    'job_type=s'    =>  \$job_type,
     31    'dbname=s'      =>  \$dbname,
     32    'project=s'     => \$project,
     33    'verbose'       => \$verbose,
    3034);
    3135
     
    3539    print "\n\n";
    3640    print "Starting script $0 on $host\n\n";
     41}
     42
     43my $listMode;
     44if ($job_type and ($job_type eq 'list_uri')) {
     45    $listMode=1;
     46} else  {
     47    $listMode=0;
    3748}
    3849
     
    5869my $pstamprequest = can_run('pstamprequest')  or (warn "Can't find pstamprequest"  and $missing_tools = 1);
    5970my $pstamptool = can_run('pstamptool')  or (warn "Can't find pstamptool"  and $missing_tools = 1);
    60 my $pstampparse = can_run('pstampparse')  or (warn "Can't find pstampparse"  and $missing_tools = 1);
     71my $pstampparse = can_run('pstampparse.pl')  or (warn "Can't find pstampparse.pl"  and $missing_tools = 1);
    6172my $pstampparser_run = can_run('pstamp_parser_run.pl')  or (warn "Can't find pstamp_parser_run.pl"  and $missing_tools = 1);
    6273
     
    6677}
    6778
    68 # if -list is used, it must be the first argument
    69 my $listMode;
    70 if ($ARGV[0] eq "-list_uri" ) {
    71     $listMode=1;
    72 } else  {
    73     $listMode=0;
    74 }
    75 
     79# make a request file
    7680my $cur_dir = getcwd();
    7781my $request_name = "web" . get_webreq_num();
    7882my $request_file = "$cur_dir/$request_name.fits";
    7983{
    80     my $command = "$pstamprequest -request_name $request_name $request_file @ARGV";
     84    my $command = "$pstamprequest -req_name $request_name -project $project $request_file @ARGV";
     85    $command .= " -$job_type" if $job_type;     # default job_type is stamp
     86
    8187    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    8288        run(command => $command, verbose => $verbose);
     
    9298    ### In list mode just parse the file print the output and we're done
    9399    ###
    94     ### XXX TODO: I shouldn't need this -mode list_uri since it's in the request file
    95     my $command = "$pstampparse -mode list_uri $request_file";
    96     $command .= " -dbname $dbname" if $dbname;
     100    my $command = "$pstampparse --mode list_uri --file $request_file --dbname $dbname";
    97101    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    98102        run(command => $command, verbose => $verbose);
     
    101105        ### print "Matching Images:\n";
    102106        print @$stdout_buf;
     107        exit 0;
    103108    } else {
     109        # we send the output to STDOUT because that's where PHP finds it
     110        print @$stdout_buf;
    104111        print @$stderr_buf;
     112        exit 1;
    105113    }
    106     exit 0;
    107114}
    108115
     
    111118{
    112119
    113     my $command = "$pstamptool -addreq -uri $request_file -out_fileset \'pstampresults/$request_name'";
     120    my $command = "$pstamptool -addreq -uri $request_file";
    114121    $command .= " -dbname $dbname" if $dbname;
    115122    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    143150    chomp $webreq_num;
    144151
    145     print STDERR "$webreq_num\n";
     152    print STDERR "$webreq_num\n" if $verbose;
    146153
    147154    my $next = $webreq_num + 1;
Note: See TracChangeset for help on using the changeset viewer.