15 import larbatch_utilities
31 if os.environ.has_key(
'SAM_EXPERIMENT'):
32 exp = os.environ[
'SAM_EXPERIMENT']
33 samweb = samweb_cli.SAMWebClient(experiment=exp)
35 md = samweb.getMetadata(filenameorid=filename)
43 if md.has_key(
'file_type'):
44 file_type = md[
'file_type']
47 raise RuntimeError(
'Missing or invalid metadata for file %s.' % filename)
52 path =
'/pnfs/dune/scratch/dunepro/dropbox/%s' % file_type
58 result =
'services.FileCatalogMetadataDUNE: {\n' 59 for key
in project.parameters:
60 result = result +
' %s: "%s"\n' % (key, project.parameters[key])
61 for key
in stage.parameters:
62 result = result +
' %s: "%s"\n' % (key, stage.parameters[key])
63 result = result +
' StageName: "%s"\n' % stage.name
64 result = result +
'}\n' 65 result = result +
'services.TFileMetadataDUNE: @local::dune_tfile_metadata\n' 75 OASIS_DIR=
"/cvmfs/dune.opensciencegrid.org/products/dune/" 77 if os.path.isfile(OASIS_DIR+
"setup_dune.sh"):
78 setup_script = OASIS_DIR+
"setup_dune.sh" 80 raise RuntimeError(
"Could not find setup script at "+OASIS_DIR)
88 dim =
'file_type %s' % project.file_type
89 dim = dim +
' and data_tier %s' % stage.data_tier
90 for key
in project.parameters:
92 dim = dim +
' and lbne_MC.name %s' % project.parameters[key]
94 dim = dim +
' and lbne_data.name %s' % project.parameters[key]
95 dim = dim +
' and version %s' % project.release_tag
96 dim = dim +
' and application %s' % stage.name
97 dim = dim +
' and availability: anylocation' 109 larbatch_utilities.test_kca()
113 if os.environ.has_key(
'X509_USER_CERT')
and os.environ.has_key(
'X509_USER_KEY'):
114 cmd=[
'voms-proxy-init',
116 '-cert', os.environ[
'X509_USER_CERT'],
117 '-key', os.environ[
'X509_USER_KEY'],
118 '-voms',
'%s:/%s/Role=%s' % (larbatch_utilities.get_experiment(), larbatch_utilities.get_experiment(), larbatch_utilities.get_role())]
120 subprocess.check_call(cmd, stdout=-1, stderr=-1)
126 cmd=[
'voms-proxy-init',
130 '%s:/%s/Role=%s' % (larbatch_utilities.get_experiment(), larbatch_utilities.get_experiment(), larbatch_utilities.get_role())]
131 jobinfo = subprocess.Popen(cmd, stdout=subprocess.PIPE,
132 stderr=subprocess.PIPE)
133 jobout, joberr = jobinfo.communicate()
135 if rc != 0
and rc!= 1:
149 return [self.
expname + elt
for elt
in (
'lbneMCGenerators',
'lbneMCName',
'lbneMCDetectorType',
'StageName')]
153 if key ==
'lbneMCDetectorType':
154 return 'lbne_MC.detector_type' 155 elif key ==
'StageName':
156 return 'lbne_MC.miscellaneous' 160 projNoun = stem.split(
"MC")
161 return prefix +
"_MC." + projNoun[1]
def dimensions(project, stage, ana=False)
def get_dropbox(filename)
def get_sam_metadata(project, stage)
def get_setup_script_path()