def execute(self): dburl = dbconn.DbURL(port=self.master_port) old_dates = ListFiles(os.path.join(self.master_datadir, DUMP_DIR)).run() try: old_dates.remove(DUMP_DATE) except ValueError, e: # DUMP_DATE was not found in old_dates pass
def execute(self): pool = WorkerPool() given = set(ListFiles(self.pid_dir).run()) try: for host in self.trail: available = ListRemoteFiles(self.pid_dir, host).run() to_copy = [dir for dir in available if dir not in given] for dir in to_copy: comp_dir = os.path.join(self.pid_dir, dir) pool.addCommand(Scp('collect coverage', srcFile = comp_dir, srcHost = host, dstFile = comp_dir, recursive = True)) finally: pool.join()
def execute(self): if not CheckDir(self.current_filespace_entry[2]).run(): return tmp_file = os.path.join(self.new_filespace_entry[2], 'tmp_file') if not CheckFilespacePermissions(tmp_file).run(): raise MoveFilespaceError('Invalid permissions for %s' % tmp_file) stats = os.statvfs(os.path.dirname(self.new_filespace_entry[2])) free_bytes = stats.f_bfree * stats.f_frsize logger.info('free_bytes for %s = %s' % (self.new_filespace_entry[2], free_bytes)) if not free_bytes: raise MoveFilespaceError('Insufficient diskspace for %s' % self.new_filespace_entry[2]) # 1. Drop the directories from old filespace location # If the filespace is being moved from pg_system filespace # for temp files will be slightly different as they will be stored under # <filespace_dir>/base/<database_oid>/ gp_temporary_files_filespace_path = os.path.join( self.pg_system_filespace_entry[2], GP_TEMPORARY_FILES_FILESPACE) if not CheckFile(gp_temporary_files_filespace_path).run(): base_dir = os.path.join(self.current_filespace_entry[2], 'base') directories = [] try: directories = ListFiles(base_dir).run() except Exception, e: if self.rollback: pass else: raise for directory in directories: try: dst_dir = os.path.join(base_dir, directory, self.TEMPORARY_FILES_DIR) if CheckDir(dst_dir).run(): logger.info('Dropping dir %s' % dst_dir) shutil.rmtree(dst_dir) except (IOError, OSError), e: logger.error('Failed to delete temporary files') raise