| 1 | == Instruction == |
| 2 | [https://geni-orca.renci.org/trac/wiki/velocity-templates Post-boot script] |
| 3 | |
| 4 | == Tutorial Experiment == |
| 5 | === A Condor Cluster Request: 1 master node and 2 worker nodes === |
| 6 | |
| 7 | [[Image(Flukes-GREE13-1.png)]] |
| 8 | |
| 9 | ** PostBoot script at the Master Node |
| 10 | |
| 11 | {{{ |
| 12 | "#!/bin/bash |
| 13 | |
| 14 | echo "hello from neuca script" |
| 15 | echo StrictHostKeyChecking no >> /etc/ssh/ssh_config |
| 16 | |
| 17 | echo $CondorMaster.IP("Link1") condor-master condor-master.orca >> /etc/hosts |
| 18 | for i in {100..200}; do |
| 19 | name=$(($i - 100)) |
| 20 | echo `echo $self.IP("Link1") | sed 's/.[0-9][0-9]*$//g'`.$i condor-w$name condor-w$name\.orca >> /etc/hosts |
| 21 | done |
| 22 | # |
| 23 | echo condor-master > /etc/hostname |
| 24 | /bin/hostname -F /etc/hostname |
| 25 | /etc/init.d/condor stop |
| 26 | cp /etc/condor/condor_config.master.local /etc/condor/condor_config.local |
| 27 | echo 'CONDOR_HOST = condor-master.orca' >> /etc/condor/condor_config.local |
| 28 | echo 'DEFAULT_DOMAIN_NAME = orca' >> /etc/condor/condor_config.local |
| 29 | /etc/init.d/condor start |
| 30 | #" |
| 31 | }}} |
| 32 | |
| 33 | ** PostBoot Script at the worker node |
| 34 | |
| 35 | {{{ |
| 36 | "#!/bin/bash |
| 37 | |
| 38 | function testSSH() { |
| 39 | local user=${1} |
| 40 | local host=${2} |
| 41 | local timeout=${3} |
| 42 | |
| 43 | SSH_OPTS="-q -o PreferredAuthentications=publickey -o HostbasedAuthentication=no -o PasswordAuthentication=no -o StrictHostKeyChecking=no" |
| 44 | |
| 45 | ssh -q -q $SSH_OPTS -o "BatchMode=yes" -o "ConnectTimeout ${timeout}" ${user}@${host} "echo 2>&1" && return 0 || return 1 |
| 46 | } |
| 47 | |
| 48 | |
| 49 | |
| 50 | echo "hello from neuca script" |
| 51 | |
| 52 | echo $CondorMaster.IP("Link1") condor-master condor-master.orca >> /etc/hosts |
| 53 | for i in {100..200}; do |
| 54 | name=$(($i - 100)) |
| 55 | echo `echo $self.IP("Link1") | sed 's/.[0-9][0-9]*$//g'`.$i condor-w$name condor-w$name\.orca >> /etc/hosts |
| 56 | done |
| 57 | ip_end=`echo $self.IP("Link1") | sed 's/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.//g'` |
| 58 | name=$(($ip_end - 100)) |
| 59 | host_name=condor-w$name |
| 60 | echo $host_name > /etc/hostname |
| 61 | /bin/hostname -F /etc/hostname |
| 62 | |
| 63 | # wait until the condor-master is pingable |
| 64 | UNPINGABLE=true |
| 65 | for ((i=0;i<60;i+=1)); |
| 66 | do |
| 67 | echo "testing ping, try: $i " >> /tmp/bootscript.out |
| 68 | PING=`ping -c 3 condor-master > /dev/null 2>&1` |
| 69 | if [ "$?" = "0" ]; then |
| 70 | UNPINGABLE=false |
| 71 | break |
| 72 | fi |
| 73 | sleep 10 |
| 74 | done |
| 75 | |
| 76 | UNSSHABLE=true |
| 77 | for ((i=0;i<60;i+=1)); |
| 78 | do |
| 79 | echo "testing ssh, try: $i" >> /tmp/bootscript.out |
| 80 | testSSH root condor-master 5 |
| 81 | if [ "$?" = "0" ]; then |
| 82 | UNSSHABLE=false |
| 83 | break |
| 84 | fi |
| 85 | sleep 10 |
| 86 | done |
| 87 | |
| 88 | orca_name=$self.Name() |
| 89 | echo $orca_name |
| 90 | |
| 91 | ssh condor-master "echo $orca_name > /tmp/$host_name" |
| 92 | |
| 93 | /etc/init.d/condor stop |
| 94 | cp /etc/condor/condor_config.worker.local /etc/condor/condor_config.local |
| 95 | echo 'CONDOR_HOST = condor-master.orca' >> /etc/condor/condor_config.local |
| 96 | echo 'DEFAULT_DOMAIN_NAME = orca' >> /etc/condor/condor_config.local |
| 97 | echo 'ALLOW_ADMINISTRATOR = *' >> /etc/condor/condor_config.local |
| 98 | echo 'ALLOW_OWNER = *' >> /etc/condor/condor_config.local |
| 99 | /etc/init.d/condor start" |
| 100 | }}} |
| 101 | |
| 102 | ** Inside the Condor cluster: |
| 103 | |
| 104 | *** As root: |
| 105 | |
| 106 | {{{ |
| 107 | 188 neuca-user-data |
| 108 | 189 neuca-user-script |
| 109 | 190 su exogeni-user |
| 110 | }}} |
| 111 | |
| 112 | ** *As exogeni-user: |
| 113 | |
| 114 | {{{ |
| 115 | cd ExoGENI-demo/ |
| 116 | 23 ls |
| 117 | 24 ./ExoGENI-demo 5 |
| 118 | 25 less ExoGENI-demo.cmd |
| 119 | 26 condor_status |
| 120 | 27 condor_q |
| 121 | 28 condor_submit ExoGENI-demo.cmd |
| 122 | 29 condor_q |
| 123 | 30 condor_status |
| 124 | 31 condor_q |
| 125 | 32 ls |
| 126 | 33 cat ExoGENI-demo.out |
| 127 | 34 condor_submit ExoGENI-demo.cmd |
| 128 | 35 condor_q |
| 129 | 36 watch condor_q |
| 130 | }}} |
| 131 | |
| 132 | === Add and Remove nodes === |
| 133 | [[Image(Flukes-GREE13-2.png)]] |