Skip to content

Commit

Permalink
docs: Rename image for improved container ux
Browse files Browse the repository at this point in the history
Signed-off-by: JiangJiaWei1103 <[email protected]>
  • Loading branch information
JiangJiaWei1103 committed Feb 3, 2025
1 parent 7d53a6e commit 702b295
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions docs/user_guide/customizing_dependencies/imagespec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<private_images>`.
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/flyte_fundamentals/optimizing_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ 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
@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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 702b295

Please sign in to comment.