예제 #1
0
from scanifc import RXPFile
import sys
import os

if __name__ == '__main__':

    # Get command line arguments, else fail
    if(len(sys.argv) != 3):
        print "{} takes two arguments".format(sys.argv[0])
        print "Usage: python rxpSplitter.py *.rxp seconds"
        exit(0)

    # The rxp file to process
    filename = sys.argv[1]
    sec_split = sys.argv[2]

    # Create directory for split files
    # inDir/basename_split/    -split rxp files
    inDir, basename = os.path.split(filename)

    # Check if split directory exists, if not make it
    splitDir = os.path.join(inDir, "{}_split".format(basename))

    if not os.path.exists(splitDir):
        os.makedirs(splitDir)
        
    rxp = RXPFile()
    rxp.open(filename)
    rxp.split_rxp(1, splitDir, True)
    rxp.close()
예제 #2
0
파일: pyRivLib.py 프로젝트: klangrjt/880_Py
        filename_sbet = sys.argv[2]
        basename_sbet = os.path.basename(filename_sbet)
    # '''

    # Initialize processing pool
    pool = mp.Pool(processes=PROC_CNT)
    if pool is None:
        raise Exception("Failed to initialize processing pool.")
        print "\n#{}: Processing pool initialized with {} workers.".format(time.strftime('%X %x'), PROC_CNT)

    print "\n#{}: Opening rxp file to split: {}".format(time.strftime('%X %x'), basename)
    rxp = RXPFile()
    rxp.open(filename)
# '''
    print "\n#{}: Spliting rxp file {}".format(time.strftime('%X %x'), basename)
    rxps_split = rxp.split_rxp(PROC_CNT*2, tmpDir)
    rxp.close()

# '''
    # Process the split rxps
    results = None
    if(PROC_SBET):
        results = [pool.apply_async(extract_rxp, args=[rxps, tmpDir, filename_sbet]) for rxps in rxps_split]
    else:
        results = [pool.apply_async(extract_rxp, args=[rxps, tmpDir]) for rxps in rxps_split]
    pool.close()    # no more jobs for work pool
    pool.join()     # blocks here until all jobs finish processing

    print "\n#{}: Cleaning up temp files and combining pieces.".format(time.strftime('%X %x'))
    gzs = cleanup_extracted(results, basename, rawDir)    
    print "\n#{}: FINISHED in {} seconds".format(time.strftime('%X %x'), time.time()-start)