def flush(self, ignore_disk=False): """Flush all subjobs to disk using XML methods Args: ignore_disk (bool): Optional flag to force the class to ignore all on-disk data when flushing """ from Ganga.Core.GangaRepository.GangaRepositoryXML import safe_save from Ganga.Core.GangaRepository.VStreamer import to_file if ignore_disk: range_limit = self._cachedJobs.keys() else: range_limit = range(len(self)) for index in range_limit: if index in self._cachedJobs: ## If it ain't dirty skip it if not self._cachedJobs[index]._dirty: continue subjob_data = self.__get_dataFile(str(index)) subjob_obj = self._cachedJobs[index] if subjob_obj is subjob_obj._getRoot(): raise GangaException( self, "Subjob parent not set correctly in flush.") safe_save(subjob_data, subjob_obj, to_file) self.write_subJobIndex(ignore_disk)
def flush(self, ignore_disk=False): """Flush all subjobs to disk using XML methods Args: ignore_disk (bool): Optional flag to force the class to ignore all on-disk data when flushing """ from Ganga.Core.GangaRepository.GangaRepositoryXML import safe_save from Ganga.Core.GangaRepository.VStreamer import to_file if ignore_disk: range_limit = self._cachedJobs.keys() else: range_limit = range(len(self)) for index in range_limit: if index in self._cachedJobs: ## If it ain't dirty skip it if not self._cachedJobs[index]._dirty: continue subjob_data = self.__get_dataFile(str(index)) subjob_obj = self._cachedJobs[index] if subjob_obj is subjob_obj._getRoot(): raise GangaException(self, "Subjob parent not set correctly in flush.") safe_save( subjob_data, subjob_obj, to_file ) self.write_subJobIndex(ignore_disk)
def flush(self): from Ganga.Core.GangaRepository.GangaRepositoryXML import safe_save for index in range(len(self)): if index in self._cachedJobs.keys(): subjob_data = self.__get_dataFile(str(index)) subjob_obj = self._cachedJobs[index] safe_save( subjob_data, subjob_obj, self._to_file ) self.write_subJobIndex() return
def flush(self): """Flush all subjobs to disk using XML methods""" from Ganga.Core.GangaRepository.GangaRepositoryXML import safe_save from Ganga.Core.GangaRepository.VStreamer import to_file for index in range(len(self)): if index in self._cachedJobs.keys(): subjob_data = self.__get_dataFile(str(index)) subjob_obj = self._cachedJobs[index] safe_save(subjob_data, subjob_obj, to_file) self.write_subJobIndex() return
def flush(self): """Flush all subjobs to disk using XML methods""" from Ganga.Core.GangaRepository.GangaRepositoryXML import safe_save from Ganga.Core.GangaRepository.VStreamer import to_file for index in range(len(self)): if index in self._cachedJobs.keys(): subjob_data = self.__get_dataFile(str(index)) subjob_obj = self._cachedJobs[index] if subjob_obj is subjob_obj._getRoot(): raise GangaException(self, "Subjob parent not set correctly in flush.") safe_save( subjob_data, subjob_obj, to_file ) self.write_subJobIndex() return
def flush(self): """Flush all subjobs to disk using XML methods""" from Ganga.Core.GangaRepository.GangaRepositoryXML import safe_save from Ganga.Core.GangaRepository.VStreamer import to_file for index in range(len(self)): if index in self._cachedJobs.keys(): ## If it ain't dirty skip it if not self._cachedJobs[index]._dirty: continue subjob_data = self.__get_dataFile(str(index)) subjob_obj = self._cachedJobs[index] if subjob_obj is subjob_obj._getRoot(): raise GangaException( self, "Subjob parent not set correctly in flush.") safe_save(subjob_data, subjob_obj, to_file) self.write_subJobIndex() return
def addAssociatedFile(self, newFile): """ Add an associated file to the ShareDir. Use this method to save it to theXML """ self.getAssociatedFiles() self.associated_files.append(newFile) safe_save(os.path.join(self.path(), 'associated_files.xml'), self.associated_files, to_file)