Skip to content
Snippets Groups Projects
Commit 56efec33 authored by sveseli's avatar sveseli
Browse files

added reprocess and process hidden options to startDaq and upload commands

parent 830b2e44
No related branches found
No related tags found
No related merge requests found
...@@ -84,8 +84,8 @@ class FileProcessingManager(threading.Thread,Singleton): ...@@ -84,8 +84,8 @@ class FileProcessingManager(threading.Thread,Singleton):
# Each plugin calculates list of files that need to be processed # Each plugin calculates list of files that need to be processed
# Final result is union of all plugins # Final result is union of all plugins
def checkUploadFilesForProcessing(self, filePathsDict, uploadInfo): def checkUploadFilesForProcessing(self, filePathsDict, uploadInfo):
if ValueUtility.toBoolean(uploadInfo.get('processAllFiles')): if ValueUtility.toBoolean(uploadInfo.get('reprocessFiles')):
del uploadInfo['processAllFiles'] del uploadInfo['reprocessFiles']
return filePathsDict return filePathsDict
checkedFilePathsDict = {} checkedFilePathsDict = {}
for processorKey in self.fileProcessorKeyList: for processorKey in self.fileProcessorKeyList:
......
...@@ -9,6 +9,7 @@ class StartDaqCli(DaqWebServiceSessionCli): ...@@ -9,6 +9,7 @@ class StartDaqCli(DaqWebServiceSessionCli):
DaqWebServiceSessionCli.__init__(self, validArgCount=self.ANY_NUMBER_OF_POSITIONAL_ARGS) DaqWebServiceSessionCli.__init__(self, validArgCount=self.ANY_NUMBER_OF_POSITIONAL_ARGS)
self.addOption('', '--experiment', dest='experimentName', help='Experiment name.') self.addOption('', '--experiment', dest='experimentName', help='Experiment name.')
self.addOption('', '--data-directory', dest='dataDirectory', help='Experiment data directory. If specified string does not already contain file server URL, value of the %s environment variable will be prepended to it.' % self.DM_FILE_SERVER_URL_ENV_VAR) self.addOption('', '--data-directory', dest='dataDirectory', help='Experiment data directory. If specified string does not already contain file server URL, value of the %s environment variable will be prepended to it.' % self.DM_FILE_SERVER_URL_ENV_VAR)
self.addOption('', '--process-hidden', dest='processHidden', action='store_true', default=False, help='Process hidden source files.')
def checkArgs(self): def checkArgs(self):
if self.options.experimentName is None: if self.options.experimentName is None:
...@@ -16,9 +17,14 @@ class StartDaqCli(DaqWebServiceSessionCli): ...@@ -16,9 +17,14 @@ class StartDaqCli(DaqWebServiceSessionCli):
if self.options.dataDirectory is None: if self.options.dataDirectory is None:
raise InvalidRequest('Experiment data directory must be provided.') raise InvalidRequest('Experiment data directory must be provided.')
def updateDaqInfoFromOptions(self, daqInfo):
if self.options.processHidden:
daqInfo['processHiddenFiles'] = True
def runCommand(self): def runCommand(self):
self.parseArgs(usage=""" self.parseArgs(usage="""
dm-start-daq --experiment=EXPERIMENTNAME --data-directory=DATADIRECTORY dm-start-daq --experiment=EXPERIMENTNAME --data-directory=DATADIRECTORY
[--process-hidden]
[key1:value1, key2:value2, ...] [key1:value1, key2:value2, ...]
Description: Description:
...@@ -29,6 +35,7 @@ Description: ...@@ -29,6 +35,7 @@ Description:
self.checkArgs() self.checkArgs()
api = ExperimentRestApi(self.getLoginUsername(), self.getLoginPassword(), self.getServiceHost(), self.getServicePort(), self.getServiceProtocol()) api = ExperimentRestApi(self.getLoginUsername(), self.getLoginPassword(), self.getServiceHost(), self.getServicePort(), self.getServiceProtocol())
daqInfo = self.splitArgsIntoDict() daqInfo = self.splitArgsIntoDict()
self.updateDaqInfoFromOptions(daqInfo)
daqInfo = api.startDaq(self.getExperimentName(), self.getDataDirectory(), daqInfo=daqInfo) daqInfo = api.startDaq(self.getExperimentName(), self.getDataDirectory(), daqInfo=daqInfo)
print daqInfo.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat()) print daqInfo.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())
......
...@@ -9,6 +9,8 @@ class UploadCli(DaqWebServiceSessionCli): ...@@ -9,6 +9,8 @@ class UploadCli(DaqWebServiceSessionCli):
DaqWebServiceSessionCli.__init__(self, validArgCount=self.ANY_NUMBER_OF_POSITIONAL_ARGS) DaqWebServiceSessionCli.__init__(self, validArgCount=self.ANY_NUMBER_OF_POSITIONAL_ARGS)
self.addOption('', '--experiment', dest='experimentName', help='Experiment name.') self.addOption('', '--experiment', dest='experimentName', help='Experiment name.')
self.addOption('', '--data-directory', dest='dataDirectory', help='Experiment data directory. If specified string does not already contain file server URL, value of the %s environment variable will be prepended to it.' % self.DM_FILE_SERVER_URL_ENV_VAR) self.addOption('', '--data-directory', dest='dataDirectory', help='Experiment data directory. If specified string does not already contain file server URL, value of the %s environment variable will be prepended to it.' % self.DM_FILE_SERVER_URL_ENV_VAR)
self.addOption('', '--reprocess', dest='reprocess', action='store_true', default=False, help='Reprocess source files that are already in storage, even if they have not been modified.')
self.addOption('', '--process-hidden', dest='processHidden', action='store_true', default=False, help='Process hidden source files.')
def checkArgs(self): def checkArgs(self):
if self.options.experimentName is None: if self.options.experimentName is None:
...@@ -16,9 +18,17 @@ class UploadCli(DaqWebServiceSessionCli): ...@@ -16,9 +18,17 @@ class UploadCli(DaqWebServiceSessionCli):
if self.options.dataDirectory is None: if self.options.dataDirectory is None:
raise InvalidRequest('Experiment data directory must be provided.') raise InvalidRequest('Experiment data directory must be provided.')
def updateDaqInfoFromOptions(self, daqInfo):
if self.options.reprocess:
daqInfo['reprocessFiles'] = True
if self.options.processHidden:
daqInfo['processHiddenFiles'] = True
def runCommand(self): def runCommand(self):
self.parseArgs(usage=""" self.parseArgs(usage="""
dm-upload --experiment=EXPERIMENTNAME --data-directory=DATADIRECTORY dm-upload --experiment=EXPERIMENTNAME --data-directory=DATADIRECTORY
[--reprocess]
[--process-hidden]
[key1:value1, key2:value2, ...] [key1:value1, key2:value2, ...]
Description: Description:
...@@ -30,6 +40,7 @@ Description: ...@@ -30,6 +40,7 @@ Description:
self.checkArgs() self.checkArgs()
api = ExperimentRestApi(self.getLoginUsername(), self.getLoginPassword(), self.getServiceHost(), self.getServicePort(), self.getServiceProtocol()) api = ExperimentRestApi(self.getLoginUsername(), self.getLoginPassword(), self.getServiceHost(), self.getServicePort(), self.getServiceProtocol())
daqInfo = self.splitArgsIntoDict() daqInfo = self.splitArgsIntoDict()
self.updateDaqInfoFromOptions(daqInfo)
uploadInfo = api.upload(self.getExperimentName(), self.getDataDirectory(), daqInfo=daqInfo) uploadInfo = api.upload(self.getExperimentName(), self.getDataDirectory(), daqInfo=daqInfo)
print uploadInfo.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat()) print uploadInfo.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())
......
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