-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcluster_add_step.py
43 lines (38 loc) · 1.14 KB
/
cluster_add_step.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/opt/conda/bin/python
import boto3
import config as c
emr = boto3.client('emr',
region_name=c.REGION_NAME,
aws_access_key_id=c.AWS_ACCESS_KEY_ID,
aws_secret_access_key=c.AWS_SECRET_ACCESS_KEY
)
# Add steps here:
ListofSteps=[
# {
# 'Name': 'Create_SL_Datalake',
# 'ActionOnFailure': 'TERMINATE_CLUSTER',
# 'HadoopJarStep': {
# 'Jar': 'command-runner.jar',
# 'Args': [
# 'spark-submit', '/home/hadoop/etl.py'
# ]
# }
# },
# {
# 'Name': 'New Step Name',
# 'ActionOnFailure': 'CONTINUE',
# 'HadoopJarStep': {
# 'Jar': 'command-runner.jar',
# 'Args': [
# 'argForNewStep'
# ]
# }
# }
]
# get cluster id:
job_flow_id = input('Enter Cluster id j-: ')
print("Job flow ID:", job_flow_id)
# Add aditional steps
step_response = emr.add_job_flow_steps(JobFlowId=job_flow_id, Steps=ListofSteps)
step_ids = step_response['StepIds']
print("Added Step IDs:", step_ids)