def main(): if len(sys.argv) < 2: sys.exit('Usage: %s config_file' % sys.argv[0]) client = None server = ParseConfig(sys.argv[1]) try: client = qfs.client(server) except: print "Unable to start the QFS client." print "Make sure that the meta- and chunkservers are running." sys.exit(1) testBaseDir = "qfssample_base" testDirs = ("dir1", "dir2") testFile1 = "dir1/file1" testFile2 = "file2" file1Content = "Cu populo nusquam alienum vim, graece latine prodesset ex qui, quo ea lucilius intellegat." file2ContentA = { 0 : "are ", # at offset 0 40 : "you ", # at offset 40 1030 : "always ", 1048580 : "wrong?" } file2ContentB = { 500 : "really " } client.cd("/") try: # just in case we didn't cleanup last time client.rmdirs(testBaseDir) except IOError, err: pass
def main(): if len(sys.argv) < 2: sys.exit('Usage: %s config_file' % sys.argv[0]) client = None server = ParseConfig(sys.argv[1]) listFile = "allPhoto.txt" f = open(listFile) try: client = qfs.client(server) except: print "Unable to start the QFS client." print "Make sure that the meta- and chunkservers are running." sys.exit(1) start = time.time() # initialize queue for i in range(10): reader = ReadThread(listFile, sourceQueue) reader.setDaemon(True) reader.run() for i in range(5): writer = WriteThread(sourceQueue, client) writer.setDaemon(True) writer.processQueueItem() print "Read from MFS and write QFS in %s seconds" % ( (time.time() - start))
def printToHTML(self, directory, host, port, buffer): client = qfs.client((host, port)) self.startHTML(directory, buffer) dirPath = os.path.join("/", directory) for info in client.readdirplus(dirPath): if info[0] in ('.', '..'): continue pathEntry = os.path.join(dirPath, info[0]) fullStat = client.fullstat(pathEntry) self.contentHTML(pathEntry, info, fullStat, buffer) self.endHTML(buffer)