- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/dist_make_fileset.pl (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ippScripts/scripts/dist_make_fileset.pl
r24199 r27840 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 39 40 40 41 # Parse the command-line arguments 41 my ($dist_id, $dist_dir, $target_id, $stage, $stage_id, $prod_id, $product_name, $ds_dbhost, $ds_dbname); 42 my ($dist_id, $dist_dir, $target_id, $stage, $stage_id, $dest_id, $product_name, $ds_dbhost, $ds_dbname); 43 my ($label, $data_group, $filter); 42 44 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 43 45 … … 45 47 'dist_id=s' => \$dist_id, # distribution run identifier 46 48 'dist_dir=s' => \$dist_dir, # directory containing dist run outputs 47 'target_id=s' => \$target_id, # 49 'target_id=s' => \$target_id, # 48 50 'stage=s' => \$stage, # raw, chip, camera, fake, warp, stack, or diff 49 51 'stage_id=s' => \$stage_id, # exp_id, chip_id, etc. 50 ' prod_id=s' => \$prod_id, # id for the product52 'dest_id=s' => \$dest_id, # id for the product 51 53 'product_name=s' => \$product_name, # location of the data store directory for this product 54 'label=s' => \$label, 55 'data_group=s' => \$data_group, 56 'filter=s' => \$filter, 52 57 'ds_dbhost=s' => \$ds_dbhost, # database host for the datastore database 53 58 'ds_dbname=s' => \$ds_dbname, # database name for the datastore database … … 60 65 61 66 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 62 pod2usage( -msg => "Required options: --dist_id --dist_dir --target_id --stage --stage_id -- prod_id --ds_dbhost --ds_dbname",67 pod2usage( -msg => "Required options: --dist_id --dist_dir --target_id --stage --stage_id --data_group --filter --dest_id --ds_dbhost --ds_dbname", 63 68 -exitval => 3) unless 64 69 defined $dist_id and … … 67 72 defined $stage and 68 73 defined $stage_id and 69 defined $prod_id and 74 defined $data_group and 75 defined $filter and 76 defined $dest_id and 70 77 defined $product_name and 71 78 defined $ds_dbhost and … … 79 86 my $fs_tag = get_fileset_tag($ipprc, $stage, $stage_id, $dbname); 80 87 81 &my_die("failed to lookup fileset tag", $dist_id, $prod_id, $PS_EXIT_UNKNOWN_ERROR) if !$fs_tag; 82 83 my $fileset_name = "$fs_tag.$stage.$stage_id.$dist_id.$prod_id"; 88 &my_die("failed to lookup fileset tag", $dist_id, $dest_id, $PS_EXIT_UNKNOWN_ERROR) if !defined $fs_tag; 89 90 my $fileset_name = $fs_tag ? "$fs_tag." : ""; 91 $fileset_name .= "$stage.$stage_id.$dist_id.$dest_id"; 84 92 85 93 print "$fileset_name\n"; … … 87 95 88 96 # make sure that the database info file for this run exists 89 my $dbinfo_file = " dbinfo.$stage.$stage_id.mdc";90 if (! -e "$d ist_dir/$dbinfo_file" ) {91 &my_die("dbinfo file for dist run $dbinfo_file not found", $dist_id, $ prod_id, $PS_EXIT_UNKNOWN_ERROR);97 my $dbinfo_file = "$dist_dir/dbinfo.$stage.$stage_id.mdc"; 98 if (! -e "$dbinfo_file" ) { 99 &my_die("dbinfo file for dist run $dbinfo_file not found", $dist_id, $dest_id, $PS_EXIT_UNKNOWN_ERROR); 92 100 } 93 101 print "dbinfo file $dbinfo_file exists\n" if $verbose; 94 102 95 103 # make sure that the dirinfo file for this run exists 96 my $dirinfo_file = " dirinfo.$stage.$stage_id.mdc";97 if (! -e "$di st_dir/$dirinfo_file" ) {98 &my_die("dirinfo file for dist run $dirinfo_file not found", $dist_id, $ prod_id, $PS_EXIT_UNKNOWN_ERROR);104 my $dirinfo_file = "$dist_dir/dirinfo.$stage.$stage_id.mdc"; 105 if (! -e "$dirinfo_file" ) { 106 &my_die("dirinfo file for dist run $dirinfo_file not found", $dist_id, $dest_id, $PS_EXIT_UNKNOWN_ERROR); 99 107 } 100 108 print "dirinfo file $dirinfo_file exists\n" if $verbose; … … 116 124 unless ($success) { 117 125 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 118 &my_die("Unable to perform $command error_code: $error_code", $dist_id, $ prod_id, $error_code);126 &my_die("Unable to perform $command error_code: $error_code", $dist_id, $dest_id, $error_code); 119 127 } 120 128 121 129 my $metadata = $mdcParser->parse (join "", @$stdout_buf) or 122 &my_die("Unable to parse metadata config doc", $dist_id, $ prod_id, $PS_EXIT_PROG_ERROR);130 &my_die("Unable to parse metadata config doc", $dist_id, $dest_id, $PS_EXIT_PROG_ERROR); 123 131 124 132 $components = parse_md_list($metadata); … … 135 143 my $md5sum = $component->{md5sum}; 136 144 # name of the file 137 my $ name = $component->{name};145 my $file_name = $component->{name}; 138 146 # component id (class_is or skycell_id) 147 my $comp_dir = $component->{outdir}; 139 148 my $comp_name = $component->{component}; 140 149 141 150 # XXX: if tarfile is not always the right type we need to add a type to distComponent 142 print $listFile "$ name|$size|$md5sum|tgz|$comp_name|\n";151 print $listFile "$comp_dir/$file_name|$size|$md5sum|tgz|$comp_name|\n"; 143 152 } 144 153 … … 146 155 147 156 { 148 # XXX: need to chose an appropriate file set type 149 my $command = "$dsreg --add $fileset_name --product $product_name --type notset --list $listFileName"; 157 my $command = "$dsreg --add $fileset_name --product $product_name --type IPP-DIST --list $listFileName"; 150 158 151 159 # the data store will refer to the distribution bundle via symlinks back to distRun.outdir 152 $command .= " --datapath $dist_dir --link"; 160 # $command .= " --datapath $dist_dir --link"; 161 $command .= " --abspath --link"; 153 162 154 163 # set the product specific columns in product list 155 $command .= " --ps0 $target_id --ps1 $stage --ps2 $stage_id --ps3 $fs_tag"; 156 157 $command .= " --dbname $ds_dbname"; # XXX: notyet --dbhost $ds_dbhost 158 159 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 160 run(command => $command, verbose => $verbose); 161 unless ($success) { 162 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 163 &my_die("Unable to perform $command error_code: $error_code", $dist_id, $prod_id, $error_code); 164 my $prod_col_3 = $fs_tag ? $fs_tag : "$stage.$stage_id"; 165 166 $command .= " --ps0 $target_id --ps1 $stage --ps2 $stage_id --ps3 $prod_col_3"; 167 $command .= " --ps4 $data_group --ps5 $filter"; 168 169 $command .= " --dbname $ds_dbname --dbhost $ds_dbhost"; 170 171 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 172 run(command => $command, verbose => $verbose); 173 unless ($success) { 174 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 175 &my_die("Unable to perform $command error_code: $error_code", $dist_id, $dest_id, $error_code); 164 176 } 165 177 } 166 178 167 179 { 168 my $command = "$disttool -addfileset -dist_id $dist_id - prod_id $prod_id -name $fileset_name";180 my $command = "$disttool -addfileset -dist_id $dist_id -dest_id $dest_id -name $fileset_name"; 169 181 $command .= " -dbname $dbname" if $dbname; 170 182 … … 175 187 # We need to have revertfileset check whether the fileset exists and do dsreg -del if it does 176 188 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 177 &my_die("Unable to perform $command error_code: $error_code", $dist_id, $ prod_id, $error_code);189 &my_die("Unable to perform $command error_code: $error_code", $dist_id, $dest_id, $error_code); 178 190 } 179 191 } … … 198 210 my $dsn = "DBI:mysql:host=$dbserver;database=$dbname"; 199 211 200 my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) 212 my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) 201 213 or die "Cannot connect to database.\n"; 202 214 … … 211 223 my $dbname = shift; 212 224 213 if ($stage eq 'stack') { 214 return "stack.$stage_id"; 215 } elsif ($stage eq 'diff') { 216 return "diff.$stage_id"; 225 if (($stage eq 'stack') or ($stage eq 'diff') or ($stage eq 'SSdiff')) { 226 return ""; 217 227 } 218 228 219 229 # 220 # we are a long ways away from the rawExp in the pipeline. Rather than do some 230 # we are a long ways away from the rawExp in the pipeline. Rather than do some 221 231 # very long joins in disttool, we look up the exp_name in the database using DBI 222 232 # 223 233 my $dbh = getDBHandle($ipprc, $dbname); 224 234 225 my $query; 235 my $query; 226 236 227 237 if ($stage eq 'raw') { … … 248 258 my $tag = $ref->{exp_name}; 249 259 250 return $tag;260 return "$tag"; 251 261 } 252 262 … … 254 264 my $msg = shift; 255 265 my $dist_id = shift; 256 my $ prod_id = shift;266 my $dest_id = shift; 257 267 my $fault = shift; 258 268 259 # TODO: disttool -adddsfileset - prod_id $prod_id -dist_id $dist_id -fault $fault269 # TODO: disttool -adddsfileset -dest_id $dest_id -dist_id $dist_id -fault $fault 260 270 print STDERR "$msg\n"; 261 271 262 my $command = "$disttool -addfileset -dist_id $dist_id - prod_id $prod_id -fault $fault";272 my $command = "$disttool -addfileset -dist_id $dist_id -dest_id $dest_id -fault $fault"; 263 273 $command .= " -dbname $dbname" if $dbname; 264 274
Note:
See TracChangeset
for help on using the changeset viewer.
