From 1652d4ceac63dde471cf42565289d311619a6d67 Mon Sep 17 00:00:00 2001 From: Alex Wu <66259759+popojk@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:33:31 +0800 Subject: [PATCH] [docs]add cache information in raw containers doc (#5876) * [docs]add cache information in docs/user_guild/customizing_dependencies/raw_container.md Signed-off-by: Alex Wu * fix example code gitsha Signed-off-by: Alex Wu * minor fix some wording abput cache info Signed-off-by: Alex Wu --------- Signed-off-by: Alex Wu --- .../customizing_dependencies/raw_containers.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/user_guide/customizing_dependencies/raw_containers.md b/docs/user_guide/customizing_dependencies/raw_containers.md index ae72b652f3..857d23788f 100644 --- a/docs/user_guide/customizing_dependencies/raw_containers.md +++ b/docs/user_guide/customizing_dependencies/raw_containers.md @@ -15,9 +15,9 @@ Refer to the raw protocol to understand how to leverage this. To clone and run the example code on this page, see the [Flytesnacks repo][flytesnacks]. ``` -```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/69dbe4840031a85d79d9ded25f80397c6834752d/examples/customizing_dependencies/customizing_dependencies/raw_container.py +```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/1f4256464615a788c40d95dfe36f120407a2826c/examples/customizing_dependencies/customizing_dependencies/raw_container.py :caption: customizing_dependencies/raw_container.py -:lines: 1-5 +:lines: 1-6 ``` ## Container tasks @@ -31,15 +31,17 @@ is `calculate_ellipse_area_shell`. This name has to be unique in the entire proj `inputs` and `outputs` specify the interface for the task; thus it should be an ordered dictionary of typed input and output variables. -```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/69dbe4840031a85d79d9ded25f80397c6834752d/examples/customizing_dependencies/customizing_dependencies/raw_container.py +[Cache](https://docs.flyte.org/en/latest/user_guide/development_lifecycle/caching.html) can be enabled in a `ContainerTask` by configuring the cache settings in the `TaskMetadata` in the `metadata` parameter. + +```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/1f4256464615a788c40d95dfe36f120407a2826c/examples/customizing_dependencies/customizing_dependencies/raw_container.py :caption: customizing_dependencies/raw_container.py -:lines: 15-112 +:lines: 16-118 ``` As can be seen in this example, `ContainerTask`s can be interacted with like normal Python functions, whose inputs correspond to the declared input variables. All data returned by the tasks are consumed and logged by a Flyte task. -```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/69dbe4840031a85d79d9ded25f80397c6834752d/examples/customizing_dependencies/customizing_dependencies/raw_container.py +```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/1f4256464615a788c40d95dfe36f120407a2826c/examples/customizing_dependencies/customizing_dependencies/raw_container.py :caption: customizing_dependencies/raw_container.py :pyobject: wf ```