CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
producerFileCleanner Namespace Reference

Functions

def getDirSize
 
def getDiskUsage
 
def logme
 
def sendmail
 

Variables

int aDelQuota = 0
 
list COLLECTDIR = sys.argv[3]
 
 delQuota = diskUsed-quota
 
string destDir = "%s/%sxxxx/%sxx/DQM_V0001_%s_R%s.root"
 
list DIR_LIST = []
 
tuple doneSize = getDirSize(TFILEDONEDIR)
 
list EMAIL = sys.argv[1]
 
int EMAILINTERVAL = 15
 
tuple EXEDIR = os.path.dirname(__file__)
 
list FILE_LIST = []
 
tuple fMatch = re.match(r"(DQM|Playback|Playback_full)_V[0-9]{4}_([0-9a-zA-Z]+)_R([0-9]{9})(_T[0-9]{8}|)\.root",f)
 
string fullFName = "%s/%s"
 
string fullSdName = "%s/%s"
 
tuple HOSTNAME = socket.gethostname()
 
int lastEmailSent = 0
 
string msg = "ERROR: Something is filling up the disks, %s does not"
 
tuple now = time.time()
 
list ORIGINALDONEDIR = sys.argv[4]
 
float PRODUCER_DU_BOT = 50.0
 
float PRODUCER_DU_TOP = 90.0
 
tuple quota = long(diskSize*PRODUCER_DU_BOT/100)
 
tuple run = fMatch.group(3)
 
string SENDMAIL = "/usr/sbin/sendmail"
 
string STOP_FILE = "%s/.stop"
 
tuple subSystem = fMatch.group(2)
 
list TFILEDONEDIR = sys.argv[2]
 
tuple TMP_LIST = glob.glob("%s/*.tmp" % COLLECTDIR)
 
int WAITTIME = 3600
 

Function Documentation

def producerFileCleanner.getDirSize (   path)

Definition at line 40 of file producerFileCleanner.py.

40 
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
def producerFileCleanner.getDiskUsage (   path)

Definition at line 32 of file producerFileCleanner.py.

32 
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)
def producerFileCleanner.logme (   msg,
  args 
)

Definition at line 28 of file producerFileCleanner.py.

Referenced by sendmail().

28 
29 def logme(msg, *args):
30  procid = "[%s/%d]" % (__file__.rsplit("/", 1)[-1], os.getpid())
31  print datetime.now(), procid, msg % args
def producerFileCleanner.sendmail (   body = "Hello from producerFileCleanner",
  subject = "Hello!" 
)

Definition at line 53 of file producerFileCleanner.py.

References logme().

53 
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 
# --------------------------------------------------------------------

Variable Documentation

int producerFileCleanner.aDelQuota = 0

Definition at line 101 of file producerFileCleanner.py.

list producerFileCleanner.COLLECTDIR = sys.argv[3]

Definition at line 11 of file producerFileCleanner.py.

producerFileCleanner.delQuota = diskUsed-quota

Definition at line 87 of file producerFileCleanner.py.

string producerFileCleanner.destDir = "%s/%sxxxx/%sxx/DQM_V0001_%s_R%s.root"

Definition at line 110 of file producerFileCleanner.py.

list producerFileCleanner.DIR_LIST = []

Definition at line 167 of file producerFileCleanner.py.

int producerFileCleanner.doneSize = getDirSize(TFILEDONEDIR)

Definition at line 74 of file producerFileCleanner.py.

list producerFileCleanner.EMAIL = sys.argv[1]

Definition at line 9 of file producerFileCleanner.py.

int producerFileCleanner.EMAILINTERVAL = 15

Definition at line 18 of file producerFileCleanner.py.

tuple producerFileCleanner.EXEDIR = os.path.dirname(__file__)

Definition at line 21 of file producerFileCleanner.py.

list producerFileCleanner.FILE_LIST = []

Definition at line 102 of file producerFileCleanner.py.

tuple producerFileCleanner.fMatch = re.match(r"(DQM|Playback|Playback_full)_V[0-9]{4}_([0-9a-zA-Z]+)_R([0-9]{9})(_T[0-9]{8}|)\.root",f)

Definition at line 106 of file producerFileCleanner.py.

string producerFileCleanner.fullFName = "%s/%s"

Definition at line 111 of file producerFileCleanner.py.

string producerFileCleanner.fullSdName = "%s/%s"

Definition at line 133 of file producerFileCleanner.py.

tuple producerFileCleanner.HOSTNAME = socket.gethostname()

Definition at line 20 of file producerFileCleanner.py.

producerFileCleanner.lastEmailSent = 0

Definition at line 25 of file producerFileCleanner.py.

string producerFileCleanner.msg = "ERROR: Something is filling up the disks, %s does not"

Definition at line 91 of file producerFileCleanner.py.

