CMS 3D CMS Logo

Functions | Variables
producerFileCleanner Namespace Reference

Functions

def getDirSize (path)
 
def getDiskUsage (path)
 
def logme (msg, args)
 
def sendmail (body="Hello from producerFileCleanner", subject="Hello!")
 

Variables

 aDelQuota
 
 COLLECTDIR
 
 delQuota
 
 destDir
 
 DIR_LIST
 
 diskPUsage
 
 diskSize
 
 diskUsed
 
 doneSize
 
 EMAIL
 
 EMAILINTERVAL
 
 EXEDIR
 
 FILE_LIST
 
 files
 
 fMatch
 
 fullFName
 
 fullSdName
 
 HOSTNAME
 
 key
 
 lastEmailSent
 
 msg
 
 now
 
 ORIGINALDONEDIR
 
 PRODUCER_DU_BOT
 
 PRODUCER_DU_TOP
 
 quota
 
 reverse
 
 run
 
 SENDMAIL
 
 stdout
 
 STOP_FILE
 
 subSystem
 
 TFILEDONEDIR
 
 TMP_LIST
 
 topdown
 
 True
 
 userAvailable
 
 WAITTIME
 

Function Documentation

◆ getDirSize()

def producerFileCleanner.getDirSize (   path)

Definition at line 41 of file producerFileCleanner.py.

41 def getDirSize(path):
42  import stat
43  size=os.stat(path).st_blksize
44  for directory,subdirs,files in os.walk(path):
45  dStats=os.lstat(directory)
46  size+=(dStats[stat.ST_NLINK]-1)*dStats[stat.ST_SIZE]
47  for f in files:
48  fStats=os.lstat("%s/%s" % (directory,f))
49  fSize=fStats[stat.ST_SIZE]
50  size+=fSize
51 
52  return size
53 

◆ getDiskUsage()

def producerFileCleanner.getDiskUsage (   path)

Definition at line 33 of file producerFileCleanner.py.

References dqmMemoryStats.float.

33 def getDiskUsage(path):
34  fsStats=os.statvfs(path)
35  size=fsStats.f_bsize*fsStats.f_blocks
36  available=fsStats.f_bavail*fsStats.f_bsize
37  used=size-available
38  usedPer=float(used)/size
39  return (size,available,used,usedPer)
40 

◆ logme()

def producerFileCleanner.logme (   msg,
  args 
)

Definition at line 29 of file producerFileCleanner.py.

References print().

Referenced by sendmail().

29 def logme(msg, *args):
30  procid = "[%s/%d]" % (__file__.rsplit("/", 1)[-1], os.getpid())
31  print(datetime.now(), procid, msg % args)
32 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ sendmail()

def producerFileCleanner.sendmail (   body = "Hello from producerFileCleanner",
  subject = "Hello!" 
)

Definition at line 54 of file producerFileCleanner.py.

References logme().

54 def sendmail(body="Hello from producerFileCleanner",subject= "Hello!"):
55  scall = Popen("%s -t" % SENDMAIL, shell=True, stdin=PIPE)
56  scall.stdin.write("To: %s\n" % EMAIL)
57  scall.stdin.write("Subject: producerFileCleaner problem on server %s\n" %
58  HOSTNAME)
59  scall.stdin.write("\n") # blank line separating headers from body
60  scall.stdin.write("%s\n" % body)
61  scall.stdin.close()
62  rc = scall.wait()
63  if rc != 0:
64  logme("ERROR: Sendmail exit with status %s", rc)
65 
66 # --------------------------------------------------------------------
def sendmail(body="Hello from producerFileCleanner", subject="Hello!")

Variable Documentation

◆ aDelQuota

producerFileCleanner.aDelQuota

Definition at line 102 of file producerFileCleanner.py.

◆ COLLECTDIR

producerFileCleanner.COLLECTDIR

Definition at line 12 of file producerFileCleanner.py.

◆ delQuota

producerFileCleanner.delQuota

Definition at line 88 of file producerFileCleanner.py.

◆ destDir

producerFileCleanner.destDir

