StorageElementProxyHandler

mod:StorageElementProxyHandler

This is used to get and put files from a remote storage.

class DIRAC.DataManagementSystem.Service.StorageElementProxyHandler.HttpThread(port, path)

Bases: threading.Thread

class HttpThread

Single daemon thread running HttpStorageAccessHandler.

daemon

A boolean value indicating whether this thread is a daemon thread (True) or not (False).

This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.

The entire Python program exits when no alive non-daemon threads are left.

getName()
ident

Thread identifier of this thread or None if it has not been started.

This is a nonzero integer. See the thread.get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited.

isAlive()

Return whether the thread is alive.

This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads.

isDaemon()
is_alive()

Return whether the thread is alive.

This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads.

join(timeout=None)

Wait until the thread terminates.

This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception or until the optional timeout occurs.

When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call isAlive() after join() to decide whether a timeout happened – if the thread is still alive, the join() call timed out.

When the timeout argument is not present or None, the operation will block until the thread terminates.

A thread can be join()ed many times.

join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.

name

A string used for identification purposes only.

It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.

run()

thread run

setDaemon(daemonic)
setName(name)
start()

Start the thread’s activity.

It must be called at most once per thread object. It arranges for the object’s run() method to be invoked in a separate thread of control.

This method will raise a RuntimeError if called more than once on the same thread object.

class DIRAC.DataManagementSystem.Service.StorageElementProxyHandler.StorageElementProxyHandler(handlerInitDict, trid)

Bases: DIRAC.Core.DISET.RequestHandler.RequestHandler

class StorageElementProxyHandler
exception ConnectionError(msg)

Bases: exceptions.Exception

args
message
auth_ping = ['all']
export_callProxyMethod(se, name, args, kargs)

A generic method to call methods of the Storage Element.

export_ping()
export_prepareFile(se, pfn)

This method simply gets the file to the local storage area

export_prepareFileForHTTP(lfn)

This method simply gets the file to the local storage area using LFN

export_uploadFile(se, pfn)

This method uploads a file present in the local cache to the specified storage element

classmethod getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
initialize()

Initialize this instance of the handler (to be overwritten)

srv_disconnect(trid=None)
classmethod srv_disconnectClient(trid)
srv_getActionTuple()
classmethod srv_getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
srv_getClientSetup()
srv_getClientVO()
srv_getFormattedRemoteCredentials()
classmethod srv_getMonitor()
srv_getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
srv_getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
classmethod srv_getServiceName()
srv_getTransportID()
classmethod srv_getURL()
classmethod srv_msgCreate(msgName)
srv_msgReply(msgObj)
classmethod srv_msgSend(trid, msgObj)
transfer_bulkFromClient(bulkId, token, bulkSize, fileHelper)
transfer_bulkToClient(bulkId, token, fileHelper)
transfer_fromClient(fileID, token, fileSize, fileHelper)

Method to receive file from clients. fileID is the local file name in the SE. fileSize can be Xbytes or -1 if unknown. token is used for access rights confirmation.

transfer_listBulk(bulkId, token, fileHelper)
transfer_toClient(fileID, token, fileHelper)

Method to send files to clients. fileID is the local file name in the SE. token is used for access rights confirmation.

types_callProxyMethod = [(<type 'str'>, <type 'unicode'>), (<type 'str'>, <type 'unicode'>), <type 'list'>, <type 'dict'>]
types_ping = []
types_prepareFile = [(<type 'str'>, <type 'unicode'>), (<type 'str'>, <type 'unicode'>)]
types_prepareFileForHTTP = [[<type 'str'>, <type 'unicode'>, <type 'list'>]]
types_uploadFile = [(<type 'str'>, <type 'unicode'>), (<type 'str'>, <type 'unicode'>)]
class DIRAC.DataManagementSystem.Service.StorageElementProxyHandler.ThreadedSocketServer(server_address, RequestHandlerClass, bind_and_activate=True)

Bases: SocketServer.ThreadingMixIn, SocketServer.TCPServer

bag dummy class to hold ThreadingMixIn and TCPServer

address_family = 2
allow_reuse_address = False
close_request(request)

Called to clean up an individual request.

daemon_threads = False
fileno()

Return socket file number.

Interface required by select().

finish_request(request, client_address)

Finish one request by instantiating RequestHandlerClass.

get_request()

Get the request and client address from the socket.

May be overridden.

handle_error(request, client_address)

Handle an error gracefully. May be overridden.

The default is to print a traceback and continue.

handle_request()

Handle one request, possibly blocking.

Respects self.timeout.

handle_timeout()

Called if no new request arrives within self.timeout.

Overridden by ForkingMixIn.

process_request(request, client_address)

Start a new thread to process the request.

process_request_thread(request, client_address)

Same as in BaseServer but as a thread.

In addition, exception handling is done here.

request_queue_size = 5
serve_forever(poll_interval=0.5)

Handle one request at a time until shutdown.

Polls for shutdown every poll_interval seconds. Ignores self.timeout. If you need to do periodic tasks, do them in another thread.

server_activate()

Called by constructor to activate the server.

May be overridden.

server_bind()

Called by constructor to bind the socket.

May be overridden.

server_close()

Called to clean-up the server.

May be overridden.

shutdown()

Stops the serve_forever loop.

Blocks until the loop has finished. This must be called while serve_forever() is running in another thread, or it will deadlock.

shutdown_request(request)

Called to shutdown and close an individual request.

socket_type = 1
timeout = None
verify_request(request, client_address)

Verify the request. May be overridden.

Return True if we should proceed with this request.

DIRAC.DataManagementSystem.Service.StorageElementProxyHandler.initializeStorageElementProxyHandler(serviceInfo)

handler initialisation

DIRAC.DataManagementSystem.Service.StorageElementProxyHandler.purgeCacheDirectory(path)

del recursively :path: