Changeset 38168 for trunk/ippScripts/scripts/sc_prepare_run.pl
- Timestamp:
- Apr 23, 2015, 3:12:58 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/sc_prepare_run.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/sc_prepare_run.pl
r38145 r38168 21 21 use Pod::Usage qw( pod2usage ); 22 22 23 #use Data::Dumper; 24 # Look for programs we need 25 my $missing_tools; 26 my $remotetool = can_run('remotetool') or (warn "Can't find remotetool" and $missing_tools = 1); 27 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 28 29 if ($missing_tools) { 30 warn("Can't find required tools."); 31 exit($PS_EXIT_CONFIG_ERROR); 32 } 33 34 # Options 35 my ($remote_id,$cmd_recipe,$stage,$camera,$path_base,$dbname,$verbose,$no_update); 36 GetOptions( 37 'remote_id=s' => \$remote_id, 38 'recipe=s' => \$cmd_recipe, 39 'stage=s' => \$stage, 40 'camera|c=s' => \$camera, 41 'path_base=s' => \$path_base, 42 'dbname|d=s' => \$dbname, 43 'verbose' => \$verbose, 44 'no_update' => \$no_update, 45 ) or pod2usage( 2 ); 46 47 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 48 pod2usage( -msg => "Required options: --remote_id --stage --camera --dbname --path_base --recipe", -exitval => 3) unless 49 defined($remote_id) and 50 defined($stage) and 51 defined($camera) and 52 defined($path_base) and 53 defined($cmd_recipe) and 54 defined($dbname) and 55 defined($dbname); 56 23 57 # Hard coded values 24 # my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location 25 my $remote_root = '/scratch3/watersc1/'; 58 # Now accessible from a recipe 59 my %remote_recipe = (); 60 { 61 my $verbose = 0; 62 my $conf_cmd = "$ppConfigDump -dump-recipe REMOTE -"; 63 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 64 run(command => $conf_cmd, verbose => $verbose); 65 unless ($success) { 66 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 67 &my_die("Unable to perform ppConfigDump: $error_code", -1, $PS_EXIT_SYS_ERROR); 68 } 69 my $mdcParser = PS::IPP::Metadata::Config->new; 70 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 71 72 my $active_recipe = ''; 73 my %recipes = (); 74 75 # print Dumper($metadata); 76 foreach my $entry (@{ $metadata }) { 77 if (${ $entry }{name} eq 'ACTIVE') { 78 $active_recipe = ${ $entry }{value}; # Not actually used 79 } 80 else { 81 if (${ $entry }{class} eq 'metadata') { # A real recipe 82 my $name = ${ $entry }{name}; 83 foreach my $tentry (@{ ${ $entry }{value} }) { 84 if (${ $tentry }{class} eq 'scalar') { # A recipe value 85 $recipes{$name}{${ $tentry }{name}} = ${ $tentry }{value}; 86 } 87 elsif (${ $tentry }{class} eq 'metadata') { # A recipe array 88 foreach my $arr_entry (@{ ${ $tentry }{value} }) { 89 push @{ $recipes{$name}{${ $tentry }{name}} }, ${ $arr_entry }{value}; 90 } 91 } 92 } 93 } 94 } 95 } 96 97 unless (exists($recipes{$cmd_recipe})) { &my_die("Cannot find recipe $cmd_recipe", -1, $PS_EXIT_CONFIG_ERROR) }; 98 # print Dumper(%recipes); 99 %remote_recipe = %{ $recipes{$cmd_recipe} }; # Select the appropriate recipe. 100 # print Dumper(\%remote_recipe); 101 } 102 103 my $remote_root = $remote_recipe{REMOTE_ROOT}; 26 104 my $remote_raw = "${remote_root}/tmp/"; # Directory to find raw data in. 27 105 … … 51 129 $job_subscription{"ff"} = 1; 52 130 53 my $proc_per_node = 24;# processors per node54 my $min_nodes = 1;# smallest allocation to ask for55 my $max_nodes = 1000;# largest allocation to ask for56 my $min_time = 1;# shortest allocation to ask for57 my $max_time = 8;# longest allocation to ask for131 my $proc_per_node = $remote_recipe{PROC_PER_NODE}; # processors per node 132 my $min_nodes = $remote_recipe{MIN_NODES}; # smallest allocation to ask for 133 my $max_nodes = $remote_recipe{MAX_NODES}; # largest allocation to ask for 134 my $min_time = $remote_recipe{MIN_TIME}; # shortest allocation to ask for 135 my $max_time = $remote_recipe{MAX_TIME}; # longest allocation to ask for 58 136 59 137 # We need to ensure we only ever try to transfer a file once. 60 138 my %file_filter = (); 61 139 62 # Look for programs we need 63 my $missing_tools; 64 my $remotetool = can_run('remotetool') or (warn "Can't find remotetool" and $missing_tools = 1); 65 66 if ($missing_tools) { 67 warn("Can't find required tools."); 68 exit($PS_EXIT_CONFIG_ERROR); 69 } 70 71 # Options 72 my ($remote_id,$stage,$camera,$path_base,$dbname,$verbose,$no_update); 73 GetOptions( 74 'remote_id=s' => \$remote_id, 75 'stage=s' => \$stage, 76 'camera|c=s' => \$camera, 77 'path_base=s' => \$path_base, 78 'dbname|d=s' => \$dbname, 79 'verbose' => \$verbose, 80 'no_update' => \$no_update, 81 ) or pod2usage( 2 ); 82 83 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 84 pod2usage( -msg => "Required options: --remote_id --stage --camera --dbname --path_base", -exitval => 3) unless 85 defined($remote_id) and 86 defined($stage) and 87 defined($camera) and 88 defined($path_base) and 89 defined($dbname); 90 140 141 # Finish setup 91 142 my $ipprc = PS::IPP::Config->new( $camera ) or &my_die( "Unable to set up", $remote_id, $PS_EXIT_CONFIG_ERROR, $fail_state); 92 143
Note:
See TracChangeset
for help on using the changeset viewer.
