#NEWLINE# def sbatch( self , sbatch_line ) : #NEWLINE# #INDENT# logger . debug ( 'Running %r' , sbatch_line ) #NEWLINE# try : #NEWLINE# #INDENT# output = subprocess . check_output ( sbatch_line , stderr = subprocess . STDOUT ) #NEWLINE# result = int ( output . strip ( ) . split ( ) [ ( - 1 ) ] ) #NEWLINE# logger . debug ( 'sbatch submitted job %d' , result ) #NEWLINE# return self #NEWLINE# #UNINDENT# except subprocess . CalledProcessError as e : #NEWLINE# #INDENT# logger . error ( 'sbatch command failed with code %d: %s' , e . returncode , e . output ) #NEWLINE# raise e #NEWLINE# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# logger . error ( 'sbatch command failed' ) #NEWLINE# raise e