bulk_submit.pl
Go to the documentation of this file.
1 #-------------------------------------------------------------------------------------------
2 # A script to bulk submit other scripts...
3 #
4 # Syntax:
5 # % perl bulk-submit.pl <options>
6 #
7 # Options:
8 # --cmd : Actual script to execute *including* all fixed arguments
9 # --arg : "Running" argument
10 # --min : "Running" argument : minimum value
11 # --max : "Running" argument : maximum value
12 #
13 # Example 1:
14 # To submit 100 nd280 MC jobs (processing flux files 100-200) using GENIE v2.6.0, type:
15 # % perl bulk-submit.pl \
16 # --cmd 'perl submit-evg_nd280.pl --version v2.6.0' \
17 # --arg '--flux-run' \
18 # --min 100 \
19 # --max 200
20 # See submit-evg_nd280.pl for more nd280 MC job options.
21 #
22 # Example 2:
23 # To submit 100 standard `\nu_e signal' SuperK MC jobs using GENIE v2.6.0, type:
24 # % perl bulk-submit.pl \
25 # --cmd 'perl submit-evg_sk_fhst.pl --neutrino nuesig --version v2.6.0' \
26 # --arg '--run' \
27 # --min 1 \
28 # --max 100
29 # See submit-evg_sk_fhst.pl for more SuperK MC job options.
30 #
31 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
32 # STFC, Rutherford Appleton Lab
33 #-------------------------------------------------------------------------------------------
34 
35 #!/usr/bin/perl
36 
37 $syntax = "%perl bulk-submit.pl --cmd <command> --arg <variable arg> --min <min> --max <max>";
38 
39 $iarg=0;
40 foreach (@ARGV) {
41  if($_ eq '--cmd') { $cmd = $ARGV[$iarg+1]; }
42  if($_ eq '--arg') { $arg = $ARGV[$iarg+1]; }
43  if($_ eq '--min') { $min = $ARGV[$iarg+1]; }
44  if($_ eq '--max') { $max = $ARGV[$iarg+1]; }
45  $iarg++;
46 }
47 die("** Syntax: $syntax \n") unless defined $cmd;
48 die("** Syntax: $syntax \n") unless defined $arg;
49 die("** Syntax: $syntax \n") unless defined $min;
50 die("** Syntax: $syntax \n") unless defined $max;
51 
52 $i=0;
53 for($i=$min; $i<=$max; $i++) {
54  $full_cmd = "$cmd $arg $i";
55  print "Running: $full_cmd \n";
56  `$full_cmd`;
57 }