<#1944 Use ImageSpec inside raw container task> Pu...
# flyte-github
a
#1944 Use ImageSpec inside raw container task Pull request opened by pingsutw TL;DR Build ImageSpec if people pass a imageSpec inside raw container task. Type ☐ Bug Fix ☑︎ Feature ☐ Plugin Are all requirements met? ☑︎ Code completed ☑︎ Smoke tested ☑︎ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description
Copy code
(flytekit-3.10) ➜  flytekit git:(image_spec_raw_container) ✗ ls flyte-example/raw_container                                 
__pycache__              calculate-ellipse-area.R install-readr.R          raw_container_wf.py
(flytekit-3.10) ➜  flytekit git:(image_spec_raw_container) ✗ pyflyte register --non-fast --version v1 flyte-example/raw_container/raw_container_wf.py
Copy code
from flytekit import ContainerTask, kwtypes, workflow, ImageSpec

image_spec = ImageSpec(registry="pingsutw", base_image="r-base")

calculate_ellipse_area_r = ContainerTask(
    name="ellipse-area-metadata-r",
    input_data_dir="/var/inputs",
    output_data_dir="/var/outputs",
    inputs=kwtypes(a=float, b=float),
    outputs=kwtypes(area=float, metadata=str),
    image=image_spec,
    command=[
        "Rscript",
        "--vanilla",
        "/root/calculate-ellipse-area.R",
        "{{.inputs.a}}",
        "{{.inputs.b}}",
        "/var/outputs",
    ],
)


@workflow
def wf(a: float = 3.0, b: float = 4.0):
    calculate_ellipse_area_r(a=a, b=b)

image▾

Tracking Issue flyteorg/flyte#4070 Follow-up issue NA flyteorg/flytekit ✅ All checks have passed 30/30 successful checks