def step(self): """ Using the workingdir attribute has to find the HD and then get the available free space.""" usage = disk_usage(self.workingDir) self.storeUsageData(usage) # Stats line readable: free = prettySize(usage.free) total = prettySize(usage.total) used = prettySize(usage.used) # Free space in GB freeGB = usage.free / (1024.0**3.0) # Notify only if free space is bellow the threshold in GB if freeGB < self.minimumFreeSpace: self.notify( "WARNING: There is only %s left for %s" % (free, self.workingDir), "Free: %s, Total: %s, Used: %s, Threshold: %s" % (free, total, used, self.minimumFreeSpace))
def getSizeStr(self): """ Return a human readable string of the file size.""" return prettySize(self.getSize()) if self._stat else '0'
def getSize(self): """ Return a human readable string of the file size.""" return prettySize(self._stat.st_size) if self._stat else 0
def __repr__(self): return "%s: %d (%s)" % (self.ext, len(self), pwutils.prettySize(self.size()))