Changeset 18235 for trunk/pstamp/scripts
- Timestamp:
- Jun 20, 2008, 9:38:26 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_job_run.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_job_run.pl
r16933 r18235 9 9 use strict; 10 10 11 if (@ARGV != 1) { 12 die "usage: $0 job_id\n"; 11 use Sys::Hostname; 12 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 13 14 my $verbose; 15 my $dbname; 16 my $job_id; 17 18 my $host = hostname(); 19 20 21 GetOptions( 22 'job_id=s' => \$job_id, 23 'dbname=s' => \$dbname, 24 'verbose' => \$verbose, 25 ); 26 27 28 if ($verbose) { 29 print "\n\n"; 30 print "Starting script $0 on $host\n\n"; 13 31 } 14 32 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"; 33 die "job_id is required" if !$job_id; 24 34 25 35 use IPC::Cmd 0.36 qw( can_run run ); … … 58 68 { 59 69 my $command = "$pstamptool -pendingjob -job_id $job_id"; 70 $command .= " -dbname $dbname" if $dbname; 60 71 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 61 run(command => $command, verbose => $verbos ity);72 run(command => $command, verbose => $verbose); 62 73 unless ($success) { 63 74 die("Unable to perform pstamptool -pendingjob: $error_code"); … … 89 100 if ($jobType eq "stamp") { 90 101 my $command = "$ppstamp -file $uri $outputBase $argString"; 102 $command .= " -dbname $dbname" if $dbname; 91 103 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 92 run(command => $command, verbose => $verbos ity);104 run(command => $command, verbose => $verbose); 93 105 94 106 if ($success) { … … 100 112 } elsif ($jobType eq "get_image") { 101 113 my $command = "$pstamp_get_image_job --uri $uri --out_dir $outputBase"; 114 $command .= " -dbname $dbname" if $dbname; 102 115 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 103 run(command => $command, verbose => $verbos ity);116 run(command => $command, verbose => $verbose); 104 117 105 118 if ($success) { … … 117 130 { 118 131 my $command = "$pstamptool -processedjob -job_id $job_id -state stop -result $jobStatus"; 132 $command .= " -dbname $dbname" if $dbname; 119 133 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 120 run(command => $command, verbose => $verbos ity);134 run(command => $command, verbose => $verbose); 121 135 unless ($success) { 122 136 die("Unable to perform $command: $error_code");
Note:
See TracChangeset
for help on using the changeset viewer.
