IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18235 for trunk/pstamp/scripts


Ignore:
Timestamp:
Jun 20, 2008, 9:38:26 AM (18 years ago)
Author:
bills
Message:

--dbname option

File:
1 edited

Legend:

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

    r16933 r18235  
    99use strict;
    1010
    11 if (@ARGV != 1) {
    12     die "usage: $0 job_id\n";
     11use Sys::Hostname;
     12use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     13
     14my $verbose;
     15my $dbname;
     16my $job_id;
     17
     18my $host = hostname();
     19
     20
     21GetOptions(
     22    'job_id=s'  =>  \$job_id,
     23    'dbname=s'  =>  \$dbname,
     24    'verbose'   =>  \$verbose,
     25);
     26
     27
     28if ($verbose) {
     29    print "\n\n";
     30    print "Starting script $0 on $host\n\n";
    1331}
    1432
    15 my $job_id = $ARGV[0];
    16 
    17 my $verbosity = 1;
    18 
    19 use Sys::Hostname;
    20 my $host = hostname();
    21 
    22 print "\n\n";
    23 print "Starting script $0 on $host\n\n";
     33die "job_id is required" if !$job_id;
    2434
    2535use IPC::Cmd 0.36 qw( can_run run );
     
    5868{
    5969    my $command = "$pstamptool -pendingjob -job_id $job_id";
     70    $command .= " -dbname $dbname" if $dbname;
    6071    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    61         run(command => $command, verbose => $verbosity);
     72        run(command => $command, verbose => $verbose);
    6273    unless ($success) {
    6374        die("Unable to perform pstamptool -pendingjob: $error_code");
     
    89100if ($jobType eq "stamp") {
    90101    my $command = "$ppstamp -file $uri $outputBase $argString";
     102    $command .= " -dbname $dbname" if $dbname;
    91103    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    92         run(command => $command, verbose => $verbosity);
     104        run(command => $command, verbose => $verbose);
    93105
    94106    if ($success) {
     
    100112} elsif ($jobType eq "get_image") {
    101113    my $command = "$pstamp_get_image_job --uri $uri --out_dir $outputBase";
     114    $command .= " -dbname $dbname" if $dbname;
    102115    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    103         run(command => $command, verbose => $verbosity);
     116        run(command => $command, verbose => $verbose);
    104117
    105118    if ($success) {
     
    117130{
    118131    my $command = "$pstamptool -processedjob -job_id $job_id -state stop -result $jobStatus";
     132    $command .= " -dbname $dbname" if $dbname;
    119133    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    120         run(command => $command, verbose => $verbosity);
     134        run(command => $command, verbose => $verbose);
    121135    unless ($success) {
    122136        die("Unable to perform $command: $error_code");
Note: See TracChangeset for help on using the changeset viewer.