- Timestamp:
- Apr 4, 2023, 8:18:25 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl
r42430 r42441 16 16 # USAGE: check_chip_locations.pl --dateobs 2010/05/01 --chiplist gpc1.chips.txt --stage v0 17 17 18 my ($fulldate, $dateword, $chiplist, $stage ) = &parse_cmdopts;19 my ($neb_dbh, $gpc_dbh) = &parse_db_config ( 'nebulous.config');18 my ($fulldate, $dateword, $chiplist, $stage, $topdir) = &parse_cmdopts; 19 my ($neb_dbh, $gpc_dbh) = &parse_db_config ("$topdir/nebulous.config"); 20 20 21 21 # read the list of chip_ids: … … 27 27 28 28 # put output files in a directory defined by the night 29 mkdir $dateword;29 mkdir "$topdir/$dateword"; 30 30 31 31 # output files: … … 35 35 foreach my $chip_id (@chip_ids) { 36 36 37 my $outfile = "$dateword/$chip_id.uris.txt";38 37 my $outfh; 39 open ($outfh, ">$ outfile");38 open ($outfh, ">$topdir/$dateword/$chip_id.uris.txt"); 40 39 41 40 # get the list of chip neb paths for one chip … … 74 73 # now save the host count for this chip 75 74 my $hostfh; 76 open ($hostfh, ">$ dateword/$chip_id.hosts.txt");75 open ($hostfh, ">$topdir/$dateword/$chip_id.hosts.txt"); 77 76 78 77 # save the host count for this chip … … 121 120 my @chip_ids; 122 121 123 open(CHIPS, $chiplist) or die "cannot open file $chiplist\n";122 open(CHIPS,"$topdir/$chiplist") or die "cannot open file $chiplist\n"; 124 123 125 124 my @lines = <CHIPS>; … … 226 225 my $xattr = $values[3]; 227 226 227 if ($xattr > 1) { $Ndead ++; next; } # do not save instances on dead partitions 228 if ($xattr == 0) { $Nmain ++; } 229 if ($xattr == 1) { $Nback ++; } 230 228 231 # count the number of each host by incrementing the hash element corresponding to the hostname: 229 232 # NOTE: hostcount is global … … 231 234 232 235 if (not defined $hostfile{$hostname}) { 233 open ($hostfile{$hostname}, ">$ dateword/$hostname.inst.$stage.txt");236 open ($hostfile{$hostname}, ">$topdir/$dateword/$hostname.inst.$stage.txt"); 234 237 ## XXX deal with open failure here 235 238 } 239 236 240 my $fh = $hostfile{$hostname}; 237 241 print $fh "$instance $data_st $md5_sum\n"; 238 239 if ($xattr == 0) { $Nmain ++; }240 if ($xattr == 1) { $Nback ++; }241 if ($xattr > 1) { $Ndead ++; }242 242 } 243 243 … … 330 330 sub parse_cmdopts { 331 331 332 my ($dateobs, $chiplist, $stage );333 GetOptions( 'dateobs=s' => \$dateobs, 'chiplist=s' => \$chiplist, ' stage=s' => \$stage) || pod2usage(2);332 my ($dateobs, $chiplist, $stage, $topdir); 333 GetOptions( 'dateobs=s' => \$dateobs, 'chiplist=s' => \$chiplist, 'topdir=s' => \$topdir, 'stage=s' => \$stage) || pod2usage(2); 334 334 335 335 pod2usage( -msg => "Cannot determine target date, use --dateobs YYYY/MM/DD", -exitval => 2) unless defined $dateobs; 336 336 pod2usage( -msg => "Provide a list of chips with --chiplist", -exitval => 2) unless defined $chiplist; 337 337 pod2usage( -msg => "Define the stage (v0, v1, etc) with --stage", -exitval => 2) unless defined $stage; 338 pod2usage( -msg => "Specify the top-level output directory with --topdir", -exitval => 2) unless defined $topdir; 338 339 339 340 # check the date format (require YYYY/MM/DD and use that from 00:00:00 to 23:59:59 or take start and end?) … … 348 349 my $dateword = sprintf ("%4d%02d%02d", $date_year, $date_month, $date_day); 349 350 350 return ($fulldate, $dateword, $chiplist, $stage )351 return ($fulldate, $dateword, $chiplist, $stage, $topdir) 351 352 } 352 353
Note:
See TracChangeset
for help on using the changeset viewer.
