CMS 3D CMS Logo

Functions | Variables
createPayload Namespace Reference

Functions

def copyToWorkflowdir (path)
 
def mkWorkflowdir ()
 

Variables

 allbeam_file
 
 allfile
 
 alllines
 
 alumi
 
 alumis
 
 args
 
 arun
 
 atime
 
 beam_file
 WRITE sqlite file. More...
 
 beam_file_tmp
 
 block
 
 checkType
 
 destDB
 
 dfile
 
 dropbox
 
 final_sqlite_file_name
 
 iov_comment
 
 iov_since
 
 iov_since_first
 
 iov_till
 
 IOVbase
 
 keys
 
 line
 
 listoffiles
 
 mergedfile
 
 metadata_file
 
 newtmpfile
 
 nfile
 
 npayloads
 
 option
 3 More...
 
 optionstring
 
 readdb_template
 
 skip
 
 sortedlist
 
 sqlite_file
 READ and check sqlite file. More...
 
 sqlite_file_name
 
 suffix
 
 tagname
 
 tagType
 
 timetype
 
 tmp_datafilename
 
 tmp_lumi_since
 
 tmp_lumi_till
 
 tmp_run
 
 tmpfile
 
 total_files
 
 uuid
 
 workflowdir
 
 workflowdirArchive
 
 workflowdirLastPayloads
 
 workflowdirTmp
 
 writedb_template
 

Function Documentation

def createPayload.copyToWorkflowdir (   path)

Definition at line 51 of file createPayload.py.

References cmsRelvalreport.exit, spr.find(), split, and harvestTrackValidationPlots.str.

52  global workflowdirArchive
53  lsCommand = ''
54  cpCommand = ''
55  listoffiles = []
56  tmplistoffiles = []
57  if path.find('castor') != -1:
58  print "Getting files from castor ..."
59  lsCommand = 'ns'
60  cpCommand = 'rf'
61  elif not os.path.exists(path):
62  exit("ERROR: File or directory " + path + " doesn't exist")
63 
64  if path[len(path)-4:len(path)] != '.txt':
65  if path[len(path)-1] != '/':
66  path = path + '/'
67 
68  aCommand = lsCommand + 'ls '+ path + " | grep .txt"
69 
70  tmpstatus = commands.getstatusoutput( aCommand )
71  tmplistoffiles = tmpstatus[1].split('\n')
72  if len(tmplistoffiles) == 1:
73  if tmplistoffiles[0] == '':
74  exit('ERROR: No files found in directory ' + path)
75  if tmplistoffiles[0].find('No such file or directory') != -1:
76  exit("ERROR: File or directory " + path + " doesn't exist")
77 
78  else:
79  tmplistoffiles.append(path[path.rfind('/')+1:len(path)])
80  path = path[0:path.rfind('/')+1]
81 
82 
83  archiveName = path
84  if path == './':
85  archiveName = os.getcwd() + '/'
86  archiveName = archiveName[archiveName[:len(archiveName)-1].rfind('/')+1:len(archiveName)]
87  if path[:len(path)-1].rfind('/') != -1:
88  archiveName = path[path[:len(path)-1].rfind('/')+1:len(path)]
89 
90  workflowdirArchive = workflowdirArchive + archiveName
91  if tagType != '' :
92  workflowdirArchive = workflowdirArchive[:len(workflowdirArchive)-1] + '_' + tagType + '/'
93  if not os.path.isdir(workflowdirArchive):
94  os.mkdir(workflowdirArchive)
95  elif(option.newarchive):
96 # tmpTime = str(datetime.datetime.now())
97 # tmpTime = tmpTime.replace(' ','-')
98 # tmpTime = tmpTime.replace('.','-')
99 # workflowdirArchive = workflowdirArchive[:len(workflowdirArchive)-1] + '_' + tmpTime + '/'
100 # os.mkdir(workflowdirArchive)
101  for n in range(1,100000):
102  tryDir = workflowdirArchive[:len(workflowdirArchive)-1] + '_' + str(n) + '/'
103  if not os.path.isdir(tryDir):
104  workflowdirArchive = tryDir
105  os.mkdir(workflowdirArchive)
106  break
107  elif n == 100000-1:
108  exit('ERROR: Unbelievable! do you ever clean ' + workflowdir + '?. I think you have to remove some directories!')
109 
110  for ifile in tmplistoffiles:
111  if ifile.find('.txt') != -1:
112  if os.path.isfile(workflowdirArchive+"/"+ifile):
113  if option.overwrite:
114  print "File " + ifile + " already exists in destination. We will overwrite it."
115  else:
116  print "File " + ifile + " already exists in destination. Keep original file."
117  listoffiles.append( workflowdirArchive + ifile )
118  continue
119  listoffiles.append( workflowdirArchive + ifile )
120  # copy to local disk
121  aCommand = cpCommand + 'cp '+ path + ifile + " " + workflowdirArchive
122  print " >> " + aCommand
123  tmpstatus = commands.getstatusoutput( aCommand )
124  return listoffiles
125 
def copyToWorkflowdir(path)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
double split
Definition: MVATrainer.cc:139
def createPayload.mkWorkflowdir ( )

