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.pl

    r29495 r29561  
    4242# Parse the command-line arguments
    4343my ($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);
     44my ($streaks_path_base, $inv_streaks_path_base, $run_state);
    4545my ($outroot, $recoveryroot, $magicked);
    4646my ($replace, $release);
     
    5050           'magic_ds_id=s'  => \$magic_ds_id,# Magic destreak run identifier
    5151           'camera=s'       => \$camera,     # camera for evaluating file rules
     52           'run-state=s'    => \$run_state,   # state of run (new or update)
    5253           'streaks_path_base=s'      => \$streaks_path_base,    # path_base for streaks data
    5354           'inv_streaks_path_base=s'  => \$inv_streaks_path_base, #path_base for streaks from inverse diff
     
    7778
    7879pod2usage( -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",
     80pod2usage( -msg => "Required options: --magic_ds_id --camera --run_state --streaks --stage --stage_id --component --uri --path_base --outroot --magicked",
    8081           -exitval => 3) unless
    8182    defined $magic_ds_id and
    8283    defined $camera and
     84    defined $run_state and
    8385    defined $streaks and
    8486    defined $streaks_path_base and
     
    113115    &my_die("Invalid value for stage: $stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    114116}
     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
    115121$inv_streaks_path_base = undef if defined($inv_streaks_path_base) and ($inv_streaks_path_base eq "NULL");
    116122$inv_streaks = undef if defined($inv_streaks) and ($inv_streaks eq "NULL");
     
    479485# Input result into database
    480486{
    481     my $command = "$magicdstool -adddestreakedfile";
     487    my $command = "$magicdstool";
    482488    $command   .= " -magic_ds_id $magic_ds_id";
    483489    $command   .= " -component $component";
    484490    $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    }
    488499    $command   .= " -dbname $dbname" if defined $dbname;
    489500
     
    581592    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
    582593
    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    }
    584601    $command   .= " -magic_ds_id $magic_ds_id";
    585602    $command   .= " -component $component";
Note: See TracChangeset for help on using the changeset viewer.