def process(siteDefs, out=sys.stdout):

    now = CommonUtils.getNow()
    srvType = 'org.glite.ce.CREAM'
    
    endpointCount = 2  # CREAM + RTEPublisher (CEMon ?)
    shareCount = siteDefs.ruleTable.getShareCount()
    resourceCount = len(siteDefs.resourceTable)
    
    out.write("dn: GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue\n" % siteDefs.compServiceID)
    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Service\n")
    out.write("objectClass: GLUE2ComputingService\n")
        
    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityName: Computing Service %s\n" % siteDefs.compServiceID)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
        
    out.write("GLUE2ServiceID: %s\n" % siteDefs.compServiceID)
    out.write("GLUE2ServiceType: %s\n" % srvType)
    out.write("GLUE2ServiceCapability: executionmanagement.jobexecution\n")
    out.write("GLUE2ServiceQualityLevel: production\n")
    out.write("GLUE2ServiceComplexity: endpointType=%d, share=%d, resource=%d\n"
                   % (endpointCount, shareCount, resourceCount))
    out.write("GLUE2ServiceAdminDomainForeignKey: %s\n" % siteDefs.siteName)
    out.write("\n")
예제 #2
0
def process(siteDefs, out=sys.stdout):

    now = CommonUtils.getNow()
    srvType = 'org.glite.ce.CREAM'

    endpointCount = 2  # CREAM + RTEPublisher (CEMon ?)
    shareCount = siteDefs.ruleTable.getShareCount()
    resourceCount = len(siteDefs.resourceTable)

    out.write("dn: GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue\n" %
              siteDefs.compServiceID)
    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Service\n")
    out.write("objectClass: GLUE2ComputingService\n")

    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityName: Computing Service %s\n" %
              siteDefs.compServiceID)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
              CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
              CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)

    out.write("GLUE2ServiceID: %s\n" % siteDefs.compServiceID)
    out.write("GLUE2ServiceType: %s\n" % srvType)
    out.write("GLUE2ServiceCapability: executionmanagement.jobexecution\n")
    out.write("GLUE2ServiceQualityLevel: production\n")
    out.write(
        "GLUE2ServiceComplexity: endpointType=%d, share=%d, resource=%d\n" %
        (endpointCount, shareCount, resourceCount))
    out.write("GLUE2ServiceAdminDomainForeignKey: %s\n" % siteDefs.siteName)
    out.write("\n")
예제 #3
0
def process(siteDefs, out=sys.stdout):

    if siteDefs.creamStandAloneMode(siteDefs.ceHost):
        return

    now = CommonUtils.getNow()
    
    for seData in siteDefs.seAccess.values():
    
        # In GLUE2 access points are mandatory
        if seData.mount == None or seData.export == None:
            continue
    
        out.write("dn: GLUE2ToStorageServiceID=%s_%s,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue\n"
                    % (siteDefs.compServiceID, seData.host, siteDefs.compServiceID))
        out.write("objectClass: GLUE2Entity\n")
        out.write("objectClass: GLUE2ToStorageService\n")
        out.write("GLUE2ToStorageServiceID: %s_%s\n" % (siteDefs.compServiceID, seData.host))
        out.write("GLUE2EntityCreationTime: %s\n" % now)
        out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
        out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
        out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
        out.write("Glue2EntityName: %s_%s\n" % (siteDefs.compServiceID, seData.host))
        out.write("GLUE2ToStorageServiceLocalPath: %s\n" % seData.mount)
        out.write("GLUE2ToStorageServiceRemotePath: %s\n" % seData.export)
        out.write("GLUE2ToStorageServiceComputingServiceForeignKey: %s\n" % siteDefs.compServiceID)
        out.write("GLUE2ToStorageServiceStorageServiceForeignKey: %s\n" % seData.host)
        out.write("\n")
