Skip to content

start_notebook_execution

start_notebook_execution(
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    editor_id: Optional[XmlStringMaxLen256] = None,
    relative_path: Optional[XmlString] = None,
    notebook_execution_name: Optional[XmlStringMaxLen256] = None,
    notebook_params: Optional[XmlString] = None,
    execution_engine: Optional[ExecutionEngineConfig] = None,
    service_role: Optional[XmlString] = None,
    notebook_instance_security_group_id: Optional[XmlStringMaxLen256] = None,
    tags: Optional[TagList] = None,
    notebook_s3_location: Optional[NotebookS3LocationFromInput] = None,
    output_notebook_s3_location: Optional[OutputNotebookS3LocationFromInput] = None,
    output_notebook_format: Optional[OutputNotebookFormat] = None,
    environment_variables: Optional[EnvironmentVariablesMap] = None,
) -> StartNotebookExecutionOutput

Starts a notebook execution.

Parameters:

  • editor_id (Optional[XmlStringMaxLen256], default: None ) –

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

  • relative_path (Optional[XmlString], default: None ) –

    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.

  • notebook_execution_name (Optional[XmlStringMaxLen256], default: None ) –

    An optional name for the notebook execution.

  • notebook_params (Optional[XmlString], default: None ) –

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

  • execution_engine (Optional[ExecutionEngineConfig], default: None ) –

    Specifies the execution engine (cluster) that runs the notebook execution.

  • service_role (Optional[XmlString], default: None ) –

    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.

  • notebook_instance_security_group_id (Optional[XmlStringMaxLen256], default: None ) –

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

  • tags (Optional[TagList], default: None ) –

    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.

  • notebook_s3_location (Optional[NotebookS3LocationFromInput], default: None ) –

    The Amazon S3 location for the notebook execution input.

  • output_notebook_s3_location (Optional[OutputNotebookS3LocationFromInput], default: None ) –

    The Amazon S3 location for the notebook execution output.

  • output_notebook_format (Optional[OutputNotebookFormat], default: None ) –

    The output format for the notebook execution.

  • environment_variables (Optional[EnvironmentVariablesMap], default: None ) –

    The environment variables associated with the notebook execution.

Raises:

Source code in docs_src/capo_emr/_services/emr.py
def start_notebook_execution(
    self,
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    editor_id: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    relative_path: Optional["capo_emr.types.xml_string.XmlString"] = None,
    notebook_execution_name: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    notebook_params: Optional["capo_emr.types.xml_string.XmlString"] = None,
    execution_engine: Optional[
        "capo_emr.types.execution_engine_config.ExecutionEngineConfig"
    ] = None,
    service_role: Optional["capo_emr.types.xml_string.XmlString"] = None,
    notebook_instance_security_group_id: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    tags: Optional["capo_emr.types.tag_list.TagList"] = None,
    notebook_s3_location: Optional[
        "capo_emr.types.notebook_s3_location_from_input.NotebookS3LocationFromInput"
    ] = None,
    output_notebook_s3_location: Optional[
        "capo_emr.types.output_notebook_s3_location_from_input.OutputNotebookS3LocationFromInput"
    ] = None,
    output_notebook_format: Optional[
        "capo_emr.types.output_notebook_format.OutputNotebookFormat"
    ] = None,
    environment_variables: Optional[
        "capo_emr.types.environment_variables_map.EnvironmentVariablesMap"
    ] = None,
) -> "capo_emr.types.start_notebook_execution_output.StartNotebookExecutionOutput":
    """<p>Starts a notebook execution.</p>

    Args:
        editor_id: <p>The unique identifier of the Amazon EMR Notebook to use for notebook execution.</p>
        relative_path: <p>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 <code>s3://MyBucket/MyNotebooks</code> when you create an Amazon EMR Notebook for a notebook with an ID of <code>e-ABCDEFGHIJK1234567890ABCD</code> (the <code>EditorID</code> of this request), and you specify a <code>RelativePath</code> of <code>my_notebook_executions/notebook_execution.ipynb</code>, the location of the file for the notebook execution is <code>s3://MyBucket/MyNotebooks/e-ABCDEFGHIJK1234567890ABCD/my_notebook_executions/notebook_execution.ipynb</code>.</p>
        notebook_execution_name: <p>An optional name for the notebook execution.</p>
        notebook_params: <p>Input parameters in JSON format passed to the Amazon EMR Notebook at runtime for execution.</p>
        execution_engine: <p>Specifies the execution engine (cluster) that runs the notebook execution.</p>
        service_role: <p>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.</p>
        notebook_instance_security_group_id: <p>The unique identifier of the Amazon EC2 security group to associate with the Amazon EMR Notebook for this notebook execution.</p>
        tags: <p>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.</p>
        notebook_s3_location: <p>The Amazon S3 location for the notebook execution input.</p>
        output_notebook_s3_location: <p>The Amazon S3 location for the notebook execution output.</p>
        output_notebook_format: <p>The output format for the notebook execution.</p>
        environment_variables: <p>The environment variables associated with the notebook execution.</p>

    Raises:
        capo_emr.errors.internal_server_exception.InternalServerException: <p>This exception occurs when there is an internal failure in the Amazon EMR service.</p>
        capo_emr.errors.invalid_request_exception.InvalidRequestException: <p>This exception occurs when there is something wrong with user input.</p>
        capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_emr.types.start_notebook_execution_input.StartNotebookExecutionInput]",
    ) -> OperationResponse[
        "capo_emr.types.start_notebook_execution_output.StartNotebookExecutionOutput"
    ]:
        import capo_emr._operations.elastic_map_reduce.start_notebook_execution

        output, http_response = (
            capo_emr._operations.elastic_map_reduce.start_notebook_execution.start_notebook_execution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartNotebookExecution")
    )
    input_: capo_emr.types.start_notebook_execution_input.StartNotebookExecutionInput = {}
    if editor_id is not None:
        input_["editor_id"] = editor_id
    if relative_path is not None:
        input_["relative_path"] = relative_path
    if notebook_execution_name is not None:
        input_["notebook_execution_name"] = notebook_execution_name
    if notebook_params is not None:
        input_["notebook_params"] = notebook_params
    if execution_engine is not None:
        input_["execution_engine"] = execution_engine
    if service_role is not None:
        input_["service_role"] = service_role
    if notebook_instance_security_group_id is not None:
        input_["notebook_instance_security_group_id"] = (
            notebook_instance_security_group_id
        )
    if tags is not None:
        input_["tags"] = tags
    if notebook_s3_location is not None:
        input_["notebook_s3_location"] = notebook_s3_location
    if output_notebook_s3_location is not None:
        input_["output_notebook_s3_location"] = output_notebook_s3_location
    if output_notebook_format is not None:
        input_["output_notebook_format"] = output_notebook_format
    if environment_variables is not None:
        input_["environment_variables"] = environment_variables

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output