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/fix_chip_locations.pl

    r42430 r42441  
    1818# for each chip, target a single host?
    1919
    20 my ($fulldate, $dateword, $chiplist, $stage) = &parse_cmdopts;
    21 my ($neb_dbh) = &parse_db_config ('nebulous.config');
     20my ($fulldate, $dateword, $chiplist, $stage, $topdir) = &parse_cmdopts;
     21my ($neb_dbh) = &parse_db_config ("$topdir/nebulous.config");
    2222
    2323# read the list of chip_ids:
     
    4242foreach my $chip_id (@chip_ids) {
    4343
    44     my $urifile = "$dateword/$chip_id.uris.txt";
    45     open (FILE, "$urifile");
     44    my $urifile = "$topdir/$dateword/$chip_id.uris.txt";
     45    open (FILE,  $urifile);
    4646    my @lines = <FILE>;
    4747    close (FILE);
     
    7171            my ($newfile, $newhost, $newxattr) = &get_new_instance ($ext_id);
    7272            unless ($newxattr == 1) { die "new instance is not at ATRC? $ext_id : $newfile : $newhost : $newxattr\n"; }
    73             open (OUTFILE, ">>$dateword/$newhost.inst.$stage.txt");
     73            open (OUTFILE, ">>$topdir/$dateword/$newhost.inst.$stage.txt");
    7474            print OUTFILE "$newfile $datast $md5sum\n";
    7575            close (OUTFILE);
     
    8585            my ($newfile, $newhost, $newxattr) = &get_new_instance ($ext_id);
    8686            unless ($newxattr == 0) { die "new instance is not at ITC? $ext_id : $newfile : $newhost : $newxattr\n"; }
    87             open (OUTFILE, ">>$dateword/$newhost.inst.$stage.txt");
     87            open (OUTFILE, ">>$topdir/$dateword/$newhost.inst.$stage.txt");
    8888            print OUTFILE "$newfile $datast $md5sum\n";
    8989            close (OUTFILE);
     
    170170    my @chip_ids;
    171171
    172     open(CHIPS,$chiplist) or die "cannot open file $chiplist\n";
     172    open(CHIPS,"$topdir/$chiplist") or die "cannot open file $chiplist\n";
    173173
    174174    my @lines = <CHIPS>;
     
    189189sub parse_cmdopts {
    190190
    191     my ($dateobs, $chiplist, $stage);
    192     GetOptions( 'dateobs=s' => \$dateobs, 'chiplist=s' => \$chiplist, 'stage=s' => \$stage) || pod2usage(2);
     191    my ($dateobs, $chiplist, $stage, $topdir);
     192    GetOptions( 'dateobs=s' => \$dateobs, 'chiplist=s' => \$chiplist, 'topdir=s' => \$topdir, 'stage=s' => \$stage) || pod2usage(2);
    193193   
    194194    pod2usage( -msg => "Cannot determine target date, use --dateobs YYYY/MM/DD", -exitval => 2) unless defined $dateobs;
    195195    pod2usage( -msg => "Provide a list of chips with --chiplist", -exitval => 2) unless defined $chiplist;
    196196    pod2usage( -msg => "Define the stage (v0, v1, etc) with --stage", -exitval => 2) unless defined $stage;
     197    pod2usage( -msg => "Specify the top-level output directory with --topdir", -exitval => 2) unless defined $topdir;
    197198   
    198199    # check the date format (require YYYY/MM/DD and use that from 00:00:00 to 23:59:59 or take start and end?)
     
    207208    my $dateword = sprintf ("%4d%02d%02d", $date_year, $date_month, $date_day);
    208209
    209     return ($fulldate, $dateword, $chiplist, $stage);
     210    return ($fulldate, $dateword, $chiplist, $stage, $topdir);
    210211}
    211212
Note: See TracChangeset for help on using the changeset viewer.