Skip to content

Commit

Permalink
Merge pull request #9245 from ggovi/new-conddb-updates-for-popcon2dro…
Browse files Browse the repository at this point in the history
…pbox

added updates for popcon2dropbox
  • Loading branch information
davidlange6 committed May 23, 2015
2 parents 2a9b48d + e99b6d0 commit 5f99698
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions CondCore/Utilities/python/popcon2dropbox.py
Expand Up @@ -30,6 +30,9 @@ def destinationDatabase( self ):
def logDbFileName( self ):
return self.md.get('logDbFileName')

def synchronizeTo( self ):
return self.md.get('synchronizeTo')

def records( self ):
return self.md.get('records')

Expand All @@ -39,7 +42,7 @@ def dumpMetadataForUpload( self, inputtag, desttag, comment ):
tags = {}
tagInfo = {}
tagInfo['dependencies'] = {}
tagInfo['synchronizeTo'] = 'offline'
tagInfo['synchronizeTo'] = self.synchronizeTo()
tags[ desttag ] = tagInfo
print tags
uploadMd['destinationTags'] = tags
Expand Down Expand Up @@ -84,7 +87,9 @@ def upload_to_dropbox( backend ):
except Exception:
print 'Netrc entry "DropBox" not found.'
return
print 'signing in...'
dropBox.signIn(username, password)
print 'signed in'
for k,v in md.records().items():
destTag = v.get("destinationTag")
inputTag = v.get("sqliteTag")
Expand All @@ -94,6 +99,6 @@ def upload_to_dropbox( backend ):
md.dumpMetadataForUpload( inputTag, destTag, comment )
dropBox.uploadFile(dbFileForDropBox, backend, upload_popcon.defaultTemporaryFile)
dropBox.signOut()
except HTTPError as e:
except upload_popcon.HTTPError as e:
print e

1 change: 1 addition & 0 deletions CondCore/Utilities/python/popcon2dropbox_job_conf.py
Expand Up @@ -26,6 +26,7 @@

process = cms.Process("TEST")
process.load("CondCore.CondDB.CondDB_cfi")
process.CondDB.DBParameters.messageLevel = cms.untracked.int32( 3 )
process.CondDB.connect = 'sqlite:%s' %popcon2dropbox.dbFileForDropBox

process.PoolDBOutputService = cms.Service("PoolDBOutputService",
Expand Down
5 changes: 3 additions & 2 deletions CondCore/Utilities/python/upload_popcon.py
Expand Up @@ -416,7 +416,8 @@ def __init__(self, hostname = defaultHostname, urlTemplate = defaultUrlTemplate)
self.hostname = hostname
self.http = HTTP()
self.http.setBaseUrl(urlTemplate % hostname)

os.environ['http_proxy'] = 'http://cmsproxy.cms:3128/'
os.environ['https_proxy'] = 'https://cmsproxy.cms:3128/'

def signInSSO(self, secure = True):
'''Signs in the server via CERN SSO.
Expand Down Expand Up @@ -538,7 +539,7 @@ def uploadFile(self, filename, backend = defaultBackend, temporaryFile = default

logging.info('%s: %s: Uploading file for the %s backend...', self.hostname, basename, backend)
os.rename(temporaryFile, fileHash)
self.http.query('uploadFile', {
self.http.query('uploadPopcon', {
'backend': backend,
'fileName': basename,
}, files = {
Expand Down

0 comments on commit 5f99698

Please sign in to comment.