sagemaker.core.workflow.functions#

The step definitions for workflow.

Functions

is_pipeline_variable(var)

Check if the variable is a pipeline variable

Classes

Join([on, values])

Join together properties.

JsonGet([step_name, property_file, ...])

Get JSON properties from PropertyFiles or S3 location.

class sagemaker.core.workflow.functions.Join(on: str = NOTHING, values: List = NOTHING)[source]#

Bases: PipelineVariable

Join together properties.

Examples: Build a Amazon S3 Uri with bucket name parameter and pipeline execution Id and use it as training input:

bucket = ParameterString('bucket', default_value='my-bucket')

TrainingInput(
    s3_data=Join(
        on='/',
        values=['s3:/', bucket, ExecutionVariables.PIPELINE_EXECUTION_ID]
    ),
    content_type="text/csv")
values#

The primitive type values, parameters, step properties, expressions to join.

Type:

List[Union[PrimitiveType, Parameter, PipelineVariable]]

on#

The string to join the values on (Defaults to “”).

Type:

str

property expr#

The expression dict for a Join function.

on: str#
to_string() PipelineVariable[source]#

Prompt the pipeline to convert the pipeline variable to String in runtime

As Join is treated as String in runtime, no extra actions are needed.

values: List#
class sagemaker.core.workflow.functions.JsonGet(step_name: str = None, property_file: PropertyFile | str | None = None, json_path: str = None, s3_uri: Join | None = None, step: Step = None)[source]#

Bases: PipelineVariable

Get JSON properties from PropertyFiles or S3 location.

step_name#

The step name from which to get the property file.

Type:

str

property_file#

Either a PropertyFile instance or the name of a property file.

Type:

Optional[Union[PropertyFile, str]]

json_path#

The JSON path expression to the requested value.

Type:

str

s3_uri#

The S3 location from which to fetch a Json file. The Json file is the output of a step defined with @step decorator.

Type:

Optional[sagemaker.workflow.functions.Join]

step#

The upstream step object which the s3_uri is associated to.

Type:

Step

property expr#

The expression dict for a JsonGet function.

json_path: str#
property_file: PropertyFile | str | None#
s3_uri: Join | None#
step: Step#
step_name: str#
sagemaker.core.workflow.functions.is_pipeline_variable(var: object) bool[source]#

Check if the variable is a pipeline variable

Parameters:

var (object) – The variable to be verified.

Returns:

True if it is, False otherwise.

Return type:

bool