def get_task_trackers(properties=None, hadoop_conf_dir=None, offline=False):
if offline:<EOL><INDENT>if not hadoop_conf_dir:<EOL><INDENT>hadoop_conf_dir = pydoop.hadoop_conf()<EOL>slaves = os.path.join(hadoop_conf_dir, "<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>with open(slaves) as f:<EOL><INDENT>task_trackers = [(l.strip(), <NUM_LIT:0>) for l in f]<EOL><DEDENT><DEDENT>except IOError:<EOL><INDENT>task_trackers = []<EOL><DEDENT><DEDENT>else:<EOL><INDENT>stdout = run_class(<EOL>"<STR_LIT>", ["<STR_LIT>"],<EOL>properties=properties, hadoop_conf_dir=hadoop_conf_dir,<EOL>keep_streams=True<EOL>)<EOL>task_trackers = []<EOL>for line in stdout.splitlines():<EOL><INDENT>if not line:<EOL><INDENT>continue<EOL><DEDENT>line = line.split("<STR_LIT::>")<EOL>task_trackers.append((line[<NUM_LIT:0>].split("<STR_LIT:_>")[<NUM_LIT:1>], int(line[-<NUM_LIT:1>])))<EOL><DEDENT><DEDENT>return task_trackers<EOL>
Get the list of task trackers in the Hadoop cluster.

Each element in the returned list is in the ``(host, port)`` format.
All arguments are passed to :func:`run_class`.

If ``offline`` is :obj:`True`, try getting the list of task trackers from
the ``slaves`` file in Hadoop's configuration directory (no attempt is
made to contact the Hadoop daemons).  In this case, ports are set to 0.