예제 #4
0
def process(siteDefs, out=sys.stdout):

    if siteDefs.creamStandAloneMode(siteDefs.ceHost):
        return

    now = CommonUtils.getNow()

    out.write(
        "dn: GLUE2ManagerId=%s_Manager,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue\n"
        % (siteDefs.compServiceID, siteDefs.compServiceID))
    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Manager\n")
    out.write("objectClass: GLUE2ComputingManager\n")

    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityName: Computing Manager on %s\n" % siteDefs.ceHost)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
              CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
              CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
    for capaItem in siteDefs.capabilities:
        out.write("GLUE2EntityOtherInfo: %s\n" % capaItem)

    out.write("GLUE2ManagerID: %s_Manager\n" % siteDefs.compServiceID)
    out.write("GLUE2ManagerProductName: %s\n" % siteDefs.batchsys)
    out.write("GLUE2ManagerProductVersion: %s\n" % siteDefs.batchsysVer)
    out.write("GLUE2ManagerServiceForeignKey: %s\n" % siteDefs.compServiceID)

    if siteDefs.wAreaShared <> None:
        out.write("GLUE2ComputingManagerWorkingAreaShared: %s\n" %
                  repr(siteDefs.wAreaShared).upper())
    if siteDefs.wAreaGuaranteed <> None:
        out.write("GLUE2ComputingManagerWorkingAreaGuaranteed: %s\n" %
                  repr(siteDefs.wAreaGuaranteed).upper())
    if siteDefs.wAreaTotal <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaTotal: %d\n" %
                  siteDefs.wAreaTotal)
    if siteDefs.wAreaFree <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaFree: %d\n" %
                  siteDefs.wAreaFree)
    if siteDefs.wAreaLifeTime <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaLifeTime: %d\n" %
                  siteDefs.wAreaLifeTime)
    if siteDefs.wAreaMultiSlotTotal <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaMultiSlotTotal: %d\n" %
                  siteDefs.wAreaMultiSlotTotal)
    if siteDefs.wAreaMultiSlotFree <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaMultiSlotFree: %d\n" %
                  siteDefs.wAreaMultiSlotFree)
    if siteDefs.wAreaMultiSlotLifeTime <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaMultiSlotLifeTime: %d\n" %
                  siteDefs.wAreaMultiSlotLifeTime)

    out.write("GLUE2ComputingManagerComputingServiceForeignKey: %s\n" %
              siteDefs.compServiceID)
    out.write("\n")
def process(siteDefs, out=sys.stdout):

    if siteDefs.creamStandAloneMode(siteDefs.ceHost):
        return

    now = CommonUtils.getNow()
    
    out.write("dn: GLUE2ManagerId=%s_Manager,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue\n"
                    % (siteDefs.compServiceID, siteDefs.compServiceID))
    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Manager\n")
    out.write("objectClass: GLUE2ComputingManager\n")

    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityName: Computing Manager on %s\n" % siteDefs.ceHost)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
    for capaItem in siteDefs.capabilities:
        out.write("GLUE2EntityOtherInfo: %s\n" % capaItem)
        
    out.write("GLUE2ManagerID: %s_Manager\n" % siteDefs.compServiceID)
    out.write("GLUE2ManagerProductName: %s\n" % siteDefs.batchsys)
    out.write("GLUE2ManagerProductVersion: %s\n" % siteDefs.batchsysVer)
    out.write("GLUE2ManagerServiceForeignKey: %s\n" % siteDefs.compServiceID)

    if siteDefs.wAreaShared <> None:
        out.write("GLUE2ComputingManagerWorkingAreaShared: %s\n" % repr(siteDefs.wAreaShared).upper())
    if siteDefs.wAreaGuaranteed <> None:
        out.write("GLUE2ComputingManagerWorkingAreaGuaranteed: %s\n" % repr(siteDefs.wAreaGuaranteed).upper())
    if siteDefs.wAreaTotal <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaTotal: %d\n" % siteDefs.wAreaTotal)
    if siteDefs.wAreaFree <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaFree: %d\n" % siteDefs.wAreaFree)
    if siteDefs.wAreaLifeTime <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaLifeTime: %d\n" % siteDefs.wAreaLifeTime)
    if siteDefs.wAreaMultiSlotTotal <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaMultiSlotTotal: %d\n" % siteDefs.wAreaMultiSlotTotal)
    if siteDefs.wAreaMultiSlotFree <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaMultiSlotFree: %d\n" % siteDefs.wAreaMultiSlotFree)
    if siteDefs.wAreaMultiSlotLifeTime <> -1:
        out.write("GLUE2ComputingManagerWorkingAreaMultiSlotLifeTime: %d\n" % siteDefs.wAreaMultiSlotLifeTime)
    
    out.write("GLUE2ComputingManagerComputingServiceForeignKey: %s\n" % siteDefs.compServiceID)
    out.write("\n")
