IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2010, 8:39:32 AM (16 years ago)
Author:
bills
Message:

Change the destreak cleanup to preserve the rows in the magicDSFile table

File:
1 edited

Legend:

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

    r29097 r29561  
    8989$q1 .= " WHERE magic_ds_id = $magic_ds_id";
    9090
    91 my $q2 = "SELECT * from magicDSFile where magic_ds_id = $magic_ds_id";
     91my $q2 = "SELECT * from magicDSFile WHERE (data_state = 'full' OR data_state = 'update') AND magic_ds_id = $magic_ds_id";
    9292
    9393my $stmt1 = $dbh->prepare($q1);
     
    245245            delete_files($rimage, $rmask, $rweight, $rsources, undef, $bimage, $bmask, $bweight, $bsources);
    246246        }
    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}
    264260
    265261### Pau.
     
    292288    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
    293289
    294     my $command = "$magicdstool -updaterun -set_state failed_cleanup";
     290    my $command = "$magicdstool -updaterun -set_state error_cleaned";
    295291    $command   .= " -magic_ds_id $magic_ds_id";
    296292    $command   .= " -dbname $dbname" if defined $dbname;
Note: See TracChangeset for help on using the changeset viewer.