Skip to content

Commit

Permalink
Adds scan_test_blobs.py to scan all the blobs in a platefile in paral…
Browse files Browse the repository at this point in the history
…lel.
  • Loading branch information
deleted committed Jan 9, 2012
1 parent 76b0559 commit 1eb8885
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/vw/Plate/scan_test_blobs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import sys, os
import glob
import subprocess, multiprocessing

# assuming this file is in the vw bin bath, alongside the blob_file_test binary
BLOB_FILE_TEST_BINARY = os.path.abspath( os.path.join( os.path.dirname( __file__), 'blob_file_test'))

def scan_blob(blobfile):
subp = subprocess.Popen( (BLOB_FILE_TEST_BINARY, blobfile), stdout=subprocess.PIPE)
(output, err) = subp.communicate()
return output

def record_output(output):
print output
sys.stdout.flush()


def scan_all_blobs(dirname):
assert os.path.exists(dirname)
pool = multiprocessing.Pool()
i = o
for blobfile in glob.glob( os.path.join( dirname, '*.blob') ):
r = pool.apply_async(scan_blob, [blobfile], callback=record_output)
i += 1
sys.stderr.write("Pooled %d blob scans" % i)
sys.stderr.flush()
pool.close()
pool.join()


def main():
if len(sys.argv) != 2:
print "Usage: %s platefile_path" % os.path.basename(__file__)
plate_dir = sys.argv[1]
scan_all_blobs(plate_dir)

if __name__ == "__main__":
main()

0 comments on commit 1eb8885

Please sign in to comment.