Skip to content
Snippets Groups Projects
Commit 8e7531b1 authored by sveseli's avatar sveseli
Browse files

allow arbitrary key-value pairs to be passed to daq service and to processing plugins

parent e674de62
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment