startNotebookExecution method

Future<StartNotebookExecutionOutput> startNotebookExecution({
  1. required String editorId,
  2. required ExecutionEngineConfig executionEngine,
  3. required String relativePath,
  4. required String serviceRole,
  5. String? notebookExecutionName,
  6. String? notebookInstanceSecurityGroupId,
  7. String? notebookParams,
  8. List<Tag>? tags,
})

Starts a notebook execution.

May throw InternalServerException. May throw InvalidRequestException.

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

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

Parameter relativePath : The path and file name of the notebook file for this execution, relative to the path specified for the EMR Notebook. For example, if you specify a path of s3://MyBucket/MyNotebooks when you create an 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 serviceRole : The name or ARN of the IAM role that is used as the service role for Amazon EMR (the EMR role) for 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 EMR Notebook for this notebook execution.

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

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 String editorId,
  required ExecutionEngineConfig executionEngine,
  required String relativePath,
  required String serviceRole,
  String? notebookExecutionName,
  String? notebookInstanceSecurityGroupId,
  String? notebookParams,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(editorId, 'editorId');
  _s.validateStringLength(
    'editorId',
    editorId,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(executionEngine, 'executionEngine');
  ArgumentError.checkNotNull(relativePath, 'relativePath');
  _s.validateStringLength(
    'relativePath',
    relativePath,
    0,
    10280,
    isRequired: true,
  );
  ArgumentError.checkNotNull(serviceRole, 'serviceRole');
  _s.validateStringLength(
    'serviceRole',
    serviceRole,
    0,
    10280,
    isRequired: true,
  );
  _s.validateStringLength(
    'notebookExecutionName',
    notebookExecutionName,
    0,
    256,
  );
  _s.validateStringLength(
    'notebookInstanceSecurityGroupId',
    notebookInstanceSecurityGroupId,
    0,
    256,
  );
  _s.validateStringLength(
    'notebookParams',
    notebookParams,
    0,
    10280,
  );
  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: {
      'EditorId': editorId,
      'ExecutionEngine': executionEngine,
      'RelativePath': relativePath,
      'ServiceRole': serviceRole,
      if (notebookExecutionName != null)
        'NotebookExecutionName': notebookExecutionName,
      if (notebookInstanceSecurityGroupId != null)
        'NotebookInstanceSecurityGroupId': notebookInstanceSecurityGroupId,
      if (notebookParams != null) 'NotebookParams': notebookParams,
      if (tags != null) 'Tags': tags,
    },
  );

  return StartNotebookExecutionOutput.fromJson(jsonResponse.body);
}