flytekit icon indicating copy to clipboard operation
flytekit copied to clipboard

Add support image composition

Open kumare3 opened this issue 2 years ago • 1 comments

TL;DR

Add support image composition so people can use imageSpec as a base image.

Type

  • [ ] Bug Fix
  • [x] Feature
  • [ ] Plugin

Are all requirements met?

  • [x] Code completed
  • [x] Smoke tested
  • [x] Unit tests added
  • [ ] Code documentation added
  • [ ] Any pending items have an associated Issue

Complete description

from flytekit import task, workflow, ImageSpec, dynamic

new_flytekit = "git+https://github.com/flyteorg/flytekit@b4612c640d6f44538e5a1a915748abadd0f557a4"
image_sklearn = ImageSpec(packages=["sklearn", new_flytekit], apt_packages=["git"], registry="pingsutw")
image_tensorflow = ImageSpec(base_image=image_sklearn, packages=["tensorflow"], registry="pingsutw")


@task(container_image=image_sklearn)
def t1(a: int) -> int:
    return a + 2


@task(container_image=image_tensorflow)
def t2(a: int) -> int:
    return a + 3


@workflow
def wf(a: int = 3):
    t1(a=a)
    t2(a=a)


if __name__ == "__main__":
    print(f"Running my_wf(a=50, b='hello') {wf(a=50)}")

Tracking Issue

NA_

Follow-up issue

NA

kumare3 avatar Aug 30 '23 00:08 kumare3

Codecov Report

Patch coverage: 20.00% and project coverage change: -0.01% :warning:

Comparison is base (82b409b) 18.72% compared to head (80a9a3f) 18.72%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1810      +/-   ##
==========================================
- Coverage   18.72%   18.72%   -0.01%     
==========================================
  Files         332      332              
  Lines       31360    31367       +7     
  Branches     3079     3081       +2     
==========================================
+ Hits         5871     5872       +1     
- Misses      25407    25413       +6     
  Partials       82       82              
Files Changed Coverage Δ
...s/flytekit/unit/core/image_spec/test_image_spec.py 0.00% <0.00%> (ø)
flytekit/image_spec/image_spec.py 40.98% <37.50%> (-1.26%) :arrow_down:

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 30 '23 01:08 codecov[bot]