IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 1, 2009, 5:28:52 PM (17 years ago)
Author:
bills
Message:

on receive side of distribution, optionally create a fileset in a status data store
defer {$stage}tool -importrun until all of the files have been downloaded
in the dist.queuruns task queue rcruns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/receive_file.pl

    r23895 r24038  
    3636
    3737# Parse the command-line arguments
    38 my ( $file_id, $source, $product, $fileset, $file, $workdir, $dbname, $verbose, $no_update, $save_temps );
     38my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $workdir, $dbname, $verbose, $no_update, $save_temps );
    3939
    4040GetOptions(
     
    4343           'product=s'         => \$product, # Product for data
    4444           'fileset=s'         => \$fileset, # Fileset for data
     45           'fileset_id=s'      => \$fileset_id, # database id for the fileset
    4546           'file=s'            => \$file, # File to retrieve
    4647           'workdir=s'         => \$workdir, # Working directory for output
     
    6162    defined $workdir;
    6263
     64$tempdir .= "/$file_id";
     65
    6366my $ipprc = PS::IPP::Config->new() or
    6467    &my_die( "Unable to set up", $file_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     
    8083    # Load into database
    8184
     85    my $target = "$workdir/$file"; # Target destination for file
     86    my $fixName = $ipprc->file_create( $target ); # Target for move
     87    my $fixFile;
     88
     89    open $fixFile, ">$fixName" or die "can't open $fixName\n";
     90
    8291    # Need to fix paths to point to new workdir
    83     my ($fixFile, $fixName) = tempfile( "$tempdir/$file.XXXX", UNLINK => !$save_temps ); # Fixed file
    8492    open my $inFile, $filename or die "Can't open $filename\n"; # Input file
    8593    my $workdir_old;            # Old workdir
     
    98106    }
    99107    close($inFile);
    100 
    101     my ($stage) = $file =~ m|^dbinfo\.(\S+)\.\d+\.mdc$|; # Stage of interest
    102     my $tool = can_run("${stage}tool") or die "Can't find tool to load $file\n";
    103 
    104     my $command = "$tool -importrun -infile $fixName"; # Command to execute
     108    close($fixFile);
     109#{
     110    my $command = "$receivetool -updatefileset -fileset_id $fileset_id -dbinfo_uri $fixName"; # Command to execute
    105111    $command .= " -dbname $dbname" if defined $dbname;
    106112    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    107113        run(command => $command, verbose => $verbose);
    108     die "Unable to load $fixName\n" unless $success;
     114    die "Unable to set dbinfo_uri for $fileset_id to  $fixName\n" unless $success;
     115#}
     116
    109117} elsif ($file =~ m|.*\.tgz$|) {
    110118    # Get contents of tarball
Note: See TracChangeset for help on using the changeset viewer.