我有一个任务需要完成,我需要在AWS上自动执行Jupyter笔记本。我对AWS环境完全陌生,所以不知道如何高效地使用它。我需要做的事情如下-
- 需要REST API来启动和停止在AWS上执行Jupyter笔记本。
- 需要在使用API调用时向笔记本发送参数
我需要哪些AWS组件来执行上述任务?
import boto3,time
emr = boto3.client(
'emr',
region_name='us-west-1'
)
start_resp = emr.start_notebook_execution(
EditorId='e-40AC8ZO6EGGCPJ4DLO48KGGGI',
RelativePath='boto3_demo.ipynb',
ExecutionEngine={'Id':'j-1HYZS6JQKV11Q'},
ServiceRole='EMR_Notebooks_DefaultRole'
)
execution_id = start_resp["NotebookExecutionId"]
print(execution_id)
print("n")
describe_response = emr.describe_notebook_execution(NotebookExecutionId=execution_id)
print(describe_response)
print("n")
list_response = emr.list_notebook_executions()
print("Existing notebook executions:n")
for execution in list_response['NotebookExecutions']:
print(execution)
print("n")
print("Sleeping for 5 sec...")
time.sleep(5)
print("Stop execution " + execution_id)
emr.stop_notebook_execution(NotebookExecutionId=execution_id)
describe_response = emr.describe_notebook_execution(NotebookExecutionId=execution_id)
print(describe_response)
print("n")
这是一个实验性存储库,它在SageMaker Studio中创建一个Jupyter扩展,以自动运行您的笔记本。它是为试用而设计的,不保证对SageMaker的支持。
https://github.com/aws-samples/sagemaker-run-notebook
我在AWS工作,我的意见是我自己的。