Ejemplo n.º 1
0
def populate_frontend_descript(work_dir,
                               frontend_dict,active_sub_list,        # will be modified
                               params):

        frontend_dict.add('DowntimesFile',params.downtimes_file)
        frontend_dict.add('FrontendName',params.frontend_name)
        frontend_dict.add('WebURL',params.web_url)
        if hasattr(params,"monitoring_web_url") and (params.monitoring_web_url is not None):
            frontend_dict.add('MonitoringWebURL',params.monitoring_web_url)
        else:
            frontend_dict.add('MonitoringWebURL',params.web_url.replace("stage","monitor"))

        if params.security.classad_proxy is None:
            raise RuntimeError, "Missing security.classad_proxy"
        params.subparams.data['security']['classad_proxy']=os.path.abspath(params.security.classad_proxy)
        if not os.path.isfile(params.security.classad_proxy):
            raise RuntimeError, "security.classad_proxy(%s) is not a file"%params.security.classad_proxy
        frontend_dict.add('ClassAdProxy',params.security.classad_proxy)
        
        frontend_dict.add('SymKeyType',params.security.sym_key)

        active_sub_list[:] # erase all
        for sub in params.groups.keys():
            if is_true(params.groups[sub].enabled):
                active_sub_list.append(sub)
        frontend_dict.add('Groups',string.join(active_sub_list,','))

        frontend_dict.add('LoopDelay',params.loop_delay)
        frontend_dict.add('AdvertiseDelay',params.advertise_delay)
        frontend_dict.add('GroupParallelWorkers',params.group_parallel_workers)
        frontend_dict.add('RestartAttempts',params.restart_attempts)
        frontend_dict.add('RestartInterval',params.restart_interval)
        frontend_dict.add('AdvertiseWithTCP',params.advertise_with_tcp)
        frontend_dict.add('AdvertiseWithMultiple',params.advertise_with_multiple)

        frontend_dict.add('MonitorDisplayText',params.monitor_footer.display_txt)
        frontend_dict.add('MonitorLink',params.monitor_footer.href_link)

        frontend_dict.add('CondorConfig',os.path.join(work_dir,cvWConsts.FRONTEND_CONDOR_CONFIG_FILE))

        frontend_dict.add('LogDir',params.log_dir)
        frontend_dict.add('ProcessLogs', str(params.log_retention['process_logs']))
        
        frontend_dict.add('MaxIdleVMsTotal',params.config.idle_vms_total.max)
        frontend_dict.add('CurbIdleVMsTotal',params.config.idle_vms_total.curb)
        frontend_dict.add('MaxIdleVMsTotalGlobal',params.config.idle_vms_total_global.max)
        frontend_dict.add('CurbIdleVMsTotalGlobal',params.config.idle_vms_total_global.curb)
        frontend_dict.add('MaxRunningTotal',params.config.running_glideins_total.max)
        frontend_dict.add('CurbRunningTotal',params.config.running_glideins_total.curb)
        frontend_dict.add('MaxRunningTotalGlobal',params.config.running_glideins_total_global.max)
        frontend_dict.add('CurbRunningTotalGlobal',params.config.running_glideins_total_global.curb)
        frontend_dict.add('HighAvailability', params.high_availability)
Ejemplo n.º 2
0
def add_attr_unparsed_real(attr_name,params,dicts):
    attr_obj=params.attrs[attr_name]
    
    if attr_obj.value is None:
        raise RuntimeError, "Attribute '%s' does not have a value: %s"%(attr_name,attr_obj)

    is_parameter = is_true(attr_obj.parameter)
    # attr_obj.type=="expr" is now used for HTCondor expression
    is_expr = False
    attr_val=params.extract_attr_val(attr_obj)
    
    if is_parameter:
        dicts['params'].add_extended(attr_name,is_expr,attr_val)
    else:
        dicts['consts'].add(attr_name,attr_val)

    do_glidein_publish = is_true(attr_obj.glidein_publish)
    do_job_publish = is_true(attr_obj.job_publish)

    if do_glidein_publish or do_job_publish:
            # need to add a line only if will be published
            if dicts['vars'].has_key(attr_name):
                # already in the var file, check if compatible
                attr_var_el=dicts['vars'][attr_name]
                attr_var_type=attr_var_el[0]
                if (((attr_obj.type=="int") and (attr_var_type!='I')) or
                    ((attr_obj.type=="expr") and (attr_var_type=='I')) or
                    ((attr_obj.type=="string") and (attr_var_type=='I'))):
                    raise RuntimeError, "Types not compatible (%s,%s)"%(attr_obj.type,attr_var_type)
                attr_var_export=attr_var_el[4]
                if do_glidein_publish and (attr_var_export=='N'):
                    raise RuntimeError, "Cannot force glidein publishing"
                attr_var_job_publish=attr_var_el[5]
                if do_job_publish and (attr_var_job_publish=='-'):
                    raise RuntimeError, "Cannot force job publishing"
            else:
                dicts['vars'].add_extended(attr_name,attr_obj.type,None,None,False,do_glidein_publish,do_job_publish)
Ejemplo n.º 3
0
def populate_main_security(client_security,params):
    if params.security.proxy_DN is None:
        raise RuntimeError,"DN not defined for classad_proxy"    
    client_security['proxy_DN']=params.security.proxy_DN
    
    collector_dns=[]
    collector_nodes=[]
    for el in params.collectors:
        dn=el.DN
        if dn is None:
            raise RuntimeError,"DN not defined for pool collector %s"%el.node
        is_secondary=is_true(el.secondary)
        if is_secondary:
            continue # only consider primary collectors for the main security config
        collector_nodes.append(el.node)
        collector_dns.append(dn)
    if len(collector_nodes)==0:
        raise RuntimeError,"Need at least one non-secondary pool collector"
    client_security['collector_nodes']=collector_nodes
    client_security['collector_DNs']=collector_dns
Ejemplo n.º 4
0
def calc_glidein_collectors(collectors):
    collector_nodes = {}
    glidein_collectors = []

    for el in collectors:
        if not collector_nodes.has_key(el.group):
            collector_nodes[el.group] = {'primary': [], 'secondary': []}
        if is_true(el.secondary):
            cWDictFile.validate_node(el.node,allow_prange=True)
            collector_nodes[el.group]['secondary'].append(el.node)
        else:
            cWDictFile.validate_node(el.node)
            collector_nodes[el.group]['primary'].append(el.node)

    for group in collector_nodes.keys():
        if len(collector_nodes[group]['secondary']) > 0:
            glidein_collectors.append(string.join(collector_nodes[group]['secondary'], ","))
        else:
            glidein_collectors.append(string.join(collector_nodes[group]['primary'], ","))
    return string.join(glidein_collectors, ";")