Ejemplo n.º 1
0
            del glidein_el['attrs'][attr]
        
    entry_name,glidein_name,factory_name=string.split(glidein,"@")

    frontend_constraints=None
    if frontend_name!=None:
        farr=frontend_name.split('.')
        if len(farr)==1:
            # just the generic frontend name
            frontend_constraints='FrontendName=?="%s"'%frontend_name
        elif len(farr)==2:
            frontend_constraints='(FrontendName=?="%s")&&(GroupName=?="%s")'%(farr[0],farr[1])
        else:
            raise RuntimeError, "Invalid frontend name; more than one dot found"

    clients_obj=glideFactoryInterface.findWork(factory_name,glidein_name,entry_name,None,key_obj,get_only_matching=False,additional_constraints=frontend_constraints)
    glidein_el['clients']=clients_obj
    clients=clients_obj.keys()

    if (frontend_name!=None) and (len(clients)==0):
        # if user requested to see only one frontend
        # and this factory is not serving that frontend
        # do not show the frontend at all
        del glideins_obj[glidein]
        continue

    for client in clients:
        if remove_internals:
            del clients_obj[client]['internals']
        
        # rename monitor into client_monitor
Ejemplo n.º 2
0
            del glidein_el['attrs'][attr]
        
    entry_name,glidein_name,factory_name=string.split(glidein,"@")

    frontend_constraints=None
    if frontend_name!=None:
        farr=frontend_name.split('.')
        if len(farr)==1:
            # just the generic frontend name
            frontend_constraints='FrontendName=?="%s"'%frontend_name
        elif len(farr)==2:
            frontend_constraints='(FrontendName=?="%s")&&(GroupName=?="%s")'%(farr[0],farr[1])
        else:
            raise RuntimeError, "Invalid frontend name; more than one dot found"

    clients_obj=glideFactoryInterface.findWork(factory_name,glidein_name,entry_name,None,key_obj,additional_constraints=frontend_constraints)
    glidein_el['clients']=clients_obj
    clients=clients_obj.keys()

    if (frontend_name!=None) and (len(clients)==0):
        # if user requested to see only one frontend
        # and this factory is not serving that frontend
        # do not show the frontend at all
        del glideins_obj[glidein]
        continue

    for client in clients:
        if remove_internals:
            del clients_obj[client]['internals']
        
        # rename monitor into client_monitor
Ejemplo n.º 3
0
def find_and_perform_work(in_downtime, glideinDescript, frontendDescript, jobDescript, jobAttributes, jobParams):
    """
    Finds work requests from the WMS collector, validates security credentials, and requests glideins.  If an entry is 
    in downtime, requested glideins is zero.
    
    @type in_downtime: boolean
    @param in_downtime: True if entry is in downtime
    @type glideinDescript:  
    @param glideinDescript: 
    @type frontendDescript:  
    @param frontendDescript: 
    @type jobDescript:  
    @param jobDescript: 
    @type jobAttributes:  
    @param jobAttributes: 
    @type jobParams:  
    @param jobParams: 
    
    @return: returns a value greater than zero if work was done.
    """
    
    entry_name=jobDescript.data['EntryName']
    auth_method = jobDescript.data['AuthMethod']
    trust_domain = jobDescript.data['TrustDomain']
    pub_key_obj=glideinDescript.data['PubKeyObj']
    old_pub_key_obj = glideinDescript.data['OldPubKeyObj']

    # Get information about which VOs to allow for this entry point.
    # This will be a comma-delimited list of pairs
    # vofrontendname:security_class,vofrontend:sec_class, ...
    frontend_whitelist=jobDescript.data['WhitelistMode']
    security_list={};
    if (frontend_whitelist == "On"):
        frontend_allowed=jobDescript.data['AllowedVOs']
        frontend_allow_list=frontend_allowed.split(',');
        for entry in frontend_allow_list:
            entry_part=entry.split(":");
            if (security_list.has_key(entry_part[0])):
                security_list[entry_part[0]].append(entry_part[1]);
            else:
                security_list[entry_part[0]]=[entry_part[1]];
   
    glideFactoryLib.factoryConfig.client_stats.set_downtime(in_downtime)
    glideFactoryLib.factoryConfig.qc_stats.set_downtime(in_downtime)
    
    #glideFactoryLib.log_files.logActivity("Find work")
    work = glideFactoryInterface.findWork(glideFactoryLib.factoryConfig.factory_name,glideFactoryLib.factoryConfig.glidein_name,entry_name,
                                          glideFactoryLib.factoryConfig.supported_signtypes,
                                          pub_key_obj)
    
    if (len(work.keys())==0) and (old_pub_key_obj != None):
        # Could not find work to do using pub key and we do have a valid old 
        # pub key object. Either there is really no work or the frontend is 
        # still using the old key in this cycle
        glideFactoryLib.log_files.logActivity("Could not find work to do using the existing key. Trying to find work using old factory key.")
        work = glideFactoryInterface.findWork(
                   glideFactoryLib.factoryConfig.factory_name,
                   glideFactoryLib.factoryConfig.glidein_name, entry_name,
                   glideFactoryLib.factoryConfig.supported_signtypes,
                   old_pub_key_obj)
        if len(work.keys())>0:
            glideFactoryLib.log_files.logActivity("Found work to do using old factory key.")
    if len(work.keys())==0:
        return 0 # nothing to be done

    #glideFactoryLib.log_files.logActivity("Perform work")
    schedd_name=jobDescript.data['Schedd']

    factory_max_running=int(jobDescript.data['MaxRunning'])
    factory_max_idle=int(jobDescript.data['MaxIdle'])
    factory_max_held=int(jobDescript.data['MaxHeld'])

    try:
        condorQ=glideFactoryLib.getCondorQData(entry_name,None,schedd_name)
    except glideFactoryLib.condorExe.ExeError,e:
        glideFactoryLib.log_files.logActivity("Schedd %s not responding, skipping"%schedd_name)
        glideFactoryLib.log_files.logWarning("getCondorQData failed: %s"%e)
        # protect and exit
        return 0