IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 12, 2008, 11:38:11 AM (18 years ago)
Author:
bills
Message:

changes to the prototype web interface to allow pantasks to sequence
the request processing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/web/request.php

    r16358 r16960  
    1313
    1414$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";
    1616
    1717// Initialize variables
     
    142142            $command_line = build_command_line();
    143143            $error_line = "";
    144             run_command();
     144            run_command($command_line);
    145145            if (! $list_checked) {
    146146                // The only output from a successful run is the request_id
    147147                $request_id = Array_pop($output_array);
    148148                $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";
    150151                if (count($output_array) != 0) {
    151152                    throw new Exception("unexpected output returned by pstampwebrequest.");
     
    175176        }
    176177    }
     178    listJobs($last_request_id);
    177179}
    178180
     
    190192    global $rvar_id, $rvar_class_id;
    191193    global $command_line;
    192     global $STAMPS_DIR;
    193194
    194195    $cmd = "pstamp_runcommand.sh pstamp_webrequest.pl";
     
    205206        throw new Exception('Stamp Name must be specified.');
    206207    }
    207     $cmd .= " -user_tag $STAMPS_DIR/$rvar_user_tag";
     208    $cmd .= " -user_tag $rvar_user_tag";
    208209
    209210    // Set up the ROI parameters
     
    262263}
    263264
    264 function run_command()
     265function run_command($command_line)
    265266{
    266     global $command_line;
    267267    global $output_array;
    268268    global $error_line;
     
    349349}
    350350
     351function listJobs($request_id)
     352{
     353    $command_line = "pstamp_runcommand.sh pstamp_listjobs.pl $request_id";
     354    run_command($command_line);
     355}
     356
    351357function getRequestStatus()
    352358{
    353359    global $request_id;
    354     global $command_line;
    355360    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);
    360365    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;
    362380    } else {
    363381        return 0;
Note: See TracChangeset for help on using the changeset viewer.