예제 #6
0
def process(siteDefs, out=sys.stdout):

    if siteDefs.clusterStandAloneMode():
        #
        # Endpoint is not available on cluster node alone
        #
        return

    now = CommonUtils.getNow()

    endPointID = siteDefs.ceHost + '_org.glite.ce.CREAM'
    endPointDN = 'GLUE2EndpointID=%s,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue' \
                  % (endPointID, siteDefs.compServiceID)
    implVer, ifaceVer = ServiceInfoUtils.getCREAMServiceInfo()
    hostDN, hostIssuer = ServiceInfoUtils.getHostCertInfo()
    #
    # TODO Validity is hard-coded for now (1hour in seconds)
    #
    validity = 3600
    statusCode, statusInfo = ServiceInfoUtils.getTomcatStatus()
    srvState, srvStarttime = ServiceInfoUtils.getCREAMServingState()

    out.write("dn: %s\n" % endPointDN)

    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Endpoint\n")
    out.write("objectClass: GLUE2ComputingEndpoint\n")

    out.write("GLUE2EntityName: %s\n" % endPointID)
    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityValidity: %d\n" % validity)
    out.write("GLUE2EntityOtherInfo: HostDN=%s\n" % hostDN)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
              CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
              CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
    out.write("GLUE2EntityOtherInfo: ArgusEnabled=%s\n" %
              repr(siteDefs.argusEnabled).upper())

    out.write("Glue2EndpointStartTime: %s\n" % now)
    out.write("GLUE2EndpointID: %s\n" % endPointID)
    out.write("GLUE2EndpointURL: https://%s:%d/ce-cream/services\n" %
              (siteDefs.ceHost, siteDefs.cePort))
    out.write("GLUE2EndpointCapability: executionmanagement.jobexecution\n")
    out.write("GLUE2EndpointTechnology: webservice\n")
    out.write("GLUE2EndpointInterfaceName: org.glite.ce.CREAM\n")
    out.write("GLUE2EndpointInterfaceVersion: %s\n" % ifaceVer)
    out.write(
        "GLUE2EndpointWSDL: https://%s:%d/ce-cream/services/CREAM2?wsdl\n" %
        (siteDefs.ceHost, siteDefs.cePort))
    out.write(
        "GLUE2EndpointSupportedProfile: http://www.ws-i.org/Profiles/BasicProfile-1.0.html\n"
    )
    out.write(
        "GLUE2EndpointSemantics:http://wiki.italiangrid.org/twiki/bin/view/CREAM/UserGuide\n"
    )
    out.write("GLUE2EndpointImplementor: gLite\n")
    out.write("GLUE2EndpointImplementationName: CREAM\n")
    out.write("GLUE2EndpointImplementationVersion: %s\n" % implVer)
    out.write("GLUE2EndpointQualityLevel: production\n")

    out.write("GLUE2EndpointHealthState: %s\n" % statusCode)
    out.write("GLUE2EndpointHealthStateInfo: %s\n" % statusInfo)
    out.write("GLUE2EndpointServingState: %s\n" % srvState)
    out.write("GLUE2EndpointStartTime: %s\n" % srvStarttime)
    out.write("GLUE2EndpointIssuerCA: %s\n" % hostIssuer)
    for tCA in ServiceInfoUtils.getTrustAnchors():
        out.write("GLUE2EndpointTrustedCA: %s\n" % tCA)

    out.write(
        "GLUE2EndpointDownTimeInfo: See the GOC DB for downtimes: https://goc.egi.eu/\n"
    )
    out.write("GLUE2EndpointServiceForeignKey: %s\n" % siteDefs.compServiceID)

    out.write("GLUE2ComputingEndpointStaging: staginginout\n")
    out.write("GLUE2ComputingEndpointJobDescription: glite:jdl\n")
    out.write("GLUE2ComputingEndpointComputingServiceForeignKey: %s\n" %
              siteDefs.compServiceID)
    out.write("\n")

    out.write("dn: GLUE2PolicyID=%s_Policy,%s\n" % (endPointID, endPointDN))

    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Policy\n")
    out.write("objectClass: GLUE2AccessPolicy\n")

    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityName: Access control rules for Endpoint %s\n" %
              endPointID)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
              CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
              CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)

    out.write("GLUE2PolicyID: %s_Policy\n" % endPointID)
    # The policy scheme needs a name: arbitrarily define this as org.glite.standard
    out.write("GLUE2PolicyScheme: org.glite.standard\n")

    voList = siteDefs.ruleTable.getVOList()
    for voItem in voList:
        out.write('GLUE2PolicyUserDomainForeignKey: %s\n' % voItem.getVOName())
    for voItem in voList:
        out.write('GLUE2PolicyRule: %s\n' % repr(voItem))

    out.write("GLUE2AccessPolicyEndpointForeignKey: %s\n" % endPointID)
    out.write("\n")
