Skip to content

Commit

Permalink
Update monitor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
skhademcis committed May 3, 2023
1 parent 23e624f commit cd66a94
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions estreamer/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def __stats( self, bookmark, count ):
self.lastCount = count

return velocity, rate




def __tick( self ):
try:
Expand All @@ -88,8 +87,13 @@ def __tick( self ):
message += ' average rate {0} ev/sec; '.format(status['cumulative_rate'])

if self.settings.monitor.bookmark:
message += ' bookmark {0};'.format(
estreamer.common.convert.toIso8601( status['bookmark'] ))

if status['bookmark'] == 0:
bookmark = estreamer.Bookmark( self.settings.bookmarkFilepath() )
timeInt = bookmark.read()
message += ' bookmark {0};'.format(estreamer.common.convert.toIso8601( timeInt ) )
else :
message += ' bookmark {0};'.format(estreamer.common.convert.toIso8601( status['bookmark'] ))

self.logger.info( message )

Expand All @@ -105,6 +109,18 @@ def __tick( self ):
except Exception as ex:
self.logger.exception(ex)

except estreamer.UnsupportedTimestampException:
# This is a workaround for the time being. Occasionally, on stopping
# the controlling process pipe communications collides with the monitor
# and messages are garbled. Investigate
self.logger.info('Running (no process data available)')

except estreamer.EncoreException as ex:
self.logger.error(ex)

except Exception as ex:
self.logger.exception(ex)



def __start( self ):
Expand Down

0 comments on commit cd66a94

Please sign in to comment.