Changeset 38168 for trunk/ippScripts/scripts/sc_prepare_camera.pl
- Timestamp:
- Apr 23, 2015, 3:12:58 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/sc_prepare_camera.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/sc_prepare_camera.pl
r38105 r38168 19 19 use Pod::Usage qw( pod2usage ); 20 20 21 # Hard coded values22 # my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location23 my $remote_root = '/scratch3/watersc1/'; # Far side destination base location24 my $remote_hostname = "LANL/Mustang"; # Name of the remote node.25 my $threads_req = 0; # How many threads are we going to use?26 27 my $fail_state = "prep_fail";28 29 21 # Look for programs we need 30 22 my $missing_tools; … … 32 24 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 33 25 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 26 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 34 27 35 28 if ($missing_tools) { … … 38 31 } 39 32 40 my ($remote_id,$cam_id,$camera,$dbname,$verbose,$path_base,$no_update );33 my ($remote_id,$cam_id,$camera,$dbname,$verbose,$path_base,$no_update,$cmd_recipe); 41 34 GetOptions( 42 35 'remote_id=s' => \$remote_id, … … 44 37 'camera|c=s' => \$camera, 45 38 'dbname|d=s' => \$dbname, 39 'recipe=s' => \$cmd_recipe, 46 40 'path_base=s' => \$path_base, 47 41 'no_update' => \$no_update, … … 50 44 51 45 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 52 pod2usage( -msg => "Required options: --remote_id --cam_id --camera --dbname --path_base ", -exitval => 3) unless46 pod2usage( -msg => "Required options: --remote_id --cam_id --camera --dbname --path_base --recipe", -exitval => 3) unless 53 47 defined($remote_id) and 54 48 defined($cam_id) and 55 49 defined($camera) and 56 50 defined($path_base) and 51 defined($cmd_recipe) and 57 52 defined($dbname); 53 54 55 # Hard coded values 56 # Now accessible from a recipe 57 my %remote_recipe = (); 58 { 59 my $verbose = 0; 60 my $conf_cmd = "$ppConfigDump -dump-recipe REMOTE -"; 61 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 62 run(command => $conf_cmd, verbose => $verbose); 63 unless ($success) { 64 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 65 &my_die("Unable to perform ppConfigDump: $error_code", -1, $PS_EXIT_SYS_ERROR); 66 } 67 my $mdcParser = PS::IPP::Metadata::Config->new; 68 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 69 70 my $active_recipe = ''; 71 my %recipes = (); 72 73 # print Dumper($metadata); 74 foreach my $entry (@{ $metadata }) { 75 if (${ $entry }{name} eq 'ACTIVE') { 76 $active_recipe = ${ $entry }{value}; # Not actually used 77 } 78 else { 79 if (${ $entry }{class} eq 'metadata') { # A real recipe 80 my $name = ${ $entry }{name}; 81 foreach my $tentry (@{ ${ $entry }{value} }) { 82 if (${ $tentry }{class} eq 'scalar') { # A recipe value 83 $recipes{$name}{${ $tentry }{name}} = ${ $tentry }{value}; 84 } 85 elsif (${ $tentry }{class} eq 'metadata') { # A recipe array 86 foreach my $arr_entry (@{ ${ $tentry }{value} }) { 87 push @{ $recipes{$name}{${ $tentry }{name}} }, ${ $arr_entry }{value}; 88 } 89 } 90 } 91 } 92 } 93 } 94 95 unless (exists($recipes{$cmd_recipe})) { &my_die("Cannot find recipe $cmd_recipe", -1, $PS_EXIT_CONFIG_ERROR) }; 96 # print Dumper(%recipes); 97 %remote_recipe = %{ $recipes{$cmd_recipe} }; # Select the appropriate recipe. 98 # print Dumper(\%remote_recipe); 99 } 100 101 102 # my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location 103 my $remote_root = $remote_recipe{REMOTE_ROOT}; 104 my $remote_hostname = $remote_recipe{REMOTE_HOSTNAME}; # Name of the remote node. 105 my $threads_req = 0; # How many threads are we going to use? 106 107 my $fail_state = "prep_fail"; 108 58 109 59 110 my $ipprc = PS::IPP::Config->new( $camera ) or &my_die( "Unable to set up", $remote_id, $cam_id, $PS_EXIT_CONFIG_ERROR, $fail_state);
Note:
See TracChangeset
for help on using the changeset viewer.
