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 52 of file createPayload.py.

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

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

Definition at line 127 of file createPayload.py.

References edm.print().

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

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 217 of file createPayload.py.

createPayload.alumi

Definition at line 239 of file createPayload.py.

createPayload.alumis

Definition at line 231 of file createPayload.py.

createPayload.args

Definition at line 159 of file createPayload.py.

createPayload.arun

Definition at line 230 of file createPayload.py.

createPayload.atime

Definition at line 224 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 220 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 201 of file createPayload.py.

createPayload.keys

Definition at line 250 of file createPayload.py.

createPayload.line

Definition at line 223 of file createPayload.py.

createPayload.listoffiles

Definition at line 209 of file createPayload.py.

createPayload.mergedfile

Definition at line 216 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 218 of file createPayload.py.

createPayload.option

3

Definition at line 159 of file createPayload.py.

createPayload.optionstring

Definition at line 49 of file createPayload.py.

createPayload.readdb_template

Definition at line 282 of file createPayload.py.

createPayload.skip
createPayload.sortedlist

Definition at line 211 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 182 of file createPayload.py.

Referenced by LumiProducer.getCurrentDataTag().

createPayload.tagType

Definition at line 50 of file createPayload.py.

createPayload.timetype

Definition at line 202 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 228 of file createPayload.py.

createPayload.total_files

Definition at line 268 of file createPayload.py.

createPayload.uuid
createPayload.workflowdir

Definition at line 45 of file createPayload.py.

createPayload.workflowdirArchive

Definition at line 48 of file createPayload.py.

createPayload.workflowdirLastPayloads

Definition at line 46 of file createPayload.py.

createPayload.workflowdirTmp

Definition at line 47 of file createPayload.py.

createPayload.writedb_template

Definition at line 281 of file createPayload.py.