Changeset 38168 for trunk/ippScripts/scripts/sc_prepare_stack.pl
- Timestamp:
- Apr 23, 2015, 3:12:58 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/sc_prepare_stack.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/sc_prepare_stack.pl
r38137 r38168 18 18 use Pod::Usage qw( pod2usage ); 19 19 20 # Hard coded values21 # my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location22 my $remote_root = '/scratch3/watersc1/'; # Far side destination base location23 my $remote_hostname = "LANL/Mustang"; # Name of the remote node.24 my $threads_req = 4; # How many threads are we going to use?25 my $have_warps = 0; # Do we have a copy of the warp if we don't find one there?26 27 my $fail_state = "prep_fail";28 29 20 # Look for programs we need 30 21 my $missing_tools; 31 22 my $remotetool = can_run('remotetool') or (warn "Can't find remotetool" and $missing_tools = 1); 32 23 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 24 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 33 25 34 26 if ($missing_tools) { … … 37 29 } 38 30 39 my ($remote_id,$stack_id,$camera,$dbname,$verbose,$path_base,$no_update );31 my ($remote_id,$stack_id,$camera,$dbname,$verbose,$path_base,$no_update,$cmd_recipe); 40 32 GetOptions( 41 33 'remote_id=s' => \$remote_id, … … 43 35 'camera|c=s' => \$camera, 44 36 'dbname|d=s' => \$dbname, 37 'recipe=s' => \$cmd_recipe, 45 38 'path_base=s' => \$path_base, 46 39 'no_update' => \$no_update, … … 49 42 50 43 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 51 pod2usage( -msg => "Required options: --remote_id --stack_id --camera --dbname --path_base ", -exitval => 3) unless44 pod2usage( -msg => "Required options: --remote_id --stack_id --camera --dbname --path_base --recipe", -exitval => 3) unless 52 45 defined($remote_id) and 53 46 defined($stack_id) and 54 47 defined($camera) and 55 defined($path_base) and 48 defined($path_base) and 49 defined($cmd_recipe) and 56 50 defined($dbname); 51 52 # Hard coded values 53 # Now accessible from a recipe 54 my %remote_recipe = (); 55 { 56 my $verbose = 0; 57 my $conf_cmd = "$ppConfigDump -dump-recipe REMOTE -"; 58 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 59 run(command => $conf_cmd, verbose => $verbose); 60 unless ($success) { 61 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 62 &my_die("Unable to perform ppConfigDump: $error_code", -1, $PS_EXIT_SYS_ERROR); 63 } 64 my $mdcParser = PS::IPP::Metadata::Config->new; 65 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 66 67 my $active_recipe = ''; 68 my %recipes = (); 69 70 # print Dumper($metadata); 71 foreach my $entry (@{ $metadata }) { 72 if (${ $entry }{name} eq 'ACTIVE') { 73 $active_recipe = ${ $entry }{value}; # Not actually used 74 } 75 else { 76 if (${ $entry }{class} eq 'metadata') { # A real recipe 77 my $name = ${ $entry }{name}; 78 foreach my $tentry (@{ ${ $entry }{value} }) { 79 if (${ $tentry }{class} eq 'scalar') { # A recipe value 80 $recipes{$name}{${ $tentry }{name}} = ${ $tentry }{value}; 81 } 82 elsif (${ $tentry }{class} eq 'metadata') { # A recipe array 83 foreach my $arr_entry (@{ ${ $tentry }{value} }) { 84 push @{ $recipes{$name}{${ $tentry }{name}} }, ${ $arr_entry }{value}; 85 } 86 } 87 } 88 } 89 } 90 } 91 92 unless (exists($recipes{$cmd_recipe})) { &my_die("Cannot find recipe $cmd_recipe", -1, $PS_EXIT_CONFIG_ERROR) }; 93 # print Dumper(%recipes); 94 %remote_recipe = %{ $recipes{$cmd_recipe} }; # Select the appropriate recipe. 95 # print Dumper(\%remote_recipe); 96 } 97 98 # my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location 99 my $remote_root = $remote_recipe{REMOTE_ROOT}; # Far side destination base location 100 my $remote_hostname = $remote_recipe{REMOTE_HOSTNAME}; # Name of the remote node. 101 my $threads_req = 4; # How many threads are we going to use? 102 my $have_warps = $remote_recipe{TRANSFER_WARP_IMAGES}; # Do we have a copy of the warp if we don't find one there? 103 104 my $fail_state = "prep_fail"; 105 57 106 58 107 my $ipprc = PS::IPP::Config->new( $camera ) or &my_die( "Unable to set up", $remote_id, $stack_id, $PS_EXIT_CONFIG_ERROR, $fail_state); … … 158 207 # ${remote_root}/tmp/${ipp_disk} 159 208 160 if ($have_warps != 0) { # Check to see if we have a copy, because if we do, then we can send it over if it's missing.209 if ($have_warps) { # Check to see if we have a copy, because if we do, then we can send it over if it's missing. 161 210 (undef,$remote_file) = &uri_to_outputs($warp_path_base . ".fits"); 162 211 ($ipp_disk,undef) = &uri_convert($warp_path_base . ".fits"); … … 201 250 close(COMPMAP); 202 251 203 my $mk_mdc_command = "mkdir -p $remote_outdir && sc_mk_stack_mdc.pl -- compmap ${remote_root}/tmp/${component_map} $warp_path_base_string > ${remote_outroot}.in.mdc";252 my $mk_mdc_command = "mkdir -p $remote_outdir && sc_mk_stack_mdc.pl --remote_root ${remote_root} --compmap ${remote_root}/tmp/${component_map} $warp_path_base_string > ${remote_outroot}.in.mdc"; 204 253 my $recipe_ppstack = $ipprc->reduction($reduction, 'STACK_PPSTACK'); # Recipe to use 205 254 my $ppstack_command = " ppStack -input ${remote_outroot}.in.mdc ";
Note:
See TracChangeset
for help on using the changeset viewer.
