'Run a command on the remote host. Returns an AsyncJob object to
interact with the remote process.
This is mostly copied from SSHHost.run and SSHHost._run'

def run_async(self, command, stdout_tee=None, stderr_tee=None, args=(), connect_timeout=30, options='', verbose=True, stderr_level=utils.DEFAULT_STDERR_LEVEL, cmd_outside_subshell=''):

    if verbose:
        logging.debug(("Running    (async    ssh)    '%s'" % command))
    self.start_master_ssh()
    self.send_file(os.path.join(self.job.clientdir, 'shared', 'hosts', 'scripts', 'run_helper.py'), os.path.join(self.job.tmpdir, 'run_helper.py'))
    env = '    '.join(('='.join(pair) for pair in self.env.iteritems()))
    ssh_cmd = self.ssh_command(connect_timeout, options)
    if (not env.strip()):
        env = ''
    else:
        env = ('export    %s;' % env)
    for arg in args:
        command += ('    "%s"' % utils.sh_escape(arg))
    full_cmd = '{ssh_cmd}    "{env}    {cmd}"'.format(ssh_cmd=ssh_cmd, env=env, cmd=utils.sh_escape(("%s    (%s    '%s')" % (cmd_outside_subshell, os.path.join(self.job.tmpdir, 'run_helper.py'), utils.sh_escape(command)))))
    job = utils.AsyncJob(full_cmd, stdout_tee=stdout_tee, stderr_tee=stderr_tee, verbose=verbose, stderr_level=stderr_level, stdin=subprocess.PIPE)
    def kill_func():
        utils.nuke_subprocess(job.sp)
    job.kill_func = kill_func
    return job
