Exemplo n.º 1
0
def main():

    url = 'https://cmsweb.cern.ch'
    testbed_url = 'https://cmsweb-testbed.cern.ch'
    #url = 'https://alan-cloud1.cern.ch'

    #Create option parser
    usage = "usage: %prog [options] [WORKFLOW] TASK"
    parser = OptionParser(usage=usage)
    parser.add_option("-f","--file", dest="file", default=None,
                        help="Text file of a list of workflows")
    parser.add_option("-m","--memory", dest="memory", default=None,
                        help="Memory to override the original request memory")

    (options, args) = parser.parse_args()
    
    wfs = None
    if len(args) == 2:
        wfs = [args[0]]
        task = args[1]
    #list of files
    elif options.file and len(args) == 1:
        wfs = [l.strip() for l in open(options.file) if l.strip()]
        task = args[0]
    else:
        parser.error("Provide the Workflow Name and the Task Name")
        sys.exit(1)

    configJson = {"createRequest":{}}
    config = Config(configJson)
    reqMgrClient = ReqMgrClient(url, config)
    
    for wfname in wfs:
        #original wf info
        wf = rqMgr.Workflow(wfname)
        #set up acdc stuff
        if "ACDC" in wf.info["RequestString"]:
            config.requestArgs["createRequest"]["RequestString"] = wf.info["RequestString"]
        else:
            config.requestArgs["createRequest"]["RequestString"] = "ACDC_"+ wf.info["RequestString"]
        config.requestArgs["createRequest"]["PrepID"] = wf.info["PrepID"]
        config.requestArgs["createRequest"]["RequestPriority"] = wf.info["RequestPriority"]
        config.requestArgs["createRequest"]["OriginalRequestName"] = wf.name
        config.requestArgs["createRequest"]["InitialTaskPath"] = "/%s/%s"%(wf.name, task)
        config.requestArgs["createRequest"]["ACDCServer"] = "https://cmsweb.cern.ch/couchdb"
        config.requestArgs["createRequest"]["ACDCDatabase"] = "acdcserver"
        config.requestArgs["createRequest"]["TimePerEvent"] = wf.info["TimePerEvent"]

        if options.memory:
            config.requestArgs["createRequest"]["Memory"] = options.memory
        else:
            config.requestArgs["createRequest"]["Memory"] = wf.info["Memory"]

        config.requestArgs["createRequest"]["SizePerEvent"] = wf.info["SizePerEvent"]
        config.requestArgs["createRequest"]["RequestType"] = "Resubmission"
        config.requestArgs["createRequest"]["Group"] = wf.info["Group"]

        r = reqMgrClient.createRequest(config)
        print "Created:"    
        print r
def main():
    #url = 'cmsweb.cern.ch'
    url = 'https://cmsweb-testbed.cern.ch'
    if len(sys.argv) != 3:
        print "Usage:  python createSitesBackfill.py JSON_FILE SITE1,SITE2,..."
        sys.exit(0)
    jsonFile = sys.argv[1]
    siteList = sys.argv[2].split(',')
    #read request params
    configJson = json.load(open(jsonFile, 'r'))
    #wrap config in an object
    config = Config(configJson)
    
    reqMgrClient = ReqMgrClient(url, config)

    #set up common stuff
    config.requestArgs["createRequest"]["Campaign"] += "SiteBackfill" 
    reqStr = config.requestArgs["createRequest"]["RequestString"]
    
    config.requestArgs["assignRequest"]["AcquisitionEra"] += "SiteBackfill"
    config.requestArgs["createRequest"]["Campaign"] += "SiteBackfill" 


    #create a request for each site
    for site in siteList:
        
        #setup creation stuff
        config.requestArgs["createRequest"]["RequestString"] = reqStr+"-"+site
        config.requestArgs["createRequest"]["PrepID"] = None

        r = reqMgrClient.createRequest(config)
        print "Created:", r
        reqMgrClient.changeSplitting(config)
        print "Changed splitting"
        
        #change assignment stuff
        config.requestArgs["assignRequest"]["SiteWhitelist"] = [site]        
        config.requestArgs["assignRequest"]["ProcessingString"] = "SITE_TEST_"+site
        #assign
        reqMgrClient.assignRequests(config)
        print "Assigned: ", r ,"to",site
Exemplo n.º 3
0
        self.requestArgs = info
        self.requestNames = []
        self.cert = None
        self.key = None
        self.assignRequests = False
        self.changeSplitting = False
        self.assignRequest = False


url = 'https://cmsweb.cern.ch'
testbed_url = 'https://cmsweb-testbed.cern.ch'
#url = 'https://alan-cloud1.cern.ch'

configJson = {"createRequest": {}}
config = Config(configJson)
reqMgrClient = ReqMgrClient(url, config)


def makeACDC(url, workflow, task, memory=None):
    #original wf info
    wf = rqMgr.Workflow(workflow)

    #set up acdc stuff
    if "ACDC" in wf.info["RequestString"]:
        config.requestArgs["createRequest"]["RequestString"] = wf.info[
            "RequestString"]
    else:
        config.requestArgs["createRequest"][
            "RequestString"] = "ACDC_" + wf.info["RequestString"]

    config.requestArgs["createRequest"]["PrepID"] = wf.info["PrepID"]
