StorageElementProxyHandler
- mod:
StorageElementProxyHandler
This is used to get and put files from a remote storage.
- class DIRAC.DataManagementSystem.Service.StorageElementProxyHandler.HttpThread(port, path)
Bases:
Thread
- class HttpThread
Single daemon thread running HttpStorageAccessHandler.
- __init__(port, path)
c’tor
- property daemon
A boolean value indicating whether this thread is a daemon thread.
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 only daemon threads are left.
- getName()
Return a string used for identification purposes only.
This method is deprecated, use the name attribute instead.
- property ident
Thread identifier of this thread or None if it has not been started.
This is a nonzero integer. See the 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.
- isDaemon()
Return whether this thread is a daemon.
This method is deprecated, use the daemon attribute instead.
- 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. See also the module function enumerate().
- 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 is_alive() 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.
- property 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.
- property native_id
Native integral thread ID of this thread, or None if it has not been started.
This is a non-negative integer. See the get_native_id() function. This represents the Thread ID as reported by the kernel.
- run()
thread run
- setDaemon(daemonic)
Set whether this thread is a daemon.
This method is deprecated, use the .daemon property instead.
- setName(name)
Set the name string for this thread.
This method is deprecated, use the name attribute instead.
- 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:
RequestHandler
- class StorageElementProxyHandler
- __init__(handlerInitDict, trid)
Constructor
- Parameters:
handlerInitDict (dictionary) – Information vars for the service
trid (object) – Transport to use
- auth_ping = ['all']
- auth_refreshConfiguration = ['CSAdministrator']
- auth_whoami = ['all']
- export_callProxyMethod(se, name, args, kargs)
A generic method to call methods of the Storage Element.
- static export_echo(data)
This method is used for testing performance of the service
- Parameters:
data (str) – data to be sent back to the caller
- Returns:
S_OK, Value is the input data
- 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
- static export_refreshConfiguration(fromMaster)
Force refreshing the configuration data
- Parameters:
fromMaster (bool) – flag to refresh from the master configuration service
- export_uploadFile(se, pfn)
This method uploads a file present in the local cache to the specified storage element
- export_whoami()
A simple whoami, returns all credential dictionary, except certificate chain object.
- 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_getClientVersion()
- 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 = [(<class 'str'>,), (<class 'str'>,), <class 'list'>, <class 'dict'>]
- types_echo = [<class 'str'>]
- types_ping = []
- types_prepareFile = [(<class 'str'>,), (<class 'str'>,)]
- types_prepareFileForHTTP = [[<class 'str'>, <class 'list'>]]
- types_refreshConfiguration = [<class 'bool'>]
- types_uploadFile = [(<class 'str'>,), (<class 'str'>,)]
- types_whoami = []
- class DIRAC.DataManagementSystem.Service.StorageElementProxyHandler.ThreadedSocketServer(server_address, RequestHandlerClass, bind_and_activate=True)
Bases:
ThreadingMixIn
,TCPServer
bag dummy class to hold ThreadingMixIn and TCPServer
- __init__(server_address, RequestHandlerClass, bind_and_activate=True)
Constructor. May be extended, do not override.
- address_family = 2
- allow_reuse_address = False
- allow_reuse_port = False
- block_on_close = True
- close_request(request)
Called to clean up an individual request.
- daemon_threads = False
- fileno()
Return socket file number.
Interface required by selector.
- 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.
- service_actions()
Called by the serve_forever() loop.
May be overridden by a subclass / Mixin to implement any code that needs to be run during the loop.
- 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: