Changeset 18234 for trunk/pstamp/scripts/pstamp_queue_requests.pl
- Timestamp:
- Jun 20, 2008, 9:37:44 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_queue_requests.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_queue_requests.pl
r17893 r18234 2 2 # 3 3 # pstamp_queue_reqests.pl 4 # 4 5 # Query registered data stores for new postage stamp requests and add them to 5 6 # the database of pending requests. 6 7 # 7 8 8 # XXX TODO: need to take dbname as a paramter9 10 9 use warnings; 11 10 use strict; 12 11 13 my $verbosity = 0;12 use Getopt::Long qw( GetOptions ); 14 13 15 14 use Sys::Hostname; 16 15 my $host = hostname(); 17 16 18 if ($verbosity) { 17 my $verbose; 18 my $dbname; 19 20 GetOptions( 21 'verbose' => \$verbose, 22 'dbname=s' => \$dbname, 23 ); 24 25 if ($verbose) { 19 26 print STDERR "\n\n"; 20 27 print STDERR "Starting script $0 on $host\n\n"; … … 56 63 { 57 64 my $command = "$pstamptool -datastore"; 65 $command .= " -dbname $dbname" if $dbname; 66 58 67 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 59 run(command => $command, verbose => $verbos ity);68 run(command => $command, verbose => $verbose); 60 69 unless ($success) { 61 die("Unable to perform pstamptool -datastore: $error_code >> 8"); 70 my $rc = $error_code >> 8; 71 die("Unable to perform pstamptool -datastore: $rc"); 62 72 } 63 73 … … 96 106 $command .= " --last_fileset $ds->{lastFileset}" if $ds->{lastFileset}; 97 107 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 98 run(command => $command, verbose => $verbos ity);108 run(command => $command, verbose => $verbose); 99 109 unless ($success) { 100 110 die("Unable to perform $command: $error_code"); … … 115 125 # each line contains a fileset 116 126 # 127 # XXX: we probably should set a limit on the number of these we process 128 # otherwise this could take a long time and the task could time out 117 129 foreach my $line (@lines) { 118 130 # parse the line into fields split by whitespace … … 125 137 my $command = "$dsfilesetls --uri $uri"; 126 138 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 127 run(command => $command, verbose => $verbos ity);139 run(command => $command, verbose => $verbose); 128 140 unless ($success) { 129 141 die("Unable to perform $command: $error_code"); … … 148 160 { 149 161 my $command = "$pstamptool -addreq -uri $req_uri -ds_id $ds_id -out_fileset $outProduct/$fs_name"; 162 $command .= " -dbname $dbname" if $dbname; 150 163 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 151 run(command => $command, verbose => $verbos ity);164 run(command => $command, verbose => $verbose); 152 165 unless ($success) { 153 # XXX: what do we do now?154 die("Unable to perform $command: $error_code");166 # XXX: what do we do now? 167 die("Unable to perform $command: $error_code"); 155 168 } 156 169 } 157 170 $lastFileset = $fs_name; 158 # we only allow one request file per fileset159 # XXX TODO: maybe Relax this restriction160 last;161 171 } 162 172 } 163 173 164 ## now update the data store table with the last_fileset 174 ## now update the last_fileset column in pstampDataStore 175 ## XXX: we should probably do this before we process the fileset. Otherwise 176 ## if we get an error from pstamptool we'll get stuck processing it over and over. 165 177 if ($lastFileset) { 166 178 # print "last fileset: $lastFileset\n"; 167 179 { 168 180 my $command = "$pstamptool -ds_id $ds_id -moddatastore -last_fileset $lastFileset"; 181 $command .= " -dbname $dbname" if $dbname; 169 182 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 170 run(command => $command, verbose => $verbos ity);183 run(command => $command, verbose => $verbose); 171 184 unless ($success) { 172 185 die("Unable to perform pstamptool -moddatastore: $error_code");
Note:
See TracChangeset
for help on using the changeset viewer.
