IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24831


Ignore:
Timestamp:
Jul 16, 2009, 5:14:07 PM (17 years ago)
Author:
bills
Message:

updates to the postage stamp server to allow the postage stamp server's
database to be located on a different mysql server than the ipp.
Also some updates towards compatability with the current ipp

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r23292 r24831  
    210210        my $base;
    211211
    212         next if ($img_type eq "warp" and $image->{ignored});
     212        next if $image->{fault};
     213        next if ($img_type ne "raw") and $image->{quality};
    213214
    214215        if ($base_name) {
     
    542543    my $project_name = shift;
    543544    my $dbname = shift;
     545    my $dbserver = shift;
    544546    die "project is not defined" if !$project_name;
    545547
     
    555557    my $command = "$pstamptool -project -name $project_name";
    556558    $command .= " -dbname $dbname" if defined $dbname;
     559    $command .= " -dbserver $dbserver" if defined $dbserver;
    557560    # run the tool and parse the output
    558561    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
  • trunk/ippTasks/pstamp.pro

    r23230 r24831  
    88$pstampJob_DB = 0
    99$pstampFin_DB = 0
     10
     11# set PS_DBSERVER if postage stamp database host is not the same as the value for DBSERVER in site.config
     12# warning: no quotes around the two words. it cause it to get passed to pstamptool as one word
     13# tricky to debug problem ensues
     14# example:
     15# $PSDBSERVER = -dbserver hostname
     16$PS_DBSERVER = ""
    1017
    1118macro pstamp.reset
     
    115122
    116123    task.exec
     124        $run = pstamptool -pendingreq
    117125        if ($DB:n == 0)
    118126            option DEFAULT
    119             command pstamptool  -pendingreq
    120127        else
    121128            option $DB:$pstampReq_DB
    122             command pstamptool  -pendingreq -dbname $DB:$pstampReq_DB
     129            $run = $run $PS_DBSERVER -dbname $DB:$pstampReq_DB
    123130            $pstampReq_DB ++
    124131            if ($pstampReq_DB >= $DB:n) set pstampReq_DB = 0
    125132        end
     133        add_poll_args run
     134        command $run
    126135    end
    127136
     
    213222        else
    214223            option $DB:$pstampFin_DB
    215             command pstamptool  -completedreq -dbname $DB:$pstampFin_DB
     224            command pstamptool  -completedreq -dbname $DB:$pstampFin_DB $PS_DBSERVER
    216225            $pstampFin_DB ++
    217226            if ($pstampFin_DB >= $DB:n) set pstampFin_DB = 0
     
    307316        else
    308317            option $DB:$pstampJob_DB
    309             command pstamptool -pendingjob -limit 10 -dbname $DB:$pstampJob_DB
     318            command pstamptool -pendingjob -limit 10 -dbname $DB:$pstampJob_DB $PS_DBSERVER
    310319            $pstampJob_DB ++
    311320            if ($pstampJob_DB >= $DB:n) set pstampJob_DB = 0
  • trunk/pstamp/scripts/dquery_finish.pl

    r19221 r24831  
    2020use PS::IPP::Config qw( :standard );
    2121
    22 my ( $req_id, $req_name, $req_file, $product, $dbname, $verbose, $save_temps );
     22my ( $req_id, $req_name, $req_file, $product, $dbname, $dbserver, $verbose, $save_temps );
    2323
    2424GetOptions(
     
    2828           'product=s'  => \$product,
    2929           'dbname=s'   => \$dbname,
     30           'dbserver=s' => \$dbserver,
    3031           'verbose'    => \$verbose,
    3132           'save-temps' => \$save_temps,
     
    5657my $outputDataStoreRoot = metadataLookupStr($ipprc->{_siteConfig}, 'DATA_STORE_ROOT');
    5758exit ($PS_EXIT_CONFIG_ERROR) unless defined $outputDataStoreRoot; # lookup failure outputs a message
     59
     60if (!$dbserver) {
     61    $dbserver = metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
     62}
    5863
    5964if ($product eq "NULL") {
     
    8994    my $command = "$pstamptool -listjob -req_id $req_id";
    9095    $command .= " -dbname $dbname" if $dbname;
     96    $command .= " -dbserver $dbserver" if $dbserver;
    9197    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    9298        run(command => $command, verbose => $verbose);
     
    149155    $command   .= " -fault $fault" if $fault;
    150156    $command   .= " -dbname $dbname" if $dbname;
     157    $command   .= " -dbserver $dbserver" if $dbserver;
    151158    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    152159        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/dqueryparse.pl

    r19221 r24831  
    2626                       );
    2727
    28 my ($req_file, $req_id, $out_dir, $product, $mode, $dbname, $verbose, $save_temps);
     28my ($req_file, $req_id, $out_dir, $product, $mode, $dbname, $dbserver, $verbose, $save_temps);
    2929
    3030#
     
    3939        'mode=s'          =>      \$mode,
    4040        'dbname=s'        =>      \$dbname,
     41        'dbserver=s'      =>      \$dbserver,
    4142        'verbose'         =>      \$verbose,
    4243        'save-temps'      =>      \$save_temps,
     
    6970    warn("Can't find required tools.");
    7071    exit ($PS_EXIT_CONFIG_ERROR);
     72}
     73
     74if (!$dbserver) {
     75    my $ipprc = = PS::IPP::Config->new();
     76    $dbserver =  metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
    7177}
    7278
     
    131137    $command .= " -rownum 0";
    132138    $command .= " -dbname $dbname" if $dbname;
     139    $command .= " -dbserver $dbserver" if $dbserver;
    133140
    134141    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    153160    $command .= " -fault $result" if $result;
    154161    $command .= " -dbname $dbname" if $dbname;
     162    $command .= " -dbserver $dbserver" if $dbserver;
    155163
    156164    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
  • trunk/pstamp/scripts/pstamp_finish.pl

    r23267 r24831  
    2424use PS::IPP::PStamp::Job qw( :standard );
    2525
    26 my ( $req_id, $req_name, $req_file, $out_dir, $product, $dbname, $verbose, $save_temps, $redirect_output);
     26my ( $req_id, $req_name, $req_file, $out_dir, $product, $dbname, $dbserver, $verbose, $save_temps, $redirect_output);
    2727
    2828# the char to the right of the bar may be used as a single - alias for the longer name
     
    3535           'out_dir=s'      => \$out_dir,
    3636           'dbname=s'       => \$dbname,
     37           'dbserver=s'     => \$dbserver,
    3738           'verbose'        => \$verbose,
    3839           'save-temps'     => \$save_temps,
     
    5051    my $logDest = "$out_dir/psfinish.$req_id.log";
    5152    $ipprc->redirect_output($logDest);
     53}
     54
     55if (!$dbserver) {
     56    $dbserver =  metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
    5257}
    5358
     
    8994        if (!mkdir $out_dir) {
    9095            print STDERR "cannot create output directory $out_dir";
    91             stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR, $dbname);
     96            stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
    9297        }
    9398
     
    97102        # request
    98103        print STDERR "output directory $out_dir exists but is not a directory";
    99         stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR, $dbname);
     104        stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
    100105    }
    101106
    102107    if (! -e $req_file ) {
    103108        print STDERR "request file $req_file is missing\n";
    104         stop_request($req_id, $PS_EXIT_CONFIG_ERROR, $dbname);
     109        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
    105110    }
    106111
     
    112117        # point
    113118        print STDERR "failed to read request_file $req_file" ;
    114         stop_request($req_id, $PS_EXIT_CONFIG_ERROR, $dbname);
     119        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
    115120    }
    116121
     
    138143        my $command = "$pstamptool -listjob -req_id $req_id";
    139144        $command   .= " -dbname $dbname" if $dbname;
     145        $command   .= " -dbserver $dbserver" if $dbserver;
    140146        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    141147            run(command => $command, verbose => $verbose);
     
    251257        my $command = "$pstamptool -updatereq -req_id $req_id -state stop -fault $request_fault";
    252258        $command   .= " -dbname $dbname" if $dbname;
     259        $command   .= " -dbserver $dbserver" if $dbserver;
    253260        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    254261            run(command => $command, verbose => $verbose);
     
    263270    my $req_id = shift;
    264271    my $fault  = shift;
    265     my $dbname = shift;
    266272
    267273    my $command = "$pstamptool -updatereq -req_id $req_id -state stop -fault $fault";
    268274    $command   .= " -dbname $dbname" if $dbname;
     275    $command   .= " -dbserver $dbserver" if $dbserver;
    269276
    270277    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
  • trunk/pstamp/scripts/pstamp_job_run.pl

    r23267 r24831  
    1717my $verbose;
    1818my $dbname;
     19my $dbserver;
    1920my $job_id;
    2021my $redirect_output;
     
    2526
    2627GetOptions(
    27     'job_id=s'      =>  \$job_id,
    28     'output_base=s' =>  \$output_base,
    29     'redirect-output' => \$redirect_output,
    30     'dbname=s'      =>  \$dbname,
    31     'verbose'       =>  \$verbose,
     28    'job_id=s'          =>  \$job_id,
     29    'output_base=s'     =>  \$output_base,
     30    'redirect-output'   => \$redirect_output,
     31    'dbname=s'          =>  \$dbname,
     32    'dbserver=s'        =>  \$dbserver,
     33    'verbose'           =>  \$verbose,
    3234);
    3335
     
    6567}
    6668
     69if (!$dbserver) {
     70    $dbserver =  metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
     71}
     72
    6773my $missing_tools;
    6874
     
    8389    my $command = "$pstamptool -pendingjob -job_id $job_id";
    8490    $command .= " -dbname $dbname" if $dbname;
     91    $command .= " -dbserver $dbserver" if $dbserver;
    8592    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    8693        run(command => $command, verbose => $verbose);
     
    118125    my $command = "$ppstamp -file $uri $outputBase $argString";
    119126    $command .= " -dbname $dbname" if $dbname;
     127    $command .= " -dbserver $dbserver" if $dbserver;
    120128    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    121129        run(command => $command, verbose => $verbose);
     
    172180    my $command = "$pstamp_get_image_job --job_id $job_id --uri $uri --out_dir $outputBase --rownum $rownum";
    173181    $command .= " --dbname $dbname" if $dbname;
     182    $command .= " --dbserver $dbserver" if $dbserver;
    174183    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    175184        run(command => $command, verbose => $verbose);
     
    191200    my $command = "$pstamptool -updatejob -job_id $job_id -state stop -fault $jobStatus";
    192201    $command .= " -dbname $dbname" if $dbname;
     202    $command .= " -dbserver $dbserver" if $dbserver;
    193203    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    194204        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstamp_listjobs.pl

    r21410 r24831  
    1212my $verbose;
    1313my $dbname;
     14my $dserver;
    1415
    1516GetOptions(
    1617    'verbose'   =>  \$verbose,
    1718    'dbname=s'  =>  \$dbname,
     19    'dbserver=s'=>  \$dbserver,
    1820);
    1921
     
    6870    my $command = "$pstamptool -listjob -req_id $request_id";
    6971    $command .= " -dbname $dbname" if $dbname;
     72    $command .= " -dbserver $dbserver" if $dbserver;
    7073    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    7174        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstamp_parser_run.pl

    r21410 r24831  
    2020my $verbose;
    2121my $dbname;
     22my $dbserver;
    2223
    2324GetOptions(
     
    2829    'verbose'           =>  \$verbose,
    2930    'dbname=s'          =>  \$dbname,
     31    'dbserver=s'         =>  \$dbserver,
    3032);
    3133
     
    6769my $pstamp_workdir = metadataLookupStr($ipprc->{_siteConfig}, 'PSTAMP_WORKDIR');
    6870exit ($PS_EXIT_CONFIG_ERROR) unless defined $pstamp_workdir; # lookup failure outputs a message
     71
     72if (!$dbserver) {
     73    $dbserver =  metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
     74}
    6975
    7076# workdir is where we download request files to and place any error output from the parser
     
    167173    $command   .= " -fault $PS_EXIT_DATA_ERROR";
    168174    $command   .= " -dbname $dbname" if $dbname;
     175    $command   .= " -dbserver $dbserver" if $dbserver;
    169176    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    170177        run(command => $command, verbose => $verbose);
     
    177184$parse_cmd .= " --mode queue_job --req_id $req_id --product $product --out_dir $workdir --file $uri";
    178185$parse_cmd .= " --dbname $dbname" if $dbname;
     186$parse_cmd .= " --dbserver $dbserver" if $dbserver;
    179187$parse_cmd .= " --verbose" if $verbose;
    180188
     
    218226    $command   .= " -fault $fault" if $fault;
    219227    $command   .= " -dbname $dbname" if $dbname;
     228    $command   .= " -dbserver $dbserver" if $dbserver;
    220229    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    221230        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstamp_queue_requests.pl

    r21410 r24831  
    1717my $verbose;
    1818my $dbname;
     19my $dbserver;
    1920my $limit;
    2021
     
    2223    'verbose'       =>  \$verbose,
    2324    'dbname=s'      =>  \$dbname,
     25    'dbserver=s'    =>  \$dbserver,
    2426    'limit=i'       =>  \$limit,
    2527);
     
    5961}
    6062
     63my $ipprc = PS::IPP::Config->new();
    6164my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     65
     66if (!$dbserver) {
     67    $dbserver =  metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
     68}
    6269
    6370my @dataStores;
     
    6673    my $command = "$pstamptool -datastore";
    6774    $command .= " -dbname $dbname" if $dbname;
     75    $command .= " -dbserver $dbserver" if $dbserver;
    6876
    6977    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    177185                my $command = "$pstamptool -addreq -uri $req_uri -ds_id $ds_id";
    178186                $command .= " -dbname $dbname" if $dbname;
     187                $command .= " -dbserver $dbserver" if $dbserver;
    179188
    180189                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    192201        my $command = "$pstamptool -ds_id $ds_id -moddatastore -last_fileset $lastFileset";
    193202        $command .= " -dbname $dbname" if $dbname;
     203        $command .= " -dbserver $dbserver" if $dbserver;
    194204        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    195205            run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstamp_revert_request.pl

    r20256 r24831  
    3131
    3232
    33 my ( $req_id, $dbname, $verbose, $save_temps );
     33my ( $req_id, $dbname, $dbserver, $verbose, $save_temps );
    3434
    3535GetOptions(
    3636           'req_id=s'   => \$req_id,
    3737           'dbname=s'   => \$dbname,
     38           'dbserver=s' => \$dbserver,
    3839           'verbose'    => \$verbose,
    3940           'save-temps' => \$save_temps,
     
    6566    my $command = "$pstamptool -listreq -req_id $req_id";
    6667    $command   .= " -dbname $dbname" if $dbname;
     68    $command   .= " -dbserver $dbserver" if $dbserver;
    6769    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    6870        run(command => $command, verbose => $verbose);
     
    9799if ($product and $fileset) {
    98100    my $command = "$dsreg --del $fileset --product $product --rm --force";
    99     $command .= " --dbname $dbname" if $dbname;
     101#   don't add dbname let dsreg get it from the DS_DBNAME in site.config
     102#    $command .= " --dbname $dbname" if $dbname;
    100103    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    101104        run(command => $command, verbose => $verbose);
     
    109112    my $command = "$pstamptool -revertreq -req_id $req_id";
    110113    $command   .= " -dbname $dbname" if $dbname;
     114    $command   .= " -dbserver $dbserver" if $dbserver;
    111115    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    112116        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstamp_webrequest.pl

    r21192 r24831  
    2424my $verbose = 0;
    2525my $dbname;
     26my $dbserver;
    2627my $project;
    2728my $job_type;
     
    3031    'job_type=s'    =>  \$job_type,
    3132    'dbname=s'      =>  \$dbname,
     33    'dbserver=s'    =>  \$dbserver,
    3234    'project=s'     => \$project,
    3335    'verbose'       => \$verbose,
     
    101103    my $command = "$pstampparse --mode list_uri --file $request_file";
    102104    $command .= " --dbname $dbname" if $dbname;
     105    $command .= " --dbserver $dbserver" if $dbserver;
    103106    $command .= " --verbose" if $verbose;
    104107    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    123126    my $command = "$pstamptool -addreq -uri $request_file -ds_id 0";
    124127    $command .= " -dbname $dbname" if $dbname;
     128    $command .= " -dbserver $dbserver" if $dbserver;
    125129    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    126130        run(command => $command, verbose => $verbose);
  • trunk/pstamp/scripts/pstampparse.pl

    r23267 r24831  
    1616my $verbose;
    1717my $dbname;
     18my $dbserver;
    1819my $req_id;
    1920my $request_file_name;
     
    2930    'mode=s'    =>  \$mode,
    3031    'dbname=s'  =>  \$dbname,
     32    'dbserver=s'=>  \$dbserver,
    3133    'verbose'   =>  \$verbose,
    3234);
     
    8991    $command .= " -outProduct $product";
    9092    $command .= " -dbname $dbname" if $dbname;
     93    $command .= " -dbserver $dbserver" if $dbserver;
    9194    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    9295        run(command => $command, verbose => $verbose);
     
    143146    die "job_type is list_uri but mode is $mode" if ($job_type eq "list_uri") and ($mode ne "list_uri");
    144147
    145     my $proj_hash = resolve_project($ipprc, $project, $dbname);
     148    my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver);
    146149    die "project $project not found\n" unless $proj_hash;
    147150
     
    217220                    . " -uri $listfile -outputBase $out_dir -rownum $rownum";
    218221        $command .= " -dbname $dbname" if $dbname;
     222        $command .= " -dbserver $dbserver" if $dbserver;
    219223        if ($mode eq "list_job") {
    220224            print "$command\n";
     
    274278            $command .= " -exp_id $exp_id" if $exp_id;
    275279            $command .= " -dbname $dbname" if $dbname;
     280            $command .= " -dbserver $dbserver" if $dbserver;
    276281
    277282            if ($mode eq "list_job") {
  • trunk/pstamp/scripts/request_finish.pl

    r21410 r24831  
    2121use PS::IPP::Config qw( :standard );
    2222
    23 my ( $req_id, $req_name, $req_file, $req_type, $out_dir, $product, $dbname, $verbose, $save_temps, $redirect_output );
     23my ( $req_id, $req_name, $req_file, $req_type, $out_dir, $product, $dbname, $dbserver, $verbose, $save_temps, $redirect_output );
    2424
    2525GetOptions(
     
    3131           'product=s'  => \$product,
    3232           'dbname=s'   => \$dbname,
     33           'dbserver=s' => \$dbserver,
    3334           'verbose'    => \$verbose,
    3435           'save-temps' => \$save_temps,
     
    8081    my $command = $finish_cmd . " --req_id $req_id --req_name $req_name --req_file $req_file --product $product --out_dir $out_dir";
    8182    $command   .= " --dbname $dbname" if $dbname;
     83    $command   .= " --dbserver $dbserver" if $dbserver;
    8284    $command   .= " --verbose" if $verbose;
    8385    $command   .= " --save-temps" if $save_temps;
     
    9395    my $command = "$pstamptool -updatereq -req_id $req_id -state stop -fault $PS_EXIT_DATA_ERROR";
    9496    $command   .= " -dbname $dbname" if $dbname;
     97    $command   .= " -dbserver $dbserver" if $dbserver;
    9598    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    9699        run(command => $command, verbose => $verbose);
Note: See TracChangeset for help on using the changeset viewer.