# # Create the directory that will hold the individual entries. # dirAttrs = { #"CacheEnabled" : "false", "CacheEnabled" : "true" } basedir = "/%s/%s" % (fileSystemName, nameGen.next()) celestefs.mkdir(basedir, attrs=dirAttrs) fileAttrs = { #"CacheEnabled" : "false", "CacheEnabled" : "true", "ContentType" : "text/plain" } timeList = [] i = 0 while i < numItems: itemName = "%s/%s" % (basedir, nameGen.next()) celestefs.create(itemName, attrs=fileAttrs) timeList += ["%4.3f" % celestefs.elapsedTime] if outFile != None: outFile.write("%4.3f\n" % celestefs.elapsedTime) i += 1 print "created %d files in %s" % (numItems, basedir) print "successive creation times:", timeList if outFile != None: outFile.close()
fsAttrs = { "MaintainSerialNumbers" : "false" } celestefs.mkfs(fileSystemName, fileSystemPassword, attrs=fsAttrs) # # If it doesn't already exist, create the file. # path = "/%s/%s" % (fileSystemName, celesteName) if not celestefs.fileExists(path): fileAttrs = { "CacheEnabled" : "true", "ContentType" : "text/plain", "ReplicationParameters" : replicationParams } celestefs.create(path, attrs=fileAttrs) # # Repeatedly ingest and fill the file, read it back to compare it with the # original, and truncate it. (If profiling is enabled, each repetition # will append information to timingsFile.) # remainingRepetitions = repetitions while repetitions <= 0 or remainingRepetitions > 0: pCat = Popen(["/bin/cat", localFile], stdout=PIPE) pWrite = celestefs.pwrite(path, 0, stdin=pCat.stdout) pWrite.communicate() pRead = celestefs.pread(path, 0, -1, stdout=PIPE) pCmp = Popen(["/usr/bin/cmp", localFile, "-"], stdin=pRead.stdout, stdout=PIPE)
# # Set the file's location in Celeste to be the leaf name part of the input # file name, placed directly in the root directory of our Celeste file # system. # celesteFilePath = sep + fileSystemName + sep + inFileName.split(sep)[-1] celesteFilePath2 = sep + fileSystemName + sep + inFileName.split(sep)[-1] + \ "2" # # Does the file we're to ingest already exist in Celeste? # if not celestefs.fileExists(celesteFilePath): print >> stderr, "%s does not exist" % celesteFilePath celestefs.create(celesteFilePath) else: print >> stderr, "%s exists" % celesteFilePath if not celestefs.fileExists(celesteFilePath2): print >> stderr, "%s does not exist" % celesteFilePath2 celestefs.create(celesteFilePath2) else: print >> stderr, "%s exists" % celesteFilePath2 # # Write the file's contents if necessary. # statOutput = celestefs.stat(celesteFilePath2, options=["-s"]) fileSize = int(statOutput.split()[1]) print >> stderr, "file size: %d" % fileSize
if not c.fileSystemExists(name): if not c.mkfs(name, name): print "mkfs(%s, %s) failed" % (name, name) exit(1) filename = "/" + name + "/" + "file" # # Create or truncate the test file, as approriate. # if not c.fileExists(filename): createAttrs = { # "BlockSize" : "3" # "BlockSize" : "16" } c.create(filename, contentType="text/plain", attrs=createAttrs) else: c.setLength(filename, 0) # # Write a sequence of characters that give clues to their offsets in the # file. # p = c.pwrite(filename) p.stdin.write("0123456789012345678901234567890123456789") p.communicate() # # See what we have so far. # p = c.pread(filename)