Skip to content

Site to Resource Mapping rfc

atsareg edited this page Mar 8, 2013 · 6 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
    }
  }
}

As it is seen in the example, there can different mappings defined with arbitrary names used in different VO's production systems. Also Production and Certification setups can use different mappings. 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.getMapping( 'Close', site )
if result['OK']:
  storageElements = result['Value']

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.

Similar mappings can be defined for other types of Resources if needed. Then the getMapping() function can be instrumented with the resource type parameter:

operationsHelper = Operations( vo = vo )
result = operationsHelper.getMapping( 'Close', site, resourceType = 'Storage' )