def _putResult(self, quality, result): image = result[1][0] if image is None: return if self.defer_file_creation: self._createFile() self.writeHeader(self._file, self.dataset.metainfo, image) self.writeData(self._file, image) syncFile(self._file) session.notifyDataFile(self.filetype, self.dataset.uid, self.detector.name, self._file.filepath)
def _putResult(self, quality, result): if result[1][0] is None: return if self.defer_file_creation: self._createFile() for i, image in enumerate(result[1]): fp = self._files[i] self.writeHeader(fp, self.dataset.metainfo, image) self.writeData(fp, image) syncFile(fp) session.notifyDataFile(self.filetype, self.dataset.uid, self.detector.name, [fp.filepath for fp in self._files])
def end(self): if self._file: self._file.close() self._file = None syncFile(self._file) # datenfile aus dateisystem fieseln und kopieren. als self.linkpaths[0] # pattern is: # \home\pc\data2\A_username_JJJJ_MM\username_JJJJ_MM-xxx-A1-yyy.lst # \home\pc\data3\B_username_JJJJ_MM\username_JJJJ_MM-xxx-B1-yyy.cfg # \home\pc\data3\B_username_JJJJ_MM\username_JJJJ_MM-xxx-B1-yyy.lst # where A1= A1...A8 and B1=B1..B8 xxx is local scancounter # idea: treat \home\pc\data as mount_point and _username_JJJJ_MM # \username_JJJJ_MM-xxx- as prefix # srcfiles = '/home/pc/data2/A_' + self.prefix + '-A%d-%03d.lst' # strategy: scan mountpoint for files containing prefix in their name for basepath in self.sink.fast_basepaths: for dirpath, _, filenames in os.walk(basepath): for filename in filenames: filepath = os.path.join(dirpath, filename) if self.prefix in filepath: self.log.info('found matching datafile: %r' % filepath)