~ubuntu-branches/ubuntu/vivid/cctools/vivid

« back to all changes in this revision

Viewing changes to dttools/src/ec2_submit_workers

  • Committer: Package Import Robot
  • Author(s): Michael Hanke
  • Date: 2012-03-30 12:40:01 UTC
  • mfrom: (9.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120330124001-ze0lhxm5uwq2e3mo
Tags: 3.4.2-2
Added patch to handle a missing CFLAGS variable in Python's sysconfig
report (Closes: #661658).

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
{
5
5
        echo "Use: ec2_submit_workers [options] <servername> <port> <ec2-key-name> <ec2-key-file> <num-workers>"
6
6
        echo "where options are:"
7
 
        echo "  -a                      Enable auto mode."
8
 
        echo "  -s                      Run as a shared worker."
9
 
        echo "  -N <name>               Preferred master name."
10
 
        echo "  -C <catalog>            Set catalog server to <catalog>. <catalog> format: HOSTNAME:PORT."
11
 
        echo "  -t <time>               Abort after this amount of idle time. (default=900s)."
12
 
        echo "  -i <image_id>           EC2 OS image ID. Default = ami-fa01f193 (Ubuntu 10.04 x86_64)."
13
 
        echo "  -z <instance_size>      EC2 instance size. Default = m1.large."
14
 
        echo "  -p <parameters>         ec2-run-instances parameters."
15
 
        echo "  -h                      Show this help message."
 
7
        echo "  -a                  Enable auto mode."
 
8
        echo "  -s                  Run as a shared worker."
 
9
        echo "  -N <name>           Preferred master name."
 
10
        echo "  -C <catalog>        Set catalog server to <catalog>. <catalog> format: HOSTNAME:PORT."
 
11
        echo "  -t <time>           Abort after this amount of idle time. (default=900s)."
 
12
        echo "  -d <subsystem>      Enable debugging on worker for this subsystem (try -d all to start)."
 
13
        echo "  -i <image_id>       EC2 OS image ID. Default = ami-fa01f193 (Ubuntu 10.04 x86_64)."
 
14
        echo "  -z <instance_size>  EC2 instance size. Default = m1.large."
 
15
        echo "  -p <parameters>     ec2-run-instances parameters."
 
16
        echo "  -h                  Show this help message."
16
17
        exit 1
17
18
}
18
19
 
22
23
instance_size=m1.large
23
24
parameters=""
24
25
 
25
 
while getopts asN:t:i:z:p:h opt 
 
26
while getopts asN:C:t:d:i:z:p:h opt 
26
27
do
27
28
        case "$opt" in
28
29
                a)  arguments="$arguments -a"; use_auto=1;;
30
31
                N)  arguments="$arguments -N $OPTARG";;
31
32
                C)  arguments="$arguments -C $OPTARG";;
32
33
                t)  arguments="$arguments -t $OPTARG";;
 
34
                d)  arguments="$arguments -d $OPTARG";;
33
35
                i)  image="$OPTARG";;
34
36
                z)  instance_size="$OPTARG";;
35
 
                p)  parameters="$parameters $OPTARG";;
 
37
                p)  parameters="$parameters $OPTARG";;
36
38
                h)  show_help;;
37
39
                \?) show_help;;
38
40
        esac
89
91
chmod 755 worker.sh
90
92
 
91
93
#Start EC2 instances of the required count.
92
 
ec2-run-instances $image --instance-type $instance_size -k $keyname $parameters -n $count
 
94
ec2run_out=$(ec2-run-instances $image --instance-type $instance_size -k $keyname $parameters -n $count)
 
95
reservation_id=$(echo $ec2run_out | awk '{print $2}')
 
96
echo "Created $count instance(s) under reservation $reservation_id."
93
97
sleep 60
94
98
 
95
99
#Wait until all of the requested instances come on-board..
97
101
while [ $running_instances -lt $count ]
98
102
do
99
103
        sleep 20
100
 
        running_instances=$(ec2-describe-instances | grep $image | grep running | wc -l)
 
104
        running_instances=$(ec2-describe-instances -F 'reservation-id'=$reservation_id | grep $image | grep running | wc -l)
101
105
done
102
106
 
103
107
inst_count=1
104
108
while [ $inst_count -le $count ]
105
109
do
106
 
        instance=$(ec2-describe-instances | grep running | awk 'NR==var{print $4 }' var="${inst_count}")
 
110
        instance=$(ec2-describe-instances -F 'reservation-id'=$reservation_id | grep running | awk 'NR==var{print $4 }' var="${inst_count}")
107
111
        echo "------------------------------------------------"
108
112
        echo "Starting worker #$inst_count on $instance"
109
113
        scp -o StrictHostKeyChecking=no -o ConnectTimeout=20 -o ConnectionAttempts=1 -i $keyfile $worker worker.sh ubuntu@$instance:.