Github user nchammas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4262#discussion_r24206704
  
    --- Diff: ec2/spark_ec2.py ---
    @@ -675,29 +676,40 @@ def setup_spark_cluster(master, opts):
             print "Ganglia started at http://%s:5080/ganglia"; % master
     
     
    -def is_ssh_available(host, opts):
    +def is_ssh_available(host, opts, print_ssh_output=False):
         """
         Check if SSH is available on a host.
         """
    -    try:
    -        with open(os.devnull, 'w') as devnull:
    -            ret = subprocess.check_call(
    -                ssh_command(opts) + ['-t', '-t', '-o', 'ConnectTimeout=3',
    -                                     '%s@%s' % (opts.user, host), 
stringify_command('true')],
    -                stdout=devnull,
    -                stderr=devnull
    -            )
    -        return ret == 0
    -    except subprocess.CalledProcessError as e:
    -        return False
    -
    -
    -def is_cluster_ssh_available(cluster_instances, opts):
    +    s = subprocess.Popen(
    +        ssh_command(opts) + ['-t', '-t', '-o', 'ConnectTimeout=3',
    +                             '%s@%s' % (opts.user, host), 
stringify_command('true')],
    +        stdout=subprocess.PIPE,
    +        stderr=subprocess.STDOUT  # we pipe stderr through stdout to 
preserve output order
    +    )
    +    cmd_output = s.communicate()[0]  # [1] is stderr, which we redirected 
to stdout
    +
    +    if s.returncode != 0 and print_ssh_output:
    +        # extra leading newline is for spacing in wait_for_cluster_state()
    +        print textwrap.dedent("""\n
    +            Warning: SSH connection error. (This could be temporary.)
    +            Host: {h}
    +            SSH return code: {r}
    +            SSH output: {o}
    +        """).format(
    +            h=host,
    +            r=s.returncode,
    +            o=cmd_output.strip()
    +        )
    +
    +    return s.returncode == 0
    +
    +
    +def is_cluster_ssh_available(cluster_instances, opts, 
print_ssh_output=False):
    --- End diff --
    
    I think I'll change this to default to `print_ssh_output=True`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to