IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16591


Ignore:
Timestamp:
Feb 21, 2008, 6:38:46 PM (18 years ago)
Author:
bills
Message:

Updates to the postage stamp server scripts

Location:
trunk/pstamp/scripts
Files:
1 added
1 deleted
3 edited

Legend:

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

    r16358 r16591  
    1515my $job_id = $ARGV[0];
    1616
    17 my $verbosity = 0;
     17my $verbosity = 1;
    1818
    1919use Sys::Hostname;
    2020my $host = hostname();
     21
    2122print "\n\n";
    2223print "Starting script $0 on $host\n\n";
     24
    2325use IPC::Cmd 0.36 qw( can_run run );
    2426
     
    5860        run(command => $command, verbose => $verbosity);
    5961    unless ($success) {
    60         die("Unable to perform pstamptool -pendingreq: $error_code");
     62        die("Unable to perform pstamptool -pendingjob: $error_code");
    6163    }
    6264
    6365    if (@$stdout_buf == 0) {
    6466        print STDERR "pending pstamp job id $job_id not found\n";
    65         exit 1;
     67        # exit 1;
     68        exit 0;
    6669    }
    6770    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     
    8285my $outputBase = $psjob->{outputBase};
    8386my $argString = $psjob->{args};
    84 #my $request_id = $psjob->{req_id};
    85 
    86 #
    87 # update the state of this job from 'new' to 'run'
    88 #
    89 {
    90     my $command = "$pstamptool -processedjob -job_id $job_id -state run";
    91     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    92         run(command => $command, verbose => $verbosity);
    93     unless ($success) {
    94         die("Unable to perform $command: $error_code");
    95     }
    96 }
    9787
    9888my $jobStatus;
     
    10393
    10494    if ($success) {
    105         $jobStatus = "ok";
     95        $jobStatus = $PS_EXIT_SUCCESS;
    10696    } else {
    107         $jobStatus = $error_code;
    108         print STDERR "ppstamp failed with error code $error_code\n";
     97        # run shifts the unix exit status up by 8 bits for some reason
     98        $jobStatus = $error_code >> 8;
     99        print STDERR "ppstamp failed with error code: $jobStatus\n";
    109100    }
    110 #    unless ($success) {
    111 #        die("Unable to perform $command: $error_code");
    112 #    }
    113101}
    114102
    115103
    116 # stop the job and set the error status
     104# stop the job and set the result value
    117105{
    118     my $command = "$pstamptool -processedjob -job_id $job_id -state stop -status $jobStatus";
     106    my $command = "$pstamptool -processedjob -job_id $job_id -state stop -result $jobStatus";
    119107    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    120108        run(command => $command, verbose => $verbosity);
     
    124112}
    125113
    126 
    127 if ($jobStatus eq "ok") {
    128     exit 0;
    129 } else {
    130     exit $jobStatus;
    131 }
     114exit $jobStatus;
  • trunk/pstamp/scripts/pstamp_dorequest.pl

    r16358 r16591  
    44###
    55###     Excecute the jobs for a given request.
    6 ###     Note: This is intended for testing outside of pantasks environment
     6###
     7###     Note: This program is not part of the postage stamp server
     8###     It is intended for testing outside of pantasks environment
    79###
    810
  • trunk/pstamp/scripts/pstamp_runcommand.sh

    r16358 r16591  
    22###
    33#
    4 # pstampwrapper.sh:
    5 # Set up the ipp environment to run a ipp commands on behalf of hte postage stamp
     4# pstamp_runcommand.sh:
     5#
     6# Set up the ipp environment to run a ipp commands on behalf of the postage stamp
    67# server and execute the command given by the argument list
     8# This script is used by cgi or php scripts.
    79
    810if [[ $# == 0 ]] ;then
     
    1517
    1618# These variables need to be customized for a particular installation
     19# XXX: why not pass these on on the command line ?
    1720export PSCONFDIR=/export/data0/bills/psconfig
    18 
    19 # TODO shouldn't need to do this but there seems to be a psconfig problem.
    20 # Gene fixed this recently
    21 #export LD_LIBRARY_PATH=/usr/local/lib
    2221
    2322WORK_DIR=/export/data1/bills/pstamp/work
     
    3029cd $WORK_DIR
    3130status=$?
    32 if [[ ! $status ]] ; then
     31if [[ $status != 0 ]] ; then
    3332    echo $0 cannot cd to WORK_DIR: $WORK_DIR status: $status >&2
    3433    exit $status
    3534fi
    3635
    37 # TODO: I do this so that I have permissions to modify the files created by
    38 # the web server user apache.
    39 #umask 0
    40 
    4136###
    42 ### configure IPP
     37### configure the IPP
    4338###
    44 #export MANPATH=""
    4539
    4640source $PSCONFDIR/psconfig.bash default
    4741status=$?
    48 if [[ ! $status ]] ; then
     42if [[ $status != 0 ]] ; then
    4943    echo error setting up IPP environment >&2
    5044    exit $status
     
    5347###
    5448### Add our command directory to the path.
    55 ### TODO: This won't be necessary once the scripts get installed as part of the IPP
     49### XXX: This won't be necessary once the scripts get installed as part of the IPP
    5650###
    5751PATH=${CMD_DIR}:${PATH}
    5852
    59 ## This test is sort of redundant.
    60 ## We'll get a more useful error by just going ahead and trying the command
    61 ## or by not suppressing the output from which
     53## make sure we are able to run the desired command
     54## XXX: This test is sort of redundant.
     55## We'd get a more useful error by just going ahead and trying the command
     56## or by not suppressing the error output of which
    6257if [[ ! -x `which $1 2> /dev/null` ]] ;then
    6358    status=$?
Note: See TracChangeset for help on using the changeset viewer.