Functions | Variables
ProcessPPFX Namespace Reference

Functions

def main ()
 
def get_options ()
 
def make_tarfile (output_filename, source_dir)
 

Variables

string CACHE_PNFS_AREA = "/pnfs/nova/scratch/users/{USER}/grid_cache/"
 
 USER
 
 PWD = os.getenv("PWD")
 
int N_JOBS = 1
 Job Defaults. More...
 
string OUTDIR = "/pnfs/nova/persistent/users/{USER}/ppfx/test/"
 
string INPUT_OPTIONS = "scripts/inputs_default.xml"
 
string IDET = "3"
 
string INDIR = "/pnfs/nova/data/flux/g4numi/v6r1"
 
string TARFILE_NAME = "local_install.tar.gz"
 
string BEAMCONFIG = "me000z200i"
 

Function Documentation

def ProcessPPFX.get_options ( )

Definition at line 74 of file ProcessPPFX.py.

75  parser = optparse.OptionParser(usage="usage: %prog [options]")
76  grid_group = optparse.OptionGroup(parser, "Grid Options")
77 
78  grid_group.add_option("--outdir",
79  default = OUTDIR,
80  help = "Output flux histograms location. Default = %default.")
81 
82  grid_group.add_option("--n_jobs",
83  default = N_JOBS,
84  help = "Number of g4numi jobs. Default = %default.")
85 
86  beam_group = optparse.OptionGroup(parser, "Beam Options")
87 
88  beam_group.add_option('--beamconfig', default = BEAMCONFIG,
89  help="Select the neutrino beam: me000z200i, me000z-200i me000z000i.Default = %default.")
90 
91  run_group = optparse.OptionGroup(parser, "Run Options")
92 
93  run_group.add_option("--input_options",
94  default = INPUT_OPTIONS,
95  help = "PPFX input: number of universes, MIPP on/off, etc. Default = %default.")
96 
97  run_group.add_option("--idet",
98  default = IDET,
99  help = "Index of the detector to be used (see at location.name in dkmetaTree->Show(0)). Default = %default.")
100 
101  parser.add_option_group(grid_group)
102  parser.add_option_group(beam_group)
103  parser.add_option_group(run_group)
104 
105  options, remainder = parser.parse_args()
106 
107  return options
108 
def get_options()
Definition: ProcessPPFX.py:74
def ProcessPPFX.main ( void  )

Definition at line 26 of file ProcessPPFX.py.

26 def main():
27  options = get_options()
28 
29  cache_folder = CACHE_PNFS_AREA + str(random.randint(10000,99999)) + "/"
30  os.makedirs(cache_folder)
31 
32  os.makedirs(options.outdir)
33 
34  print "\nTarring up local area..."
35  make_tarfile(TARFILE_NAME, ".")
36 
37  shutil.move(TARFILE_NAME, cache_folder)
38  shutil.copy("ppfx_job.sh", cache_folder)
39 
40  print "\nTarball of local area:", cache_folder + TARFILE_NAME
41 
42  logfile = options.outdir + "/ppfx_{BEAMCONFIG}_\$PROCESS.log".format(BEAMCONFIG = options.beamconfig)
43 
44  print "\nOutput logfile(s):",logfile
45 
46  submit_command = ("jobsub_submit {GRID} {MEMORY} -N {NJOBS} -dPPFX {OUTDIR} "
47  "-G nova "
48  "-e BEAMCONFIG={BEAMCONFIG} "
49  "-e IN_DIR={IN_DIR} "
50  "-e INPUT_OPTIONS={INPUT_OPTIONS} "
51  "-e IDET={IDET} "
52  "-f {TARFILE} "
53  "-L {LOGFILE} "
54  "file://{CACHE}/ppfx_job.sh".format(
55  GRID = ("--OS=SL6 -g "
56  "--resource-provides=usage_model=DEDICATED,OPPORTUNISTIC "
57  "--role=Analysis "),
58  MEMORY = "--memory 200MB ",
59  NJOBS = options.n_jobs,
60  OUTDIR = options.outdir,
61  BEAMCONFIG = options.beamconfig,
62  IN_DIR = INDIR,
63  INPUT_OPTIONS = options.input_options,
64  IDET = options.idet,
65  TARFILE = cache_folder + TARFILE_NAME,
66  LOGFILE = logfile,
67  CACHE = cache_folder)
68  )
69 
70  #Ship it
71  print "\nSubmitting to grid:\n"+submit_command+"\n"
72  status = subprocess.call(submit_command, shell=True)
73 
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
def main()
Definition: ProcessPPFX.py:26
def make_tarfile(output_filename, source_dir)
Definition: ProcessPPFX.py:109
def get_options()
Definition: ProcessPPFX.py:74
static QCString str
def ProcessPPFX.make_tarfile (   output_filename,
  source_dir 
)

Definition at line 109 of file ProcessPPFX.py.

109 def make_tarfile(output_filename, source_dir):
110  tar = tarfile.open(output_filename, "w:gz")
111  for i in os.listdir(source_dir):
112  tar.add(i)
113  tar.close()
114 
def make_tarfile(output_filename, source_dir)
Definition: ProcessPPFX.py:109

Variable Documentation

string ProcessPPFX.BEAMCONFIG = "me000z200i"

Definition at line 22 of file ProcessPPFX.py.

string ProcessPPFX.CACHE_PNFS_AREA = "/pnfs/nova/scratch/users/{USER}/grid_cache/"

Definition at line 9 of file ProcessPPFX.py.

string ProcessPPFX.IDET = "3"

Definition at line 19 of file ProcessPPFX.py.

string ProcessPPFX.INDIR = "/pnfs/nova/data/flux/g4numi/v6r1"

Definition at line 20 of file ProcessPPFX.py.

string ProcessPPFX.INPUT_OPTIONS = "scripts/inputs_default.xml"

Definition at line 18 of file ProcessPPFX.py.

int ProcessPPFX.N_JOBS = 1

Job Defaults.

Definition at line 15 of file ProcessPPFX.py.

string ProcessPPFX.OUTDIR = "/pnfs/nova/persistent/users/{USER}/ppfx/test/"

Definition at line 16 of file ProcessPPFX.py.

ProcessPPFX.PWD = os.getenv("PWD")

Definition at line 10 of file ProcessPPFX.py.

string ProcessPPFX.TARFILE_NAME = "local_install.tar.gz"

Definition at line 21 of file ProcessPPFX.py.

ProcessPPFX.USER

Definition at line 9 of file ProcessPPFX.py.