Changeset 27874 for trunk/pstamp/scripts/pstamp_parser_run.pl
- Timestamp:
- May 6, 2010, 1:55:20 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_parser_run.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_parser_run.pl
r27859 r27874 28 28 my $redirect_output; 29 29 my $product; 30 my $outdir; 30 31 my $label; 31 32 my $verbose; … … 37 38 'uri=s' => \$uri, 38 39 'product=s' => \$product, 40 'outdir=s' => \$outdir, 39 41 'label=s' => \$label, 40 42 'redirect-output' => \$redirect_output, … … 81 83 } 82 84 83 # workdir is where all of the files generated for this request are placed 84 # NOTE: this location needs to be kept in sync with the web interface ( request.php ) 85 my $datestr = strftime "%Y%m%d", gmtime; 86 my $datedir = "$pstamp_workdir/$datestr"; 87 if (! -e $datedir ) { 88 mkdir $datedir or my_die( "failed to create working directory $datedir for request id $req_id", $req_id, 85 if (!$outdir or ($outdir eq "NULL")) { 86 # workdir is where all of the files generated for this request are placed 87 # NOTE: this location needs to be kept in sync with the web interface ( request.php ) 88 my $datestr = strftime "%Y%m%d", gmtime; 89 my $datedir = "$pstamp_workdir/$datestr"; 90 if (! -e $datedir ) { 91 mkdir $datedir or my_die( "failed to create working directory $datedir for request id $req_id", $req_id, 92 $PS_EXIT_CONFIG_ERROR); 93 } 94 95 $outdir = "$datedir/$req_id"; 96 } 97 98 if (! -e $outdir ) { 99 mkdir $outdir or my_die("failed to create working directory $outdir for request id $req_id", $req_id, 89 100 $PS_EXIT_CONFIG_ERROR); 90 101 } 91 92 my $workdir = "$datedir/$req_id"; 93 if (! -e $workdir ) { 94 mkdir $workdir or my_die("failed to create working directory $workdir for request id $req_id", $req_id, 95 $PS_EXIT_CONFIG_ERROR); 96 } 102 97 103 98 104 if ($redirect_output) { 99 my $logDest = "$ workdir/psparse.$req_id.log";105 my $logDest = "$outdir/psparse.$req_id.log"; 100 106 $ipprc->redirect_output($logDest); 101 107 } … … 108 114 109 115 my $fn = basename($uri); 110 my $new_uri = "$ workdir/$fn";116 my $new_uri = "$outdir/$fn"; 111 117 if ($uri =~ /^http:/) { 112 118 # if the uri is an http uri download the file … … 123 129 } 124 130 if (! copy $uri, $new_uri) { 125 my_die ("failed to copy request file $uri to workdir $ workdir", $req_id, $PS_EXIT_UNKNOWN_ERROR);131 my_die ("failed to copy request file $uri to workdir $outdir", $req_id, $PS_EXIT_UNKNOWN_ERROR); 126 132 } 127 133 } … … 173 179 # that they sent us a request file that we don't understand 174 180 175 my $command = "$pstamptool -updatereq -req_id $req_id -s tate run";176 $command .= " - reqType unknown";177 $command .= " - fault $PS_EXIT_DATA_ERROR";181 my $command = "$pstamptool -updatereq -req_id $req_id -set_state run"; 182 $command .= " -set_reqType unknown"; 183 $command .= " -set_fault $PS_EXIT_DATA_ERROR"; 178 184 $command .= " -dbname $dbname" if $dbname; 179 185 $command .= " -dbserver $dbserver" if $dbserver; … … 186 192 } 187 193 188 $parse_cmd .= " --mode queue_job --req_id $req_id --product $product --out _dir $workdir --file $uri";194 $parse_cmd .= " --mode queue_job --req_id $req_id --product $product --outdir $outdir --file $uri"; 189 195 $parse_cmd .= " --dbname $dbname" if $dbname; 190 196 $parse_cmd .= " --dbserver $dbserver" if $dbserver; … … 194 200 my $fault; 195 201 { 196 my $error_file_name = "$ workdir/parse_error.txt";202 my $error_file_name = "$outdir/parse_error.txt"; 197 203 # get rid of any error file from previous attempt to parse this request 198 204 unlink $error_file_name if (-e $error_file_name); … … 227 233 # 228 234 { 229 my $command = "$pstamptool -updatereq -req_id $req_id -state $newState"; 230 $command .= " -reqType $reqType" if $reqType; 231 $command .= " -uri $new_uri" if $new_uri; 232 $command .= " -fault $fault" if $fault; 235 my $command = "$pstamptool -updatereq -req_id $req_id -set_state $newState"; 236 $command .= " -set_outdir $outdir"; 237 $command .= " -set_reqType $reqType" if $reqType; 238 $command .= " -set_uri $new_uri" if $new_uri; 239 $command .= " -set_fault $fault" if $fault; 233 240 $command .= " -dbname $dbname" if $dbname; 234 241 $command .= " -dbserver $dbserver" if $dbserver; … … 269 276 carp($msg); 270 277 271 my $command = "$pstamptool -updatereq -req_id $req_id - fault $fault";278 my $command = "$pstamptool -updatereq -req_id $req_id -set_fault $fault"; 272 279 $command .= " -dbname $dbname" if $dbname; 273 280 $command .= " -dbserver $dbserver" if $dbserver;
Note:
See TracChangeset
for help on using the changeset viewer.
