IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 10, 2013, 12:56:40 PM (13 years ago)
Author:
watersc1
Message:

Updated script to launch camRun updates, and use new config files for chip stage updates.

File:
1 edited

Legend:

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

    r34635 r35792  
    3434my $qstack_threshold     = 0.05; # Only make a quickstack if more than 5% of the exposures require it.
    3535my $minimum_stack_inputs = 4;    # We can avoid magicking stack inputs if we have more than this number.
     36my $do_updates_pv2       = 1;    # Do updates using the calls needed for PV2. 
    3637
    3738GetOptions(
     
    231232    my $chip = ${ $chips }[0];
    232233    my $chip_magicDS_id = 0;
     234    my $chip_cam_id = 0;
    233235    if ($chip) {
    234236        $chip_magicDS_id = $chip->{magic_ds_id};
     237        $chip_cam_id     = $chip->{cam_id};
    235238    }
    236239    if ($chip_magicDS_id == 0) {
    237240#       return(&remake_this_exposure($exposure));
     241    }
     242
     243    my $do_cam_update = 0;
     244    if ($chip_cam_id) {      # If there is no cam_id, we can't look for it.
     245        my $camtool_info_cmd = "camtool -processedexp -cam_id $chip_cam_id ";
     246        $camtool_info_cmd   .= " -dbname $dbname " if defined $dbname;
     247        ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     248            run(command => $camtool_info_cmd, verbose => $verbose);
     249        unless ($success) {
     250            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     251            &my_die("Unable to perform camtool -listrun: $error_code", $exposure->{exp_id}, $data_group);
     252        }
     253        my $cams = $mdcParser->parse_list(join "", @$stdout_buf) or
     254            &my_die("Unable to parse metadata from camtool -listrun", $exposure->{exp_id}, $data_group);
     255        my $cam = ${ $cams }[0];
     256        # There can be only one.
     257        if ($cam) {
     258            if ($cam->{label} ne $label) {
     259                $do_cam_update = 1;
     260            }
     261        }
    238262    }
    239263
     
    272296    }
    273297
     298#
     299# This is where we launch updates.
     300#
    274301   
    275302    my $chiptool_update_cmd = "chiptool -setimfiletoupdate -chip_id $exposure->{chip_id} -set_label $label";
     303    if ($do_updates_pv2) {
     304        $chiptool_update_cmd   .= " -set_update_mode 1 "; # Use the current config information
     305    }
    276306    $chiptool_update_cmd   .= " -dbname $dbname " if defined $dbname;
     307    my $camtool_update_cmd .= "camtool -updaterun -set_state update -cam_id $chip_cam_id -set_label $label";
     308    $camtool_update_cmd    .= " -dbname $dbname " if defined $dbname;
    277309    my $magicDS_update_cmd  = "magicdstool -setfiletoupdate -magic_ds_id $chip_magicDS_id -set_label $label";
    278310    $magicDS_update_cmd    .= " -dbname $dbname " if defined $dbname;
     
    289321                &my_die("Unable to perform chiptool -setimfiletoupdate: $error_code", $exposure->{exp_id}, $data_group);
    290322            }
    291 
     323            if ($do_updates_pv2) {     # Are we updating camera stages for PV2?
     324                if ($do_cam_update) {  # Is this camRun still set to the old label?
     325                    ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     326                        run(command => $camtool_update_cmd, verbose => $verbose);
     327                    unless ($success) {
     328                        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     329                        &my_die("Unable to perform camtool -updaterun: $error_code", $exposure->{exp_id}, $data_group);
     330                    }
     331                }
     332            }
    292333#             if ($chip_magicDS_id != 0) {   
    293334#               ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Note: See TracChangeset for help on using the changeset viewer.