Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- sudo easy_install-2.y pip
- sudo /usr/local/bin/pip2 install librosa
- try:
- clusterId=argv[1]
- except:
- print("Syntax: emr_install.py [ClusterId]")
- import sys
- sys.exit(1)
- emrclient=client('emr')
- # Get list of core nodes
- instances=emrclient.list_instances(ClusterId=clusterId,InstanceGroupTypes=['CORE'])['Instances']
- instance_list=[x['Ec2InstanceId'] for x in instances]
- # Attach tag to core nodes
- ec2client=client('ec2')
- ec2client.create_tags(Resources=instance_list,Tags=[{"Key":"environment","Value":"coreNodeLibs"}])
- ssmclient=client('ssm')
- # Run shell script to install libraries
- command=ssmclient.send_command(Targets=[{"Key": "tag:environment", "Values":["coreNodeLibs"]}],
- DocumentName='AWS-RunShellScript',
- Parameters={"commands":["bash /home/hadoop/install_librosa.sh"]},
- TimeoutSeconds=3600)['Command']['CommandId']
- command_status=ssmclient.list_commands(
- CommandId=command,
- Filters=[
- {
- 'key': 'Status',
- 'value': 'SUCCESS'
- },
- ]
- )['Commands'][0]['Status']
- time.sleep(30)
- print("Command:" + command + ": " + command_status)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement