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

References join(), and MatrixUtil.remove().

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

Definition at line 71 of file popcon2dropbox.py.

References mps_monitormerge.items, and MatrixUtil.remove().

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

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.