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

◆ copyToWorkflowdir()

def createPayload.copyToWorkflowdir (   path)

Definition at line 53 of file createPayload.py.

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

References beamvalidation.exit(), spr.find(), edm.print(), FastTimerService_cff.range, cms::dd.split(), and str.

◆ mkWorkflowdir()

def createPayload.mkWorkflowdir ( )

Definition at line 128 of file createPayload.py.

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

References edm.print().

Variable Documentation

◆ allbeam_file

createPayload.allbeam_file

Definition at line 256 of file createPayload.py.

◆ allfile

createPayload.allfile

Definition at line 259 of file createPayload.py.

◆ alllines

createPayload.alllines

Definition at line 218 of file createPayload.py.

◆ alumi

createPayload.alumi

Definition at line 240 of file createPayload.py.

◆ alumis

createPayload.alumis

Definition at line 232 of file createPayload.py.

◆ args

createPayload.args

Definition at line 160 of file createPayload.py.

◆ arun

createPayload.arun

Definition at line 231 of file createPayload.py.

◆ atime

createPayload.atime

Definition at line 225 of file createPayload.py.

◆ beam_file

createPayload.beam_file

WRITE sqlite file.

Definition at line 291 of file createPayload.py.

◆ beam_file_tmp

createPayload.beam_file_tmp

Definition at line 301 of file createPayload.py.

◆ block

createPayload.block

Definition at line 221 of file createPayload.py.

◆ checkType

createPayload.checkType

◆ destDB

createPayload.destDB

Definition at line 271 of file createPayload.py.

◆ dfile

createPayload.dfile

Definition at line 372 of file createPayload.py.

◆ dropbox

createPayload.dropbox

Definition at line 407 of file createPayload.py.

◆ final_sqlite_file_name

createPayload.final_sqlite_file_name

Definition at line 392 of file createPayload.py.

◆ iov_comment

createPayload.iov_comment

Definition at line 275 of file createPayload.py.

◆ iov_since

createPayload.iov_since

Definition at line 278 of file createPayload.py.

◆ iov_since_first

createPayload.iov_since_first

Definition at line 268 of file createPayload.py.

◆ iov_till

createPayload.iov_till

Definition at line 279 of file createPayload.py.

◆ IOVbase

createPayload.IOVbase

Definition at line 202 of file createPayload.py.

◆ keys

createPayload.keys

Definition at line 251 of file createPayload.py.

◆ line

createPayload.line

Definition at line 224 of file createPayload.py.

◆ listoffiles

createPayload.listoffiles

Definition at line 210 of file createPayload.py.

◆ mergedfile

createPayload.mergedfile

Definition at line 217 of file createPayload.py.

◆ metadata_file

createPayload.metadata_file

Definition at line 286 of file createPayload.py.

◆ newtmpfile

createPayload.newtmpfile

Definition at line 302 of file createPayload.py.

◆ nfile

createPayload.nfile

Definition at line 267 of file createPayload.py.

◆ npayloads

createPayload.npayloads

Definition at line 219 of file createPayload.py.

◆ option

createPayload.option

3

Definition at line 160 of file createPayload.py.

◆ optionstring

createPayload.optionstring

Definition at line 50 of file createPayload.py.

◆ readdb_template

createPayload.readdb_template

Definition at line 283 of file createPayload.py.

◆ skip

createPayload.skip

Definition at line 233 of file createPayload.py.

◆ sortedlist

createPayload.sortedlist

Definition at line 212 of file createPayload.py.

◆ sqlite_file

createPayload.sqlite_file

READ and check sqlite file.

Merge sqlite files CREATE payload for merged output

Definition at line 285 of file createPayload.py.

◆ sqlite_file_name

createPayload.sqlite_file_name

Definition at line 284 of file createPayload.py.

◆ suffix

createPayload.suffix

◆ tagname

createPayload.tagname

◆ tagType

createPayload.tagType

Definition at line 51 of file createPayload.py.

◆ timetype

createPayload.timetype

Definition at line 203 of file createPayload.py.

◆ tmp_datafilename

createPayload.tmp_datafilename

Definition at line 292 of file createPayload.py.

◆ tmp_lumi_since

createPayload.tmp_lumi_since

Definition at line 304 of file createPayload.py.

◆ tmp_lumi_till

createPayload.tmp_lumi_till

Definition at line 305 of file createPayload.py.

◆ tmp_run

createPayload.tmp_run

Definition at line 303 of file createPayload.py.

◆ tmpfile

createPayload.tmpfile

Definition at line 229 of file createPayload.py.

◆ total_files

createPayload.total_files

Definition at line 269 of file createPayload.py.

◆ uuid

createPayload.uuid

◆ workflowdir

createPayload.workflowdir

Definition at line 46 of file createPayload.py.

◆ workflowdirArchive

createPayload.workflowdirArchive

Definition at line 49 of file createPayload.py.

◆ workflowdirLastPayloads

createPayload.workflowdirLastPayloads

Definition at line 47 of file createPayload.py.

◆ workflowdirTmp

createPayload.workflowdirTmp

Definition at line 48 of file createPayload.py.

◆ writedb_template

createPayload.writedb_template

Definition at line 282 of file createPayload.py.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
createPayload.copyToWorkflowdir
def copyToWorkflowdir(path)
Definition: createPayload.py:53
cms::dd::split
std::vector< std::string_view > split(std::string_view, const char *)
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
str
#define str(s)
Definition: TestProcessor.cc:48
createPayload.mkWorkflowdir
def mkWorkflowdir()
Definition: createPayload.py:128
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53