Skip to content

Instantly share code, notes, and snippets.

@sujee
Created January 2, 2011 05:40
Show Gist options
  • Save sujee/762324 to your computer and use it in GitHub Desktop.
Save sujee/762324 to your computer and use it in GitHub Desktop.
run-emr-TestMR.sh : launches an MR job on EMR
#!/bin/bash
## http://sujee.net/tech/articles/amazon-emr-beyond-basics/
# config
# if changing machine type, also change mapred config file
MASTER_INSTANCE_TYPE="m1.large"
SLAVE_INSTANCE_TYPE="c1.xlarge"
INSTANCES=5
export JOBNAME="MyMR"
export TIMESTAMP=$(date +%Y%m%d-%H%M%S)
# end config
echo "==========================================="
echo $(date +%Y%m%d.%H%M%S) " > $0 : starting...."
export t1=$(date +%s)
#if the line breaks don't work, join the following lines and remove all '\'
export JOBID=$(elastic-mapreduce --plain-output --create --name "${JOBNAME}__${TIMESTAMP}" \
--num-instances "$INSTANCES" --master-instance-type "$MASTER_INSTANCE_TYPE" \
--slave-instance-type "$SLAVE_INSTANCE_TYPE" \
--jar s3://my_bucket/my.jar --main-class my.TestMR \
--log-uri s3://my_bucket/emr-logs/ )
sh ./emr-wait-for-completion.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment