예제 #1
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
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",
                    )