def process(siteDefs, out=sys.stdout):

    if siteDefs.clusterStandAloneMode():
        #
        # Endpoint is not available on cluster node alone
        #
        return

    now = CommonUtils.getNow()

    endPointID = siteDefs.ceHost + '_org.glite.ce.CREAM'
    endPointDN = 'GLUE2EndpointID=%s,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue' \
                  % (endPointID, siteDefs.compServiceID)
    implVer, ifaceVer = ServiceInfoUtils.getCREAMServiceInfo()
    hostDN, hostIssuer = ServiceInfoUtils.getHostCertInfo()
    #
    # TODO Validity is hard-coded for now (1hour in seconds)
    #
    validity = 3600
    statusCode, statusInfo = ServiceInfoUtils.getTomcatStatus()
    srvState, srvStarttime = ServiceInfoUtils.getCREAMServingState()
    
    out.write("dn: %s\n" % endPointDN)
    
    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Endpoint\n")
    out.write("objectClass: GLUE2ComputingEndpoint\n")
    
    out.write("GLUE2EntityName: %s\n" % endPointID)
    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityValidity: %d\n" % validity)
    out.write("GLUE2EntityOtherInfo: HostDN=%s\n" % hostDN)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
    out.write("GLUE2EntityOtherInfo: ArgusEnabled=%s\n" % repr(siteDefs.argusEnabled).upper())
    
    out.write("Glue2EndpointStartTime: %s\n" % now)
    out.write("GLUE2EndpointID: %s\n" % endPointID)
    out.write("GLUE2EndpointURL: https://%s:%d/ce-cream/services\n" % (siteDefs.ceHost, siteDefs.cePort))
    out.write("GLUE2EndpointCapability: executionmanagement.jobexecution\n")
    out.write("GLUE2EndpointTechnology: webservice\n")
    out.write("GLUE2EndpointInterfaceName: org.glite.ce.CREAM\n")
    out.write("GLUE2EndpointInterfaceVersion: %s\n" % ifaceVer)
    out.write("GLUE2EndpointWSDL: https://%s:%d/ce-cream/services/CREAM2?wsdl\n" % (siteDefs.ceHost, siteDefs.cePort))
    out.write("GLUE2EndpointSupportedProfile: http://www.ws-i.org/Profiles/BasicProfile-1.0.html\n")
    out.write("GLUE2EndpointSemantics:http://wiki.italiangrid.org/twiki/bin/view/CREAM/UserGuide\n")
    out.write("GLUE2EndpointImplementor: gLite\n")
    out.write("GLUE2EndpointImplementationName: CREAM\n")
    out.write("GLUE2EndpointImplementationVersion: %s\n" % implVer)
    out.write("GLUE2EndpointQualityLevel: production\n")
    
    out.write("GLUE2EndpointHealthState: %s\n" % statusCode)
    out.write("GLUE2EndpointHealthStateInfo: %s\n" % statusInfo)
    out.write("GLUE2EndpointServingState: %s\n" % srvState)
    out.write("GLUE2EndpointStartTime: %s\n" % srvStarttime)
    out.write("GLUE2EndpointIssuerCA: %s\n" % hostIssuer)
    for tCA in ServiceInfoUtils.getTrustAnchors():
        out.write("GLUE2EndpointTrustedCA: %s\n" % tCA)
    
    out.write("GLUE2EndpointDownTimeInfo: See the GOC DB for downtimes: https://goc.egi.eu/\n")
    out.write("GLUE2EndpointServiceForeignKey: %s\n" % siteDefs.compServiceID)
    
    out.write("GLUE2ComputingEndpointStaging: staginginout\n")
    out.write("GLUE2ComputingEndpointJobDescription: glite:jdl\n")
    out.write("GLUE2ComputingEndpointComputingServiceForeignKey: %s\n" % siteDefs.compServiceID)
    out.write("\n")
    
    
    out.write("dn: GLUE2PolicyID=%s_Policy,%s\n" % (endPointID, endPointDN))

    out.write("objectClass: GLUE2Entity\n")
    out.write("objectClass: GLUE2Policy\n")
    out.write("objectClass: GLUE2AccessPolicy\n")
    
    out.write("GLUE2EntityCreationTime: %s\n" % now)
    out.write("GLUE2EntityName: Access control rules for Endpoint %s\n" % endPointID)
    out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
    out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
    out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)

    out.write("GLUE2PolicyID: %s_Policy\n" % endPointID)
    # The policy scheme needs a name: arbitrarily define this as org.glite.standard
    out.write("GLUE2PolicyScheme: org.glite.standard\n")
    
    voList = siteDefs.ruleTable.getVOList()
    for voItem in voList:
        out.write('GLUE2PolicyUserDomainForeignKey: %s\n' % voItem.getVOName())
    for voItem in voList:
        out.write('GLUE2PolicyRule: %s\n' % repr(voItem))
        
    out.write("GLUE2AccessPolicyEndpointForeignKey: %s\n" % endPointID)
    out.write("\n")
