spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nchammas <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-3398] [EC2] Have spark-ec2 intelligentl...
Date Sat, 13 Sep 2014 05:03:18 GMT
Github user nchammas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2339#discussion_r17510489
  
    --- Diff: ec2/spark_ec2.py ---
    @@ -608,14 +597,53 @@ def setup_spark_cluster(master, opts):
             print "Ganglia started at http://%s:5080/ganglia" % master
     
     
    -# Wait for a whole cluster (masters, slaves and ZooKeeper) to start up
    -def wait_for_cluster(conn, wait_secs, master_nodes, slave_nodes):
    -    print "Waiting for instances to start up..."
    -    time.sleep(5)
    -    wait_for_instances(conn, master_nodes)
    -    wait_for_instances(conn, slave_nodes)
    -    print "Waiting %d more seconds..." % wait_secs
    -    time.sleep(wait_secs)
    +def is_ssh_available(host, opts):
    +    "Checks if SSH is available on the 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 wait_for_cluster_state(cluster_instances, cluster_state, opts):
    +    """
    +    cluster_instances: a list of boto.ec2.instance.Instance
    +    cluster_state: a string representing the desired state of all the instances in the
cluster
    +           value can be 'ssh-ready' or a valid value from boto.ec2.instance.InstanceState
such as
    +           'running', 'terminated', etc.
    +           (would be nice to replace this with a proper enum: http://stackoverflow.com/a/1695250)
    +    """
    +    sys.stdout.write(
    --- End diff --
    
    I can make that change, but scanning through the rest of the script it doesn't look consistent
with the style that's been followed. Some examples:
    * [L384](https://github.com/apache/spark/blob/2584ea5b23b1c5a4df9549b94bfc9b8e0900532e/ec2/spark_ec2.py#L384)
    * [L430](https://github.com/apache/spark/blob/2584ea5b23b1c5a4df9549b94bfc9b8e0900532e/ec2/spark_ec2.py#L430)
    * [L460](https://github.com/apache/spark/blob/2584ea5b23b1c5a4df9549b94bfc9b8e0900532e/ec2/spark_ec2.py#L460)
    * [L506](https://github.com/apache/spark/blob/2584ea5b23b1c5a4df9549b94bfc9b8e0900532e/ec2/spark_ec2.py#L506)
    
    Is your recommendation specific to `sys.stdout.write()`?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message