startNotebookExecution method

Future<StartNotebookExecutionOutput> startNotebookExecution({
  1. required ExecutionEngineConfig executionEngine,
  2. required String serviceRole,
  3. String? editorId,
  4. Map<String, String>? environmentVariables,
  5. String? notebookExecutionName,
  6. String? notebookInstanceSecurityGroupId,
  7. String? notebookParams,
  8. NotebookS3LocationFromInput? notebookS3Location,
  9. OutputNotebookFormat? outputNotebookFormat,
  10. OutputNotebookS3LocationFromInput? outputNotebookS3Location,
  11. String? relativePath,
  12. List<Tag>? tags,
})

Starts a notebook execution.

May throw InternalServerException. May throw InvalidRequestException.

Parameter executionEngine : Specifies the execution engine (cluster) that runs the notebook execution.

Parameter serviceRole : The name or ARN of the IAM role that is used as the service role for Amazon EMR (the Amazon EMR role) for the notebook execution.

Parameter editorId : The unique identifier of the Amazon EMR Notebook to use for notebook execution.

Parameter environmentVariables : The environment variables associated with the notebook execution.

Parameter notebookExecutionName : An optional name for the notebook execution.

Parameter notebookInstanceSecurityGroupId : The unique identifier of the Amazon EC2 security group to associate with the Amazon EMR Notebook for this notebook execution.

Parameter notebookParams : Input parameters in JSON format passed to the Amazon EMR Notebook at runtime for execution.

Parameter notebookS3Location : The Amazon S3 location for the notebook execution input.

Parameter outputNotebookFormat : The output format for the notebook execution.

Parameter outputNotebookS3Location : The Amazon S3 location for the notebook execution output.

Parameter relativePath : The path and file name of the notebook file for this execution, relative to the path specified for the Amazon EMR Notebook. For example, if you specify a path of s3://MyBucket/MyNotebooks when you create an Amazon EMR Notebook for a notebook with an ID of e-ABCDEFGHIJK1234567890ABCD (the EditorID of this request), and you specify a RelativePath of my_notebook_executions/notebook_execution.ipynb, the location of the file for the notebook execution is s3://MyBucket/MyNotebooks/e-ABCDEFGHIJK1234567890ABCD/my_notebook_executions/notebook_execution.ipynb.

Parameter tags : A list of tags associated with a notebook execution. Tags are user-defined key-value pairs that consist of a required key string with a maximum of 128 characters and an optional value string with a maximum of 256 characters.

Implementation

Future<StartNotebookExecutionOutput> startNotebookExecution({
  required ExecutionEngineConfig executionEngine,
  required String serviceRole,
  String? editorId,
  Map<String, String>? environmentVariables,
  String? notebookExecutionName,
  String? notebookInstanceSecurityGroupId,
  String? notebookParams,
  NotebookS3LocationFromInput? notebookS3Location,
  OutputNotebookFormat? outputNotebookFormat,
  OutputNotebookS3LocationFromInput? outputNotebookS3Location,
  String? relativePath,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'ElasticMapReduce.StartNotebookExecution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ExecutionEngine': executionEngine,
      'ServiceRole': serviceRole,
      if (editorId != null) 'EditorId': editorId,
      if (environmentVariables != null)
        'EnvironmentVariables': environmentVariables,
      if (notebookExecutionName != null)
        'NotebookExecutionName': notebookExecutionName,
      if (notebookInstanceSecurityGroupId != null)
        'NotebookInstanceSecurityGroupId': notebookInstanceSecurityGroupId,
      if (notebookParams != null) 'NotebookParams': notebookParams,
      if (notebookS3Location != null)
        'NotebookS3Location': notebookS3Location,
      if (outputNotebookFormat != null)
        'OutputNotebookFormat': outputNotebookFormat.value,
      if (outputNotebookS3Location != null)
        'OutputNotebookS3Location': outputNotebookS3Location,
      if (relativePath != null) 'RelativePath': relativePath,
      if (tags != null) 'Tags': tags,
    },
  );

  return StartNotebookExecutionOutput.fromJson(jsonResponse.body);
}