Changeset 16960 for trunk/pstamp/web/request.php
- Timestamp:
- Mar 12, 2008, 11:38:11 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/web/request.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/web/request.php
r16358 r16960 13 13 14 14 $COMMAND_DIR = "/export/data0/bills/src/ipp/pstamp/scripts"; 15 $STAMPS_DIR = "/export/data1/bills/pstamp/work/stamps";15 //$STAMPS_DIR = "/export/data1/bills/pstamp/work/stamps"; 16 16 17 17 // Initialize variables … … 142 142 $command_line = build_command_line(); 143 143 $error_line = ""; 144 run_command( );144 run_command($command_line); 145 145 if (! $list_checked) { 146 146 // The only output from a successful run is the request_id 147 147 $request_id = Array_pop($output_array); 148 148 $last_request_id = $request_id; 149 #echo "The request id is $request_id\n"; 149 setcookie("our_request_id", $request_id); 150 // echo "The request id is $request_id\n"; 150 151 if (count($output_array) != 0) { 151 152 throw new Exception("unexpected output returned by pstampwebrequest."); … … 175 176 } 176 177 } 178 listJobs($last_request_id); 177 179 } 178 180 … … 190 192 global $rvar_id, $rvar_class_id; 191 193 global $command_line; 192 global $STAMPS_DIR;193 194 194 195 $cmd = "pstamp_runcommand.sh pstamp_webrequest.pl"; … … 205 206 throw new Exception('Stamp Name must be specified.'); 206 207 } 207 $cmd .= " -user_tag $ STAMPS_DIR/$rvar_user_tag";208 $cmd .= " -user_tag $rvar_user_tag"; 208 209 209 210 // Set up the ROI parameters … … 262 263 } 263 264 264 function run_command( )265 function run_command($command_line) 265 266 { 266 global $command_line;267 267 global $output_array; 268 268 global $error_line; … … 349 349 } 350 350 351 function listJobs($request_id) 352 { 353 $command_line = "pstamp_runcommand.sh pstamp_listjobs.pl $request_id"; 354 run_command($command_line); 355 } 356 351 357 function getRequestStatus() 352 358 { 353 359 global $request_id; 354 global $command_line;355 360 global $command_status; 356 357 $command_line = "pstamp_runcommand.sh pstamp_listjobs.pl $request_id"; 358 run_command();359 361 global $output_array; 362 363 $command_line = "pstamp_runcommand.sh pstamptool -listreq -req_id $request_id -simple"; 364 run_command($command_line); 360 365 if ($command_status == 0) { 361 return countRunningJobs(); 366 $size = sizeof($output_array); 367 $runningReq = 0; 368 for ($i = 0; $i < $size; $i++) { 369 $elements = explode(" ", $output_array[$i]); 370 if (count($elements) >= 3) { 371 $state = $elements[2]; 372 if ($state != "stop") { 373 $runningReq++; 374 } 375 } else { 376 throw new Exception ("incorrect data in job status: $output_array[$i]"); 377 } 378 } 379 return $runningReq; 362 380 } else { 363 381 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.
