CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
popcon2dropbox Namespace Reference

Classes

class  CondMetaData
 

Functions

def runO2O
 
def upload_to_dropbox
 

Variables

string confFileName = 'popcon2dropbox.json'
 
string dbFileForDropBox = '%s.db'
 
string dbLogFile = '%s_log.db'
 
string fileNameForDropBox = 'input_for_dropbox'
 

Function Documentation

def popcon2dropbox.runO2O (   cmsswdir,
  releasepath,
  release,
  arch,
  jobfilename,
  logfilename,
  p 
)

Definition at line 56 of file popcon2dropbox.py.

References join(), and python.multivaluedict.remove().

56 
57 def runO2O( cmsswdir, releasepath, release, arch, jobfilename, logfilename, *p ):
58  # first remove any existing metadata file...
59  if path.exists( '%s.db' %fileNameForDropBox ):
60  print "Removing files with name %s" %fileNameForDropBox
61  remove( '%s.db' %fileNameForDropBox )
62  if path.exists( '%s.txt' %fileNameForDropBox ):
63  remove( '%s.txt' %fileNameForDropBox )
64  command = 'export SCRAM_ARCH=%s;' %arch
65  command += 'CMSSWDIR=%s;' %cmsswdir
66  command += 'source ${CMSSWDIR}/cmsset_default.sh;'
67  command += 'cd %s/%s/src;' %(releasepath,release)
68  command += 'eval `scramv1 runtime -sh`;'
69  command += 'cd -;'
70  command += 'pwd;'
71  command += 'cmsRun %s ' %jobfilename
72  command += ' '.join(p)
73  command += ' 2>&1'
74  pipe = subprocess.Popen( command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
75  stdout_val = pipe.communicate()[0]
76  return stdout_val
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def popcon2dropbox.upload_to_dropbox (   backend)

Definition at line 77 of file popcon2dropbox.py.

References python.multivaluedict.remove().

77 
78 def upload_to_dropbox( backend ):
79  md = CondMetaData()
80  # first remove any existing metadata file...
81  if path.exists( '%s.txt' %fileNameForDropBox ):
82  remove( '%s.txt' %fileNameForDropBox )
83  try:
84  dropBox = upload_popcon.DropBox(upload_popcon.defaultHostname, upload_popcon.defaultUrlTemplate)
85  # Try to find the netrc entry
86  try:
87  (username, account, password) = netrc.netrc().authenticators(upload_popcon.defaultNetrcHost)
88  except Exception:
89  print 'Netrc entry "DropBox" not found.'
90  return
91  print 'signing in...'
92  dropBox.signIn(username, password)
93  print 'signed in'
94  for k,v in md.records().items():
95  destTag = v.get("destinationTag")
96  inputTag = v.get("sqliteTag")
97  if inputTag == None:
98  inputTag = destTag
99  comment = v.get("comment")
100  md.dumpMetadataForUpload( inputTag, destTag, comment )
101  dropBox.uploadFile(dbFileForDropBox, backend, upload_popcon.defaultTemporaryFile)
102  dropBox.signOut()
103  except upload_popcon.HTTPError as e:
104  print e
105 

Variable Documentation

string popcon2dropbox.confFileName = 'popcon2dropbox.json'

Definition at line 8 of file popcon2dropbox.py.

string popcon2dropbox.dbFileForDropBox = '%s.db'

Definition at line 10 of file popcon2dropbox.py.

string popcon2dropbox.dbLogFile = '%s_log.db'

Definition at line 11 of file popcon2dropbox.py.

string popcon2dropbox.fileNameForDropBox = 'input_for_dropbox'

Definition at line 9 of file popcon2dropbox.py.