DataStoreClient

Module that holds the DataStore Client class

class DIRAC.AccountingSystem.Client.DataStoreClient.DataStoreClient(retryGraceTime=0, **kwargs)

Bases: Client

Class providing front end access to DIRAC Accounting DataStore Service
  • It allows to reduce the interactions with the server by building and list of

pending Registers to be sent that are sent in a bundle using the commit method.
  • In case the DataStore is down Registers are sent as DISET requests.

__init__(retryGraceTime=0, **kwargs)

Simple constructor

Params int retryGraceTime:

the seconds to wait before sending records to the failover

addRegister(register)

Add a register to the list to be sent

Params BaseAccountingType register:

the accounting record to send.

property call

To be removed once we’re sure self.call has been removed

Type:

Deprecated

commit()

Send the registers in a bundle mode

commitRegisters(self, entriesList, **kwargs)

Add a record for a type

Automatically created for the service function export_commitRegisters()

Parameters:

entriesList – entriesList

compactDB(self, **kwargs)

Compact the db by grouping buckets

Automatically created for the service function export_compactDB()

delayedCommit()

If needed start a timer that will run the commit later allowing to send more registers at once (reduces overheads).

disableFailover()
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

getClientKWArgs()

Returns a copy of the connection arguments

getRegisteredTypes(self, **kwargs)

Get a list of registered types (Only for all powerful admins)

Automatically created for the service function export_getRegisteredTypes()

getServer()

Getter for the server url. Useful ?

httpsClient

alias of TornadoClient

regenerateBuckets(self, typeName, **kwargs)

Recalculate buckets. (Only for all powerful admins)

Automatically created for the service function export_regenerateBuckets()

Parameters:

typeName – typeName

registerType(self, typeName, definitionKeyFields, definitionAccountingFields, bucketsLength, **kwargs)

Register a new type. (Only for all powerful admins)

Automatically created for the service function export_registerType()

Parameters:
  • typeName – typeName

  • definitionKeyFields – definitionKeyFields

  • definitionAccountingFields – definitionAccountingFields

  • bucketsLength – bucketsLength

remove(register)

Remove a Register from the Accounting DataStore

removeRegisters(self, entriesList, **kwargs)

Remove a record for a type

Automatically created for the service function export_removeRegisters()

Parameters:

entriesList – entriesList

setBucketsLength(self, typeName, bucketsLength, **kwargs)

Change the buckets Length. (Only for all powerful admins)

Automatically created for the service function export_setBucketsLength()

Parameters:
  • typeName – typeName

  • bucketsLength – bucketsLength

setServer(url)

Set the server URL used by default

Parameters:

url – url of the service