IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2023, 8:18:25 AM (3 years ago)
Author:
eugene
Message:

allow long-running jobs (md5sum) to be remote; fix some error handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl

    r42430 r42441  
    1616# USAGE: check_chip_locations.pl --dateobs 2010/05/01 --chiplist gpc1.chips.txt --stage v0
    1717
    18 my ($fulldate, $dateword, $chiplist, $stage) = &parse_cmdopts;
    19 my ($neb_dbh, $gpc_dbh) = &parse_db_config ('nebulous.config');
     18my ($fulldate, $dateword, $chiplist, $stage, $topdir) = &parse_cmdopts;
     19my ($neb_dbh, $gpc_dbh) = &parse_db_config ("$topdir/nebulous.config");
    2020
    2121# read the list of chip_ids:
     
    2727
    2828# put output files in a directory defined by the night
    29 mkdir $dateword;
     29mkdir "$topdir/$dateword";
    3030
    3131# output files:
     
    3535foreach my $chip_id (@chip_ids) {
    3636
    37     my $outfile = "$dateword/$chip_id.uris.txt";
    3837    my $outfh;
    39     open ($outfh, ">$outfile");
     38    open ($outfh, ">$topdir/$dateword/$chip_id.uris.txt");
    4039
    4140    # get the list of chip neb paths for one chip
     
    7473    # now save the host count for this chip
    7574    my $hostfh;
    76     open ($hostfh, ">$dateword/$chip_id.hosts.txt");
     75    open ($hostfh, ">$topdir/$dateword/$chip_id.hosts.txt");
    7776
    7877    # save the host count for this chip
     
    121120    my @chip_ids;
    122121
    123     open(CHIPS,$chiplist) or die "cannot open file $chiplist\n";
     122    open(CHIPS,"$topdir/$chiplist") or die "cannot open file $chiplist\n";
    124123
    125124    my @lines = <CHIPS>;
     
    226225        my $xattr    = $values[3];
    227226       
     227        if ($xattr  > 1) { $Ndead ++; next; } # do not save instances on dead partitions
     228        if ($xattr == 0) { $Nmain ++; }
     229        if ($xattr == 1) { $Nback ++; }
     230
    228231        # count the number of each host by incrementing the hash element corresponding to the hostname:
    229232        # NOTE: hostcount is global
     
    231234
    232235        if (not defined $hostfile{$hostname}) {
    233             open ($hostfile{$hostname}, ">$dateword/$hostname.inst.$stage.txt");
     236            open ($hostfile{$hostname}, ">$topdir/$dateword/$hostname.inst.$stage.txt");
    234237            ## XXX deal with open failure here
    235238        }
     239
    236240        my $fh = $hostfile{$hostname};
    237241        print $fh "$instance $data_st $md5_sum\n";
    238 
    239         if ($xattr == 0) { $Nmain ++; }
    240         if ($xattr == 1) { $Nback ++; }
    241         if ($xattr  > 1) { $Ndead ++; }
    242242    }
    243243
     
    330330sub parse_cmdopts {
    331331
    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);
    334334   
    335335    pod2usage( -msg => "Cannot determine target date, use --dateobs YYYY/MM/DD", -exitval => 2) unless defined $dateobs;
    336336    pod2usage( -msg => "Provide a list of chips with --chiplist", -exitval => 2) unless defined $chiplist;
    337337    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;
    338339   
    339340    # check the date format (require YYYY/MM/DD and use that from 00:00:00 to 23:59:59 or take start and end?)
     
    348349    my $dateword = sprintf ("%4d%02d%02d", $date_year, $date_month, $date_day);
    349350
    350     return ($fulldate, $dateword, $chiplist, $stage)
     351    return ($fulldate, $dateword, $chiplist, $stage, $topdir)
    351352}
    352353
Note: See TracChangeset for help on using the changeset viewer.