StorageManagerClient

Class that contains client access to the StorageManagerDB handler.

class DIRAC.StorageManagementSystem.Client.StorageManagerClient.StorageManagerClient(**kwargs)

Bases: DIRAC.Core.Base.Client.Client

This is the client to the StorageManager service, so even if it is not seen, it exposes all its RPC calls

__init__(**kwargs)

C’tor.

Parameters:kwargs – just stored as an attribute and passed when creating the RPCClient
executeRPC(*parms, **kws)

This method extracts some parameters from kwargs that are used as parameter of the constructor or RPCClient. Unfortunately, only a few of all the available parameters of BaseClient are exposed.

Parameters:
  • rpc – if an RPC client is passed, use that one
  • timeout – we can change the timeout on a per call bases. Default is self.timeout
  • url – We can specify which url to use
getAssociatedReplicas(self, replicaIDs, **kwargs)

Retrieve the list of Replicas that belong to the same Tasks as the provided list

Automatically created for the service function export_getAssociatedReplicas()

Parameters:replicaIDs – replicaIDs
getCacheReplicas(self, condDict, older, newer, timeStamp, orderAttribute, limit, **kwargs)

Get the replcias known to the DB.

Automatically created for the service function export_getCacheReplicas()

Parameters:
  • condDict – condDict
  • older – older
  • newer – newer
  • timeStamp – timeStamp
  • orderAttribute – orderAttribute
  • limit – limit
getCacheReplicasSummary(self, **kwargs)

Reports breakdown of file number/size in different staging states across storage elements

Automatically created for the service function export_getCacheReplicasSummary()

getOfflineReplicas(self, **kwargs)

This method obtains the replicas for which all replicas in the task are Offline

Automatically created for the service function export_getOfflineReplicas()

getReplicasWithStatus(self, status, **kwargs)

This method allows to retrieve replicas with the supplied status

Automatically created for the service function export_getReplicasWithStatus()

Parameters:status – status
getServer()

Getter for the server url. Useful ?

getStageRequests(self, condDict, older, newer, timeStamp, orderAttribute, limit, **kwargs)

Get the replcias known to the DB.

Automatically created for the service function export_getStageRequests()

Parameters:
  • condDict – condDict
  • older – older
  • newer – newer
  • timeStamp – timeStamp
  • orderAttribute – orderAttribute
  • limit – limit
getStageSubmittedReplicas(self, **kwargs)

This method obtains the replica metadata and the stage requestID for the replicas in StageSubmitted status

Automatically created for the service function export_getStageSubmittedReplicas()

getStagedReplicas(self, **kwargs)

This method obtains the replicas for which all replicas in the task are Staged/StageSubmitted

Automatically created for the service function export_getStagedReplicas()

getSubmittedStagePins(self, **kwargs)

This method obtains the number of files and size of the requests submitted for each storage element

Automatically created for the service function export_getSubmittedStagePins()

getTaskInfo(self, taskID, **kwargs)

Obtain the metadata of the stage task from the DB.

Automatically created for the service function export_getTaskInfo()

Parameters:taskID – taskID
getTaskStatus(self, taskID, **kwargs)

Obtain the status of the stage task from the DB.

Automatically created for the service function export_getTaskStatus()

Parameters:taskID – taskID
getTaskSummary(self, taskID, **kwargs)

Obtain the summary of the stage task from the DB.

Automatically created for the service function export_getTaskSummary()

Parameters:taskID – taskID
getTasks(self, condDict, older, newer, timeStamp, orderAttribute, limit, **kwargs)

Get the replicas known to the DB.

Automatically created for the service function export_getTasks()

Parameters:
  • condDict – condDict
  • older – older
  • newer – newer
  • timeStamp – timeStamp
  • orderAttribute – orderAttribute
  • limit – limit
getTasksWithStatus(self, status, **kwargs)

This method allows to retrieve Tasks with the supplied status

Automatically created for the service function export_getTasksWithStatus()

Parameters:status – status
getWaitingReplicas(self, **kwargs)

This method obtains the replicas for which all replicas in the task are Waiting

