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(
'records')
41 tagInfo[
'dependencies'] = {}
42 tagInfo[
'synchronizeTo'] =
'offline'
43 tags[ desttag ] = tagInfo
45 uploadMd[
'destinationTags'] = tags
46 uploadMd[
'inputTag'] = inputtag
47 uploadMd[
'since'] =
None
48 uploadMd[
'userText'] = comment
49 with open(
'%s.txt' %fileNameForDropBox,
'wb')
as jf:
50 jf.write( json.dumps( uploadMd, sort_keys=
True, indent = 2 ) )
53 def runO2O( cmsswdir, releasepath, release, arch, jobfilename, logfilename, *p ):
55 if path.exists(
'%s.db' %fileNameForDropBox ):
56 print "Removing files with name %s" %fileNameForDropBox
57 remove(
'%s.db' %fileNameForDropBox )
58 if path.exists(
'%s.txt' %fileNameForDropBox ):
59 remove(
'%s.txt' %fileNameForDropBox )
60 command =
'export SCRAM_ARCH=%s;' %arch
61 command +=
'CMSSWDIR=%s;' %cmsswdir
62 command +=
'source ${CMSSWDIR}/cmsset_default.sh;'
63 command +=
'cd %s/%s/src;' %(releasepath,release)
64 command +=
'eval `scramv1 runtime -sh`;'
67 command +=
'cmsRun %s ' %jobfilename
68 command +=
' '.
join(p)
70 pipe = subprocess.Popen( command, shell=
True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
71 stdout_val = pipe.communicate()[0]
77 if path.exists(
'%s.txt' %fileNameForDropBox ):
78 remove(
'%s.txt' %fileNameForDropBox )
83 (username, account, password) = netrc.netrc().authenticators(upload_popcon.defaultNetrcHost)
85 print 'Netrc entry "DropBox" not found.'
87 dropBox.signIn(username, password)
88 for k,v
in md.records().items():
89 destTag = v.get(
"destinationTag")
90 inputTag = v.get(
"sqliteTag")
93 comment = v.get(
"comment")
94 md.dumpMetadataForUpload( inputTag, destTag, comment )
95 dropBox.uploadFile(dbFileForDropBox, backend, upload_popcon.defaultTemporaryFile)
97 except HTTPError
as e:
static std::string join(char **cmd)