airflow.providers.amazon.aws.operators.sagemaker_unified_studio_notebook

This module contains the Amazon SageMaker Unified Studio Notebook operator.

This operator supports asynchronous notebook execution in SageMaker Unified Studio.

Classes

SageMakerUnifiedStudioNotebookOperator

Execute a notebook in SageMaker Unified Studio.

Module Contents

class airflow.providers.amazon.aws.operators.sagemaker_unified_studio_notebook.SageMakerUnifiedStudioNotebookOperator(*, notebook_identifier, domain_identifier, owning_project_identifier, client_token=None, notebook_parameters=None, compute_configuration=None, timeout_configuration=None, wait_for_completion=True, waiter_delay=10, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), endpoint_url=None, **kwargs)[source]

Bases: airflow.providers.amazon.aws.operators.base_aws.AwsBaseOperator[airflow.providers.amazon.aws.hooks.sagemaker_unified_studio_notebook.SageMakerUnifiedStudioNotebookHook]

Execute a notebook in SageMaker Unified Studio.

This operator calls the DataZone StartNotebookRun API to kick off headless notebook execution. When not configured otherwise, polls the GetNotebookRun API until the run reaches a terminal state.

Examples:
from airflow.providers.amazon.aws.operators.sagemaker_unified_studio_notebook import (
    SageMakerUnifiedStudioNotebookOperator,
)

notebook_operator = SageMakerUnifiedStudioNotebookOperator(
    task_id="run_notebook",
    notebook_identifier="nb-1234567890",
    domain_identifier="dzd_example",
    owning_project_identifier="proj_example",
    notebook_parameters={"param1": "value1"},
    compute_configuration={"instanceType": "sc.m5.large"},
    timeout_configuration={"runTimeoutInMinutes": 1440},
)
Parameters:
  • notebook_identifier (str) – The ID of the notebook to execute.

  • domain_identifier (str) – The ID of the SageMaker Unified Studio domain containing the notebook.

  • owning_project_identifier (str) – The ID of the SageMaker Unified Studio project containing the notebook.

  • client_token (str | None) – Optional idempotency token. Auto-generated if not provided.

  • notebook_parameters (dict | None) – Optional dict of parameters to pass to the notebook.

  • compute_configuration (dict | None) – Optional compute config. Example: {“instanceType”: “sc.m5.large”}

  • timeout_configuration (dict | None) – Optional timeout settings. Example: {“runTimeoutInMinutes”: 1440}

  • wait_for_completion (bool) – If True, wait for the notebook run to finish before completing the task. If False, the operator returns immediately after starting the run. (default: True)

  • waiter_delay (int) – Interval in seconds to poll the notebook run status (default: 10).

  • deferrable (bool) – If True, the operator will defer polling to the trigger, freeing up the worker slot while waiting. (default: False)

  • endpoint_url (str | None) – Optional custom endpoint URL for the DataZone API.

See also

For more information on how to use this operator, take a look at the guide: Run SageMaker Unified Studio notebooks

aws_hook_class[source]
template_fields: collections.abc.Sequence[str][source]
notebook_identifier[source]
domain_identifier[source]
owning_project_identifier[source]
client_token = None[source]
notebook_parameters = None[source]
compute_configuration = None[source]
timeout_configuration = None[source]
wait_for_completion = True[source]
waiter_delay = 10[source]
deferrable[source]
endpoint_url = None[source]
execute(context)[source]

Derive when creating an operator.

The main method to execute the task. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event=None)[source]

Was this entry helpful?