def _readDataList(self): """Read the only data list from 'target directory'. """ self._log(logging.INFO, "Gather input lists from %s" % self.getTargetDirectory()) #Input list dataListFiles = MyFile.dirContent(self.getTargetDirectory(), "*" + Task.OUTPUTLISTEXTENSION) #Input data or representations if len(dataListFiles) == 0: raise Exception("No data list found in %s!" % self.getTargetDirectory()) elif len(dataListFiles) > 1: raise Exception("One input list max, %d found!" % len(dataListFiles)) self._log(logging.INFO, "Found data list: %s!" % dataListFiles[0]) #Copy from target directory dataListSrcPath = self.getTargetDirectory() + os.sep + dataListFiles[0] dataListDestPath = self.getInputDirectory() + os.sep +\ MyFile.removeExtension(dataListFiles[0])[0] + Task.INPUTLISTEXTENSION MyFile.copyFile(dataListSrcPath, dataListDestPath) #Read content self.inputList = DataList() self.inputList.readFile(dataListDestPath)
def _readMapLists(self): """Read the data maps from 'target directory'. """ #Data maps dataMapFiles = MyFile.dirContent(self.getTargetDirectory(), "*" + Task.OUTPUTMAPEXTENSION) #Map of representations for data if len(dataMapFiles) == 0: raise Exception("No data map found in %s!" % self.getTargetDirectory()) self._log(logging.INFO, "Found %d input map list(s)!" % len(dataMapFiles)) for dataMapFile in dataMapFiles: self._log(logging.INFO, "Found map list: %s!" % dataMapFile) #Copy from target directory dataMapSrcPath = self.getTargetDirectory() + os.sep + dataMapFile dataMapDestPath = self.getInputDirectory() + os.sep +\ MyFile.removeExtension(dataMapFile)[0] + Task.INPUTMAPEXTENSION MyFile.copyFile(dataMapSrcPath, dataMapDestPath) #Read content tempDataMap = DataMap() tempDataMap.readFile(dataMapDestPath) self.mapLists.append(tempDataMap) self._log(logging.INFO, "Lists have been copied to %s" % self.getInputDirectory()) #Debug information dataListFiles = MyFile.dirContent(self.getInputDirectory(), "*") self._log(logging.INFO, "Files in input directory: '%s'." % ", ".join(dataListFiles))