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