#NEWLINE# def _handle_offset_commit_response( self , offsets , future , send_time , response ) : #NEWLINE# #INDENT# self . _sensors . commit_latency . record ( ( ( time . time ( ) - send_time ) * 1000 ) ) #NEWLINE# unauthorized_topics = set ( ) #NEWLINE# for ( topic , partitions ) in response . topics : #NEWLINE# #INDENT# for ( partition , error_code ) in partitions : #NEWLINE# #INDENT# tp = TopicPartition ( topic , partition ) #NEWLINE# offset = offsets [ tp ] #NEWLINE# error_type = Errors . for_code ( error_code ) #NEWLINE# if ( error_type is Errors . NoError ) : #NEWLINE# #INDENT# log . debug ( 'Group %s committed offset %s for partition %s' , self . group_id , offset , tp ) #NEWLINE# if self . _subscription . is_assigned ( tp ) : #NEWLINE# #INDENT# self . _subscription . assignment [ tp ] . committed = offset . offset #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( error_type is Errors . GroupAuthorizationFailedError ) : #NEWLINE# #INDENT# log . error ( 'Not authorized to commit offsets for group %s' , self . group_id ) #NEWLINE# future . failure ( error_type ( self . group_id ) ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( error_type is Errors . TopicAuthorizationFailedError ) : #NEWLINE# #INDENT# unauthorized_topics . add ( topic ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( error_type in ( Errors . OffsetMetadataTooLargeError , Errors . InvalidCommitOffsetSizeError ) ) : #NEWLINE# #INDENT# log . debug ( 'OffsetCommit for group %s failed on partition %s %s' , self . group_id , tp , error_type . __name__ ) #NEWLINE# future . failure ( error_type ( ) ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( error_type is Errors . GroupLoadInProgressError ) : #NEWLINE# #INDENT# log . debug ( 'OffsetCommit for group %s failed: %s' , self . group_id , error_type . __name__ ) #NEWLINE# future . failure ( error_type ( self . group_id ) ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( error_type in ( Errors . GroupCoordinatorNotAvailableError , Errors . NotCoordinatorForGroupError , Errors . RequestTimedOutError ) ) : #NEWLINE# #INDENT# log . debug ( 'OffsetCommit for group %s failed: %s' , self . group_id , error_type . __name__ ) #NEWLINE# self . coordinator_dead ( ) #NEWLINE# future . failure ( error_type ( self . group_id ) ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( error_type in ( Errors . UnknownMemberIdError , Errors . IllegalGenerationError , Errors . RebalanceInProgressError ) ) : #NEWLINE# #INDENT# error = error_type ( self . group_id ) #NEWLINE# log . debug ( 'OffsetCommit for group %s failed: %s' , self . group_id , error ) #NEWLINE# self . _subscription . mark_for_reassignment ( ) #NEWLINE# future . failure ( Errors . CommitFailedError ( 'Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured session.timeout.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.' ) ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . error ( 'Group %s failed to commit partition %s at offset %s: %s' , self . group_id , tp , offset , error_type . __name__ ) #NEWLINE# future . failure ( error_type ( ) ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if unauthorized_topics : #NEWLINE# #INDENT# log . error ( 'Not authorized to commit to topics %s for group %s' , unauthorized_topics , self . group_id ) #NEWLINE# future . failure ( Errors . TopicAuthorizationFailedError ( unauthorized_topics ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# future . success ( True )