#NEWLINE# def get_logs( self , decode_logs = True ) : #NEWLINE# #INDENT# '\n        :param decode_logs: bool, docker by default output logs in simple json structure:\n            { "stream": "line" }\n            if this arg is set to True, it decodes logs to human readable form\n        :return: str\n        ' #NEWLINE# logs = graceful_chain_get ( self . get_annotations_or_labels ( ) , 'logs' ) #NEWLINE# if ( not logs ) : #NEWLINE# #INDENT# logger . error ( 'no logs' ) #NEWLINE# return '' #NEWLINE# #UNINDENT# if decode_logs : #NEWLINE# #INDENT# output = [ ] #NEWLINE# for line in logs . split ( '\n' ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# decoded_line = json . loads ( line ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# output += [ decoded_line . get ( 'stream' , '' ) . strip ( ) ] #NEWLINE# error = decoded_line . get ( 'error' , '' ) . strip ( ) #NEWLINE# if error : #NEWLINE# #INDENT# output += [ error ] #NEWLINE# #UNINDENT# error_detail = decoded_line . get ( 'errorDetail' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# error_msg = error_detail . get ( 'message' , '' ) . strip ( ) #NEWLINE# if error_msg : #NEWLINE# #INDENT# output += [ error_detail ] #NEWLINE# #UNINDENT# #UNINDENT# output += '\n' #NEWLINE# return '\n' . join ( output ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return logs