FreeDiskSpaceCommand

FreeDiskSpaceCommand The Command gets the free space that is left in a Storage Element

Note: there are, still, many references to “space tokens”, for example ResourceManagementClient().selectSpaceTokenOccupancyCache(token=elementName) This is for historical reasons, and shoud be fixed one day. For the moment, when you see “token” or “space token” here, just read “StorageElement”.

class DIRAC.ResourceStatusSystem.Command.FreeDiskSpaceCommand.FreeDiskSpaceCommand(args=None, clients=None)

Bases: Command

Uses diskSpace method to get the free space

__init__(args=None, clients=None)
doCache()

This is a method that gets the element’s details from the spaceTokenOccupancyCache DB table. It will return a dictionary with th results, converted to “correct” unit.

doCommand()

Real commands don’t need to extende/replace this method, which is called by clients.

What is done here is the following: if self.masterMode is set to True, then the “doMaster()” method is called. if not, then the doCache() method is called, and if this returns an object this is returned, and otherwise the “doNew” method is called.

doMaster()

This method calls the doNew method for each storage element that exists in the CS.

doNew(masterParams=None)

Gets the parameters to run, either from the master method or from its own arguments.

Gets the total and the free disk space of a storage element and inserts the results in the SpaceTokenOccupancyCache table of ResourceManagementDB database.

The result is also returned to the caller, not only inserted. What is inserted in the DB will normally be in MB, what is returned will be in the specified unit.

returnERROR(s_obj)

Overwrites S_ERROR message with command name, much easier to debug

returnSObj(s_obj)

Overwrites S_ERROR message with command name, much easier to debug