Referenced by FWGUIEventDataAdder.addNewItem(), DDXMLElement.appendText(), edm::service::ELdestination.changeFile(), edm::PrintEventSetupDataRetrieval.check(), edm::service::ELdestination.clearSummary(), dqmservices::DQMFileIterator.collect(), cond::DecodingKey.createFromInputFile(), DDI::Specific.createPartSelections(), cond::RelationalAuthenticationService::RelationalAuthenticationService.credentials(), edm::JobReport.dumpFiles(), HLTScalersClient.endLuminosityBlock(), DDLMap.errorOut(), RPCConst.etaFromTowerNum(), PSFitter::HybridMinimizer.ExamineMinimum(), cond::DecodingKey.flush(), edm::service::ELdestination.flush(), DDXMLElement.get(), DDXMLElement.getDDName(), EcalCondDBInterface.getEcalLogicID(), dqmservices::DQMStreamerReader.getEventMsg(), cond.getLoginName(), evf::EvFDaqDirector.getStreamDestinations(), DDXMLElement.getText(), cond::CredentialStore.importForPrincipal(), triggerExpression::PathReader.init(), cond::DecodingKey.init(), cond::CredentialStore.installAdmin(), RPCConst.iptFromPt(), dqmservices::DQMFileIterator.logLumiState(), ora::ContainerSchema.mapping(), MuonDDDConstants.MuonDDDConstants(), DQMNet.onPeerData(), FWFileEntry.openFile(), QualityTester.performTests(), edm::PrintEventSetupContent.print(), egHLT::TrigCodes.printCodes(), DDLTubs.processElement(), DDLTrapezoid.processElement(), DDLPolyGenerator.processElement(), DDLAlgoPosPart.processElement(), DDLRotationAndReflection.processElement(), DDLCompositeMaterial.processElement(), DDLVector.processElement(), DDLRotationByAxis.processOne(), RPCConst.ptFromIpt(), cond::SQLReport.putOnFile(), cond::FileReader.read(), readRemote(), RecoProducerFP420.RecoProducerFP420(), DQMNet.releaseFromWait(), CmsShowMainBase.reloadConfiguration(), cond::CredentialStore.removeConnection(), cond::CredentialStore.removePrincipal(), edm::JobReport.reportAnalysisFile(), edm::JobReport.reportError(), edm::JobReport.reportFallbackAttempt(), edm::JobReport.reportMemoryInfo(), edm::JobReport.reportMessageInfo(), edm::JobReport.reportPerformanceForModule(), edm::JobReport.reportPerformanceSummary(), edm::JobReport.reportRandomStateFile(), edm::JobReport.reportSkippedEvent(), edm::JobReport.reportSkippedFile(), DQMNet.requestObjectData(), DQMFileSaver.saveForOffline(), DCCTBBlockPrototype.seeIfIsPossibleToIncrement(), DQMImplNet< DQMNet::Object >.sendObjectListToPeers(), CmsShowMainBase.sendVersionInfo(), edm::StreamerOutputModuleBase.serializeEvent(), cond::CredentialStore.setPermission(), Tm.setToString(), cond::CredentialStore.setUpForService(), TrackingRecHit.sharesInput(), edm::service::ELdestination.summarization(), edm::service::ELdestination.summary(), DDXMLElement.throwError(), cond::CredentialStore.unsetPermission(), dqmservices::DQMFileIterator.update_state(), edm::StreamerOutputModuleBase.write(), and RawEventOutputModuleForBU< Consumer >.write().

tuple producerFileCleanner.now = time.time()

Definition at line 89 of file producerFileCleanner.py.

list producerFileCleanner.ORIGINALDONEDIR = sys.argv[4]

Definition at line 12 of file producerFileCleanner.py.

float producerFileCleanner.PRODUCER_DU_BOT = 50.0

Definition at line 16 of file producerFileCleanner.py.

float producerFileCleanner.PRODUCER_DU_TOP = 90.0

Definition at line 15 of file producerFileCleanner.py.

tuple producerFileCleanner.quota = long(diskSize*PRODUCER_DU_BOT/100)

Definition at line 86 of file producerFileCleanner.py.

tuple producerFileCleanner.run = fMatch.group(3)

Definition at line 109 of file producerFileCleanner.py.

string producerFileCleanner.SENDMAIL = "/usr/sbin/sendmail"

Definition at line 19 of file producerFileCleanner.py.

string producerFileCleanner.STOP_FILE = "%s/.stop"

Definition at line 22 of file producerFileCleanner.py.

tuple producerFileCleanner.subSystem = fMatch.group(2)

Definition at line 108 of file producerFileCleanner.py.

list producerFileCleanner.TFILEDONEDIR = sys.argv[2]

Definition at line 10 of file producerFileCleanner.py.

tuple producerFileCleanner.TMP_LIST = glob.glob("%s/*.tmp" % COLLECTDIR)

Definition at line 161 of file producerFileCleanner.py.

int producerFileCleanner.WAITTIME = 3600

Definition at line 17 of file producerFileCleanner.py.