def next_mock_hadoop_counters():
 counters_dir = get_mock_dir('counters')
 filenames = sorted(os.listdir(counters_dir))
 if filenames:
  counters_path = os.path.join(counters_dir, filenames[0])
  try:
   with open(counters_path) as f:
    return json.load(f)
  finally:
   os.remove(counters_path)
 else:
  return {}

def next_mock_hadoop_counters ( ) : counters_dir = get_mock_dir ( 'counters' ) filenames = sorted ( os . listdir ( counters_dir ) ) if filenames : counters_path = os . path . join ( counters_dir , filenames [ 0 ] ) try : with open ( counters_path ) as f : return json . load ( f ) finally : os . remove ( counters_path ) else : return { }
read the next set of counters from the filesystem .