Definition at line 126 of file createPayload.py.

127  global workflowdir
128  global workflowdirLastPayloads
129  global workflowdirTmp
130  global workflowdirArchive
131  if not os.path.isdir(workflowdir):
132  print "Making " + workflowdir + " directory..."
133  os.mkdir(workflowdir)
134 
135  if not os.path.isdir(workflowdirLastPayloads):
136  os.mkdir(workflowdirLastPayloads)
137  else:
138  os.system("rm -f "+ workflowdirLastPayloads + "*")
139 
140  if not os.path.isdir(workflowdirTmp):
141  os.mkdir(workflowdirTmp)
142  else:
143  os.system("rm -f "+ workflowdirTmp + "*")
144 
145  if not os.path.isdir(workflowdirArchive):
146  os.mkdir(workflowdirArchive)
147 

Variable Documentation

createPayload.allbeam_file

Definition at line 255 of file createPayload.py.

createPayload.allfile

Definition at line 258 of file createPayload.py.

createPayload.alllines

Definition at line 216 of file createPayload.py.

createPayload.alumi

Definition at line 238 of file createPayload.py.

createPayload.alumis

Definition at line 230 of file createPayload.py.

createPayload.args

Definition at line 158 of file createPayload.py.

createPayload.arun

Definition at line 229 of file createPayload.py.

createPayload.atime

Definition at line 223 of file createPayload.py.

createPayload.beam_file

WRITE sqlite file.

Definition at line 290 of file createPayload.py.

createPayload.beam_file_tmp

Definition at line 300 of file createPayload.py.

createPayload.block

Definition at line 219 of file createPayload.py.

createPayload.checkType

Definition at line 382 of file createPayload.py.

createPayload.destDB

Definition at line 270 of file createPayload.py.

createPayload.dfile

Definition at line 371 of file createPayload.py.

createPayload.dropbox

Definition at line 406 of file createPayload.py.

createPayload.final_sqlite_file_name

Definition at line 391 of file createPayload.py.

createPayload.iov_comment

Definition at line 274 of file createPayload.py.

createPayload.iov_since

Definition at line 277 of file createPayload.py.

createPayload.iov_since_first

Definition at line 267 of file createPayload.py.

createPayload.iov_till

Definition at line 278 of file createPayload.py.

createPayload.IOVbase

Definition at line 200 of file createPayload.py.

createPayload.keys

Definition at line 249 of file createPayload.py.

createPayload.line

Definition at line 222 of file createPayload.py.

createPayload.listoffiles

Definition at line 208 of file createPayload.py.

createPayload.mergedfile

Definition at line 215 of file createPayload.py.

createPayload.metadata_file

Definition at line 285 of file createPayload.py.

createPayload.newtmpfile

Definition at line 301 of file createPayload.py.

createPayload.nfile

Definition at line 266 of file createPayload.py.

createPayload.npayloads

Definition at line 217 of file createPayload.py.

createPayload.option

3

Definition at line 158 of file createPayload.py.

createPayload.optionstring

Definition at line 48 of file createPayload.py.

createPayload.readdb_template

Definition at line 282 of file createPayload.py.

createPayload.skip
createPayload.sortedlist

Definition at line 210 of file createPayload.py.

createPayload.sqlite_file

READ and check sqlite file.

Merge sqlite files CREATE payload for merged output

Definition at line 284 of file createPayload.py.

createPayload.sqlite_file_name

Definition at line 283 of file createPayload.py.

createPayload.suffix
createPayload.tagname

Definition at line 181 of file createPayload.py.

Referenced by LumiProducer.getCurrentDataTag().

createPayload.tagType

Definition at line 49 of file createPayload.py.

createPayload.timetype

Definition at line 201 of file createPayload.py.

createPayload.tmp_datafilename

Definition at line 291 of file createPayload.py.

createPayload.tmp_lumi_since

Definition at line 303 of file createPayload.py.

createPayload.tmp_lumi_till

Definition at line 304 of file createPayload.py.

createPayload.tmp_run

Definition at line 302 of file createPayload.py.

createPayload.tmpfile

Definition at line 227 of file createPayload.py.

Referenced by BeamMonitor.FitAndFill().

createPayload.total_files

Definition at line 268 of file createPayload.py.

createPayload.uuid
createPayload.workflowdir

Definition at line 44 of file createPayload.py.

createPayload.workflowdirArchive

Definition at line 47 of file createPayload.py.

createPayload.workflowdirLastPayloads

Definition at line 45 of file createPayload.py.

createPayload.workflowdirTmp

Definition at line 46 of file createPayload.py.

createPayload.writedb_template

Definition at line 281 of file createPayload.py.