Commit e34b36b5 authored by Manuela Kuhn's avatar Manuela Kuhn
Browse files

Added option to enable clean up thread

parent d178e84d
......@@ -73,6 +73,11 @@ monitoredFormats = [".tif", ".cbf"]
# (needed if eventDetector is InotifyxDetector or HttpDetector)
historySize = 0
# Flag describing if a clean up thread which regularly checks
# if some files were missed should be activated
# (needed if eventDetector is InotifyxDetector)
useCleanUp = False
# Time (in seconds) since last modification after which a file will be seen as closed
# (needed if eventDetector is WatchdogDetector)
timeTillClosed = 2
......
......@@ -114,6 +114,7 @@ def argumentParsing():
monitoredFormats = json.loads(config.get('asection', 'monitoredFormats'))
# for InotifyxDetector:
historySize = config.getint('asection', 'historySize')
useCleanUp = config.getboolean('asection', 'useCleanUp')
# for WatchdogDetector:
timeTillClosed = config.getfloat('asection', 'timeTillClosed')
# for ZmqDetector:
......@@ -151,6 +152,12 @@ def argumentParsing():
(needed if eventDetector is InotifyxDetector; default=" + str(historySize) + ")",
default = historySize)
parser.add_argument("--useCleanUp" , type = bool,
help = "Flag describing if a clean up thread which regularly checks \
if some files were missed should be activated \
(needed if eventDetector is InotifyxDetector; default=" + str(useCleanUp) + ")",
default = useCleanUp )
parser.add_argument("--timeTillClosed" , type = float,
help = "Time (in seconds) since last modification after which a file will be seen as closed \
(only needed if eventDetectorType is WatchdogDetector; default=" + str(timeTillClosed) + ")",
......@@ -392,7 +399,10 @@ class DataManager():
"monSubdirs" : arguments.fixSubdirs,
"monSuffixes" : arguments.monitoredFormats,
"timeout" : 1,
"historySize" : arguments.historySize
"historySize" : arguments.historySize,
"useCleanUp" : arguments.useCleanUp,
"cleanUpTime" : 5,
"actionTime" : 120
}
elif arguments.eventDetectorType == "WatchdogDetector":
self.eventDetectorConfig = {
......
......@@ -239,7 +239,10 @@ class EventDetector():
not config.has_key("monEventType") or
not config.has_key("monSuffixes") or
not config.has_key("timeout") or
not config.has_key("historySize") ):
not config.has_key("historySize") or
not config.has_key("useCleanUp") or
not config.has_key("cleanUpTime") or
not config.has_key("actionTime") ):
self.log.error ("Configuration of wrong format")
self.log.debug ("config="+ str(config))
checkPassed = False
......@@ -262,15 +265,16 @@ class EventDetector():
self.history = collections.deque(maxlen=config["historySize"])
self.cleanUpTime = 5
self.actionTime = 120
self.cleanUpTime = config["cleanUpTime"]
self.actionTime = config["actionTime"]
self.lock = threading.Lock()
self.add_watch()
self.cleanupThread = CleanUp(self.paths, self.monSubdirs, self.monSuffixes, self.cleanUpTime, self.actionTime, self.lock, logQueue)
self.cleanupThread.start()
if config["useCleanUp"]:
self.cleanupThread = CleanUp(self.paths, self.monSubdirs, self.monSuffixes, self.cleanUpTime, self.actionTime, self.lock, logQueue)
self.cleanupThread.start()
def get_events (self, fd, *args):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment