#NEWLINE# def handle( self , key , value ) : #NEWLINE# #INDENT# '\n        Processes a vaild action info request\n\n        @param key: The key that matched the request\n        @param value: The value associated with the key\n        ' #NEWLINE# master = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# master [ 'uuid' ] = value #NEWLINE# master [ 'total_pending' ] = 0 #NEWLINE# master [ 'server_time' ] = int ( self . get_current_time ( ) ) #NEWLINE# elements = key . split ( ':' ) #NEWLINE# dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# dict [ 'spiderid' ] = elements [ 1 ] #NEWLINE# dict [ 'appid' ] = self [ 2 ] #NEWLINE# extras = self . get_log_dict ( 'info' , dict [ 'appid' ] , dict [ 'spiderid' ] , master [ 'uuid' ] ) #NEWLINE# if ( len ( elements ) == 4 ) : #NEWLINE# #INDENT# dict [ 'crawlid' ] = elements [ 3 ] #NEWLINE# extras = self . get_log_dict ( 'info' , dict [ 'appid' ] , dict [ 'spiderid' ] , master [ 'uuid' ] , elements [ 3 ] ) #NEWLINE# #UNINDENT# self . logger . info ( 'Received info request' , extra = extras ) #NEWLINE# if ( 'crawlid' in dict ) : #NEWLINE# #INDENT# master = self . _build_crawlid_info ( master , dict ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# master = self . _build_appid_info ( master , dict ) #NEWLINE# #UNINDENT# if self . _send_to_kafka ( master ) : #NEWLINE# #INDENT# extras [ 'success' ] = True #NEWLINE# self . logger . info ( 'Sent info to kafka' , extra = extras ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# extras [ 'success' ] = False #NEWLINE# self . logger . error ( 'Failed to send info to kafka' , extra = extras )