#NEWLINE# def _parse_step_log_from_log4j_records( records ) : #NEWLINE# #INDENT# 'Pulls errors, counters, IDs, etc. from log4j records\n    emitted by Hadoop.\n\n    This powers :py:func:`_parse_step_log` and\n    :py:func:`_interpret_hadoop_jar_command_stderr`.\n    ' #NEWLINE# result = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for record in records : #NEWLINE# #INDENT# message = record [ 'message' ] #NEWLINE# if _is_counter_log4j_record ( record ) : #NEWLINE# #INDENT# result [ 'counters' ] = _parse_indented_counters ( message . splitlines ( ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# m = _OUTPUT_DIRECTORY_RE . match ( message ) #NEWLINE# if m : #NEWLINE# #INDENT# result [ 'output_dir' ] = m . group ( 'output_dir' ) #NEWLINE# continue #NEWLINE# #UNINDENT# m = _SUBMITTED_APPLICATION_RE . match ( message ) #NEWLINE# if m : #NEWLINE# #INDENT# result [ 'application_id' ] = m . group ( 'application_id' ) #NEWLINE# continue #NEWLINE# #UNINDENT# m = _RUNNING_JOB_RE . match ( message ) #NEWLINE# if m : #NEWLINE# #INDENT# result [ 'job_id' ] = m . group ( 'job_id' ) #NEWLINE# continue #NEWLINE# #UNINDENT# m = _TASK_ATTEMPT_FAILED_RE . match ( message ) #NEWLINE# if m : #NEWLINE# #INDENT# error_str = '\n' . join ( message . splitlines ( ) [ 1 : ] ) #NEWLINE# if ( not error_str ) : #NEWLINE# #INDENT# error_str = message #NEWLINE# #UNINDENT# error = dict ( attempt_id = m . group ( 'attempt_id' ) , hadoop_error = dict ( message = error_str , num_lines = record [ 'num_lines' ] , start_line = record [ 'start_line' ] ) ) #NEWLINE# result . setdefault ( 'errors' , [ ] ) #NEWLINE# result [ 'errors' ] . append ( error ) #NEWLINE# #UNINDENT# #UNINDENT# return result