Changeset 21410 for trunk/pstamp/scripts/pstamp_finish.pl
- Timestamp:
- Feb 6, 2009, 5:44:55 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_finish.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_finish.pl
r21190 r21410 14 14 use File::Temp qw( tempfile ); 15 15 use File::Copy; 16 use File::Basename qw(dirname); 16 17 17 18 use PS::IPP::Metadata::Config; … … 23 24 use PStamp::Job qw( :standard ); 24 25 25 my ( $req_id, $req_name, $req_file, $ product, $dbname, $verbose, $save_temps);26 my ( $req_id, $req_name, $req_file, $out_dir, $product, $dbname, $verbose, $save_temps, $redirect_output); 26 27 27 28 # the char to the right of the bar may be used as a single - alias for the longer name 28 29 # for example --input and -i are equivalent 29 30 GetOptions( 30 'req_id=s' => \$req_id, 31 'req_name=s' => \$req_name, 32 'req_file=s' => \$req_file, 33 'product=s' => \$product, 34 'dbname=s' => \$dbname, 35 'verbose' => \$verbose, 36 'save-temps' => \$save_temps, 31 'req_id=s' => \$req_id, 32 'req_name=s' => \$req_name, 33 'req_file=s' => \$req_file, 34 'product=s' => \$product, 35 'out_dir=s' => \$out_dir, 36 'dbname=s' => \$dbname, 37 'verbose' => \$verbose, 38 'save-temps' => \$save_temps, 39 'redirect-output' => \$redirect_output, 37 40 ) or pod2usage( 2 ); 38 41 39 42 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 40 43 41 die "usage: --req_id id --req_name name --req_file file --product product [--dbname dbname --verbose]\n" 42 if !$req_id or !$req_name or !$req_file or !$product; 44 die "usage: --req_id id --req_name name --req_file file --product product --out_dir output_directory [--dbname dbname --verbose]\n" 45 if !$req_id or !$req_name or !$req_file or !$product or !$out_dir; 46 47 my $ipprc = PS::IPP::Config->new(); # IPP Configuration 48 49 if ($redirect_output) { 50 my $logDest = "$out_dir/psfinish.$req_id.log"; 51 $ipprc->redirect_output($logDest); 52 } 43 53 44 54 my $missing_tools; … … 53 63 } 54 64 55 my $ipprc = PS::IPP::Config->new(); # IPP Configuration56 65 57 66 my $outputDataStoreRoot = metadataLookupStr($ipprc->{_siteConfig}, 'DATA_STORE_ROOT'); … … 64 73 my $fileset = $req_name; 65 74 75 66 76 # Here we invoke the assumption that the output for the request is placed in the 67 77 # fileset directory directly 68 my $out_dir = "$outputDataStoreRoot/$product/$fileset"; 78 # my $out_dir = "$outputDataStoreRoot/$product/$fileset"; 79 80 # now we are assuming that the output directory is the dirname of the request file 81 # XXX: put this in the database 69 82 70 83 print STDERR "product: $product REQ_NAME: $req_name $out_dir\n" if $verbose; … … 72 85 if (!-e $out_dir) { 73 86 # something must have gone wrong parsing the request 74 print STDERR "output filesetdirectory $out_dir does not exist\n";87 print STDERR "output directory $out_dir does not exist\n"; 75 88 76 89 if (!mkdir $out_dir) { … … 83 96 # XXX TODO: fault the request so we pstamp_finish doesn't keep trying to process the 84 97 # request 85 print STDERR "output filesetdirectory $out_dir exists but is not a directory";98 print STDERR "output directory $out_dir exists but is not a directory"; 86 99 stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR, $dbname); 87 100 } … … 111 124 print $rlf "results.fits|||table|\n"; 112 125 113 # XXX: this file is in the request's workdir not the out_dir 114 my $err_file = "$out_dir/parse_error.txt"; 115 if (-e $err_file ) { 126 my $err_file = "parse_error.txt"; 127 if (-e "$out_dir/$err_file" ) { 116 128 print $rlf "$err_file|||text|\n"; 117 129 } … … 222 234 if (!$request_fault) { 223 235 # register the fileset 224 # Note that we are assuming that the fileset's files are already in the fileset directory.225 # We could put them somewhere else and copy them in but for now we set the output directory226 # to the fileset directory at parse time227 236 my $command = "$dsreg --list $reglist_name --add $fileset --product $product --type PSRESULTS"; 237 $command .= " --link --datapath $out_dir"; 228 238 $command .= " --dbname $dbname" if $dbname; 229 239
Note:
See TracChangeset
for help on using the changeset viewer.
