Changeset 23777
- Timestamp:
- Apr 9, 2009, 1:56:50 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
ippScripts/scripts/dist_advancerun.pl (modified) (4 diffs)
-
ippScripts/scripts/dist_component.pl (modified) (14 diffs)
-
ippTasks/dist.pro (modified) (3 diffs)
-
ippTools/share/disttool_pendingcomponent.sql (modified) (15 diffs)
-
ippTools/share/disttool_toadvance.sql (modified) (3 diffs)
-
ippTools/src/disttool.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/dist_advancerun.pl
r23744 r23777 28 28 29 29 # Parse the command-line arguments 30 my ($dist_id, $stage, $stage_id, $out root);30 my ($dist_id, $stage, $stage_id, $outdir); 31 31 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); 32 32 … … 35 35 'stage=s' => \$stage, # raw, chip, warp, or diff 36 36 'stage_id=s' => \$stage_id, # exp_id, chip_id, warp_id, or diff_id 37 'out root=s' => \$outroot, # "directory" for outputs37 'outdir=s' => \$outdir, # "directory" for outputs 38 38 'save-temps' => \$save_temps, # Save temporary files? 39 39 'dbname=s' => \$dbname, # Database name … … 45 45 46 46 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 47 pod2usage( -msg => "Required options: --dist_id --stage --stage_id --out root",47 pod2usage( -msg => "Required options: --dist_id --stage --stage_id --outdir", 48 48 -exitval => 3) unless 49 49 defined $dist_id and 50 50 defined $stage and 51 51 defined $stage_id and 52 defined $out root;52 defined $outdir; 53 53 54 54 $ipprc->redirect_output($logfile) if $logfile; … … 90 90 91 91 # XXX we should create a file rule for this 92 my $outfile = "$out root/dbinfo.$stage.$stage_id.mdc";92 my $outfile = "$outdir/dbinfo.$stage.$stage_id.mdc"; 93 93 94 94 { -
trunk/ippScripts/scripts/dist_component.pl
r23743 r23777 58 58 # Parse the command-line arguments 59 59 my ($dist_id, $camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $clean); 60 my ($out root, $run_state, $data_state, $magicked, $no_magic, $poor_quality);60 my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality); 61 61 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 62 62 … … 71 71 'state=s' => \$run_state, # state of the run 72 72 'data_state=s' => \$data_state, # data_state for this component 73 'poor_quality' => \$poor_quality, # the processing for this component did not produced images73 'poor_quality' => \$poor_quality, # the processing for this component did not produced images 74 74 'no_magic' => \$no_magic, # magic is not required for this distribution run 75 75 'magicked' => \$magicked, # magicked state for this component 76 'out root=s' => \$outroot,# "directory" for outputs76 'outdir=s' => \$outdir, # "directory" for outputs 77 77 'clean' => \$clean, # create clean distribution 78 78 'save-temps' => \$save_temps, # Save temporary files? … … 84 84 85 85 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 86 pod2usage( -msg => "Required options: --dist_id --camera --stage --stage_id --component --path_base --out root",86 pod2usage( -msg => "Required options: --dist_id --camera --stage --stage_id --component --path_base --outdir", 87 87 -exitval => 3) unless 88 88 defined $dist_id and … … 92 92 defined $component and 93 93 defined $path_base and 94 defined $out root;94 defined $outdir; 95 95 96 96 $ipprc->redirect_output($logfile) if $logfile; 97 97 98 if (($stage eq 'raw') and ! defined $chip_path_base) {98 if (($stage eq 'raw') and !$clean and !defined $chip_path_base) { 99 99 pod2usage( -msg => "Required options: --chip_path_base for raw stage", -exitval => 3); 100 100 } … … 105 105 106 106 # making a clean bundle of raw images doesn't make sense 107 if (($stage eq "raw") and $clean) {108 # well I suppose we could ship the registration log file. naw.109 &my_die("cannot create clean run at raw stage", $dist_id, $component, $PS_EXIT_CONFIG_ERROR);110 }111 107 112 108 # create the output directories if it is not a nebulous path and it doesn't exist 113 if (index($out root, "neb://") != 0) {114 if (! -e $out root) {115 my $code = system "mkdir -p $out root";116 &my_die("cannot create output directory $out root", $dist_id, $component,109 if (index($outdir, "neb://") != 0) { 110 if (! -e $outdir ) { 111 my $code = system "mkdir -p $outdir"; 112 &my_die("cannot create output directory $outdir", $dist_id, $component, 117 113 $code >> 8) if $code; 118 114 } … … 122 118 # note: We my_die in get_file_list if something goes wrong. 123 119 124 my $file_list = get_file_list($stage, $component, $path_base );125 126 if ( $stage ne 'fake') {120 my $file_list = get_file_list($stage, $component, $path_base, $clean); 121 122 if (($stage ne 'raw') and ($stage ne 'fake')) { 127 123 # If the file list is empty it is an error because we should at least get a config dump file 128 124 # except for fake stage which doesn't do anything yet … … 132 128 # set up directory for temporary files 133 129 134 my $tmpdir = "$out root/tmpdir.$dist_id.$component";130 my $tmpdir = "$outdir/tmpdir.$dist_id.$component"; 135 131 if (-e $tmpdir) { 136 132 if (-d $tmpdir) { … … 155 151 156 152 # foreach my $file_rule (keys %$file_list) { 153 my $num_files = 0; 157 154 foreach my $file (@$file_list) { 158 155 # check whether this file rule refers to an image, mask, or variance fits image … … 188 185 # we need to pre-process the image before adding to the bundle. Save the path names. 189 186 # the images will be created below 187 $num_files++; 190 188 if ($image_type && $nan_masked_pixels) { 191 189 # save the … … 251 249 my $bytes; 252 250 my $md5sum; 253 if ($stage eq 'fake') { 251 if (0) { 252 if (($stage eq 'fake') or (($stage eq 'raw') and $clean)) { 254 253 open DUMMY, ">$tmpdir/fake.$component" or &my_die("Unable to create placeholder for fake component", 255 254 $dist_id, $component, $PS_EXIT_CONFIG_ERROR); … … 257 256 close DUMMY; 258 257 } 259 # create the tarfile 260 { 258 } 259 if ($num_files) { 260 # create the tarfile 261 261 # XXX TODO: create a file rule for the tar file name 262 262 my $tbase = basename($path_base); 263 263 $tbase .= ".$component" if $component; 264 264 $file_name = "$tbase.tgz"; 265 my $tarfile = "$out root/$file_name";265 my $tarfile = "$outdir/$file_name"; 266 266 267 267 my $command = "tar -C $tmpdir --owner=ipp --group=users -czhf $tarfile ."; … … 279 279 &my_die("unable to compute md5sum for $tarfile", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR) if !$md5sum; 280 280 281 my @finfo = stat($tarfile); 282 &my_die("unable to stat $tarfile", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR) if !@finfo; 283 $bytes = $finfo[7]; 281 $bytes = -s $tarfile; 284 282 285 283 delete_tmpdir($tmpdir); 284 } else { 285 # no files for this component 286 $file_name = "none"; 287 $bytes = 0; 288 $md5sum = "0"; 286 289 } 287 290 { … … 360 363 my $component = shift; 361 364 my $path_base = shift; 365 my $clean = shift; 362 366 363 367 my @file_list; … … 366 370 # eventually rawImfile will have a path_base that we'll need to add '.fits' 367 371 # XXX do we want to distribute the registration log files? 368 my %file; 369 $file{file_rule} = "RAW.IMAGE"; 370 $file{name} = $path_base; 371 push @file_list, \%file; 372 if (!$clean) { 373 my %file; 374 $file{file_rule} = "RAW.IMAGE"; 375 $file{name} = $path_base; 376 push @file_list, \%file; 377 } 372 378 return \@file_list; 373 379 } -
trunk/ippTasks/dist.pro
r23702 r23777 131 131 book getword distToProcess $pageName state -var STATE 132 132 book getword distToProcess $pageName data_state -var DATA_STATE 133 book getword distToProcess $pageName quality -var QUALITY 133 134 book getword distToProcess $pageName no_magic -var NO_MAGIC 134 135 book getword distToProcess $pageName magicked -var MAGICKED 135 book getword distToProcess $pageName out root -var OUTROOT136 book getword distToProcess $pageName outdir -var OUTDIR 136 137 book getword distToProcess $pageName dbname -var DBNAME 137 138 138 $EXTRA_ FLAGS = ""139 $EXTRA_ARGS = "" 139 140 if ("$CLEAN" == "T") 140 $EXTRA_ FLAGS = --clean141 $EXTRA_ARGS = --clean 141 142 end 142 143 # magicked is output as integer due to the union in the sql 143 144 if ($MAGICKED) 144 $EXTRA_ FLAGS = $EXTRA_FLAGS --magicked145 $EXTRA_ARGS = $EXTRA_ARGS --magicked 145 146 end 146 147 # no_magic is output as integer due to the union in the sql 147 148 if ($NO_MAGIC) 148 $EXTRA_FLAGS = $EXTRA_FLAGS --no_magic 149 $EXTRA_ARGS = $EXTRA_ARGS --no_magic 150 end 151 if ($QUALITY) 152 $EXTRA_ARGS = $EXTRA_ARGS --poor_quality 149 153 end 150 154 … … 153 157 host anyhost 154 158 155 sprintf logfile "%s /dist.%s.%s.log" $OUTROOT$DIST_ID $COMPONENT159 sprintf logfile "%s.%s/dist.%s.%s.log" $OUTDIR $DIST_ID $COMPONENT 156 160 stdout $logfile 157 161 stderr $logfile 158 162 159 $run = dist_component.pl --dist_id $DIST_ID --camera $CAMERA --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --path_base $PATH_BASE --chip_path_base $CHIP_PATH_BASE --state $STATE --data_state $DATA_STATE $EXTRA_ FLAGS --outroot $OUTROOT--logfile $logfile163 $run = dist_component.pl --dist_id $DIST_ID --camera $CAMERA --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --path_base $PATH_BASE --chip_path_base $CHIP_PATH_BASE --state $STATE --data_state $DATA_STATE $EXTRA_ARGS --outdir $OUTDIR --logfile $logfile 160 164 161 165 add_standard_args run … … 251 255 book getword distToAdvance $pageName stage -var STAGE 252 256 book getword distToAdvance $pageName stage_id -var STAGE_ID 253 book getword distToAdvance $pageName out root -var OUTROOT257 book getword distToAdvance $pageName outdir -var OUTDIR 254 258 255 259 host anyhost 256 260 257 sprintf logfile "%s/dist.advance.%s.log" $OUT ROOT$DIST_ID261 sprintf logfile "%s/dist.advance.%s.log" $OUTDIR $DIST_ID 258 262 stdout $logfile 259 263 stderr $logfile 260 264 261 $run = dist_advancerun.pl --dist_id $DIST_ID --stage $STAGE --stage_id $STAGE_ID --out root $OUTROOT--logfile $logfile265 $run = dist_advancerun.pl --dist_id $DIST_ID --stage $STAGE --stage_id $STAGE_ID --outdir $OUTDIR --logfile $logfile 262 266 add_standard_args run 263 267 -
trunk/ippTools/share/disttool_pendingcomponent.sql
r23737 r23777 1 1 SELECT * FROM ( 2 -- raw stage 2 3 SELECT 3 4 distRun.dist_id, … … 8 9 clean, 9 10 rawExp.camera, 10 outroot,11 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 11 12 rawImfile.uri as path_base, -- change this once rawImfile has path_base 12 13 chipProcessedImfile.path_base as chip_path_base, … … 41 42 WHERE 42 43 distRun.state = 'new' 44 AND distRun.clean = 0 43 45 AND distRun.stage = 'raw' 44 46 AND distComponent.dist_id IS NULL 45 47 AND (rawExp.magicked OR distRun.no_magic) 46 48 -- where hook 1 %s 49 UNION 50 -- raw stage clean (dbinfo only) 51 SELECT 52 distRun.dist_id, 53 distRun.label, 54 stage, 55 stage_id, 56 'exposure' AS component, 57 clean, 58 rawExp.camera, 59 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 60 NULL, 61 NULL, 62 NULL as state, 63 NULL as data_state, 64 0 as quality, 65 distRun.no_magic, 66 rawExp.magicked 67 FROM distRun 68 JOIN rawExp ON exp_id = stage_id 69 LEFT JOIN distComponent 70 ON distRun.dist_id = distComponent.dist_id 71 WHERE 72 distRun.state = 'new' 73 AND distRun.stage = 'raw' 74 AND distRun.clean 75 AND distComponent.dist_id IS NULL 76 -- where hook 2 %s 47 77 48 78 -- chip stage … … 56 86 clean, 57 87 rawExp.camera, 58 outroot,88 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 59 89 chipProcessedImfile.path_base, 60 90 chipProcessedImfile.path_base as chip_path_base, … … 77 107 AND (distRun.clean OR chipRun.magicked OR distRun.no_magic) 78 108 AND (chipRun.state = 'full' OR (distRun.clean AND chipRun.state = 'cleaned')) 79 -- where hook 2%s109 -- where hook 3 %s 80 110 UNION 81 111 SELECT … … 88 118 clean, 89 119 rawExp.camera, 90 outroot,120 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 91 121 camProcessedExp.path_base, 92 122 NULL as chip_path_base, … … 111 141 AND (distRun.clean OR chipRun.magicked OR distRun.no_magic) 112 142 AND (camRun.state = 'full' OR (distRun.clean AND camRun.state = 'cleaned')) 113 -- where hook 3%s143 -- where hook 4 %s 114 144 UNION 115 145 SELECT … … 121 151 clean, 122 152 rawExp.camera, 123 outroot,153 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 124 154 fakeProcessedImfile.path_base, 125 155 NULL, … … 142 172 AND distRun.stage = 'fake' 143 173 AND distComponent.dist_id IS NULL 144 -- where hook 4%s174 -- where hook 5 %s 145 175 UNION 146 176 SELECT … … 152 182 clean, 153 183 rawExp.camera, 154 outroot,184 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 155 185 warpSkyfile.path_base, 156 186 NULL as chip_path_base, … … 176 206 AND (distRun.clean OR warpRun.magicked OR distRun.no_magic) 177 207 AND (warpRun.state = 'full' OR (distRun.clean AND warpRun.state = 'cleaned')) 178 -- where hook 5%s208 -- where hook 6 %s 179 209 UNION 180 210 SELECT … … 186 216 clean, 187 217 rawExp.camera, 188 outroot,218 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 189 219 diffSkyfile.path_base, 190 220 NULL as chip_path_base, … … 209 239 AND (distRun.clean OR diffRun.magicked OR distRun.no_magic) 210 240 AND (diffRun.state = 'full' OR (distRun.clean AND diffRun.state = 'cleaned')) 211 -- where hook 6%s241 -- where hook 7 %s 212 242 UNION 213 243 SELECT DISTINCT … … 219 249 clean, 220 250 rawExp.camera, 221 outroot,251 CONCAT_WS('.', outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 222 252 stackSumSkyfile.path_base, 223 253 NULL as chip_path_base, … … 258 288 AND distComponent.dist_id IS NULL 259 289 AND (stackRun.state = 'full' OR (distRun.clean AND stackRun.state = 'cleaned')) 260 -- where hook 7%s290 -- where hook 8 %s 261 291 ) as Foo -
trunk/ippTools/share/disttool_toadvance.sql
r23742 r23777 3 3 stage, 4 4 stage_id, 5 outroot,5 CONCAT_WS('.', outroot, CONVERT(dist_id, CHAR)) as outdir, 6 6 label, 7 7 clean 8 8 FROM 9 9 ( 10 -- raw stage 10 -- raw stage not clean 11 11 SELECT 12 12 distRun.dist_id, … … 23 23 WHERE 24 24 distRun.state = 'new' 25 AND distRun.clean = 0 25 26 AND distRun.fault = 0 26 27 AND distRun.stage = 'raw' … … 31 32 COUNT(rawImfile.class_id) = COUNT(distComponent.component) 32 33 AND SUM(distComponent.fault) = 0 34 UNION 35 -- clean distribution of raw files (dbinfo only) only 1 component 36 SELECT 37 distRun.dist_id, 38 stage, 39 stage_id, 40 outroot, 41 label, 42 clean 43 FROM distRun 44 LEFT JOIN distComponent 45 ON distRun.dist_id = distComponent.dist_id 46 WHERE 47 distRun.state = 'new' 48 AND distRun.clean 49 AND distRun.fault = 0 50 AND distRun.stage = 'raw' 51 AND distComponent.component IS NOT NULL 52 AND distComponent.fault = 0 33 53 UNION 34 54 -- chip stage -
trunk/ippTools/src/disttool.c
r23765 r23777 564 564 // will get blocked by pending earlier stages 565 565 psString raw_where = ""; 566 psString raw_clean_where = ""; 566 567 psString chip_where = ""; 567 568 psString camera_where = ""; … … 574 575 query, 575 576 raw_where, 577 raw_clean_where, 576 578 chip_where, 577 579 camera_where,
Note:
See TracChangeset
for help on using the changeset viewer.
