IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16283


Ignore:
Timestamp:
Feb 1, 2008, 5:42:05 PM (18 years ago)
Author:
bills
Message:

get web page working again with job sequencing through the database

Location:
trunk/pstamp
Files:
4 edited

Legend:

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

    r16280 r16283  
    9696}
    9797
     98my $jobStatus;
    9899{
    99100    my $command = "$ppstamp -file $uri $outputBase $argString";
    100101    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    101102        run(command => $command, verbose => $verbosity);
    102 ###
    103 ### update the status of the job with the error
    104 ###
    105     unless ($success) {
    106         die("Unable to perform $command: $error_code");
     103
     104    if ($success) {
     105        $jobStatus = "ok";
     106    } else {
     107        $jobStatus = $error_code;
     108        print STDERR "ppstamp failed with error code $error_code\n";
    107109    }
     110#    unless ($success) {
     111#        die("Unable to perform $command: $error_code");
     112#    }
    108113}
    109114
    110115
     116# stop the job and set the error status
    111117{
    112     my $command = "$pstamptool -processedjob -job_id $job_id -state stop -status ok";
     118    my $command = "$pstamptool -processedjob -job_id $job_id -state stop -status $jobStatus";
    113119    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    114120        run(command => $command, verbose => $verbosity);
     
    119125
    120126
    121 exit 0;
     127exit $jobStatus;
  • trunk/pstamp/scripts/pstamp_dorequest.pl

    r16280 r16283  
    1616my $request_id = $ARGV[0];
    1717
    18 my $verbosity = 0;
     18my $verbosity = 1;
    1919
    2020use Sys::Hostname;
     
    7878        if ($job->{req_id} == $request_id) {
    7979            # there must be a better way to do this
     80            print STDERR "adding $job->{job_id} to the list\n";
    8081            $psjobs[@psjobs] = $job;
    8182        }
     
    9091
    9192foreach my $job (@psjobs) {
    92     my $command = "echo $ppstamp_run $job->{job_id}";
     93    my $command = "$ppstamp_run $job->{job_id}";
    9394    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    9495        run(command => $command, verbose => $verbosity);
     
    100101
    101102#
    102 # set the state of the request to stop
     103# Update the state of the request
    103104#
    104105
  • trunk/pstamp/scripts/pstampwebrequest.sh

    r16280 r16283  
    1212#
    1313# Note: there's nothing really web specific about this program.
     14#       with the exception that we set up the environment to allow a
     15#       random user (in this case apache ) to run ipp programs
     16#
     17# TODO: re-write this in perl
    1418#
    1519###
     
    4246
    4347# These variables need to be customized for a particular installation
    44 BASE_DIR=/export/data1/bills/pstamp
    4548export PSCONFDIR=/export/data0/bills/psconfig
    4649
     
    4851export LD_LIBRARY_PATH=/usr/local/lib
    4952
     53WORK_DIR=/export/data1/bills/pstamp/work
     54CMD_DIR=/export/data0/bills/src/ipp/pstamp/scripts
     55
    5056#### END LOCAL_CONFIGURATION
    5157
    52 WORK_DIR=$BASE_DIR/work
    53 CMD_DIR=$BASE_DIR/bin
    5458export HOME=$WORK_DIR
    5559
     
    6771
    6872
    69 ## configure IPP
     73###
     74### configure IPP
     75###
    7076export MANPATH=""
    7177
    7278source $PSCONFDIR/psconfig.bash default
    7379
     80###
     81### Add our command directory to the path. This won't be necessary once the scripts get
     82### installed in the IPP
     83###
    7484PATH=${CMD_DIR}:${PATH}
    7585
     
    149159
    150160###
    151 ### TODO: Won't it interfere with pantask's job processing?
    152 ###
    153 ### Queue jobs for the request
     161### TODO: Until we have pantasks monitoring the reuest and job table
     162### run things directly
     163
     164
     165###
     166### Queue the jobs for the request
    154167###
    155168pstampparser_run.pl $request_id  1> $parse_out 2> $parse_err
     
    166179fi
    167180
    168 cat $parse.out
    169 
    170 ### for each line in the output add a psJob to the
    171 
    172181###
    173182### Ok now it's time to build the stamps
     183###
    174184
    175185stamp_out=stamp.${out_ext}
    176186stamp_err=stamp.${err_ext}
    177187
    178 echo making stamps > $stamp_err
    179 
    180 ###
    181 ### Make the stamps
     188echo making stamps for request> $stamp_err
     189
     190###
     191### Make the stamps by executing each of the jobs
    182192###
    183193pstamp_dorequest.pl $request_id 1>$stamp_out 2>>$stamp_err
    184194if [[ $? != 0 ]]; then
    185     echo makestamps.pl failed
     195    echo pstamp_do_request.pl failed
    186196    echo STDERR:
    187197    cat $stamp_err
     
    192202fi
    193203
    194 # Success print the output
    195 # get the stamp urls
    196 cat $stamp_out
     204# Success print the urls
     205pstamptool -listjob -req_id $request_id -simple | awk '{ print $6 ".fits" }'
    197206
    198207cleanup
  • trunk/pstamp/web/request.php

    r16279 r16283  
    1414<pre>
    1515<?php
     16
     17$COMMAND_DIR = "/export/data0/bills/src/ipp/pstamp/scripts";
     18$STAMPS_DIR = "stamps";
    1619
    1720// Initialize variables
     
    416419    global $rvar_id, $rvar_class_id;
    417420    global $command_line;
     421    global $STAMPS_DIR;
    418422
    419423    $cmd = "pstampwebrequest.sh";
     
    430434        throw new Exception('Stamp Name must be specified.');
    431435    }
    432     $cmd .= " -user_tag $rvar_user_tag";
     436    $cmd .= " -user_tag $STAMPS_DIR/$rvar_user_tag";
    433437
    434438    // Set up the ROI parameters
     
    493497    global $error_line;
    494498    global $command_status;
    495 
    496     $HOME = "/export/data1/bills/pstamp";
    497     $cmd_dir  = "$HOME/bin";
    498     $work_dir = "$HOME/work";
    499 
    500 
    501     exec ("$cmd_dir/$command_line", $output_array, $command_status);
     499    global $COMMAND_DIR;
     500
     501
     502    exec ("$COMMAND_DIR/$command_line", $output_array, $command_status);
    502503
    503504    $size = sizeof($output_array);
     
    520521function printURL($path)
    521522{
    522     $fileName = basename($path);
    523523    echo "<tr><td>";
    524     echo "<a href=\"http:$path\" target=\"_blank\" type=\"image/fits\">";
    525     echo $fileName;
    526     echo "</a>";
     524    $doURL = 1;
     525    if ($doURL) {
     526        $fileName = basename($path);
     527        echo "<a href=\"http:$path\" target=\"_blank\" type=\"image/fits\">";
     528        echo $fileName;
     529        echo "</a>";
     530    } else {
     531        print "$path";
     532    }
    527533    echo "</td></tr>";
    528534}
Note: See TracChangeset for help on using the changeset viewer.