Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Make sure default image can be found #698

Merged

Conversation

bimtauer
Copy link
Contributor

TL;DR

Image name interpolation from default image currently fails bc find_image does not compare to to the default_image of the ImageConfig.

This is confusing bc the docs explicitly mention interpolation from the default image as an example.

Currently when trying to register workflows with multiple images, they fail with

AssertionError: Image Config with name default not found in the configuration

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

The fix is very simple and adds the default_image to the list of images searched by the find_image method.

Tracking Issue

NA

Follow-up issue

NA

Copy link
Contributor

@kumare3 kumare3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small request then +1

@@ -92,7 +92,7 @@ def find_image(self, name) -> Optional[Image]:
"""
Return an image, by name, if it exists.
"""
for i in self.images:
for i in self.images + [self.default_image]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much. Would you mind adding a simple unit test so that the behavior does not retrogress?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Copy link
Contributor Author

@bimtauer bimtauer Oct 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test and also another line to handle the case of images being None. It seems unnecessary since pretty much everywhere else you initialize ImageConfig with either images=[] or images=[default_image] (also a solution to my problem but maybe more hacky?) but I still thought it might be a good idea since the type hints declare it as Optional.

@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #698 (6861cf6) into master (85fd07e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #698   +/-   ##
=======================================
  Coverage   85.70%   85.71%           
=======================================
  Files         355      356    +1     
  Lines       29703    29715   +12     
  Branches     2426     2426           
=======================================
+ Hits        25457    25469   +12     
  Misses       3605     3605           
  Partials      641      641           
Impacted Files Coverage Δ
flytekit/core/context_manager.py 92.93% <100.00%> (+0.02%) ⬆️
...s/flytekit/unit/core/test_python_auto_container.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85fd07e...6861cf6. Read the comment docs.

@bimtauer bimtauer force-pushed the fix/include-default-img-in-find-images branch from 9aaf53b to 2736440 Compare October 12, 2021 16:19
@bimtauer bimtauer requested a review from kumare3 October 14, 2021 07:20
Signed-off-by: Tim Bauer <[email protected]>
@kumare3
Copy link
Contributor

kumare3 commented Oct 15, 2021

@bimtauer some tests are broken, can you please fix them. we can then merge this PR

@wild-endeavor wild-endeavor merged commit eeb66b3 into flyteorg:master Oct 18, 2021
@welcome
Copy link

welcome bot commented Oct 18, 2021

Congrats on merging your first pull request! 🎉

@bimtauer bimtauer deleted the fix/include-default-img-in-find-images branch October 19, 2021 09:24
@bimtauer
Copy link
Contributor Author

Thanks for restarting the github actions and merging!

aeioulisa pushed a commit to aeioulisa/flytekit that referenced this pull request Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants