diff --git a/conf/dataManager.conf b/conf/dataManager.conf index d22a9a535524693ef7394e32eca64930053d9292..17938025b3ee98fa5462da07169d1ede16c510e4 100644 --- a/conf/dataManager.conf +++ b/conf/dataManager.conf @@ -8,10 +8,10 @@ localTarget = /space/projects/live-viewer/data/target #localTarget = /home/kuhnm/Arbeit/live-viewer/data/target #localTarget = /gpfs -# Type of event detector to use (options are: inotifyx) +# Type of event detector to use (options are: inotifyx, watchdog) #eventDetectorType = inotifyx eventDetectorType = watchdog -# Event type of files to be monitored (options are: "IN_CLOSE_WRITE", "IN_MOVED_TO", ...) +# Event type of files to be monitored (options are: IN_CLOSE_WRITE, IN_MOVED_TO, ...) monitoredEventType = IN_CLOSE_WRITE #monitoredEventType = IN_MOVED_TO # Subdirectories of watchDir to be monitored diff --git a/src/DataManager.py b/src/DataManager.py index 2a5ac816f1904b7382caa6a1077fb43ff33a992a..33a4d9a75a368911b2606a3c0d443b9cf6d4d7d0 100644 --- a/src/DataManager.py +++ b/src/DataManager.py @@ -271,8 +271,10 @@ if __name__ == '__main__': from shutil import copyfile from subprocess import call + + logfile = BASE_PATH + os.sep "logs" + os.sep + "dataManager_test.log" #enable logging - helpers.initLogging(BASE_PATH + "/logs/dataManager_test.log", verbose=True, onScreenLogLevel="debug") + helpers.initLogging(logfile, verbose=True, onScreenLogLevel="debug") class Test_Receiver_Stream(): def __init__(self, comPort, fixedRecvPort, receivingPort, receivingPort2): @@ -344,8 +346,8 @@ if __name__ == '__main__': testPr = Process ( target = Test_Receiver_Stream, args = (comPort, fixedRecvPort, receivingPort, receivingPort2)) testPr.start() - sourceFile = BASE_PATH + "/test_file.cbf" - targetFileBase = BASE_PATH + "/data/source/local/raw/" + sourceFile = BASE_PATH + os.sep + "test_file.cbf" + targetFileBase = BASE_PATH + os.sep + "data" + os.sep + "source" + os.sep + "local" + os.sep + "raw" + os.sep i = 100 @@ -371,7 +373,7 @@ if __name__ == '__main__': else: pass except Exception as e: - self.log.error("Exception detected: " + str(e)) + logging.error("Exception detected: " + str(e)) finally: if test: testPr.terminate() diff --git a/src/sender/DataDispatcher.py b/src/sender/DataDispatcher.py index 3c59e37e0876da2d12bda5bf56dd0ac58c589232..c204a6d34485de6dc76f0edc63f31dc0117c3fbe 100644 --- a/src/sender/DataDispatcher.py +++ b/src/sender/DataDispatcher.py @@ -390,11 +390,16 @@ if __name__ == '__main__': import time from shutil import copyfile + logfile = BASE_PATH + os.sep + "logs" + os.sep + "dataDispatcher.log" + #enable logging - helpers.initLogging(BASE_PATH + "/logs/dataDispatcher.log", verbose=True, onScreenLogLevel="debug") + helpers.initLogging(logfile, verbose=True, onScreenLogLevel="debug") + + sourceFile = BASE_PATH + os.sep + "test_file.cbf" + targetFile = BASE_PATH + os.sep + "data" + os.sep + "source" + os.sep + "local" + os.sep + "raw" + os.sep "100.cbf" - copyfile(BASE_PATH + "/test_file.cbf", BASE_PATH + "/data/source/local/raw/100.cbf") + copyfile(sourceFile, targetFile) time.sleep(0.5) @@ -403,7 +408,7 @@ if __name__ == '__main__': receivingPort2 = "6006" chunkSize = 10485760 ; # = 1024*1024*10 = 10 MiB - localTarget = BASE_PATH + "/data/target" + localTarget = BASE_PATH + os.sep + "data" + os.sep + "target" fixedStreamId = False fixedStreamId = "zitpcx19282:6006" @@ -429,8 +434,8 @@ if __name__ == '__main__': metadata = { - "sourcePath" : BASE_PATH + "/data/source", - "relativePath": "/local/raw", + "sourcePath" : BASE_PATH + os.sep +"data" + os.sep + "source", + "relativePath": os.sep + "local" + os.sep + "raw", "filename" : "100.cbf" } targets = [['zitpcx19282:6005', 1], ['zitpcx19282:6006', 0]] diff --git a/src/sender/InotifyxDetector.py b/src/sender/InotifyxDetector.py index ae5bfa5b9a48fa488ea9f9fad565d916edad6781..4028f27524350f26bc04879f53f0d76fd20fd3e6 100644 --- a/src/sender/InotifyxDetector.py +++ b/src/sender/InotifyxDetector.py @@ -319,7 +319,7 @@ if __name__ == '__main__': import helpers - logfilePath = BASE_PATH + "/logs/inotifyDetector.log" + logfilePath = BASE_PATH + os.sep + "logs" + os.sep + "inotifyDetector.log" verbose = True onScreen = "debug" @@ -328,7 +328,7 @@ if __name__ == '__main__': config = { "eventDetectorType" : "inotifyx", - "monDir" : BASE_PATH + "/data/source", + "monDir" : BASE_PATH + os.sep + "data" + os.sep + "source", "monEventType" : "IN_CLOSE_WRITE", "monSubdirs" : ["commissioning", "current", "local"], "monSuffixes" : [".tif", ".cbf"] @@ -336,8 +336,8 @@ if __name__ == '__main__': eventDetector = InotifyxDetector(config) - sourceFile = BASE_PATH + "/test_file.cbf" - targetFileBase = BASE_PATH + "/data/source/local/raw/" + sourceFile = BASE_PATH + os.sep + "test_file.cbf" + targetFileBase = BASE_PATH + os.sep + "data" + os.sep + "source" + os.sep + "local" + os.sep + "raw" + os.sep i = 100 while True: diff --git a/src/sender/SignalHandler.py b/src/sender/SignalHandler.py index 688a1e4e4425021c829601b0af048535d5445d0e..8693dfa737756128feb2acac7786685ae983f499 100644 --- a/src/sender/SignalHandler.py +++ b/src/sender/SignalHandler.py @@ -370,8 +370,10 @@ if __name__ == '__main__': self.requestFwSocket.close(0) self.context.destroy() + BASE_PATH = os.path.dirname ( os.path.dirname ( os.path.dirname ( os.path.realpath ( __file__ ) ))) - helpers.initLogging("/space/projects/live-viewer/logs/signalHandler.log", verbose=True, onScreenLogLevel="debug") + logfile = BASE_PATH + os.sep + "logs" + os.sep + "signalHandler.log" + helpers.initLogging(logfile, verbose=True, onScreenLogLevel="debug") whiteList = ["localhost", "zitpcx19282"] diff --git a/src/sender/TaskProvider.py b/src/sender/TaskProvider.py index 0dcdac7793093eecc8f5e2203f247ce043cbb657..176a60bb6289cd598709bf1206941af1d4fa6535 100644 --- a/src/sender/TaskProvider.py +++ b/src/sender/TaskProvider.py @@ -234,12 +234,14 @@ if __name__ == '__main__': self.requestFwSocket.close(0) self.context.destroy() + logfile = BASE_PATH + os.sep + "logs" + os.sep + "taskProvider.log" + #enable logging - helpers.initLogging(BASE_PATH + "/logs/taskProvider.log", verbose=True, onScreenLogLevel="debug") + helpers.initLogging(logfile, verbose=True, onScreenLogLevel="debug") # eventDetectorConfig = { # "eventDetectorType" : "inotifyx", -# "monDir" : BASE_PATH + "/data/source", +# "monDir" : BASE_PATH + os.sep + "data" + os.sep + "source", # "monEventType" : "IN_CLOSE_WRITE", # "monSubdirs" : ["commissioning", "current", "local"], # "monSuffixes" : [".tif", ".cbf"] @@ -247,7 +249,7 @@ if __name__ == '__main__': eventDetectorConfig = { "eventDetectorType" : "watchdog", - "monDir" : BASE_PATH + "/data/source", + "monDir" : BASE_PATH + os.sep + "data" + os.sep + "source", "monEventType" : "IN_CLOSE_WRITE", "monSubdirs" : ["commissioning", "current", "local"], "monSuffixes" : [".tif", ".cbf"], @@ -270,8 +272,8 @@ if __name__ == '__main__': routerSocket.connect(connectionStr) logging.info("=== routerSocket connected to " + connectionStr) - sourceFile = BASE_PATH + "/test_file.cbf" - targetFileBase = BASE_PATH + "/data/source/local/raw/" + sourceFile = BASE_PATH + os.sep + "test_file.cbf" + targetFileBase = BASE_PATH + os.sep + "data" + os.sep + "source" + os.sep + "local" + os.sep + "raw" + os.sep i = 100 try: diff --git a/src/sender/WatchdogDetector.py b/src/sender/WatchdogDetector.py index c66e7136552de53554488678092f5f1fda79bd1d..b55b7ca97693f9ae64c6ab34efc7cae1f5222c30 100644 --- a/src/sender/WatchdogDetector.py +++ b/src/sender/WatchdogDetector.py @@ -337,7 +337,7 @@ if __name__ == '__main__': import helpers - logfilePath = BASE_PATH + "/logs/watchdogDetector.log" + logfilePath = BASE_PATH + os.sep + "logs" + os.sep + "watchdogDetector.log" verbose = True onScreen = "debug" @@ -346,7 +346,7 @@ if __name__ == '__main__': config = { #TODO normpath to make insensitive to "/" at the end - "monDir" : BASE_PATH + "/data/source", + "monDir" : BASE_PATH + os.sep + "data" + os.sep + "source", "monEventType" : "ON_CLOSE", # "monEventType" : "IN_CREATE", "monSubdirs" : ["commissioning", "current", "local"], @@ -355,7 +355,7 @@ if __name__ == '__main__': } sourceFile = BASE_PATH + "/test_file.cbf" - targetFileBase = BASE_PATH + "/data/source/local/raw/" + targetFileBase = BASE_PATH + os.sep + "data" + os.sep + "source" + os.sep + "local" + os.sep + "raw" + os.sep eventDetector = WatchdogDetector(config)