@@ -140,7 +140,7 @@ def process_args(self):
140140 def get_tables (self ):
141141 try :
142142 return self .conn .tables ()
143- except (socket .timeout , ThriftException ) as _ :
143+ except (socket .timeout , ThriftException , happybase . hbase . ttypes . IOError ) as _ :
144144 die ('ERROR while trying to get table list: {0}' .format (_ ))
145145
146146 def run (self ):
@@ -150,9 +150,7 @@ def run(self):
150150 try :
151151 log .info ('connecting to HBase Thrift Server at {0}:{1}' .format (self .host , self .port ))
152152 self .conn = happybase .Connection (host = self .host , port = self .port , timeout = 10 * 1000 ) # ms
153- except socket .timeout as _ :
154- die ('ERROR: {0}' .format (_ ))
155- except ThriftException as _ :
153+ except (socket .timeout , ThriftException , happybase .hbase .ttypes .IOError ) as _ :
156154 die ('ERROR: {0}' .format (_ ))
157155 tables = self .get_tables ()
158156 # of course there is a minor race condition here between getting the table list, checking and creating
@@ -193,9 +191,7 @@ def populate_table(self):
193191 #log.info("connecting to test table '%s'", table)
194192 try :
195193 table_conn = self .conn .table (table )
196- except socket .timeout as _ :
197- die ('ERROR while trying to connect to table \' {0}\' : {1}' .format (table , _ ))
198- except ThriftException as _ :
194+ except (socket .timeout , ThriftException , happybase .hbase .ttypes .IOError ) as _ :
199195 die ('ERROR while trying to connect to table \' {0}\' : {1}' .format (table , _ ))
200196 log .info ("populating test table '%s' with random data" , table )
201197 if self .use_existing_table :
@@ -218,7 +214,7 @@ def populate_table(self):
218214 print (file = sys .stderr )
219215 time_taken = time .time () - start
220216 log .info ('sent %s rows of generated data to HBase in %.2f seconds' , self .num_rows , time_taken )
221- except (socket .timeout , ThriftException ) as _ :
217+ except (socket .timeout , ThriftException , happybase . hbase . ttypes . IOError ) as _ :
222218 exp = str (_ )
223219 exp = exp .replace ('\\ n' , '\n ' )
224220 exp = exp .replace ('\\ t' , '\t ' )
0 commit comments