#! /bin/bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. export PYTHONPATH=`pwd`/src/ NUM=10 BIGNODE=172.16.250.254 BASEID=0 date echo "Creating small VMs..." for h in `seq -w 1 ${NUM}`; do echo "Creating VM #${h}..." INFO=`./create 1 $h 2>/dev/null | grep "[ \t]id:"` if [[ ${BASEID} -eq 0 ]]; then BASEID=`echo ${INFO} | sed 's/[^0-9]*\([0-9]*\).*/\1/'` fi done echo "Small VMs created" echo "Waiting for startup..." while [[ true ]]; do PASS="True" for h in `cat ~/hosts/vms.txt`; do HN=`ssh root@bd.${h} "hostname 2> /dev/null" 2> /dev/null | cut -c -2` if [[ "${HN}" != "vm" ]]; then PASS="False" fi done if [[ "${PASS}" == "True" ]]; then break fi sleep 1 done echo "Waiting finished" echo "Starting work on small VMs..." for h in `cat ~/hosts/vms.txt`; do ssh root@bd.${h} "./run > /dev/null 2>&1" > /dev/null 2>&1 & done echo "Creating large VM..." ./create 2 11 > /dev/null 2>&1 echo "Done creating large VM" while [[ true ]]; do sleep 5 COUNT=0 for h in `cat ~/hosts/vms.txt`; do CNT=`ssh root@bd.${h} "ls /x/mryan3/cvm-out/*/*.txt 2> /dev/null | wc -l 2> /dev/null" 2> /dev/null` COUNT=$((COUNT+CNT)) done echo "${COUNT}/64 work items completed..." if [[ ${COUNT} -eq 64 ]]; then break fi done echo "Work on small VMs completed" for i in `seq 1 ${NUM}`; do wait done echo "Collecting output from small VMs to the large VM..." ssh root@bd.${BIGNODE} ./gather > /dev/null 2>&1 echo "Done collecting output" echo "Destroying small VMs..." for i in `seq 1 ${NUM}`; do ./bin/destroyVm $((i+BASEID-1)) > /dev/null 2>&1 done echo "Done destroying small VMs" echo "Doing work on large VM..." ssh root@bd.${BIGNODE} ./build > /dev/null 2>&1 & while [[ true ]]; do sleep 2 SIZE=`ssh root@bd.${BIGNODE} "du -hs ./out.e 2> /dev/null | awk '{print "'$1'"}' 2> /dev/null" 2> /dev/null` echo "${SIZE}/154M output data generated..." if [[ "${SIZE}" == "154M" ]]; then break fi done wait echo "Work on large VM complete" echo "Copying final output file to localhost..." scp root@bd.${BIGNODE}:./out.e /tmp/out.e echo "Copy complete" echo "Destroying large VM..." ./bin/destroyVm $((11+BASEID-1)) > /dev/null 2>&1 echo "Large VM destroyed" echo "Generating output image from etree..." (cd ~/local/src/mryan3/BigDatavis/src; ./util/draw_slice -d /tmp/out.e 0 0 0 512 0 0 0 512 0 512 512 /tmp/output.jpg > /dev/null 2>&1) echo "Image complete" date qiv /tmp/output.jpg