Skip to content
chaen edited this page Jan 15, 2014 · 19 revisions

The main point of this version is to remove the uselessly complex ReplicaManager class. It does not contain any change from the logic perspective, but introduces slightly different interface. It is a first step in the implementation of RFC #17. The replacement of PFN with (LFN,SE name) is to happen in v6r12.

ReplicaManager class deprecated

The calls to the ReplicaManager class have to be replaced by calls :

  • to the FileCatalog, if the method acts only on the FileCatalog. It is the case for all methods of the ReplicaManager which contains "Catalog" (eg. getCatalogReplicaStatus, removeCatalogReplica, etc).
  • to the StorageElement if the method acts only on the StorageElement. It is the case for all methods of the ReplicaManager which contains "Storage" (eg. getStorageFileMetadata, prestageStorageFile, etc).
  • to the new DataManager class if it implies both the StorageElement and the FileCatalog.

The SingleFile and SingleDir parameters are deprecated as well. The enforced return type convention is the successful/failed dictionaries. However, a utility function is provided to mock the deprecated arguments :

res = ReplicaManager().doSomething(arg1, arg2, singleFile = True )

becomes

from DIRAC.Resources.Utilities import Utils

res = Utils.executeSingleFileOrDirWrapper(DataManager().doSomething(arg1, arg2 ))

The catalogs parameter of the ReplicaManager is also removed. It allowed you to specify on which catalogs your method should act. This information should be now given in the constructor of the DataManager or the FileCatalog itself, and all the methods called with these instances will act only on the given catalogs.

rm = ReplicaManager()
res = rm.registerFile( fileTuple, catalog = 'LFC' )

becomes

dm = DataManager(catalogs = ['LFC'])
res = dm.registerFile( fileTuple )

StorageElement class

The StorageElement class was slightly refactored in order to prepare the replacement of PFN with (LFN,SE name). The interface remains the same except for getPfnForProtocol and getPfnForLfn which now follow the successful/failed return convention, and a new getLfnForPfn method, that replaces the eponymous methods in the FileCatalog and the ReplicaManager.

Also, it is now encouraged to call the StorageElement methods with an LFN rather than a PFN. If you give it a PFN, a warning will be issued.

Clone this wiki locally