Skip to content

Commit

Permalink
*gaierror caught in ES connection to central server.
Browse files Browse the repository at this point in the history
*box files indexing skipped when unable to have connection
  • Loading branch information
smorovic committed Jan 26, 2015
1 parent 350f981 commit 7f9c2d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions python/aUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,12 @@ def setFieldByName(self,field,value,warning=True):
#get definitions from jsd file
def getDefinitions(self):
if self.filetype in [STREAM]:
#try:
self.jsdfile = self.data["definition"]
#except:
# self.logger.error("no definition field in "+str(self.filepath))
# self.definitions = {}
# return False
elif not self.jsdfile:
self.logger.warning("jsd file not set")
self.definitions = {}
Expand Down
8 changes: 6 additions & 2 deletions python/elasticbu.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def updateIndexMaybe(self,index_name,alias_write,alias_read,settings,mapping):
retry=True
continue

except (ConnectionError,Timeout) as ex:
except (socket.gaierror,ConnectionError,Timeout) as ex:
#try to reconnect with different IP from DNS load balancing
if self.runMode and connectionAttempts>100:
self.logger.error('elastic (BU): exiting after 100 connection attempts to '+ self.es_server_url)
Expand Down Expand Up @@ -315,8 +315,10 @@ def elasticize_eols(self,infile):
def index_documents(self,name,documents,bulk=True):
attempts=0
destination_index = ""
is_box=False
if name.startswith("boxinfo"):
destination_index = self.boxinfo_write
is_box=True
else:
destination_index = self.runindex_write
while True:
Expand All @@ -330,12 +332,14 @@ def index_documents(self,name,documents,bulk=True):
except ElasticHttpError as ex:
if attempts<=1:continue
self.logger.error('elasticsearch HTTP error. skipping document '+name)
if is_box==True:break
#self.logger.exception(ex)
return False
except (ConnectionError,Timeout) as ex:
except (socket.gaierror,ConnectionError,Timeout) as ex:
if attempts>100 and self.runMode:
raise(ex)
self.logger.error('elasticsearch connection error. retry.')
if is_box==True:break
if self.stopping:return False
time.sleep(0.1)
ip_url=getURLwithIP(self.es_server_url,self.nsslock)
Expand Down
Binary file modified rpm/hltd-1.6.0-0.x86_64.rpm
Binary file not shown.

0 comments on commit 7f9c2d3

Please sign in to comment.