From 8e7531b1c0779c8f5dbad490cd1ca65a8bda045c Mon Sep 17 00:00:00 2001
From: Sinisa Veseli <sveseli@aps.anl.gov>
Date: Fri, 26 Jun 2015 20:07:25 +0000
Subject: [PATCH] allow arbitrary key-value pairs to be passed to daq service
 and to processing plugins

---
 .../dm/common/processing/plugins/fileProcessor.py    |  6 +++---
 .../common/processing/plugins/fileTransferPlugin.py  | 12 ++++++++----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/python/dm/common/processing/plugins/fileProcessor.py b/src/python/dm/common/processing/plugins/fileProcessor.py
index 63745e6f..823ddadb 100755
--- a/src/python/dm/common/processing/plugins/fileProcessor.py
+++ b/src/python/dm/common/processing/plugins/fileProcessor.py
@@ -10,7 +10,7 @@ class FileProcessor:
         self.configDict = {}
 
     @abc.abstractmethod
-    def processFile(self, filePath, daqPath, experiment):
+    def processFile(self, fileInfo):
         return NotImplemented
         
     def configure(self):
@@ -27,11 +27,11 @@ class FileProcessor:
         self.configDict['numberOfRetries'] = nRetries
 
     def getNumberOfRetries(self):
-        self.configDict.get('numberOfRetries', self.DEFAULT_NUMBER_OF_RETRIES)
+        return self.configDict.get('numberOfRetries', self.DEFAULT_NUMBER_OF_RETRIES)
 
     def setRetryWaitPeriodInSeconds(self, waitPeriod):
         self.configDict['retryWaitPeriodInSeconds'] = waitPeriod
 
     def getRetryWaitPeriodInSeconds(self):
-        self.configDict.get('retryWaitPeriodInSeconds', DEFAULT_RETRY_WAIT_PERIOD_IN_SECONDS)
+        return self.configDict.get('retryWaitPeriodInSeconds', self.DEFAULT_RETRY_WAIT_PERIOD_IN_SECONDS)
 
diff --git a/src/python/dm/common/processing/plugins/fileTransferPlugin.py b/src/python/dm/common/processing/plugins/fileTransferPlugin.py
index 8aafaf52..635a7e5b 100755
--- a/src/python/dm/common/processing/plugins/fileTransferPlugin.py
+++ b/src/python/dm/common/processing/plugins/fileTransferPlugin.py
@@ -19,13 +19,17 @@ class FileTransferPlugin(FileProcessor):
         self.command = command
         self.subprocess = None
 
-    def processFile(self, filePath, daqPath, experiment):
+    def processFile(self, fileInfo):
+        filePath = fileInfo.get('filePath')
+        dataDirectory = fileInfo.get('dataDirectory')
+        experiment = fileInfo.get('experiment')
+
         storageHost = experiment.get('storageHost')
         storageDirectory = experiment.get('storageDirectory')
         dest = '%s:%s' % (storageHost, storageDirectory)
-        # Use relative path with respect to daq directory as a source
-        os.chdir(daqPath)
-        src = os.path.relpath(filePath, daqPath)
+        # Use relative path with respect to data directory as a source
+        os.chdir(dataDirectory)
+        src = os.path.relpath(filePath, dataDirectory)
         self.start(src, dest)
 
     def getFullCommand(self, src, dest):
-- 
GitLab