Repository: aws/sagemaker-python-sdk

Issue:
Wrong file name in error message for invalid initialization_script in NotebookJobStep
**Describe the bug**
If you use an initialization_script that doesn't exist in NotebookJobStep you receive an error message that informs the input notebook name instead of the initialization_script name.

The error seems at https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/workflow/notebook_job_step.py#L267

**To reproduce**
```
steps = [NotebookJobStep(
    image_uri="885854791233.dkr.ecr.us-east-1.amazonaws.com/sagemaker-distribution-prod:1-cpu",
    kernel_name="python3",
    input_notebook="job-test/job.ipynb",
    initialization_script="invalid-file.sh",
)]
pipeline = Pipeline(
    name="pipeline",
    steps=steps,
)
pipeline.upsert(role_arn=role)
```


**Expected behavior**
ValueError: Validation Errors: 
- The initialization script(invalid-file.sh) is not a valid file.

**Screenshots or logs**
ValueError: Validation Errors: 
- The initialization script(job-test/job.ipynb) is not a valid file.

Discussion:

Solution patch:
diff --git a/src/sagemaker/workflow/notebook_job_step.py b/src/sagemaker/workflow/notebook_job_step.py
index ca0ecac1..8db95a2f 100644
--- a/src/sagemaker/workflow/notebook_job_step.py
+++ b/src/sagemaker/workflow/notebook_job_step.py
@@ -243,25 +243,27 @@ class NotebookJobStep(ConfigurableRetryStep):
         # input notebook is required
         if not self.input_notebook or not os.path.isfile(self.input_notebook):
             errors.append(
-                f"The required input notebook({self.input_notebook}) is not a valid " f"file."
+                f"The required input notebook ({self.input_notebook}) is not a valid file."
             )
 
         # init script is optional
         if self.initialization_script and not os.path.isfile(self.initialization_script):
-            errors.append(f"The initialization script({self.input_notebook}) is not a valid file.")
+            errors.append(
+                f"The initialization script ({self.initialization_script}) is not a valid file."
+            )
 
         if self.additional_dependencies:
             for path in self.additional_dependencies:
                 if not os.path.exists(path):
                     errors.append(
-                        f"The path({path}) specified in additional dependencies does not exist."
+                        f"The path ({path}) specified in additional dependencies does not exist."
                     )
         # image uri is required
         if not self.image_uri or self._region_from_session not in self.image_uri:
             errors.append(
-                f"The image uri(specified as {self.image_uri}) is required and "
+                f"The image uri (specified as {self.image_uri}) is required and "
                 f"should be hosted in same region of the session"
-                f"({self._region_from_session})."
+                f" ({self._region_from_session})."
             )
 
         if not self.kernel_name:


Test patch:
diff --git a/tests/unit/sagemaker/workflow/test_notebook_job_step.py b/tests/unit/sagemaker/workflow/test_notebook_job_step.py
index 6a5bb20d..aad67679 100644
--- a/tests/unit/sagemaker/workflow/test_notebook_job_step.py
+++ b/tests/unit/sagemaker/workflow/test_notebook_job_step.py
@@ -199,11 +199,11 @@ class TestNotebookJobStep(unittest.TestCase):
             in str(context.exception)
         )
         self.assertTrue(
-            "The required input notebook(None) is not a valid file." in str(context.exception)
+            "The required input notebook (None) is not a valid file." in str(context.exception)
         )
         self.assertTrue(
-            "The image uri(specified as None) is required and should be hosted in "
-            "same region of the session(us-west-2)." in str(context.exception)
+            "The image uri (specified as None) is required and should be hosted in "
+            "same region of the session (us-west-2)." in str(context.exception)
         )
         self.assertTrue("The kernel name is required." in str(context.exception))
 
@@ -222,19 +222,19 @@ class TestNotebookJobStep(unittest.TestCase):
             ).arguments
 
         self.assertTrue(
-            "The required input notebook(path/non-existing-file) is not a valid file."
+            "The required input notebook (path/non-existing-file) is not a valid file."
             in str(context.exception)
         )
         self.assertTrue(
-            "The initialization script(path/non-existing-file) is not a valid file."
+            "The initialization script (non-existing-script) is not a valid file."
             in str(context.exception)
         )
         self.assertTrue(
-            "The path(/tmp/non-existing-folder) specified in additional dependencies "
+            "The path (/tmp/non-existing-folder) specified in additional dependencies "
             "does not exist." in str(context.exception)
         )
         self.assertTrue(
-            "The path(path2/non-existing-file) specified in additional dependencies "
+            "The path (path2/non-existing-file) specified in additional dependencies "
             "does not exist." in str(context.exception)
         )
 
@@ -251,9 +251,9 @@ class TestNotebookJobStep(unittest.TestCase):
             ).arguments
 
         self.assertTrue(
-            "The image uri(specified as 236514542706.dkr.ecr.us-east-9.amazonaws.com/"
+            "The image uri (specified as 236514542706.dkr.ecr.us-east-9.amazonaws.com/"
             "sagemaker-data-science) is required and should be hosted in "
-            "same region of the session(us-west-2)." in str(context.exception)
+            "same region of the session (us-west-2)." in str(context.exception)
         )
 
     def test_invalid_notebook_job_name(self):