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

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

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 
std::vector< std::string_view > split(std::string_view, const char *)
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:19
#define str(s)
def exit(msg="")
def createPayload.mkWorkflowdir ( )

Definition at line 128 of file createPayload.py.

References edm.print().

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 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66

Variable Documentation

createPayload.allbeam_file

Definition at line 256 of file createPayload.py.

createPayload.allfile

Definition at line 259 of file createPayload.py.

createPayload.alllines

Definition at line 218 of file createPayload.py.

createPayload.alumi

Definition at line 240 of file createPayload.py.

createPayload.alumis

Definition at line 232 of file createPayload.py.

createPayload.args

Definition at line 160 of file createPayload.py.

createPayload.arun

Definition at line 231 of file createPayload.py.

createPayload.atime

Definition at line 225 of file createPayload.py.

createPayload.beam_file

WRITE sqlite file.

Definition at line 291 of file createPayload.py.

createPayload.beam_file_tmp

Definition at line 301 of file createPayload.py.

createPayload.block

Definition at line 221 of file createPayload.py.

createPayload.checkType

Definition at line 383 of file createPayload.py.

Referenced by edm::DataManagingProductResolver.setFailedStatus().

createPayload.destDB

Definition at line 271 of file createPayload.py.

createPayload.dfile

Definition at line 372 of file createPayload.py.

createPayload.dropbox

Definition at line 407 of file createPayload.py.

createPayload.final_sqlite_file_name

Definition at line 392 of file createPayload.py.

createPayload.iov_comment

Definition at line 275 of file createPayload.py.

createPayload.iov_since

Definition at line 278 of file createPayload.py.

createPayload.iov_since_first

Definition at line 268 of file createPayload.py.

createPayload.iov_till

Definition at line 279 of file createPayload.py.

createPayload.IOVbase

Definition at line 202 of file createPayload.py.

createPayload.keys

Definition at line 251 of file createPayload.py.

createPayload.line

Definition at line 224 of file createPayload.py.

createPayload.listoffiles

Definition at line 210 of file createPayload.py.

createPayload.mergedfile

Definition at line 217 of file createPayload.py.

createPayload.metadata_file

Definition at line 286 of file createPayload.py.

createPayload.newtmpfile

Definition at line 302 of file createPayload.py.

createPayload.nfile

Definition at line 267 of file createPayload.py.

createPayload.npayloads

Definition at line 219 of file createPayload.py.

createPayload.option

3

Definition at line 160 of file createPayload.py.

createPayload.optionstring

Definition at line 50 of file createPayload.py.

createPayload.readdb_template

Definition at line 283 of file createPayload.py.

createPayload.skip

Definition at line 233 of file createPayload.py.

createPayload.sortedlist

Definition at line 212 of file createPayload.py.

createPayload.sqlite_file

READ and check sqlite file.

Merge sqlite files CREATE payload for merged output

Definition at line 285 of file createPayload.py.

createPayload.sqlite_file_name

Definition at line 284 of file createPayload.py.

createPayload.suffix
createPayload.tagname

Definition at line 183 of file createPayload.py.

Referenced by LumiProducer.getCurrentDataTag().

createPayload.tagType

Definition at line 51 of file createPayload.py.

createPayload.timetype

Definition at line 203 of file createPayload.py.

createPayload.tmp_datafilename

Definition at line 292 of file createPayload.py.

createPayload.tmp_lumi_since

Definition at line 304 of file createPayload.py.

createPayload.tmp_lumi_till

Definition at line 305 of file createPayload.py.

createPayload.tmp_run

Definition at line 303 of file createPayload.py.

createPayload.tmpfile

Definition at line 229 of file createPayload.py.

createPayload.total_files

Definition at line 269 of file createPayload.py.

createPayload.uuid
createPayload.workflowdir

Definition at line 46 of file createPayload.py.

createPayload.workflowdirArchive

Definition at line 49 of file createPayload.py.

createPayload.workflowdirLastPayloads

Definition at line 47 of file createPayload.py.

createPayload.workflowdirTmp

Definition at line 48 of file createPayload.py.

createPayload.writedb_template

Definition at line 282 of file createPayload.py.