sagemaker.core.workflow.pipeline_context#
The pipeline context for workflow
Functions
|
Convenience method for runnable_by_pipeline decorator |
|
A convenient Decorator |
Classes
|
Managing a session that executes Sagemaker pipelines and jobs locally in a pipeline context. |
|
Managing interactions with SageMaker APIs and AWS services needed under Pipeline Context |
- class sagemaker.core.workflow.pipeline_context.LocalPipelineSession(boto_session=None, default_bucket=None, s3_endpoint_url=None, disable_local_code=False, default_bucket_prefix=None)[source]#
Bases:
LocalSession,PipelineSessionManaging a session that executes Sagemaker pipelines and jobs locally in a pipeline context.
This class inherits from the LocalSession and PipelineSession classes. When running Sagemaker pipelines locally, this class is preferred over LocalSession.
- class sagemaker.core.workflow.pipeline_context.PipelineSession(boto_session=None, sagemaker_client=None, default_bucket=None, settings=<sagemaker.core.session_settings.SessionSettings object>, sagemaker_config: dict | None = None, default_bucket_prefix: str | None = None)[source]#
Bases:
SessionManaging interactions with SageMaker APIs and AWS services needed under Pipeline Context
This class inherits the SageMaker session, it provides convenient methods for manipulating entities and resources that Amazon SageMaker uses, such as training jobs, endpoints, and input datasets in S3. When composing SageMaker Model-Building Pipeline, PipelineSession is recommended over regular SageMaker Session
- property context#
Hold contextual information useful to the session
- sagemaker.core.workflow.pipeline_context.retrieve_caller_name(job_instance)[source]#
Convenience method for runnable_by_pipeline decorator
This function takes an instance of a job class and maps it to the pipeline session function that creates the job request.
- Parameters:
job_instance – A job class instance, one of the following types: - Processor (from sagemaker.core.processing) - ModelTrainer (from sagemaker.train.model_trainer) - Transformer (from sagemaker.core.transformer) - HyperparameterTuner (from sagemaker.train.tuner)
Note
This function uses duck typing to avoid importing from Train package, which would create architecture violations (Core should not depend on Train). Instead of isinstance checks, we check for characteristic attributes/methods.
- sagemaker.core.workflow.pipeline_context.runnable_by_pipeline(run_func)[source]#
A convenient Decorator
This is a decorator designed to annotate, during pipeline session, the methods that downstream managed to
preprocess user inputs, outputs, and configurations
generate the create request
start the job.
For instance, Processor.run, Estimator.fit, or Transformer.transform. This decorator will essentially run 1, and capture the request shape from 2, then instead of starting a new job in 3, it will return request shape from 2 to sagemaker.workflow.steps.Step. The request shape will be used to construct the arguments needed to compose that particular step as part of the pipeline. The job will be started during pipeline execution.