sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

ConditionComparison fails if `left` is a primitive such as `float` or `int`

Open kevinnowland opened this issue 3 years ago • 2 comments

Describe the bug

ConditionComparison fails if left is a primitive such as a float or int.

https://github.com/aws/sagemaker-python-sdk/blob/0a0b6e65288496ad33fd5ee34020665aced02156/src/sagemaker/workflow/conditions.py#L82

This line should be "LeftValue": primitive_or_expr(self.left) matching the line below it or, if current behavior is expected, then documentation should be updated and primitives should not be expected for left.

To reproduce

Create a ConditionGreatherThanOrEqualTo object and set both left and right to primitives such as 1.0 and 0.0.

Expected behavior

Primitives should not cause conditions to fail.

Screenshots or logs

This is a partial version of my code:

Screen Shot 2022-01-28 at 10 17 00 AM

This was the result when starting a pipeline:

Screen Shot 2022-01-28 at 10 21 55 AM

System information

Running sagemaker==2.74.0 on python==3.8.12 in a custom kernel image attached to SageMaker Studio.

Additional context

None.

kevinnowland avatar Jan 28 '22 15:01 kevinnowland

Good catch, the left value should allow primitives as well. See PR above

staubhp avatar Jan 31 '22 18:01 staubhp

@kevinnowland We have merged the PR with the changes. Can you please check if it solves your issue ?

navinsoni avatar Jul 06 '22 19:07 navinsoni

Closing as https://github.com/aws/sagemaker-python-sdk/issues/2843 should have fixed it. Feel free to reopen if needed.

martinRenou avatar Sep 22 '23 09:09 martinRenou