forked from amplab/training-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts to print master hostnames and copy progress
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# Usage | ||
# check-copy-progress <private_key_path> <file-with-hostnames> | ||
|
||
pssh -i -x "-i $1" -l root -h $2 '~/ephemeral-hdfs/bin/hadoop fs -dus /' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
PYTHONPATH="./third_party/boto-2.4.1.zip/boto-2.4.1:$PYTHONPATH" python get_masters.py $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import print_function | ||
import json | ||
import urllib2 | ||
import boto | ||
from optparse import OptionParser | ||
from boto import * | ||
|
||
def is_active(instance): | ||
return (instance.state in ['pending', 'running', 'stopping', 'stopped']) | ||
|
||
def main(): | ||
parser = OptionParser(usage="get_masters [cluster_prefix]", | ||
add_help_option=True) | ||
(opts, args) = parser.parse_args() | ||
if len(args) != 1: | ||
get_cluster_masters() | ||
else: | ||
get_cluster_masters(args[0]) | ||
|
||
def get_cluster_masters(prefix=""): | ||
conn = connect_ec2() | ||
res = conn.get_all_instances() | ||
# master reservations have only one node | ||
masters = [i for i in res if len(i.instances) == 1] | ||
master_instances = [m.instances[0] for m in masters if is_active(m.instances[0])] | ||
|
||
name_host = [(m.tags['cluster'], m.public_dns_name) for m in master_instances] | ||
|
||
for (name, host) in name_host: | ||
if prefix in name: | ||
print(name + " " + host) | ||
|
||
if __name__ == "__main__": | ||
main() |