Changeset 18547
- Timestamp:
- Jul 15, 2008, 10:13:31 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_webrequest.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_webrequest.pl
r18247 r18547 24 24 my $verbose = 0; 25 25 my $dbname; 26 my $project; 27 my $job_type; 26 28 27 29 GetOptions( 28 'verbose' => \$verbose, 29 'dbname=s' => \$dbname, 30 'job_type=s' => \$job_type, 31 'dbname=s' => \$dbname, 32 'project=s' => \$project, 33 'verbose' => \$verbose, 30 34 ); 31 35 … … 35 39 print "\n\n"; 36 40 print "Starting script $0 on $host\n\n"; 41 } 42 43 my $listMode; 44 if ($job_type and ($job_type eq 'list_uri')) { 45 $listMode=1; 46 } else { 47 $listMode=0; 37 48 } 38 49 … … 58 69 my $pstamprequest = can_run('pstamprequest') or (warn "Can't find pstamprequest" and $missing_tools = 1); 59 70 my $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);71 my $pstampparse = can_run('pstampparse.pl') or (warn "Can't find pstampparse.pl" and $missing_tools = 1); 61 72 my $pstampparser_run = can_run('pstamp_parser_run.pl') or (warn "Can't find pstamp_parser_run.pl" and $missing_tools = 1); 62 73 … … 66 77 } 67 78 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 76 80 my $cur_dir = getcwd(); 77 81 my $request_name = "web" . get_webreq_num(); 78 82 my $request_file = "$cur_dir/$request_name.fits"; 79 83 { 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 81 87 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 82 88 run(command => $command, verbose => $verbose); … … 92 98 ### In list mode just parse the file print the output and we're done 93 99 ### 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"; 97 101 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 98 102 run(command => $command, verbose => $verbose); … … 101 105 ### print "Matching Images:\n"; 102 106 print @$stdout_buf; 107 exit 0; 103 108 } else { 109 # we send the output to STDOUT because that's where PHP finds it 110 print @$stdout_buf; 104 111 print @$stderr_buf; 112 exit 1; 105 113 } 106 exit 0;107 114 } 108 115 … … 111 118 { 112 119 113 my $command = "$pstamptool -addreq -uri $request_file -out_fileset \'pstampresults/$request_name'";120 my $command = "$pstamptool -addreq -uri $request_file"; 114 121 $command .= " -dbname $dbname" if $dbname; 115 122 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 143 150 chomp $webreq_num; 144 151 145 print STDERR "$webreq_num\n" ;152 print STDERR "$webreq_num\n" if $verbose; 146 153 147 154 my $next = $webreq_num + 1;
Note:
See TracChangeset
for help on using the changeset viewer.
