Changeset 29561 for trunk/ippScripts
- Timestamp:
- Oct 26, 2010, 8:39:32 AM (16 years ago)
- Location:
- trunk/ippScripts/scripts
- Files:
-
- 3 edited
-
magic_destreak.pl (modified) (6 diffs)
-
magic_destreak_cleanup.pl (modified) (3 diffs)
-
magic_destreak_revert.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/magic_destreak.pl
r29495 r29561 42 42 # Parse the command-line arguments 43 43 my ($magic_ds_id, $camera, $streaks, $inv_streaks, $exp_id, $stage, $stage_id, $component, $uri, $path_base, $cam_path_base, $cam_reduction); 44 my ($streaks_path_base, $inv_streaks_path_base );44 my ($streaks_path_base, $inv_streaks_path_base, $run_state); 45 45 my ($outroot, $recoveryroot, $magicked); 46 46 my ($replace, $release); … … 50 50 'magic_ds_id=s' => \$magic_ds_id,# Magic destreak run identifier 51 51 'camera=s' => \$camera, # camera for evaluating file rules 52 'run-state=s' => \$run_state, # state of run (new or update) 52 53 'streaks_path_base=s' => \$streaks_path_base, # path_base for streaks data 53 54 'inv_streaks_path_base=s' => \$inv_streaks_path_base, #path_base for streaks from inverse diff … … 77 78 78 79 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 79 pod2usage( -msg => "Required options: --magic_ds_id --camera -- streaks --stage --stage_id --component --uri --path_base --outroot --magicked",80 pod2usage( -msg => "Required options: --magic_ds_id --camera --run_state --streaks --stage --stage_id --component --uri --path_base --outroot --magicked", 80 81 -exitval => 3) unless 81 82 defined $magic_ds_id and 82 83 defined $camera and 84 defined $run_state and 83 85 defined $streaks and 84 86 defined $streaks_path_base and … … 113 115 &my_die("Invalid value for stage: $stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 114 116 } 117 118 &my_die("Invalid value for run-state: $run_state", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) 119 unless ($run_state eq 'new') or ($run_state eq 'update'); 120 115 121 $inv_streaks_path_base = undef if defined($inv_streaks_path_base) and ($inv_streaks_path_base eq "NULL"); 116 122 $inv_streaks = undef if defined($inv_streaks) and ($inv_streaks eq "NULL"); … … 479 485 # Input result into database 480 486 { 481 my $command = "$magicdstool -adddestreakedfile";487 my $command = "$magicdstool"; 482 488 $command .= " -magic_ds_id $magic_ds_id"; 483 489 $command .= " -component $component"; 484 490 $command .= " -setmagicked" if $replace; 485 $command .= " -backup_path_base $backup_path_base" if $backup_path_base; 486 $command .= " -recovery_path_base $recovery_path_base" if $recovery_path_base; 487 $command .= " $statsFlags" if $statsFlags; 491 if ($run_state eq 'new') { 492 $command .= " -adddestreakedfile"; 493 $command .= " -backup_path_base $backup_path_base" if $backup_path_base; 494 $command .= " -recovery_path_base $recovery_path_base" if $recovery_path_base; 495 $command .= " $statsFlags" if $statsFlags; 496 } else { 497 $command .= " -tofullfile"; 498 } 488 499 $command .= " -dbname $dbname" if defined $dbname; 489 500 … … 581 592 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; 582 593 583 my $command = "$magicdstool -adddestreakedfile"; 594 my $command = "$magicdstool"; 595 596 if ($run_state eq 'new') { 597 $command .= " -adddestreakedfile"; 598 } else { 599 $command .= " -updatedestreakedfile"; 600 } 584 601 $command .= " -magic_ds_id $magic_ds_id"; 585 602 $command .= " -component $component"; -
trunk/ippScripts/scripts/magic_destreak_cleanup.pl
r29097 r29561 89 89 $q1 .= " WHERE magic_ds_id = $magic_ds_id"; 90 90 91 my $q2 = "SELECT * from magicDSFile wheremagic_ds_id = $magic_ds_id";91 my $q2 = "SELECT * from magicDSFile WHERE (data_state = 'full' OR data_state = 'update') AND magic_ds_id = $magic_ds_id"; 92 92 93 93 my $stmt1 = $dbh->prepare($q1); … … 245 245 delete_files($rimage, $rmask, $rweight, $rsources, undef, $bimage, $bmask, $bweight, $bsources); 246 246 } 247 } 248 249 $dbh = DBI->connect($dsn, $dbuser, $dbpassword) or die "Cannot connect to mysql server\n"; 250 251 if (!$no_update and ($num_components > 0)) { 252 my $result = $dbh->do("DELETE FROM magicDSFile WHERE magic_ds_id = ?", undef, $magic_ds_id); 253 # my $result = $stmt3->do($magic_ds_id); 254 my_die("attempt to delete magicDSFiles failed", $magic_ds_id, $PS_EXIT_UNKNOWN_ERROR) if $result eq "0E0"; 255 } 256 257 if (!$no_update) { 258 my $result = $dbh->do("UPDATE magicDSRun SET state = 'cleaned' WHERE magic_ds_id = ?", undef, $magic_ds_id); 259 my_die("attempt to update magicDSRun.state failed", $magic_ds_id, $PS_EXIT_UNKNOWN_ERROR) if $result eq "0E0"; 260 } else { 261 print STDERR "skipping update of magicDSRun\n"; 262 } 263 247 my $command = "$magicdstool -tocleanedfile -magic_ds_id $magic_ds_id -component $component"; 248 $command .= " -dbname $dbname" if defined $dbname; 249 250 unless ($no_update) { 251 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 252 run(command => $command, verbose => $verbose); 253 unless ($success) { 254 carp("failed to update database for $magic_ds_id"); 255 } 256 } else { 257 print "Skipping command: $command\n"; 258 } 259 } 264 260 265 261 ### Pau. … … 292 288 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; 293 289 294 my $command = "$magicdstool -updaterun -set_state failed_cleanup";290 my $command = "$magicdstool -updaterun -set_state error_cleaned"; 295 291 $command .= " -magic_ds_id $magic_ds_id"; 296 292 $command .= " -dbname $dbname" if defined $dbname; -
trunk/ippScripts/scripts/magic_destreak_revert.pl
r27946 r29561 38 38 39 39 # Parse the command-line arguments 40 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base, $cam_reduction, $magicked );40 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base, $cam_reduction, $magicked, $run_state); 41 41 my ($outroot, $recoveryroot, $replace, $release, $bytes, $md5sum); 42 42 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); … … 47 47 'stage=s' => \$stage, # raw, chip, warp, or diff 48 48 'stage_id=s' => \$stage_id, # exp_id, chip_id, warp_id, or diff_id 49 'run-state=s' => \$run_state, # current state of run 49 50 'component=s' => \$component, # the class_id or skycell_id 50 51 'path_base=s' => \$path_base, # path_base of the input … … 74 75 defined $path_base and 75 76 defined $magicked and 77 defined $run_state and 76 78 defined $outroot; 77 79 … … 248 250 { 249 251 my $command = "$magicdstool -revertdestreakedfile -i_am_sure"; 252 $command .= " -state $run_state"; 250 253 $command .= " -magic_ds_id $magic_ds_id"; 251 254 $command .= " -component $component";
Note:
See TracChangeset
for help on using the changeset viewer.
