DIPStorage

DIPStorage class is the client of the DIRAC Storage Element.

The following methods are available in the Service interface

getMetadata() get() getDir() put() putDir() remove()

class DIRAC.Resources.Storage.DIPStorage.DIPStorage(storageName, parameters)

Bases: DIRAC.Resources.Storage.StorageBase.StorageBase

DYNAMIC_OPTIONS = {}
PROTOCOL_PARAMETERS = ['Protocol', 'Host', 'Path', 'Port', 'SpaceToken', 'WSUrl']
__init__(storageName, parameters)
changeDirectory(directory)

Change the directory to the supplied directory

constructURLFromLFN(lfn, withWSUrl=False)

Construct URL from the given LFN according to the VO convention for the primary protocol of the storage plagin

Parameters:
  • lfn (str) – file LFN
  • withWSUrl (boolean) – flag to include the web service part into the resulting URL
Return result:

result[‘Value’] - resulting URL

createDirectory(path)

Create the remote directory

exists(path)

Check if the given path exists. The ‘path’ variable can be a string or a list of strings.

getCurrentDirectory()

Get the current directory

getCurrentURL(fileName)

Obtain the current file URL from the current working directory and the filename

Parameters:
  • self – self reference
  • fileName (str) – path on storage
getDirectory(path, localPath=False)

Get a local copy in the current directory of a physical file specified by its path

getDirectoryMetadata(path)

Get metadata associated to the directory

getDirectorySize(path)

Get the size of the contents of the directory

getEndpoint()
This will get endpoint of the storage. It basically is the same as getURLBase()
but without the basePath
Returns:‘proto://hostname<:port>’
getFile(path, localPath=False)

Get a local copy in the current directory of a physical file specified by its path

getFileMetadata(path)

Get metadata associated to the file

getFileSize(path)

Get size of supplied files

getName()

The name with which the storage was instantiated

getOccupancy(*parms, **kws)

Gets the DIPStorage occupancy info

Returns:S_OK/S_ERROR (free and total space, in MB)
getParameters()

Get the parameters with which the storage was instantiated

getTransportURL(pathDict, protocols)

Get a transport URL for a given URL. For a simple storage plugin it is just returning input URL if the plugin protocol is one of the requested protocols

Parameters:
  • pathDict (dict) – URL obtained from File Catalog or constructed according to convention
  • protocols (python:list) – a list of acceptable transport protocols in priority order
getURLBase(withWSUrl=False)

This will get the URL base. This is then appended with the LFN in DIRAC convention.

Parameters:
  • self – self reference
  • withWSUrl (bool) – flag to include Web Service part of the url
Returns:

URL

isDirectory(path)

Determine whether the path is a directory

isFile(path)

Determine whether the path is a directory

isNativeURL(url)

Check if URL :url: is valid for :self.protocol:

Parameters:
  • self – self reference
  • url (str) – URL
isOK()
isURL(path)

Guess if the path looks like a URL

Parameters:
  • self – self reference
  • path (string) – input file LFN or URL
Returns boolean:
 

True if URL, False otherwise

listDirectory(path)

List the contents of the directory

pinFile(*parms, **kws)

Pin the file on the destination storage element

prestageFile(*parms, **kws)

Issue prestage request for file

prestageFileStatus(*parms, **kws)

Obtain the status of the prestage request

putDirectory(path)

Put a local directory to the physical storage together with all its files and subdirectories.

putFile(path, sourceSize=0)

Put a file to the physical storage

releaseFile(*parms, **kws)

Release the file on the destination storage element

removeDirectory(path, recursive=False)

Remove a directory from the storage together with all its files and subdirectories.

removeFile(path)

Remove physically the file specified by its path

resetCurrentDirectory()

Reset the working directory to the base dir

setParameters(parameters)

Applying extra storage parameters

setStorageElement(se)
updateURL(url, withWSUrl=False)

Update the URL according to the current SE parameters