Exemplo n.º 4
0
def main():

    url = 'https://cmsweb.cern.ch'
    testbed_url = 'https://cmsweb-testbed.cern.ch'
    #url = 'https://alan-cloud1.cern.ch'

    #Create option parser
    usage = "usage: %prog [options] JSON_FILE SITE1,SITE2,..."
    parser = OptionParser(usage=usage)

    parser.add_option(
        "-t",
        "--team",
        dest="team",
        default=None,
        help="Team for assigning, if empty, the one on the Json file")
    parser.add_option("--testbed",
                      action="store_true",
                      dest="testbed",
                      default=False,
                      help="Use testbed ReqMgr instead of production ReqMgr.")
    parser.add_option("-m",
                      "--multi",
                      action="store_true",
                      dest="multi",
                      default=False,
                      help="Assign to all sites")

    (options, args) = parser.parse_args()

    if len(args) != 2:
        parser.error("Provide the JSON file and the site list")
        sys.exit(1)

    #the input options
    jsonFile = args[0]
    siteList = args[1].split(',')
    if options.testbed:
        url = testbed_url

    #read request params and wrap
    configJson = json.load(open(jsonFile, 'r'))
    config = Config(configJson)
    reqMgrClient = ReqMgrClient(url, config)

    #set up common stuff
    config.requestArgs["createRequest"]["Campaign"] += "SiteBackfill"
    reqStr = config.requestArgs["createRequest"]["RequestString"]

    config.requestArgs["assignRequest"]["AcquisitionEra"] += "SiteBackfill"
    config.requestArgs["createRequest"]["Campaign"] += "SiteBackfill"

    if options.team:
        config.requestArgs["assignRequest"]["Team"] = options.team

    #create a request for each site
    if not options.multi:
        for site in siteList:

            #setup creation stuff
            config.requestArgs["createRequest"][
                "RequestString"] = reqStr + "-" + site + "Backfill"
            config.requestArgs["createRequest"]["PrepID"] = None

            r = reqMgrClient.createRequest(config)
            print "Created:"
            print r
            reqMgrClient.changeSplitting(config)
            print "Changed splitting"

            #change assignment stuff
            config.requestArgs["assignRequest"]["SiteWhitelist"] = [site]
            config.requestArgs["assignRequest"][
                "ProcessingString"] = "SITE_TEST_" + site
            #assign
            reqMgrClient.assignRequests(config)
            print "Assigned to", site

    else:
        #setup creation stuff
        config.requestArgs["createRequest"][
            "RequestString"] = reqStr + "-SiteBackfill"
        config.requestArgs["createRequest"]["PrepID"] = None

        r = reqMgrClient.createRequest(config)
        print "Created:"
        print r
        reqMgrClient.changeSplitting(config)
        print "Changed splitting"

        #change assignment stuff
        config.requestArgs["assignRequest"]["SiteWhitelist"] = siteList
        config.requestArgs["assignRequest"]["ProcessingString"] = "SITE_TEST"
        #assign
        reqMgrClient.assignRequests(config)
        print "Assigned to", siteList
def main():

    url = 'https://cmsweb.cern.ch'
    testbed_url = 'https://cmsweb-testbed.cern.ch'
    #url = 'https://alan-cloud1.cern.ch'

    #Create option parser
    usage = "usage: %prog [options] JSON_FILE SITE1,SITE2,..."
    parser = OptionParser(usage=usage)

    parser.add_option("-t","--team", dest="team", default=None,
                        help="Team for assigning, if empty, the one on the Json file")
    parser.add_option("--testbed",action="store_true", dest="testbed", default=False,
                        help="Use testbed ReqMgr instead of production ReqMgr.")

    (options, args) = parser.parse_args()
    
    if len(args) != 2:
        parser.error("Provide the JSON file and the site list")
        sys.exit(1)
    
    #the input options
    jsonFile = args[0]
    siteList = args[1].split(',')
    if options.testbed:
        url = testbed_url

    #read request params and wrap
    configJson = json.load(open(jsonFile, 'r'))
    config = Config(configJson)
    reqMgrClient = ReqMgrClient(url, config)

    #set up common stuff
    config.requestArgs["createRequest"]["Campaign"] += "SiteBackfill" 
    reqStr = config.requestArgs["createRequest"]["RequestString"]
    
    config.requestArgs["assignRequest"]["AcquisitionEra"] += "SiteBackfill"
    config.requestArgs["createRequest"]["Campaign"] += "SiteBackfill" 
    
    if options.team:
        config.requestArgs["assignRequest"]["Team"] = options.team

    #create a request for each site
    for site in siteList:
        
        #setup creation stuff
        config.requestArgs["createRequest"]["RequestString"] = reqStr+"-"+site+"Backfill"
        config.requestArgs["createRequest"]["PrepID"] = None

        r = reqMgrClient.createRequest(config)
        print "Created:"
        print r
        reqMgrClient.changeSplitting(config)
        print "Changed splitting"
        
        #change assignment stuff
        config.requestArgs["assignRequest"]["SiteWhitelist"] = [site]        
        config.requestArgs["assignRequest"]["ProcessingString"] = "SITE_TEST_"+site
        #assign
        reqMgrClient.assignRequests(config)
        print "Assigned to",site