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

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

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

Definition at line 74 of file popcon2dropbox.py.

References python.multivaluedict.remove().

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

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.