IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24125


Ignore:
Timestamp:
May 9, 2009, 2:19:48 PM (17 years ago)
Author:
bills
Message:

Pass information about the paths from the distribution server to the client.
Use these to edit the database dump

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/dbconfig/changes.txt

    r24108 r24125  
    11021102ALTER TABLE receiveFile ADD COLUMN component VARCHAR(64);
    11031103
     1104ALTER TABLE receiveFileset CHANGE COLUMN dbinfo_uri dbinfo VARCHAR(255);
     1105ALTER TABLE receiveFileset ADD COLUMN dirinfo VARCHAR(255) AFTER state;
     1106
  • trunk/dbconfig/receive.md

    r24108 r24125  
    1818        fileset         STR     128
    1919        state           STR     64
    20         dbinfo_uri      STR     255
     20        dirinfo         STR     255
     21        dbinfo          STR     255
    2122        fault           S16     0       # Key
    2223END
  • trunk/ippScripts/scripts/dist_advancerun.pl

    r23874 r24125  
    1616use IPC::Cmd 0.36 qw( can_run run );
    1717use File::Temp qw( tempfile );
    18 use File::Basename qw( basename );
     18use File::Basename qw( dirname);
    1919use PS::IPP::Metadata::Config;
    2020use PS::IPP::Metadata::List qw( parse_md_list );
     
    7272
    7373my $tool_cmd;
     74my $list_mode;
     75my $component_key;
    7476if ($stage eq "raw") {
    7577    $tool_cmd = "$regtool -exp_id";
     78    $list_mode = "-processedimfile";
     79    $component_key = "class_id";
    7680} elsif ($stage eq "chip") {
    7781    $tool_cmd = "$chiptool -chip_id";
     82    $list_mode = "-processedimfile";
     83    $component_key = "class_id";
    7884} elsif ($stage eq "camera") {
    7985    $tool_cmd = "$camtool -cam_id";
     86    $list_mode = "-processedexp";
     87    $component_key = "";
    8088} elsif ($stage eq "fake") {
    8189    $tool_cmd = "$faketool -fake_id";
     90    $list_mode = "-processedimfile";
     91    $component_key = "class_id";
    8292} elsif ($stage eq "warp") {
    8393    $tool_cmd = "$warptool -warp_id";
     94    $list_mode = "-warped";
     95    $component_key = "skycell_id";
    8496} elsif ($stage eq "stack") {
    8597    $tool_cmd = "$stacktool -stack_id";
     98    $list_mode = "-sumskyfile";
     99    $component_key = "skycell_id";
    86100} elsif ($stage eq "diff") {
    87101    $tool_cmd = "$difftool -diff_id";
     102    $list_mode = "-diffskyfile";
     103    $component_key = "skycell_id";
    88104} else {
    89105    &my_die("Unexpected stage: $stage", $dist_id, $PS_EXIT_CONFIG_ERROR);
    90106}
    91107
     108$tool_cmd .= " $stage_id";
     109
    92110# XXX should we create a file rule for this?
    93 my $outfile = "$outdir/dbinfo.$stage.$stage_id.mdc";
    94 
    95 {
    96     my $command = "$tool_cmd $stage_id -exportrun -outfile $outfile";
     111my $dbinfo_file = "$outdir/dbinfo.$stage.$stage_id.mdc";
     112
     113{
     114    my $command = "$tool_cmd -exportrun -outfile $dbinfo_file";
    97115    $command .= " -clean" if defined $clean;
    98116    $command .= " -dbname $dbname" if defined $dbname;
     
    105123    }
    106124}
    107 
    108 # set distRun.stage = 'full'
    109 {
    110     my $command = "$disttool -updaterun -dist_id $dist_id -set_state full";
     125my $dirinfo = "$outdir/dirinfo.$stage.$stage_id.mdc";
     126{
     127    my $command = "$tool_cmd $list_mode";
    111128    $command .= " -dbname $dbname" if defined $dbname;
    112129
     
    117134        &my_die("Unable to perform $command: $error_code", $dist_id, $error_code);
    118135    }
     136    if (@$stdout_buf == 0) {
     137        &my_die("Unable to perform $command: $error_code", $dist_id, $error_code);
     138    }
     139    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     140        &my_die("Unable to parse metadata config doc", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     141    my $components = parse_md_list($metadata) or
     142        &my_die("Unable to parse metadata list", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     143
     144    open MANIFEST, ">$dirinfo" or
     145        &my_die("Unable to open dirinfo file $dirinfo",  $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     146
     147    my $destdir;
     148    foreach my $c (@$components) {
     149        if (!$destdir) {
     150            my $workdir = $c->{workdir};
     151            if ($workdir) {
     152                $destdir = stripvolume($workdir, $stage);
     153            } elsif ($stage eq 'raw') {
     154                $destdir = 'none';
     155            } else {
     156                &my_die("workdir not found for open dirinfo file $dirinfo",  $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     157            }
     158            print MANIFEST "destdir METADATA\n";
     159            print MANIFEST "\t" , "destdir", "\tSTR\t", $destdir, "\n";
     160            print MANIFEST "END\n\n";
     161            print MANIFEST "components METADATA\n";
     162        }
     163        my $component = $c->{$component_key} ? $c->{$component_key} : "exposure";
     164        my $path;
     165        if ($stage eq 'raw') {
     166            $path = $c->{uri};
     167        } else {
     168            $path = $c->{path_base};
     169        }
     170        &my_die("unable to find path",  $dist_id, $PS_EXIT_UNKNOWN_ERROR) if !$path;
     171        my $component_dir = find_componentdir($destdir, $path);
     172#        print MANIFEST "$component METADATA\n";
     173        print MANIFEST "\t" , "$component", "\tSTR\t", $component_dir, "\n";
     174    }
     175    print MANIFEST "END\n\n";
     176    close MANIFEST or
     177        &my_die("Unable to close dirinfo file $dirinfo",  $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     178}
     179
     180{
     181    my $command = "$disttool -updaterun -dist_id $dist_id -set_state full";
     182    $command .= " -dbname $dbname" if defined $dbname;
     183
     184    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     185        run(command => $command, verbose => $verbose);
     186    unless ($success) {
     187        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     188        &my_die("Unable to perform $command: $error_code", $dist_id, $error_code);
     189    }
    119190}
    120191
     
    124195### Pau.
    125196
     197sub stripvolume
     198{
     199    my $path = shift;
     200    my $stage = shift;
     201    my @segments;
     202
     203    # workdir isn't what we want for raw stage
     204    return "none" if ($stage and ($stage eq 'raw'));
     205
     206    my $scheme = file_scheme($path);
     207    my $tail;
     208    if ($scheme) {
     209        # strip off scheme://
     210        $tail = substr($path, length($scheme) + 3);
     211    } elsif (substr($path, 0, 1) eq '/') {
     212        $tail = substr($path, 1);
     213        $scheme = "";
     214    }
     215    # remove any leading / that are left
     216    while ((substr($tail, 0, 1) eq '/')) {
     217        $tail = substr($tail, 1);
     218    }
     219
     220    if (($scheme eq 'neb') or ($scheme eq 'path')) {
     221        my $volume;
     222        ($volume, @segments) = split '/', $tail;
     223
     224    } elsif (!$scheme or ($scheme eq 'file')) {
     225
     226        # XXX Here we're assuming the /data/ipp??? structure. This won't be true when data is forwarded
     227        # by remote sites. We need a way to configure this
     228        my $volume;
     229
     230        # data/ippxxx/dirs
     231        (undef, $volume, @segments) = split '/', $tail;
     232    } else {
     233        die( "unexpected workdir value: $path\n");
     234    }
     235
     236    return caturi(@segments);
     237}
     238
     239sub find_componentdir
     240{
     241    my $destdir = shift;
     242    my $path = shift;
     243
     244    my $result;
     245    if ($destdir eq 'none') {
     246        $result = stripvolume($path);
     247    } else {
     248        # find location of destdir in the path
     249        my $i = index($path, $destdir);
     250
     251        $result = substr($path, $i + length($destdir) + 1);
     252
     253        while (substr($result, 0, 1) eq '/') {
     254            $result = substr($result, 1);
     255        }
     256    }
     257    return dirname($result);
     258}
    126259
    127260sub my_die
  • trunk/ippScripts/scripts/dist_make_fileset.pl

    r24104 r24125  
    9191    &my_die("dbinfo file for dist run $dbinfo_file not found", $dist_id, $prod_id, $PS_EXIT_UNKNOWN_ERROR);
    9292}
    93 print "dbinfo file $dbinfo_file exists\n";
     93print "dbinfo file $dbinfo_file exists\n" if $verbose;
     94
     95# make sure that the dirinfo file for this run exists
     96my $dirinfo_file = "dirinfo.$stage.$stage_id.mdc";
     97if (! -e "$dist_dir/$dirinfo_file" ) {
     98    &my_die("dirinfo file for dist run $dirinfo_file not found", $dist_id, $prod_id, $PS_EXIT_UNKNOWN_ERROR);
     99}
     100print "dirinfo file $dirinfo_file exists\n" if $verbose;
    94101
    95102# open the dsreg file list
     
    97104
    98105# add the dbinfo file to the list
    99 # XXX: change type from text to dbinfo once we descide on types
     106# XXX: change type from text to dbinfo and dirinfo once we define the types
    100107print $listFile "$dbinfo_file|||text|dbinfo|\n";
     108print $listFile "$dirinfo_file|||text|dirinfo|\n";
    101109
    102110my $components;
  • trunk/ippScripts/scripts/receive_file.pl

    r24102 r24125  
    1717use IPC::Cmd 0.36 qw( can_run run );
    1818use PS::IPP::Metadata::Config;
     19use PS::IPP::Metadata::List qw( parse_md_list );
    1920use PS::IPP::Config 1.01 qw( :standard );
    2021use File::Temp qw( tempfile );
     22use File::Basename qw( basename );
    2123use Carp;
    2224
     
    3638
    3739# Parse the command-line arguments
    38 my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $component, $bytes, $md5sum, $workdir, $dbname, $verbose, $no_update, $save_temps );
     40my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $component, $bytes, $md5sum, $workdir, $dirinfo_uri, $dbname, $verbose, $no_update, $save_temps );
    3941
    4042GetOptions(
     
    4951           'md5sum=s'          => \$md5sum, # md5sum for file from data store
    5052           'workdir=s'         => \$workdir, # Working directory for output
     53           'dirinfo=s'    => \$dirinfo_uri, # file containing the destination directories for this component
    5154           'dbname=s'          => \$dbname,    # Database name
    5255           'verbose'           => \$verbose,   # Print to stdout
     
    5659
    5760pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    58 pod2usage( -msg => "Required options: --file_id --source --product --fileset --file --workdir",
     61pod2usage( -msg => "Required options: --file_id --source --product --fileset --file --component --workdir --bytes --md5sum --dirinfo",
    5962           -exitval => $PS_EXIT_CONFIG_ERROR) unless
    6063    defined $file_id and
     
    6669    defined $bytes and
    6770    defined $md5sum and
     71    defined $dirinfo_uri and
    6872    defined $workdir;
    6973
    7074$tempdir .= "/$file_id";
     75
     76&my_die( "dirinfo is NULL for $component", $file_id, $PS_EXIT_CONFIG_ERROR )
     77    if (($dirinfo_uri eq "NULL") and ($component ne "dirinfo"));
    7178
    7279my $ipprc = PS::IPP::Config->new() or
    7380    &my_die( "Unable to set up", $file_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     81
     82my $mdcParser = PS::IPP::Metadata::Config->new;
     83
     84
    7485
    7586# Retrieve file
     
    8798my $mjd_copy = DateTime->now->mjd;   # MJD of finishing copy
    8899
     100# figure out which dirinfo file to read
     101my $dirinfo_file_to_read = $component eq "dirinfo" ? $filename : $dirinfo_uri;
     102
     103# process it
     104my ($destdir, $components, $dirinfo_lines) = read_dirinfo_file($dirinfo_file_to_read, $file_id);
     105
     106# select a directory for the dirinfo and dbinfo files
     107# XXX: perhaps this directory should be set by the script and passed in
     108# rather than computed here.
     109
     110my ($day, $month, $year) = (localtime)[3,4,5];
     111my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day;
     112my $dir_for_info_files = caturi($workdir, $datestr, $fileset);
     113
    89114# Deal with file
    90 if ($file =~ m|^dbinfo\.\S+\.mdc$|) {
    91     # Load into database
    92 
    93     my $target = "$workdir/$file"; # Target destination for file
    94     my $fixName = $ipprc->file_create( $target ); # Target for move
    95     my $fixFile;
    96 
    97     open $fixFile, ">$fixName" or &my_die( "can't open $fixName\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
    98 
    99     # Need to fix paths to point to new workdir
    100     open my $inFile, $filename or &my_die( "Can't open $filename\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); # Input file
    101     my $workdir_old;            # Old workdir
    102     while (<$inFile>) {
    103         # XXX This is a global approach to fixing the path: it should fix anything and everything, but won't
    104         # work if there are multiple workdirs in a file and the bits are all mixed up.  To cover that case,
    105         # we should fix each of the elements (workdir, uri, path_base) separately.
    106         if (m|^\s*workdir\s+STR\s+(\S+)|) {
    107             $workdir_old = $1;
    108             $workdir_old =~ s|\@HOST\@|\\S+|;
    109         }
    110         if (defined $workdir_old) {
    111             s|$workdir_old|$workdir|;
    112         }
    113         print $fixFile $_;
    114     }
    115     close($inFile);
    116     close($fixFile);
    117 #{
    118     my $command = "$receivetool -updatefileset -fileset_id $fileset_id -dbinfo_uri $fixName"; # Command to execute
     115if ($component eq 'dirinfo') {
     116    # save the dirinfo file contents into the $workdir
     117
     118    $dirinfo_uri = caturi($dir_for_info_files, basename($filename));
     119    print "dirinfo_uri: $dirinfo_uri\n" if $verbose;
     120
     121    my $resolved = $ipprc->file_resolve($dirinfo_uri, 'create');
     122    &my_die( "failed to resolve $dirinfo_uri\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$resolved;
     123
     124    open OUT, ">$resolved"
     125        or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     126    print OUT @$dirinfo_lines
     127        or &my_die( "failed to write $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     128    close OUT
     129        or &my_die( "failed to close $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     130   
     131    # update the fileset to allow processing of other files
     132    my $command = "$receivetool -updatefileset -fileset_id $fileset_id";
     133    $command .= " -set_state new -dirinfo $dirinfo_uri";
    119134    $command .= " -dbname $dbname" if defined $dbname;
     135
    120136    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    121137        run(command => $command, verbose => $verbose);
    122     &my_die( "Unable to set dbinfo_uri for $fileset_id to  $fixName\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $success;
    123 #}
    124 
    125 } elsif ($file =~ m|.*\.tgz$|) {
     138    &my_die( "Unable to update fileset $fileset_id to\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $success;
     139
     140} elsif ($component eq "dbinfo") {
     141
     142    open INFILE, $filename or &my_die( "Can't open $filename\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     143
     144    my @lines = (<INFILE>);
     145
     146    my $dbinfo = join "", @lines;
     147
     148    close INFILE;
     149
     150    my $dbinfo_uri = caturi($dir_for_info_files, basename($filename));
     151    print "dbinfo_uri: $dbinfo_uri\n" if $verbose;
     152
     153    my $resolved = $ipprc->file_resolve($dbinfo_uri, 'create');
     154    &my_die( "failed to resolve $dbinfo_uri\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$resolved;
     155
     156    open OUT, ">$resolved"
     157        or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     158
     159    # We process the dbinfo file (the exported run from the distribution) line by line
     160    # Rather than read it as an mdc and interptet it, we do our substitutions directly
     161    # This is much faster. Parsing a mdc file for a chip run takes several seconds.
     162    # we are very strict on the formatting
     163
     164    # first line tells us the run type. From this we get the stage
     165    #
     166    my $line = $lines[0];
     167    my ($runType, $multi) = split " ", $line;
     168    &my_die( "unexpected first line found in $filename: $line\n", $file_id, $PS_EXIT_UNKNOWN_ERROR)
     169        if !$runType or ($multi ne 'MULTI');
     170    my $stage;
     171    my $comp_name;
     172    my $current_component;
     173    if ($runType eq 'rawExp') {
     174        $stage = 'raw';
     175        $comp_name = 'class_id';
     176    } elsif ($runType eq 'chipRun') {
     177        $stage = 'chip';
     178        $comp_name = 'class_id';
     179    } elsif ($runType eq 'camRun') {
     180        $stage = 'camera';
     181        $comp_name = 'exposure';
     182        $current_component = $comp_name;
     183    } elsif ($runType eq 'fakeRun') {
     184        $stage = 'fake';
     185        $comp_name = 'class_id';
     186    } elsif ($runType eq 'warpRun') {
     187        $stage = 'warp';
     188        $comp_name = 'skycell_id';
     189    } elsif ($runType eq 'diffRun') {
     190        $stage = 'diff';
     191        $comp_name = 'skycell_id';
     192    } elsif ($runType eq 'stackRun') {
     193        $stage = 'stack';
     194        $comp_name = 'skycell_id';
     195    } else {
     196        &my_die( "unexpected run type line found in $filename: $runType\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     197    }
     198
     199    my $new_workdir_value;
     200    if ($destdir eq 'none') {
     201        $new_workdir_value = "$workdir";
     202    } else {
     203        $new_workdir_value = "$workdir/$destdir";
     204    }
     205    my $component_dir;
     206    if ($current_component) {
     207        $component_dir = $components->{$current_component};
     208    }
     209    foreach $line (@lines) {
     210        my $out_line = $line;
     211
     212        my ($name, $type, $value) = split " ", $line;
     213        # we only edit complete lines
     214        if ($name and $type and $value) {
     215            my $new_value;
     216            if ($name eq $comp_name) {
     217                $current_component = $value;
     218                $component_dir = $components->{$current_component};
     219                &my_die( "$component_dir is null for $value in $filename: $runType\n",
     220                        $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$component_dir;
     221            } elsif ($name eq 'workdir') {
     222                $new_value = $new_workdir_value;
     223            } elsif ($name eq 'tess_id') {
     224                # for tess_id strip off any directories just keep the basename.
     225                # The site configuration will need to map this to a proper location
     226                # XXX: Document this
     227                $new_value = basename($value);
     228            } elsif ((($name eq 'uri') or ($name eq 'path_base')) and ($value ne 'NULL')) {
     229                &my_die( "$component_dir is null and we need it for $name",
     230                        $file_id, $PS_EXIT_PROG_ERROR) if !$component_dir;
     231
     232                $new_value = caturi($new_workdir_value, $component_dir, basename($value));
     233            }
     234
     235            if ($new_value) {
     236                $out_line = "   " . $name . "\t\t" . $type . "\t" . $new_value . "\n";
     237            }
     238        }
     239
     240        print OUT $out_line or &my_die( "failed to write to $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     241    }
     242
     243    close OUT
     244        or &my_die( "failed to close $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     245
     246    # update the fileset to allow processing of other files
     247    my $command = "$receivetool -updatefileset -fileset_id $fileset_id";
     248    $command .= " -dbinfo $dbinfo_uri";
     249    $command .= " -dbname $dbname" if defined $dbname;
     250
     251    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     252        run(command => $command, verbose => $verbose);
     253    &my_die( "Unable to update fileset $fileset_id to\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $success;
     254
     255
     256} elsif ($file =~ m|.*\.tgz$|) {        # XXX: perhaps get this off of file type ?
    126257    # Get contents of tarball
    127258    my @files = ();
     
    151282    }
    152283
     284    my $component_dir = $components->{$component};
     285    &my_die( "Unable to find component_dir for $component $filename\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $component_dir;
     286
     287    my $target_dir;
     288    if ($destdir eq 'none') {
     289        $target_dir = "$workdir";
     290    } else {
     291        $target_dir = "$workdir/$destdir";
     292    }
     293    $target_dir .= "/$component_dir";
     294
    153295    # Move files into filesystem of choice
    154296    foreach my $file ( @files ) {
    155297        my $from = "$tempdir/$file"; # Source for file
    156         my $target = "$workdir/$file"; # Target destination for file
     298        my $target = "$target_dir/$file"; # Target destination for file
    157299        my $to = $ipprc->file_create( $target ); # Target for move
    158300        system("mv $from $to") == 0 or &my_die( "Unable to move $file into workdir $workdir: $!\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     
    162304}
    163305
    164 unlink $filename or &my_die( "Unable to unlink $filename\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     306if (!$save_temps) {
     307    unlink $filename or &my_die( "Unable to unlink $filename\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     308}
    165309my $mjd_extract = DateTime->now->mjd;   # MJD of finishing extract
    166310
     
    186330# Pau.
    187331
     332sub read_dirinfo_file
     333{
     334    my $filename = shift;
     335    my $file_id = shift;
     336
     337    open INFILE, $filename or &my_die( "Can't open $filename\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     338
     339    my @lines = (<INFILE>);
     340
     341    my $dirinfo = join "", @lines;
     342
     343    close INFILE;
     344
     345    my $metadata = $mdcParser->parse($dirinfo) or
     346        &my_die("Unable to parse metadata config doc", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     347
     348    my $array = parse_md_list($metadata) or
     349        &my_die("Unable to parse metadata list", $file_id, $PS_EXIT_UNKNOWN_ERROR);
     350
     351    my $dest_hash = $array->[0];
     352
     353    my $destdir = $dest_hash->{destdir};
     354    &my_die("destdir not found in $filename", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$destdir;
     355
     356    my $components = $array->[1];
     357
     358    return ($destdir, $components, \@lines);
     359}
    188360
    189361sub my_die
  • trunk/ippScripts/scripts/receive_fileset.pl

    r24103 r24125  
    9292my $new_state;
    9393if ($numFiles > 0) {
    94     $new_state = "new";
     94    $new_state = "listed";
    9595    my $command = "receivetool -addfile"; # Command to execute
    9696    $command .= " -fileset_id $fileset_id";
  • trunk/ippTasks/dist.pro

    r24098 r24125  
    266266    book getword distToAdvance $pageName outdir -var OUTDIR
    267267    book getword distToAdvance $pageName clean -var CLEAN
     268    book getword distToAdvance $pageName dbname -var DBNAME
    268269    $EXTRA_ARGS = ""
    269270    if ("$CLEAN" == "T")
  • trunk/ippTasks/receive.pro

    r24109 r24125  
    405405    book getword receiveFile $pageName component -var COMPONENT
    406406    book getword receiveFile $pageName workdir -var WORKDIR
     407    book getword receiveFile $pageName dirinfo -var DIRINFO
    407408    book getword receiveFile $pageName dbname -var DBNAME
    408409    book getword receiveFile $pageName state -var RUN_STATE
     
    411412    stderr $LOGDIR/receive.file.log
    412413
    413     $run = receive_file.pl --file_id $FILE_ID --source $SOURCE --product $PRODUCT --fileset $FILESET --fileset_id $FILESET_ID --file $FILE --component $COMPONENT --bytes $BYTES --md5 $MD5SUM --workdir $WORKDIR
     414    $run = receive_file.pl --file_id $FILE_ID --source $SOURCE --product $PRODUCT --fileset $FILESET --fileset_id $FILESET_ID --file $FILE --component $COMPONENT --bytes $BYTES --md5 $MD5SUM --workdir $WORKDIR --dirinfo $DIRINFO
    414415    add_standard_args run
    415416
     
    512513    book getword receiveAdvance $pageName fileset_id -var FILESET_ID
    513514    book getword receiveAdvance $pageName fileset -var FILESET
    514     book getword receiveAdvance $pageName dbinfo_uri -var DBINFO_URI
     515    book getword receiveAdvance $pageName dbinfo -var DBINFO
    515516    book getword receiveAdvance $pageName status_product -var STATUS_PRODUCT
    516517    book getword receiveAdvance $pageName ds_dbname -var DS_DBNAME
     
    521522    stderr $LOGDIR/receive.advance.log
    522523
    523     $run = receive_advance.pl --fileset_id $FILESET_ID --fileset $FILESET --dbinfo_uri $DBINFO_URI --status_product $STATUS_PRODUCT --ds_dbname $DS_DBNAME --ds_dbhost $DS_DBHOST
     524    $run = receive_advance.pl --fileset_id $FILESET_ID --fileset $FILESET --dbinfo $DBINFO --status_product $STATUS_PRODUCT --ds_dbname $DS_DBNAME --ds_dbhost $DS_DBHOST
    524525    add_standard_args run
    525526
  • trunk/ippTools/share/pxadmin_create_tables.sql

    r24105 r24125  
    13301330    fileset VARCHAR(128) NOT NULL, -- fileset to receive
    13311331    state VARCHAR(64), -- new or full
    1332     dbinfo_uri VARCHAR(255), -- uri for database dump for this fileset's run
     1332    dirinfo VARCHAR(255), -- uri for directory info file for this run
     1333    dbinfo VARCHAR(255), -- uri for database dump file for this run
    13331334    fault SMALLINT NOT NULL DEFAULT 0, -- Fault code
    13341335    PRIMARY KEY(fileset_id),
  • trunk/ippTools/share/receivetool_pendingfile.sql

    r24112 r24125  
    44    product,
    55    workdir,
    6     destdir,
     6    dirinfo,
    77    fileset,
    88    fileset_id,
     
    1818    ON receiveResult.file_id = receiveFile.file_id
    1919WHERE
    20     ((receiveFileset.state = 'new') OR (receiveFileset.state = 'listed' AND receiveFile.component = 'dbinfo'))
     20    ((receiveFileset.state = 'new') OR (receiveFileset.state = 'listed' AND receiveFile.component = 'dirinfo'))
    2121    AND receiveFileset.fault = 0
    2222    AND receiveResult.file_id IS NULL
  • trunk/ippTools/share/receivetool_revert.sql

    r23885 r24125  
    44    AND receiveFile.fileset_id = receiveFileset.fileset_id
    55    AND receiveFileset.source_id = receiveSource.source_id
    6     AND fault != 0
     6    AND receiveResult.fault != 0
  • trunk/ippTools/share/receivetool_toadvance.sql

    r24106 r24125  
    22    receiveFileset.fileset_id,
    33    receiveFileset.fileset,
    4     receiveFileset.dbinfo_uri,
     4    receiveFileset.dbinfo,
    55    receiveSource.status_product,
    66    receiveSource.ds_dbname,
  • trunk/ippTools/src/disttool.c

    r24001 r24125  
    488488    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
    489489    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
    490     PXOPT_COPY_S16(config->args, where, "-fault", "distComponent.fault", "==");
     490    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    491491
    492492    // It might be useful to be able to query by the parameters of the underlying runs
  • trunk/ippTools/src/receivetool.c

    r24109 r24125  
    238238        psFree(output);
    239239
    240         if (!receiveFilesetInsert(config->dbh, 0, source_id, fileset, "reg", NULL, 0)) {
     240        if (!receiveFilesetInsert(config->dbh, 0, source_id, fileset, "reg", NULL, NULL, 0)) {
    241241            psError(PS_ERR_UNKNOWN, false, "Unable to add fileset");
    242242            psFree(source_id_str);
     
    512512    if (psListLength(where->list)) {
    513513        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    514         psStringAppend(&query, " WHERE %s", whereClause);
     514        psStringAppend(&query, " AND %s", whereClause);
    515515        psFree(whereClause);
    516516    }
     
    592592    // to chanage
    593593    PXOPT_LOOKUP_S32(fault, config->args, "-fault", false, false);
    594     PXOPT_LOOKUP_STR(dbinfo_uri, config->args, "-dbinfo_uri", false, false);
     594    PXOPT_LOOKUP_STR(destdir, config->args, "-destdir", false, false);
     595    PXOPT_LOOKUP_STR(dirinfo, config->args, "-dirinfo", false, false);
     596    PXOPT_LOOKUP_STR(dbinfo, config->args, "-dbinfo", false, false);
    595597    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
    596598
    597     if (!fault && !dbinfo_uri && !state) {
    598         psError(PS_ERR_UNKNOWN, true, "one of -fault, -dbinfo_uri, -set_state are required");
     599    if (!fault && !dirinfo &&!dbinfo && !state) {
     600        psError(PS_ERR_UNKNOWN, true, "at least one of -fault, -dirinfo, -dbinfo, -set_state are required");
    599601        return false;
    600602    }
     
    608610        sep = ",";
    609611    }
    610     if (dbinfo_uri) {
    611         psStringAppend(&query, "%s dbinfo_uri = '%s'", sep, dbinfo_uri);
     612    if (dirinfo) {
     613        psStringAppend(&query, "%s dirinfo = '%s'", sep, dirinfo);
     614        sep = ",";
     615    }
     616    if (dbinfo) {
     617        psStringAppend(&query, "%s dbinfo = '%s'", sep, dbinfo);
    612618        sep = ",";
    613619    }
  • trunk/ippTools/src/receivetoolConfig.c

    r24109 r24125  
    8585    psMetadataAddS64(updatefilesetArgs, PS_LIST_TAIL, "-fileset_id", 0, "define fileset_id (required)", 0);
    8686    psMetadataAddStr(updatefilesetArgs, PS_LIST_TAIL, "-set_state", 0, "define state", NULL);
    87     psMetadataAddStr(updatefilesetArgs, PS_LIST_TAIL, "-dbinfo_uri", 0, "define dbinfo_uri", NULL);
     87    psMetadataAddStr(updatefilesetArgs, PS_LIST_TAIL, "-destdir", 0, "define destdir", NULL);
     88    psMetadataAddStr(updatefilesetArgs, PS_LIST_TAIL, "-dirinfo", 0, "define dirinfo", NULL);
     89    psMetadataAddStr(updatefilesetArgs, PS_LIST_TAIL, "-dbinfo", 0, "define dbinfo", NULL);
    8890    psMetadataAddS32(updatefilesetArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0);
    8991
     
    107109    psMetadata *addresultArgs = psMetadataAlloc();
    108110    psMetadataAddS64(addresultArgs, PS_LIST_TAIL, "-file_id", 0, "define receive_id (required)", 0);
     111    psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "-path_base", 0, "path_base for component", NULL);
    109112    psMetadataAddF32(addresultArgs, PS_LIST_TAIL, "-dtime_copy", 0, "define time to copy", NAN);
    110113    psMetadataAddF32(addresultArgs, PS_LIST_TAIL, "-dtime_extract", 0, "define time to extract", NAN);
Note: See TracChangeset for help on using the changeset viewer.