in airflow_dag_for_execution/simple_dag.py [0:0]
def start_execution(**context):
editor_id = <FILL_IN_NOTEBOOK_ID, e.g. 'e-ABCDEFG'>
relative_path = <FILL_IN_NOTEBOOK_FILE_PATH, e.g. 'folder/demo.ipynb'>
emr = boto3.client('emr', region_name=<FILL_IN_REGION, e.g. 'us-west-2'>)
ti = context['task_instance']
cluster_id = ti.xcom_pull(key='return_value', task_ids='create_cluster_task')
print("Starting an execution using cluster: " + cluster_id)
start_resp = emr.start_notebook_execution(
EditorId=editor_id,
RelativePath=relative_path,
ExecutionEngine={'Id': cluster_id, 'Type': 'EMR'},
ServiceRole='EMR_Notebooks_DefaultRole'
)
execution_id = start_resp['NotebookExecutionId']
print("Started an execution: " + execution_id)
return execution_id