Definition at line 111 of file producerFileCleanner.py.

◆ DIR_LIST

producerFileCleanner.DIR_LIST

Definition at line 168 of file producerFileCleanner.py.

◆ diskPUsage

producerFileCleanner.diskPUsage

Definition at line 76 of file producerFileCleanner.py.

◆ diskSize

producerFileCleanner.diskSize

Definition at line 76 of file producerFileCleanner.py.

◆ diskUsed

producerFileCleanner.diskUsed

Definition at line 76 of file producerFileCleanner.py.

◆ doneSize

producerFileCleanner.doneSize

Definition at line 75 of file producerFileCleanner.py.

◆ EMAIL

producerFileCleanner.EMAIL

Definition at line 10 of file producerFileCleanner.py.

◆ EMAILINTERVAL

producerFileCleanner.EMAILINTERVAL

Definition at line 19 of file producerFileCleanner.py.

◆ EXEDIR

producerFileCleanner.EXEDIR

Definition at line 22 of file producerFileCleanner.py.

◆ FILE_LIST

producerFileCleanner.FILE_LIST

Definition at line 103 of file producerFileCleanner.py.

◆ files

producerFileCleanner.files

Definition at line 106 of file producerFileCleanner.py.

◆ fMatch

producerFileCleanner.fMatch

Definition at line 107 of file producerFileCleanner.py.

◆ fullFName

producerFileCleanner.fullFName

Definition at line 112 of file producerFileCleanner.py.

◆ fullSdName

producerFileCleanner.fullSdName

Definition at line 134 of file producerFileCleanner.py.

◆ HOSTNAME

producerFileCleanner.HOSTNAME

Definition at line 21 of file producerFileCleanner.py.

◆ key

producerFileCleanner.key

Definition at line 106 of file producerFileCleanner.py.

◆ lastEmailSent

producerFileCleanner.lastEmailSent

Definition at line 26 of file producerFileCleanner.py.

◆ msg

producerFileCleanner.msg

Definition at line 92 of file producerFileCleanner.py.

◆ now

producerFileCleanner.now

Definition at line 90 of file producerFileCleanner.py.

◆ ORIGINALDONEDIR

producerFileCleanner.ORIGINALDONEDIR

Definition at line 13 of file producerFileCleanner.py.

◆ PRODUCER_DU_BOT

producerFileCleanner.PRODUCER_DU_BOT

Definition at line 17 of file producerFileCleanner.py.

◆ PRODUCER_DU_TOP

producerFileCleanner.PRODUCER_DU_TOP

Definition at line 16 of file producerFileCleanner.py.

◆ quota

producerFileCleanner.quota

Definition at line 87 of file producerFileCleanner.py.

◆ reverse

producerFileCleanner.reverse

Definition at line 163 of file producerFileCleanner.py.

◆ run

producerFileCleanner.run

Definition at line 110 of file producerFileCleanner.py.

◆ SENDMAIL

producerFileCleanner.SENDMAIL

Definition at line 20 of file producerFileCleanner.py.

◆ stdout

producerFileCleanner.stdout

Definition at line 8 of file producerFileCleanner.py.

◆ STOP_FILE

producerFileCleanner.STOP_FILE

Definition at line 23 of file producerFileCleanner.py.

◆ subSystem

producerFileCleanner.subSystem

Definition at line 109 of file producerFileCleanner.py.

◆ TFILEDONEDIR

producerFileCleanner.TFILEDONEDIR

Definition at line 11 of file producerFileCleanner.py.

◆ TMP_LIST

producerFileCleanner.TMP_LIST

Definition at line 162 of file producerFileCleanner.py.

◆ topdown

producerFileCleanner.topdown

Definition at line 135 of file producerFileCleanner.py.

◆ True

producerFileCleanner.True

Definition at line 163 of file producerFileCleanner.py.

◆ userAvailable

producerFileCleanner.userAvailable

Definition at line 76 of file producerFileCleanner.py.

◆ WAITTIME

producerFileCleanner.WAITTIME

Definition at line 18 of file producerFileCleanner.py.