Skip to content

Site to Resource Mapping rfc

atsareg edited this page Mar 15, 2013 · 7 revisions

RFC #9

Author: A.Tsaregorodtsev

Last Modified: 8.03.2013

In various production activities it is necessary to associate a given set of resources to sites and vice versa. For example, Storage Elements that are allowed for access from a given Site within a given activity. Obviously activities can depend on a VO and Setup. Therefore, it is suitable to describe those associations ( mappings ) in the /Operations section of the Configuration Service.

Mappings in the /Operations section

The proposed CS structure for describing mappings is illustrated by the following example:

<Operations> {
  SiteToStorageMapping {
    Close {
       CERN.ch = CERN-disk, CERN-DST
       UseLocalResources = True
    }
    MCDataUpload
    {
       Manchester.uk = RAL-DST
       Imperial.uk = RAL-DST
       PIC.es = IN2P3-DST
    }
    NeverUse
    {
       IHEP.cn = CERN-tape
    }
  }
  SiteToDBServerMapping
  {
    ProductionConditions
    {
      Manchester.uk = RAL-Oracle
      LAL.fr = IN2P3-MySQL
    }
  }
}

As it is seen in the example, the mappings have the following properties:

  • there can be different mappings defined with arbitrary names used in different VO's production systems
  • mapping can be defined for any "Resource Type"
  • mappings can be defined independently for different Setups, e.g. Production and Certification
  • UseLocalResources flag suggests that eligible resources belonging to the site must be added to the resulting set of mapped resources

In the code the mappings are accessed with a Operations helper:

from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
...
operationsHelper = Operations( vo = vo )
result = operationsHelper.getSiteMapping( 'Storage', 'Close' )
if result['OK']:
  storageElementsForCERN = result['Value'].get('CERN.ch',[])

result = operationsHelper.getResourceMapping( 'Storage', 'Close' )
if result['OK']:
  sitesUsingRDSTatCERN = result['Value'].get('CERN-RDST',[])

The helper will take into account the mappings defined in the <Operations> sections but will also return only the resources eligible for usage by the given VO. To do that the Operations helper will use internally the Resources helper.

Clone this wiki locally