예제 #8
0
def process(siteDefs, out=sys.stdout):

    if siteDefs.creamStandAloneMode(siteDefs.ceHost):
        return

    now = CommonUtils.getNow()

    for queue in siteDefs.ruleTable.getQueueList():

        ceList, voList = siteDefs.ruleTable.getHostAndVOList(queue)

        #
        # For the moment we consider just one host per share
        #
        ceId = '%s:%d/cream-%s-%s' % (siteDefs.ceHost, siteDefs.cePort,
                                      siteDefs.jobmanager, queue)

        for voItem in voList:

            shareId = "%s_%s_%s" % (queue, voItem.getNormName(),
                                    siteDefs.compServiceID)
            shareDN = 'GLUE2ShareID=%s,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue' \
                      % (shareId, siteDefs.compServiceID)

            out.write("dn: %s\n" % shareDN)

            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2Share\n")
            out.write("objectClass: GLUE2ComputingShare\n")

            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityOtherInfo: CREAMCEId=%s\n" % ceId)
            out.write("GLUE2EntityOtherInfo: ServiceType=org.glite.ce.CREAM\n")
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
                      CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
                      CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" %
                      siteDefs.ceHost)

            out.write("GLUE2ShareID: %s\n" % shareId)
            out.write("GLUE2ShareDescription: Share of %s for %s\n" %
                      (queue, voItem.getVOName()))

            out.write("GLUE2ComputingShareMappingQueue: %s\n" % queue)
            # Default value for Serving state is production
            # Real value supposed to be provided by the dynamic plugin
            out.write("GLUE2ComputingShareServingState: unknown\n")
            out.write("GLUE2ComputingShareDefaultCPUTime: %d\n" %
                      MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxCPUTime: %d\n" %
                      MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareDefaultWallTime: %d\n" %
                      MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxWallTime: %d\n" %
                      MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxRunningJobs: %d\n" %
                      MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxTotalJobs: %d\n" %
                      MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxWaitingJobs: %d\n" %
                      MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxSlotsPerJob: %d\n" %
                      MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareRunningJobs: 0\n")
            out.write("GLUE2ComputingShareTotalJobs: 0\n")
            out.write("GLUE2ComputingShareFreeSlots: 0\n")
            out.write("GLUE2ComputingShareUsedSlots: 0\n")
            out.write("GLUE2ComputingShareWaitingJobs: %d\n" % MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareEstimatedAverageWaitingTime: %d\n" %
                      MAX_RESPONSE_TIME)
            out.write("GLUE2ComputingShareEstimatedWorstWaitingTime: %d\n" %
                      MAX_RESPONSE_TIME)
            out.write("GLUE2ComputingShareMaxMainMemory: %d\n" %
                      MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareMaxVirtualMemory: %d\n" %
                      MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareGuaranteedMainMemory: 0\n")
            out.write("GLUE2ComputingShareGuaranteedVirtualMemory: 0\n")

            for resItem in siteDefs.resourceTable.values():
                out.write("GLUE2ShareResourceForeignKey: %s\n" % resItem.id)
                out.write(
                    "GLUE2ComputingShareExecutionEnvironmentForeignKey: %s\n" %
                    resItem.id)

            for ceHostItem in ceList:
                out.write(
                    "GLUE2ShareEndpointForeignKey: %s_org.glite.ce.CREAM\n" %
                    ceHostItem)
                out.write(
                    "GLUE2ComputingShareComputingEndpointForeignKey: %s_org.glite.ce.CREAM\n"
                    % ceHostItem)

            out.write("GLUE2ShareServiceForeignKey: %s\n" %
                      siteDefs.compServiceID)
            out.write("GLUE2ComputingShareComputingServiceForeignKey: %s\n" %
                      siteDefs.compServiceID)
            out.write("\n")

            out.write("dn: GLUE2PolicyID=%s_policy,%s\n" % (shareId, shareDN))
            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2Policy\n")
            out.write("objectClass: GLUE2MappingPolicy\n")
            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
                      CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
                      CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" %
                      siteDefs.ceHost)

            out.write("GLUE2PolicyID: %s_policy\n" % shareId)
            out.write("GLUE2PolicyScheme: org.glite.standard\n")
            out.write("GLUE2PolicyRule: %s\n" % repr(voItem))
            out.write("GLUE2PolicyUserDomainForeignKey: %s\n" %
                      voItem.getVOName())

            out.write("GLUE2MappingPolicyShareForeignKey: %s\n" % shareId)
            out.write("\n")
def process(siteDefs, out=sys.stdout):

    if siteDefs.creamStandAloneMode(siteDefs.ceHost):
        return

    now = CommonUtils.getNow()
    
    for queue in siteDefs.ruleTable.getQueueList():
    
        ceList, voList = siteDefs.ruleTable.getHostAndVOList(queue)
        
        #
        # For the moment we consider just one host per share
        #
        ceId = '%s:%d/cream-%s-%s' % (siteDefs.ceHost, siteDefs.cePort, siteDefs.jobmanager, queue)
    
        for voItem in voList:
            
            shareId = "%s_%s_%s" % (queue, voItem.getNormName(), siteDefs.compServiceID)
            shareDN = 'GLUE2ShareID=%s,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue' \
                      % (shareId, siteDefs.compServiceID)
            
            out.write("dn: %s\n" % shareDN)
            
            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2Share\n")
            out.write("objectClass: GLUE2ComputingShare\n")
            
            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityOtherInfo: CREAMCEId=%s\n" % ceId)
            out.write("GLUE2EntityOtherInfo: ServiceType=org.glite.ce.CREAM\n")
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
            
            out.write("GLUE2ShareID: %s\n" % shareId)
            out.write("GLUE2ShareDescription: Share of %s for %s\n" % (queue, voItem.getVOName()))

            out.write("GLUE2ComputingShareMappingQueue: %s\n" % queue)
            # Default value for Serving state is production
            # Real value supposed to be provided by the dynamic plugin
            out.write("GLUE2ComputingShareServingState: unknown\n")
            out.write("GLUE2ComputingShareDefaultCPUTime: %d\n" % MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxCPUTime: %d\n" % MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareDefaultWallTime: %d\n" % MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxWallTime: %d\n" % MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxRunningJobs: %d\n" % MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxTotalJobs: %d\n" % MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxWaitingJobs: %d\n" % MAX_POLICY_NUMBER)
            out.write("GLUE2ComputingShareMaxSlotsPerJob: %d\n" % MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareRunningJobs: 0\n")
            out.write("GLUE2ComputingShareTotalJobs: 0\n")
            out.write("GLUE2ComputingShareFreeSlots: 0\n")
            out.write("GLUE2ComputingShareUsedSlots: 0\n")
            out.write("GLUE2ComputingShareWaitingJobs: %d\n"  % MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareEstimatedAverageWaitingTime: %d\n" % MAX_RESPONSE_TIME)
            out.write("GLUE2ComputingShareEstimatedWorstWaitingTime: %d\n" % MAX_RESPONSE_TIME)
            out.write("GLUE2ComputingShareMaxMainMemory: %d\n"  % MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareMaxVirtualMemory: %d\n"  % MAX_JOB_NUMBER)
            out.write("GLUE2ComputingShareGuaranteedMainMemory: 0\n")
            out.write("GLUE2ComputingShareGuaranteedVirtualMemory: 0\n")

            for resItem in siteDefs.resourceTable.values():
                out.write("GLUE2ShareResourceForeignKey: %s\n" % resItem.id)
                out.write("GLUE2ComputingShareExecutionEnvironmentForeignKey: %s\n" % resItem.id)
            
            for ceHostItem in ceList:
                out.write("GLUE2ShareEndpointForeignKey: %s_org.glite.ce.CREAM\n" % ceHostItem)
                out.write("GLUE2ComputingShareComputingEndpointForeignKey: %s_org.glite.ce.CREAM\n" % ceHostItem)
            
            out.write("GLUE2ShareServiceForeignKey: %s\n" % siteDefs.compServiceID)
            out.write("GLUE2ComputingShareComputingServiceForeignKey: %s\n" % siteDefs.compServiceID)
            out.write("\n")
            
            out.write("dn: GLUE2PolicyID=%s_policy,%s\n" % (shareId, shareDN))
            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2Policy\n")
            out.write("objectClass: GLUE2MappingPolicy\n")
            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)

            out.write("GLUE2PolicyID: %s_policy\n" % shareId)
            out.write("GLUE2PolicyScheme: org.glite.standard\n")
            out.write("GLUE2PolicyRule: %s\n" % repr(voItem))
            out.write("GLUE2PolicyUserDomainForeignKey: %s\n" % voItem.getVOName())

            out.write("GLUE2MappingPolicyShareForeignKey: %s\n" % shareId)
            out.write("\n")
def process(siteDefs, out=sys.stdout):

    if siteDefs.creamStandAloneMode(siteDefs.ceHost):
        return

    now = CommonUtils.getNow()
    
    osType = 'linux'
    # Hardwire the data validity period to 1 hour for now
    validity = 3600
    
    for resItem in siteDefs.resourceTable.values():
    
        #
        # TODO verify following values
        #

        cores, benchName, benchValue = parseProcDescr(resItem.procDescr)
        
        if resItem.smpSize > 0:
            totalInstances = resItem.logCPU/resItem.smpSize
        else:
            totalInstances = resItem.logCPU
        
        if resItem.logCPU == resItem.phyCPU:
            cpuType = 'single'
        else:
            cpuType = 'multi'
            
        if resItem.phyCPU <> 0  and resItem.smpSize == (resItem.logCPU/resItem.phyCPU):
            coreType = 'single'
        else:
            coreType = 'multi'
        
        resDN = 'GLUE2ResourceID=%s,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue' \
                % (resItem.id, siteDefs.compServiceID)
        
        out.write("dn: %s\n" % resDN)
        out.write("objectClass: GLUE2Entity\n")
        out.write("objectClass: GLUE2Resource\n")
        out.write("objectClass: GLUE2ExecutionEnvironment\n")
        
        out.write("GLUE2EntityCreationTime: %s\n" % now)
        out.write("GLUE2EntityName: %s\n" % resItem.id)
        out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
        out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
        out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
        out.write("GLUE2EntityOtherInfo: SmpSize=%d\n" % resItem.smpSize)
        out.write("GLUE2EntityOtherInfo: Cores=%s\n" % cores)

        out.write("GLUE2ResourceID: %s\n" % resItem.id)
        out.write("GLUE2ResourceManagerForeignKey: %s_Manager\n" % siteDefs.compServiceID)

        out.write("GLUE2ExecutionEnvironmentPlatform: %s\n" % resItem.osArch)
        out.write("GLUE2ExecutionEnvironmentTotalInstances: %d\n" % totalInstances)
        out.write("GLUE2ExecutionEnvironmentPhysicalCPUs: %d\n" % resItem.phyCPU)
        out.write("GLUE2ExecutionEnvironmentLogicalCPUs: %d\n" % resItem.logCPU)
        out.write("GLUE2ExecutionEnvironmentCPUMultiplicity: %scpu-%score\n" 
                      % (cpuType, coreType))
        out.write("GLUE2ExecutionEnvironmentCPUVendor: %s\n" % resItem.procVendor)
        out.write("GLUE2ExecutionEnvironmentCPUModel: %s\n" % resItem.procModel)
        out.write("GLUE2ExecutionEnvironmentCPUClockSpeed: %s\n" % resItem.procSpeed)
        out.write("GLUE2ExecutionEnvironmentMainMemorySize: %d\n" % resItem.mainMemSize)
        out.write("GLUE2ExecutionEnvironmentVirtualMemorySize: %d\n" % resItem.mainVirtSize)
        out.write("GLUE2ExecutionEnvironmentOSFamily: %s\n" % osType)
        out.write("GLUE2ExecutionEnvironmentOSName: %s\n" % resItem.osName)
        out.write("GLUE2ExecutionEnvironmentOSVersion: %s\n" % resItem.osRelease)
        out.write("GLUE2ExecutionEnvironmentConnectivityIn: %s\n" % repr(resItem.inBound).upper())
        out.write("GLUE2ExecutionEnvironmentConnectivityOut: %s\n" % repr(resItem.outBound).upper())
        out.write("GLUE2ExecutionEnvironmentComputingManagerForeignKey: %s_Manager\n" % siteDefs.compServiceID)
        out.write("GLUE2ExecutionEnvironmentCPUTimeScalingFactor: 1\n")
        out.write("\n")    


        benchList = list()
        benchList.append(('specfp2000', resItem.benchSF00))
        benchList.append(('specint2000', resItem.benchSI00))
        if benchName:
            benchList.append((benchName, benchValue))
        
        for benchName, benchValue in benchList:
            out.write("dn: GLUE2BenchmarkID=%s_%s,%s\n" % (resItem.id, benchName, resDN))
            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2Benchmark\n")
            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
            out.write("Glue2EntityName: Benchmark %s\n" % benchName)
            out.write("GLUE2BenchmarkID: %s_%s\n" % (resItem.id, benchName))
            out.write("GLUE2BenchmarkType: %s\n" % benchName)
            out.write("GLUE2BenchmarkValue: %s\n" % benchValue)
            out.write("GLUE2BenchmarkExecutionEnvironmentForeignKey: %s\n" %resItem.id)
            out.write("GLUE2BenchmarkComputingManagerForeignKey: %s_Manager\n" % siteDefs.compServiceID)
            out.write("\n")
        
        for appItem in resItem.runtimeEnv:
            out.write("dn: GLUE2ApplicationEnvironmentId=%s_%s,%s\n" % (appItem, resItem.id, resDN))
            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2ApplicationEnvironment\n")
            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityValidity: %d\n" % validity)
            out.write("GLUE2ApplicationEnvironmentID: %s_%s\n" % (appItem, resItem.id))
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" % CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" % CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" % siteDefs.ceHost)
            out.write("GLUE2ApplicationEnvironmentAppName: %s\n" % appItem)
            out.write("GLUE2ApplicationEnvironmentComputingManagerForeignKey: %s_Manager\n" % siteDefs.compServiceID)
            out.write("\n")
예제 #11
0
def process(siteDefs, out=sys.stdout):

    if siteDefs.creamStandAloneMode(siteDefs.ceHost):
        return

    now = CommonUtils.getNow()

    osType = 'linux'
    # Hardwire the data validity period to 1 hour for now
    validity = 3600

    for resItem in siteDefs.resourceTable.values():

        #
        # TODO verify following values
        #

        cores, benchName, benchValue = parseProcDescr(resItem.procDescr)

        if resItem.smpSize > 0:
            totalInstances = resItem.logCPU / resItem.smpSize
        else:
            totalInstances = resItem.logCPU

        if resItem.logCPU == resItem.phyCPU:
            cpuType = 'single'
        else:
            cpuType = 'multi'

        if resItem.phyCPU <> 0 and resItem.smpSize == (resItem.logCPU /
                                                       resItem.phyCPU):
            coreType = 'single'
        else:
            coreType = 'multi'

        resDN = 'GLUE2ResourceID=%s,GLUE2ServiceID=%s,GLUE2GroupID=resource,o=glue' \
                % (resItem.id, siteDefs.compServiceID)

        out.write("dn: %s\n" % resDN)
        out.write("objectClass: GLUE2Entity\n")
        out.write("objectClass: GLUE2Resource\n")
        out.write("objectClass: GLUE2ExecutionEnvironment\n")

        out.write("GLUE2EntityCreationTime: %s\n" % now)
        out.write("GLUE2EntityName: %s\n" % resItem.id)
        out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
                  CommonUtils.providerName)
        out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
                  CommonUtils.providerVersion)
        out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" %
                  siteDefs.ceHost)
        out.write("GLUE2EntityOtherInfo: SmpSize=%d\n" % resItem.smpSize)
        out.write("GLUE2EntityOtherInfo: Cores=%s\n" % cores)

        out.write("GLUE2ResourceID: %s\n" % resItem.id)
        out.write("GLUE2ResourceManagerForeignKey: %s_Manager\n" %
                  siteDefs.compServiceID)

        out.write("GLUE2ExecutionEnvironmentPlatform: %s\n" % resItem.osArch)
        out.write("GLUE2ExecutionEnvironmentTotalInstances: %d\n" %
                  totalInstances)
        out.write("GLUE2ExecutionEnvironmentPhysicalCPUs: %d\n" %
                  resItem.phyCPU)
        out.write("GLUE2ExecutionEnvironmentLogicalCPUs: %d\n" %
                  resItem.logCPU)
        out.write("GLUE2ExecutionEnvironmentCPUMultiplicity: %scpu-%score\n" %
                  (cpuType, coreType))
        out.write("GLUE2ExecutionEnvironmentCPUVendor: %s\n" %
                  resItem.procVendor)
        out.write("GLUE2ExecutionEnvironmentCPUModel: %s\n" %
                  resItem.procModel)
        out.write("GLUE2ExecutionEnvironmentCPUClockSpeed: %s\n" %
                  resItem.procSpeed)
        out.write("GLUE2ExecutionEnvironmentMainMemorySize: %d\n" %
                  resItem.mainMemSize)
        out.write("GLUE2ExecutionEnvironmentVirtualMemorySize: %d\n" %
                  resItem.mainVirtSize)
        out.write("GLUE2ExecutionEnvironmentOSFamily: %s\n" % osType)
        out.write("GLUE2ExecutionEnvironmentOSName: %s\n" % resItem.osName)
        out.write("GLUE2ExecutionEnvironmentOSVersion: %s\n" %
                  resItem.osRelease)
        out.write("GLUE2ExecutionEnvironmentConnectivityIn: %s\n" %
                  repr(resItem.inBound).upper())
        out.write("GLUE2ExecutionEnvironmentConnectivityOut: %s\n" %
                  repr(resItem.outBound).upper())
        out.write(
            "GLUE2ExecutionEnvironmentComputingManagerForeignKey: %s_Manager\n"
            % siteDefs.compServiceID)
        out.write("GLUE2ExecutionEnvironmentCPUTimeScalingFactor: 1\n")
        out.write("\n")

        benchList = list()
        benchList.append(('specfp2000', resItem.benchSF00))
        benchList.append(('specint2000', resItem.benchSI00))
        if benchName:
            benchList.append((benchName, benchValue))

        for benchName, benchValue in benchList:
            out.write("dn: GLUE2BenchmarkID=%s_%s,%s\n" %
                      (resItem.id, benchName, resDN))
            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2Benchmark\n")
            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
                      CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
                      CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" %
                      siteDefs.ceHost)
            out.write("Glue2EntityName: Benchmark %s\n" % benchName)
            out.write("GLUE2BenchmarkID: %s_%s\n" % (resItem.id, benchName))
            out.write("GLUE2BenchmarkType: %s\n" % benchName)
            out.write("GLUE2BenchmarkValue: %s\n" % benchValue)
            out.write("GLUE2BenchmarkExecutionEnvironmentForeignKey: %s\n" %
                      resItem.id)
            out.write(
                "GLUE2BenchmarkComputingManagerForeignKey: %s_Manager\n" %
                siteDefs.compServiceID)
            out.write("\n")

        for appItem in resItem.runtimeEnv:
            out.write("dn: GLUE2ApplicationEnvironmentId=%s_%s,%s\n" %
                      (appItem, resItem.id, resDN))
            out.write("objectClass: GLUE2Entity\n")
            out.write("objectClass: GLUE2ApplicationEnvironment\n")
            out.write("GLUE2EntityCreationTime: %s\n" % now)
            out.write("GLUE2EntityValidity: %d\n" % validity)
            out.write("GLUE2ApplicationEnvironmentID: %s_%s\n" %
                      (appItem, resItem.id))
            out.write("GLUE2EntityOtherInfo: InfoProviderName=%s\n" %
                      CommonUtils.providerName)
            out.write("GLUE2EntityOtherInfo: InfoProviderVersion=%s\n" %
                      CommonUtils.providerVersion)
            out.write("GLUE2EntityOtherInfo: InfoProviderHost=%s\n" %
                      siteDefs.ceHost)
            out.write("GLUE2ApplicationEnvironmentAppName: %s\n" % appItem)
            out.write(
                "GLUE2ApplicationEnvironmentComputingManagerForeignKey: %s_Manager\n"
                % siteDefs.compServiceID)
            out.write("\n")