IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 16, 2009, 5:54:55 PM (17 years ago)
Author:
Paul Price
Message:

Distribution client workflow is now working!

Location:
trunk/ippScripts/scripts
Files:
3 edited

Legend:

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

    r23890 r23894  
    6565my $filename = "$tempdir/$file";  # Target filename
    6666{
    67     my $uri = "$source/product/$fileset/$file"; # URI for datastore file
     67    my $uri = "$source/$product/$fileset/$file"; # URI for datastore file
    6868    my $command = "dsget --uri $uri --filename $filename"; # Command to execute
    6969
     
    8181
    8282    my $command = "$tool -importrun -infile $filename"; # Command to execute
     83    $command .= " -dbname $dbname" if defined $dbname;
    8384    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    8485        run(command => $command, verbose => $verbose);
     
    8889    my @files = ();
    8990    {
    90         my $command = "tar -C $tempdir -tvzf $filename"; # Command to execute
     91        my $command = "tar -C $tempdir -tzf $filename"; # Command to execute
    9192        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    9293            run(command => $command, verbose => $verbose);
    9394        die "Unable to get listing of tar file $filename\n" unless $success;
    9495
    95         foreach my $line (@$stdout_buf) {
     96        my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output
     97        foreach my $line ( @lines ) {
    9698            $line =~ s/\#.*$//;
    9799            next unless $line =~ /\S+/;
     
    99101            my $file = $fields[0];      # Name of file
    100102            $file =~ s|^./||;
    101             push @files, $file if defined $file;
     103            push @files, $file if $file =~ /\S+/;
    102104        }
    103105    }
     
    115117        my $from = "$tempdir/$file"; # Source for file
    116118        my $target = "$workdir/$file"; # Target destination for file
    117         my $to = $ipprc->file_prepare( $target ); # Target for move
     119        my $to = $ipprc->file_create( $target ); # Target for move
    118120        system("mv $from $to") == 0 or die "Unable to move $file into workdir $workdir: $!\n";
    119121    }
     
    129131{
    130132    my $command = "$receivetool -addresult";
    131     $command .= " -file $file_id";
     133    $command .= " -file_id $file_id";
    132134    $command .= (" -dtime_copy " . (($mjd_copy - $mjd_start) * 86400));
    133     $command .= (" -dtime_extract " . (($mjd_extract - $mjd_start) * 86400));
     135    $command .= (" -dtime_extract " . (($mjd_extract - $mjd_copy) * 86400));
    134136    $command .= " -dbname $dbname" if defined $dbname;
     137
     138
     139    print "$command\n";
    135140
    136141    unless (defined $no_update) {
  • trunk/ippScripts/scripts/receive_fileset.pl

    r23888 r23894  
    5555my @files = ();                 # Files to add
    5656{
    57     my $uri = "$source/product/$fileset"; # URI for datastore fileset
     57    my $uri = "$source/$product/$fileset"; # URI for datastore fileset
    5858    $uri .= "/index.txt" unless $uri =~ m|/index.txt$|;
    5959    my $command = "dsfilesetls --uri $uri"; # Command to execute
     
    6464
    6565    # Get files
    66     foreach my $line (@$stdout_buf) {
     66    my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output
     67    foreach my $line ( @lines ) {
    6768        $line =~ s/\#.*$//;
    6869        next unless $line =~ /\S+/;
     
    7778    my $command = "receivetool -addfile"; # Command to execute
    7879    $command .= " -fileset_id $fileset_id";
    79     $command .= " -file" . join(' -file', @files);
     80    $command .= " -file " . join(' -file ', @files);
    8081    $command .= " -dbname $dbname" if defined $dbname;
    8182
  • trunk/ippScripts/scripts/receive_source.pl

    r23892 r23894  
    5555$uri .= "/index.txt" unless $uri =~ m|/index.txt$|;
    5656my $command = "dsproductls --uri $uri"; # Command to execute
    57 $command .= "--last_fileset $last_fileset" if defined $last_fileset;
     57$command .= " --last_fileset $last_fileset" if defined $last_fileset;
    5858
    5959my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    6161die "Unable to get source listing from $source for $product\n" unless $success;
    6262
    63 # Add filesets
    64 my $last;                   # Last fileset seen
    65 foreach my $line (@$stdout_buf) {
     63# Parse list of filesets
     64my @filesets = ();              # Filesets to add
     65my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output
     66foreach my $line ( @lines ) {
    6667    $line =~ s/\#.*//g;
    6768    next unless $line =~ /\S+/;
     
    6970    my @fields = split(/\s+/, $line); # Fields in line
    7071    my $fileset = $fields[1];
    71     next if not defined $fileset;
    72 
    73     my $command = "receivetool -addfileset"; # Command to execute
    74     $command .= " -source_id $source_id";
    75     $command .= " -fileset $fileset";
    76     $command .= " -dbname $dbname" if defined $dbname;
    77 
    78     unless (defined $no_update) {
    79         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    80             run(command => $command, verbose => $verbose);
    81         die "Unable to add fileset $fileset\n" unless $success;
    82         $last = $fileset;
    83     }
     72    push @filesets, $fileset if defined $fileset and $fileset =~ /\S+/;
    8473}
    8574
    86 # Update the last fileset seen
    87 if (defined $last and (not defined $last_fileset or $last ne $last_fileset)) {
    88     my $command = "receivetool -updatelast"; # Command to execute
    89     $command .= " -source_id $source_id";
    90     $command .= " -fileset $last";
    91     $command .= " -dbname $dbname" if defined $dbname;
     75if (scalar @filesets > 0) {
     76    # Add filesets
     77    {
     78        my $command = "receivetool -addfileset"; # Command to execute
     79        $command .= " -src_id $source_id";
     80        $command .= " -fileset " . join(' -fileset ', @filesets);
     81        $command .= " -dbname $dbname" if defined $dbname;
    9282
    93     unless (defined $no_update) {
    94         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    95             run(command => $command, verbose => $verbose);
    96         die "Unable to update last fileset to $last\n" unless $success;
     83        unless (defined $no_update) {
     84            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     85                run(command => $command, verbose => $verbose);
     86            die "Unable to add filesets from $source for $product\n" unless $success;
     87        }
     88    }
     89
     90    # Update the last fileset seen
     91    {
     92        my $command = "receivetool -updatelast"; # Command to execute
     93        $command .= " -src_id $source_id";
     94        my $last = pop @filesets; # Last fileset
     95        $command .= " -fileset $last";
     96        $command .= " -dbname $dbname" if defined $dbname;
     97
     98        unless (defined $no_update) {
     99            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     100                run(command => $command, verbose => $verbose);
     101            die "Unable to update last fileset to $last\n" unless $success;
     102        }
    97103    }
    98104}
Note: See TracChangeset for help on using the changeset viewer.