在使用boto3启动AWS EMR集群上的笔记本时,它没有进入"运行"状态,所以我不确定我的脚本是否正常工作。注意-我从lambda函数调用boto3函数,并使用api网关调用此lambda函数。有什么方法可以验证我的笔记本是否运行成功?
集群状态-等待,笔记本状态-已停止,笔记本已连接到集群。
'进口json进口boto3导入时间
def lambda_handler(event, context):# TODO实现Client = boto3.client('emr')cluster_state = client. descripbe_cluster (ClusterId='XXXX')print("集群状态- n")打印(cluster_state)Response = client.start_notebook_execution(EditorId ="XXXX",RelativePath ="XXXX",ExecutionEngine ={"XXXX"},ServiceRole ="XXXX")
execution_id = response["NotebookExecutionId"]
print("========== Execution ID ==========")
print(execution_id)
describe_response = client.describe_notebook_execution(
NotebookExecutionId=execution_id
)
print("Describing notebook execution n")
print(describe_response)
list_response = client.list_notebook_executions()
print("Notebook execution details: n")
for execution in list_response['NotebookExecutions']:
print(execution)
print("n")
print("Sleeping for 5 sec...")
time.sleep(5)
client.stop_notebook_execution(NotebookExecutionId=execution_id)
describe_response = client.describe_notebook_execution(
NotebookExecutionId=execution_id
)
print(describe_response)`
Cloudwatch日志-"状态":"开始"状态":"停止"状态":"完成"状态":"停止"状态":"停止"状态":"停止"状态":"停止"状态":"完成"状态":"完成"状态":"失败">
笔记本安全组sg-0055653XXXXXbf01c没有连接主安全组sg-0055653XXXXXbf01c的出口规则。请修复安全组或使用默认选项。