From 90510c2991b85fa6f1ee06f76de7482bf8ecf1e6 Mon Sep 17 00:00:00 2001 From: Future-Outlier Date: Thu, 14 Nov 2024 13:30:48 +0800 Subject: [PATCH] Better Error MSG, very nice PR Wayner Signed-off-by: Future-Outlier --- flytekit/core/container_task.py | 4 +++- tests/flytekit/unit/core/test_local_raw_container.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/flytekit/core/container_task.py b/flytekit/core/container_task.py index 43f9ebe413..e2a3598aa4 100644 --- a/flytekit/core/container_task.py +++ b/flytekit/core/container_task.py @@ -144,7 +144,9 @@ def _render_command_and_volume_binding(self, cmd: str, **kwargs) -> Tuple[str, D if type(input_val) in [FlyteFile, FlyteDirectory]: if not path_k: raise AssertionError( - "FlyteFile and FlyteDirectory commands should not use the syntax: {{.inputs.infile}}" + "FlyteFile and FlyteDirectory commands should not use the template syntax like this: {{.inputs.infile}}\n" + "Please use a path-like syntax, such as: /var/inputs/infile.\n" + "This requirement is due to how Flyte Propeller processes template syntax inputs." ) local_flyte_file_or_dir_path = str(input_val) remote_flyte_file_or_dir_path = os.path.join(self._input_data_dir, k) # type: ignore diff --git a/tests/flytekit/unit/core/test_local_raw_container.py b/tests/flytekit/unit/core/test_local_raw_container.py index 525d5801d3..9fb49b5b90 100644 --- a/tests/flytekit/unit/core/test_local_raw_container.py +++ b/tests/flytekit/unit/core/test_local_raw_container.py @@ -99,7 +99,10 @@ def flyte_file_io_wf() -> FlyteFile: return flyte_file_io(inputs=ff) with pytest.raises( - AssertionError, match="FlyteFile and FlyteDirectory commands should not use the syntax: {{.inputs.infile}}" + AssertionError, + match="FlyteFile and FlyteDirectory commands should not use the template syntax like this: {{.inputs.infile}}\n" + "Please use a path-like syntax, such as: /var/inputs/infile.\n" + "This requirement is due to how Flyte Propeller processes template syntax inputs." ): flyte_file_io_wf()