- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/receive_file.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ippScripts/scripts/receive_file.pl
r24894 r27840 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 print "Starting script $0 on $host\n\n"; 9 my $date = `date`; 10 print "\n\n"; 11 print "Starting script $0 on $host at $date\n\n"; 10 12 11 13 use DateTime; … … 124 126 print "dirinfo resolved is: $resolved\n" if $verbose; 125 127 126 open OUT, ">$resolved" 128 open OUT, ">$resolved" 127 129 or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); 128 130 print OUT @$dirinfo_lines … … 130 132 close OUT 131 133 or &my_die( "failed to close $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); 132 134 133 135 # update the fileset to allow processing of other files 134 136 my $command = "$receivetool -updatefileset -fileset_id $fileset_id"; … … 136 138 $command .= " -dbname $dbname" if defined $dbname; 137 139 138 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 139 run(command => $command, verbose => $verbose); 140 &my_die( "Unable to update fileset $fileset_id to\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $success; 140 unless ($no_update) { 141 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 142 run(command => $command, verbose => $verbose); 143 &my_die( "Unable to update fileset $fileset_id to\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $success; 144 } else { 145 print STDERR "skipping $command\n"; 146 } 141 147 142 148 } elsif ($component eq "dbinfo") { … … 156 162 &my_die( "failed to resolve $dbinfo_uri\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$resolved; 157 163 158 open OUT, ">$resolved" 164 open OUT, ">$resolved" 159 165 or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); 160 166 … … 164 170 # we are very strict about the format of the file 165 171 # 166 # First comes the data for the Run 167 # Next is the data for each component 172 # First comes the dbversion metadata 173 # Next comes the data for the Run 174 # Next is the data for each component and other associated tables 168 175 # The component_id (class_id, skycell_id) must come before any of the paths that we edit 169 176 170 # The first line tells us the run type. From this we get the stage 171 # 172 my $line = $lines[0]; 173 my ($runType, $multi) = split " ", $line; 174 &my_die( "unexpected first line found in $filename: $line\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) 175 if !$runType or ($multi ne 'MULTI'); 177 my $runType = findRunType(\@lines); 176 178 177 179 my $stage; … … 215 217 $component_dir = $components->{$current_component}; 216 218 } 217 foreach $line (@lines) {219 foreach my $line (@lines) { 218 220 my $out_line = $line; 219 221 … … 227 229 $current_component = $value; 228 230 $component_dir = $components->{$current_component}; 229 &my_die( "$component_dir is null for $value in $filename: $runType\n", 231 &my_die( "$component_dir is null for $value in $filename: $runType\n", 230 232 $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$component_dir; 231 233 } elsif ($name eq 'workdir') { … … 237 239 $new_value = basename($value); 238 240 } elsif ((($name eq 'uri') or ($name eq 'path_base')) and ($value ne 'NULL')) { 239 &my_die( "$component_dir is null and we need it for $name", 241 &my_die( "$component_dir is null and we need it for $name", 240 242 $file_id, $PS_EXIT_PROG_ERROR) if !$component_dir; 241 243 … … 492 494 return $new_path; 493 495 } 496 sub findRunType { 497 my $lines = shift; 498 my $runType; 499 my ($firstWord, $multi) = split " ", $lines->[0]; 500 &my_die( "unexpected first line found in $filename: $lines->[0]\n", 501 $file_id, $PS_EXIT_UNKNOWN_ERROR) if ($firstWord ne 'dbversion') or ($multi ne 'MULTI'); 502 503 my $dbversionDone = 0; 504 foreach my $line (@$lines) { 505 # skip blank lines 506 next if !$line or $line eq "\n"; 507 508 ($firstWord, $multi) = split " ", $line; 509 if ($dbversionDone) { 510 # The first non blank line after the dbversion tells us the run type. 511 # From this we get the stage 512 &my_die( "unexpected line found in $filename: $line\n", 513 $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$firstWord or !$multi or ($multi ne 'MULTI'); 514 515 $runType = $firstWord; 516 last; 517 } else { 518 if ($firstWord and $firstWord eq 'END') { 519 # we're past the dbversion file now 520 $dbversionDone = 1; 521 } 522 } 523 } 524 &my_die( "failed to determine run type from $filename", 525 $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$runType; 526 527 return $runType; 528 } 494 529 495 530 sub my_die
Note:
See TracChangeset
for help on using the changeset viewer.
