예제 #1
0
    def uploadToConfigCache(self, user, group = 'CMSYAAT',
                                label       = "Autogenerated by CMSYAAT",
                                description = "Autogenerated by CMSYAAT \n" +
                                    "http://github.com/PeriousApricot/CMSYAAT"
                                ):
        """
        uploads this object to a ConfigCache instance. ConfigCache is the
        subsystem that stores CMSSW configurations so every bit of infrastructure
        doesn't have to ship them around.
        
        Returns a URL that can later be used to retrieve the configuration
        """
        
        cache = ConfigCache()

        # TODO refactor this into a helper function
        couchHost = '/'.join(self.endpoint.split('/')[:-1])
        couchDB   = self.endpoint.split('/')[-1]

        return cache.upload( self.configObject,
                      group       = group,
                      userDN      = user,
                      label       = label,
                      description = description,
                      url         = couchHost,
                      database    = couchDB)
예제 #2
0
    def loadConfigFromFile(self, config, directory, args = []):
        """
        given a CMSSW config and the directory of a CMSSW installation, expand
        the configuration into the format needed for WMCore
        
        configuration is written to target if given, /tmp otherwise
        
        args is the list of command line arguments that should be passed to
        the configuration, similar to what would be placed after cmsRun <conf>
        """
        cache = ConfigCache()

        expandedConfig = cache.loadConfig( configPath = config,
                                           scramDir   = directory,
                                           arguments  = args )
        self.configObject = expandedConfig
                       "SE and it will be globally accessible")

parser.add_option("-u", "--user", dest="user",
                  help="Username to store as", default=pwd.getpwuid(os.getuid()))
parser.add_option("-g", "--group", dest="group",
                  help="Group to store as", default="CMSYAAT")
parser.add_option("--hostname", dest="hostname",
                  help="Target couch instance (formatted as http://andrewmelo.cloudant.com:5984)",
                  default="http://se2.accre.vanderbilt.edu:5985")
parser.add_option("-d", "--database", dest="database",
                  help="Target database", default="wmagent_configcache")

(options, args) = parser.parse_args()

# Load the config initially (takes forever)
cacheFile = ConfigCache()
config = cacheFile.loadConfig( options.filename )
for filename in args:
    # Modify the config for this filename
    targetName = "%s%s" % ( options.prefix, os.path.basename( filename ) )
    config.process.source = cms.Source("LHESource",
        fileNames = cms.untracked.vstring(targetName)
    )

    # Upload the config to the cache
    target = cacheFile.upload(config, options.user, options.group,
                    url=options.hostname,
                    database=options.database,
                #    arguments=args,
                    label = os.path.basename(filename),
                    description = "LHE for SusyScan. Generated by Andrew Melo",
예제 #4
0
#!/usr/bin/env python2.6

import sys
import pwd

from optparse import OptionParser
from CMSYAAT.FileCache.ConfigCache import ConfigCache

# TODO: Get some common options parsing
parser = OptionParser()
parser.add_option("-f", "--filename", dest="filename",
                  help="Configuration to dump")
parser.add_option('-o', dest="output", default=None,
                  help="Output file (defaults to stdout)")
(options, args) = parser.parse_args()


cacheFile = ConfigCache()
config = cacheFile.loadConfig( options.filename )
print config.process.dumpPython()