def _ls_spark_task_logs(fs, log_dir_stream, application_id=None, job_id=None):
 stderr_logs = []
 key_to_stdout_log = {}
 for match in _ls_logs(fs, log_dir_stream, _match_task_log_path, application_id=application_id, job_id=job_id):
  if (match['log_type'] == 'stderr'):
   stderr_logs.append(match)
  elif (match['log_type'] == 'stdout'):
   key_to_stdout_log[_log_key(match)] = match
 for stderr_log in stderr_logs:
  stdout_log = key_to_stdout_log.get(_log_key(stderr_log))
  if stdout_log:
   stderr_log['stdout'] = stdout_log
 return stderr_logs

def _ls_spark_task_logs ( fs , log_dir_stream , application_id = None , job_id = None ) : stderr_logs = [ ] key_to_stdout_log = { } for match in _ls_logs ( fs , log_dir_stream , _match_task_log_path , application_id = application_id , job_id = job_id ) : if ( match [ 'log_type' ] == 'stderr' ) : stderr_logs . append ( match ) elif ( match [ 'log_type' ] == 'stdout' ) : key_to_stdout_log [ _log_key ( match ) ] = match for stderr_log in stderr_logs : stdout_log = key_to_stdout_log . get ( _log_key ( stderr_log ) ) if stdout_log : stderr_log [ 'stdout' ] = stdout_log return stderr_logs
yield matching spark logs .