#NEWLINE# def main( ) : #NEWLINE# #INDENT# parser = ArgumentParser ( ) #NEWLINE# Job . Runner . addToilOptions ( parser ) #NEWLINE# parser . add_argument ( '--fileToSort' , dest = 'fileToSort' , help = 'The file you wish to sort' ) #NEWLINE# parser . add_argument ( '--N' , dest = 'N' , help = 'The threshold below which a serial sort function isused to sort file. All lines must of length less than or equal to N or program will fail' , default = 10000 ) #NEWLINE# options = parser . parse_args ( ) #NEWLINE# if ( options . fileToSort is None ) : #NEWLINE# #INDENT# raise RuntimeError ( 'No file to sort given' ) #NEWLINE# #UNINDENT# if ( not os . path . exists ( options . fileToSort ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'File to sort does not exist: %s' % options . fileToSort ) ) #NEWLINE# #UNINDENT# if ( int ( parser . N ) <= 0 ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'Invalid value of N: %s' % options . N ) ) #NEWLINE# #UNINDENT# Job . Runner . startToil ( Job . wrapJobFn ( setup , options . fileToSort , int ( options . N ) , False , memory = sortMemory ) , options )