8 confFileName =
'popcon2dropbox.json'
9 fileNameForDropBox =
'input_for_dropbox'
10 dbFileForDropBox =
'%s.db' %fileNameForDropBox
11 dbLogFile =
'%s_log.db' %fileNameForDropBox
18 with open(confFileName)
as jf:
19 self.
md = json.load(jf)
22 return self.md.get(
'authenticationPath')
25 return self.md.get(
'authenticationSystem')
28 return self.md.get(
'destinationDatabase')
31 return self.md.get(
'logDbFileName')
34 return self.md.get(
'synchronizeTo')
37 return self.md.get(
'records')
44 tagInfo[
'dependencies'] = {}
46 tags[ desttag ] = tagInfo
48 uploadMd[
'destinationTags'] = tags
49 uploadMd[
'inputTag'] = inputtag
50 uploadMd[
'since'] =
None
51 uploadMd[
'userText'] = comment
52 with open(
'%s.txt' %fileNameForDropBox,
'wb')
as jf:
53 jf.write( json.dumps( uploadMd, sort_keys=
True, indent = 2 ) )
56 def runO2O( cmsswdir, releasepath, release, arch, jobfilename, logfilename, *p ):
58 if path.exists(
'%s.db' %fileNameForDropBox ):
59 print "Removing files with name %s" %fileNameForDropBox
60 remove(
'%s.db' %fileNameForDropBox )
61 if path.exists(
'%s.txt' %fileNameForDropBox ):
62 remove(
'%s.txt' %fileNameForDropBox )
63 command =
'export SCRAM_ARCH=%s;' %arch
64 command +=
'CMSSWDIR=%s;' %cmsswdir
65 command +=
'source ${CMSSWDIR}/cmsset_default.sh;'
66 command +=
'cd %s/%s/src;' %(releasepath,release)
67 command +=
'eval `scramv1 runtime -sh`;'
70 command +=
'cmsRun %s ' %jobfilename
71 command +=
' '.
join(p)
73 pipe = subprocess.Popen( command, shell=
True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
74 stdout_val = pipe.communicate()[0]
80 if path.exists(
'%s.txt' %fileNameForDropBox ):
81 remove(
'%s.txt' %fileNameForDropBox )
86 (username, account, password) = netrc.netrc().authenticators(upload_popcon.defaultNetrcHost)
88 print 'Netrc entry "DropBox" not found.'
91 dropBox.signIn(username, password)
93 for k,v
in md.records().items():
94 destTag = v.get(
"destinationTag")
95 inputTag = v.get(
"sqliteTag")
98 comment = v.get(
"comment")
99 md.dumpMetadataForUpload( inputTag, destTag, comment )
100 dropBox.uploadFile(dbFileForDropBox, backend, upload_popcon.defaultTemporaryFile)
static std::string join(char **cmd)