Automatically created for the service function export_getWaitingReplicas()

insertStageRequest(self, requestReplicas, pinLifetime, **kwargs)

This method inserts the stage request ID assocaited to supplied replicaIDs

Automatically created for the service function export_insertStageRequest()

Parameters:
  • requestReplicas – requestReplicas
  • pinLifetime – pinLifetime
killTasksBySourceTaskID(self, sourceTaskIDs, **kwargs)

Given SourceTaskIDs (jobIDs), this will cancel further staging of files for the corresponding tasks

Automatically created for the service function export_killTasksBySourceTaskID()

Parameters:sourceTaskIDs – sourceTaskIDs
removeStageRequests(self, replicaIDs, **kwargs)

Automatically created for the service function export_removeStageRequests()

Parameters:replicaIDs – replicaIDs
removeTasks(self, taskIDs, **kwargs)

This method removes the entries from TaskReplicas and Tasks with the supplied task IDs

Automatically created for the service function export_removeTasks()

Parameters:taskIDs – taskIDs
removeUnlinkedReplicas(self, **kwargs)

This method removes Replicas which have no associated Tasks

Automatically created for the service function export_removeUnlinkedReplicas()

setOldTasksAsFailed(self, daysOld, **kwargs)

Set Tasks older than “daysOld” number of days to Failed These tasks have already been retried every day for staging

Automatically created for the service function export_setOldTasksAsFailed()

Parameters:daysOld – daysOld
setRequest(self, lfnDict, source, callbackMethod, taskID, **kwargs)

This method allows stage requests to be set into the StagerDB

Automatically created for the service function export_setRequest()

Parameters:
  • lfnDict – lfnDict
  • source – source
  • callbackMethod – callbackMethod
  • taskID – taskID
setServer(url)

Set the server URL used by default

Parameters:url – url of the service
setStageComplete(self, replicaIDs, **kwargs)

This method updates the status of the stage request for the supplied replica IDs

Automatically created for the service function export_setStageComplete()

Parameters:replicaIDs – replicaIDs
setTasksDone(self, taskIDs, **kwargs)

This method sets the status in the Tasks table to Done for the list of supplied task IDs

Automatically created for the service function export_setTasksDone()

Parameters:taskIDs – taskIDs
setTimeout(**kwargs)

Specify the timeout of the call. Forwarded to RPCClient

param int timeout:
 timeout for the RPC calls

Deprecated: Please use self._getRPC(timeout) or self.timeout=<value>

updateReplicaFailure(self, replicaFailures, **kwargs)

This method sets the status of the replica to failed with the supplied reason

Automatically created for the service function export_updateReplicaFailure()

Parameters:replicaFailures – replicaFailures
updateReplicaInformation(self, replicaTuples, **kwargs)

This method sets the pfn and size for the supplied replicas

Automatically created for the service function export_updateReplicaInformation()

Parameters:replicaTuples – replicaTuples
updateReplicaStatus(self, replicaIDs, newReplicaStatus, **kwargs)

This allows to update the status of replicas

Automatically created for the service function export_updateReplicaStatus()

Parameters:
  • replicaIDs – replicaIDs
  • newReplicaStatus – newReplicaStatus
updateTaskStatus(self, sourceID, status, successful, failed, **kwargs)

An example to show the usage of the callbacks.

Automatically created for the service function export_updateTaskStatus()

Parameters:
  • sourceID – sourceID
  • status – status
  • successful – successful
  • failed – failed
wakeupOldRequests(self, oldRequests, retryInterval, **kwargs)

get only StageRequests with StageRequestSubmitTime older than 1 day AND are still not staged delete these requests reset Replicas with corresponding ReplicaIDs to Status=’New’

Automatically created for the service function export_wakeupOldRequests()

Parameters:
  • oldRequests – oldRequests
  • retryInterval – retryInterval
DIRAC.StorageManagementSystem.Client.StorageManagerClient.getFilesToStage(lfnList, jobState=None, checkOnlyTapeSEs=None, jobLog=None)

Utility that returns out of a list of LFNs those files that are offline, and those for which at least one copy is online