Changeset 38168 for trunk/ippScripts/scripts/sc_prepare_staticsky.pl
- Timestamp:
- Apr 23, 2015, 3:12:58 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/sc_prepare_staticsky.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/sc_prepare_staticsky.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 26 my $fail_state = "prep_fail";27 28 20 # Look for programs we need 29 21 my $missing_tools; … … 31 23 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 32 24 my $staticskytool= can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1); 25 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 33 26 34 27 if ($missing_tools) { … … 37 30 } 38 31 39 my ($remote_id,$sky_id,$camera,$dbname,$verbose,$path_base,$no_update );32 my ($remote_id,$sky_id,$camera,$dbname,$verbose,$path_base,$no_update,$cmd_recipe); 40 33 GetOptions( 41 34 'remote_id=s' => \$remote_id, … … 43 36 'camera|c=s' => \$camera, 44 37 'dbname|d=s' => \$dbname, 38 'recipe=s' => \$cmd_recipe, 45 39 'path_base=s' => \$path_base, 46 40 'no_update' => \$no_update, … … 49 43 50 44 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 51 pod2usage( -msg => "Required options: --remote_id --sky_id --camera --dbname --path_base ", -exitval => 3) unless45 pod2usage( -msg => "Required options: --remote_id --sky_id --camera --dbname --path_base --recipe", -exitval => 3) unless 52 46 defined($remote_id) and 53 47 defined($sky_id) and 54 48 defined($camera) and 55 49 defined($path_base) and 50 defined($cmd_recipe) and 56 51 defined($dbname); 52 53 # Hard coded values 54 # Now accessible from a recipe 55 my %remote_recipe = (); 56 { 57 my $verbose = 0; 58 my $conf_cmd = "$ppConfigDump -dump-recipe REMOTE -"; 59 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 60 run(command => $conf_cmd, verbose => $verbose); 61 unless ($success) { 62 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 63 &my_die("Unable to perform ppConfigDump: $error_code", -1, $PS_EXIT_SYS_ERROR); 64 } 65 my $mdcParser = PS::IPP::Metadata::Config->new; 66 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 67 68 my $active_recipe = ''; 69 my %recipes = (); 70 71 # print Dumper($metadata); 72 foreach my $entry (@{ $metadata }) { 73 if (${ $entry }{name} eq 'ACTIVE') { 74 $active_recipe = ${ $entry }{value}; # Not actually used 75 } 76 else { 77 if (${ $entry }{class} eq 'metadata') { # A real recipe 78 my $name = ${ $entry }{name}; 79 foreach my $tentry (@{ ${ $entry }{value} }) { 80 if (${ $tentry }{class} eq 'scalar') { # A recipe value 81 $recipes{$name}{${ $tentry }{name}} = ${ $tentry }{value}; 82 } 83 elsif (${ $tentry }{class} eq 'metadata') { # A recipe array 84 foreach my $arr_entry (@{ ${ $tentry }{value} }) { 85 push @{ $recipes{$name}{${ $tentry }{name}} }, ${ $arr_entry }{value}; 86 } 87 } 88 } 89 } 90 } 91 } 92 93 unless (exists($recipes{$cmd_recipe})) { &my_die("Cannot find recipe $cmd_recipe", -1, $PS_EXIT_CONFIG_ERROR) }; 94 # print Dumper(%recipes); 95 %remote_recipe = %{ $recipes{$cmd_recipe} }; # Select the appropriate recipe. 96 # print Dumper(\%remote_recipe); 97 } 98 99 100 my $remote_root = $remote_recipe{REMOTE_ROOT}; # Far side destination base location 101 my $remote_hostname = $remote_recipe{REMOTE_HOSTNAME}; # Name of the remote node. 102 my $threads_req = 4; # How many threads are we going to use? 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, $sky_id, $PS_EXIT_CONFIG_ERROR, $fail_state); … … 186 235 close(COMPMAP); 187 236 188 my $mk_mdc_command = "mkdir -p $remote_outdir && sc_mk_staticsky_mdc.pl -- compmap ${remote_root}/tmp/${component_map} $input_path_base_string > ${remote_outroot}.in.mdc";237 my $mk_mdc_command = "mkdir -p $remote_outdir && sc_mk_staticsky_mdc.pl --remote_root ${remote_root} --compmap ${remote_root}/tmp/${component_map} $input_path_base_string > ${remote_outroot}.in.mdc"; 189 238 my $recipe_psphot = $ipprc->reduction($reduction, 'STACKPHOT_PSPHOT'); 190 239 my $recipe_ppsub = $ipprc->reduction($reduction, 'STACKPHOT_PPSUB');
Note:
See TracChangeset
for help on using the changeset viewer.
