From 702b2956aafb141ed0644465c942e73c7b49186f Mon Sep 17 00:00:00 2001 From: JiangJiaWei1103 Date: Tue, 4 Feb 2025 00:34:21 +0800 Subject: [PATCH] docs: Rename image for improved container ux Signed-off-by: JiangJiaWei1103 --- docs/user_guide/customizing_dependencies/imagespec.md | 8 ++++---- .../multiple_images_in_a_workflow.md | 4 ++-- docs/user_guide/flyte_fundamentals/optimizing_tasks.md | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/user_guide/customizing_dependencies/imagespec.md b/docs/user_guide/customizing_dependencies/imagespec.md index 6d992ddb72..22f7ea558f 100644 --- a/docs/user_guide/customizing_dependencies/imagespec.md +++ b/docs/user_guide/customizing_dependencies/imagespec.md @@ -17,7 +17,7 @@ For example, [flytekitplugins-envd](https://github.com/flyteorg/flytekit/blob/c0 For every {py:class}`flytekit.PythonFunctionTask` task or a task decorated with the `@task` decorator, you can specify rules for binding container images. By default, flytekit binds a single container image, i.e., the [default Docker image](https://ghcr.io/flyteorg/flytekit), to all tasks. To modify this behavior, -use the `container_image` parameter available in the {py:func}`flytekit.task` decorator, and pass an +use the `image` parameter available in the {py:func}`flytekit.task` decorator, and pass an `ImageSpec`. Before building the image, Flytekit checks the container registry to see if the image already exists. @@ -100,12 +100,12 @@ tensorflow_image_spec = ImageSpec( if tensorflow_image_spec.is_container(): import tensorflow as tf -@task(container_image=pandas_image_spec) +@task(image=pandas_image_spec) def task1() -> pd.DataFrame: return pd.DataFrame({"Name": ["Tom", "Joseph"], "Age": [1, 22]}) -@task(container_image=tensorflow_image_spec) +@task(image=tensorflow_image_spec) def task2() -> int: num_gpus = len(tf.config.list_physical_devices('GPU')) print("Num GPUs Available: ", num_gpus) @@ -189,7 +189,7 @@ image_spec = ImageSpec( copy=["files/input.txt"], ) -@task(container_image=image_spec) +@task(image=image_spec) def my_task() -> str: with open("/root/files/input.txt", "r") as f: return f.read() diff --git a/docs/user_guide/customizing_dependencies/multiple_images_in_a_workflow.md b/docs/user_guide/customizing_dependencies/multiple_images_in_a_workflow.md index 9b8e6bc206..42894afdc1 100644 --- a/docs/user_guide/customizing_dependencies/multiple_images_in_a_workflow.md +++ b/docs/user_guide/customizing_dependencies/multiple_images_in_a_workflow.md @@ -8,7 +8,7 @@ For every {py:class}`flytekit.PythonFunctionTask` task or a task decorated with the `@task` decorator, you can specify rules for binding container images. By default, flytekit binds a single container image, i.e., the [default Docker image](https://ghcr.io/flyteorg/flytekit), to all tasks. -To modify this behavior, use the `container_image` parameter available in the {py:func}`flytekit.task` decorator. +To modify this behavior, use the `image` parameter available in the {py:func}`flytekit.task` decorator. :::{note} If the Docker image is not available publicly, refer to {ref}`Pulling Private Images`. @@ -32,7 +32,7 @@ The following parameters can be used to configure images in the `@task` decorato 1. `image` refers to the name of the image in the image configuration. The name `default` is a reserved keyword and will automatically apply to the default image name for this repository. 2. `fqn` refers to the fully qualified name of the image. For example, it includes the repository and domain URL of the image. Example: docker.io/my_repo/xyz. -3. `version` refers to the tag of the image. For example: latest, or python-3.9 etc. If `container_image` is not specified, then the default configured image for the project is used. +3. `version` refers to the tag of the image. For example: latest, or python-3.9 etc. If `image` parameter of the {py:func}`flytekit.task` decorator is not specified, then the default configured image for the project is used. ## Sending images to `pyflyte` command diff --git a/docs/user_guide/flyte_fundamentals/optimizing_tasks.md b/docs/user_guide/flyte_fundamentals/optimizing_tasks.md index 5be50448ea..284b2d9ac0 100644 --- a/docs/user_guide/flyte_fundamentals/optimizing_tasks.md +++ b/docs/user_guide/flyte_fundamentals/optimizing_tasks.md @@ -214,7 +214,7 @@ import torch.nn as nn @task( requests=Resources(cpu="2", mem="16Gi"), - container_image="ghcr.io/flyteorg/flytekit:py3.9-latest", + image="ghcr.io/flyteorg/flytekit:py3.9-latest", ) def get_data() -> Tuple[np.ndarray, np.ndarray]: ... # get dataset as numpy ndarrays @@ -222,7 +222,7 @@ def get_data() -> Tuple[np.ndarray, np.ndarray]: @task( requests=Resources(cpu="4", gpu="1", mem="16Gi"), - container_image="ghcr.io/flyteorg/flytecookbook:kfpytorch-latest", + image="ghcr.io/flyteorg/flytecookbook:kfpytorch-latest", ) def train_model(features: np.ndarray, target: np.ndarray) -> nn.Module: ... # train a model using gpus @@ -257,7 +257,7 @@ from flytekitplugins.kfpytorch import PyTorch task_config=PyTorch(num_workers=2), requests=Resources(cpu="2", gpu="1", mem="8Gi"), limits=Resources(cpu="4", gpu="2", mem="16Gi"), - container_image="ghcr.io/flyteorg/flytecookbook:kfpytorch-latest", + image="ghcr.io/flyteorg/flytecookbook:kfpytorch-latest", ) def train_model(features: np.ndarray, target: np.ndarray) -> nn.Module: ... # train a model using gpus