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

Add docker commands in ImageSpec #2676

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
662f15e
feat: add docker commands in ImageSpec
mao3267 Aug 9, 2024
4f670dc
use private-key (#2645)
Future-Outlier Aug 2, 2024
b4e7ece
Don't call remote when --help in remote-X (#2642)
wild-endeavor Aug 2, 2024
a22792f
Bump grpc receive message size (#2640)
wild-endeavor Aug 3, 2024
fbba823
Raise an exception when filters' value isn't a list. (#2576)
arbaobao Aug 5, 2024
b946674
Update error message for TypeTransformerFailedError (#2648)
wayner0628 Aug 5, 2024
ffc030e
[Error Message] Dataclasses Mismatched Type (#2650)
Future-Outlier Aug 6, 2024
ac8563d
Added warning for command list and shell true (#2653)
pryce-turner Aug 6, 2024
b59346a
In `FlyteRemote.upload_file`, pass the file object directly rather th…
redartera Aug 6, 2024
f11f397
Modify test_array_node.py to support running in python 3.8 (#2652)
eapolinario Aug 6, 2024
901fe4f
Handle common cases of mutable default arguments explicitly (#2651)
eapolinario Aug 6, 2024
9e0dbf5
Allow a hash method to be present for numpy arrays (#2649)
demmerichs Aug 6, 2024
140b58f
return exceptions when gathering (#2657)
wild-endeavor Aug 7, 2024
78a6219
Correct FlyteFile docstring (#2658)
ppiegaze Aug 8, 2024
8d229d9
Remove pip cache after install (#2662)
thomasjpfan Aug 8, 2024
59b5932
Adds validation to image_spec for list of strings (#2655)
thomasjpfan Aug 8, 2024
be3b145
Make elastic timeout configurable for HorovovJob. (#2631)
supercharleszhu Aug 8, 2024
9ea6b23
Fix overriding of loader_args task resolver in papermill plugin (#2660)
eapolinario Aug 8, 2024
e83c240
Catch all exceptions when rendering python dependencies (#2664)
thomasjpfan Aug 8, 2024
b3dbc08
Don't check the retrun statement for reference_launch_plan (#2665)
pingsutw Aug 8, 2024
72319a2
Bump flyteidl to 1.13.1 (#2666)
mao3267 Aug 9, 2024
5a72f98
Merge branch 'master' of https://github.com/mao3267/flytekit into add…
mao3267 Aug 11, 2024
8446503
fix: raise exception for docker commands in envd builder
mao3267 Aug 13, 2024
0a85ccc
test: add unit tests for docker commands
mao3267 Aug 13, 2024
f18c283
fix: modify error message
mao3267 Aug 16, 2024
f073069
test: raise exception for docker commands in envd builder
mao3267 Aug 16, 2024
f2c3679
test: ImageSpec with docker commands
mao3267 Aug 16, 2024
767ef0f
Merge branch 'master' of https://github.com/mao3267/flytekit into add…
mao3267 Aug 16, 2024
cca874b
fix: add docker commands to parameters_str_list
mao3267 Aug 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds validation to image_spec for list of strings (#2655)
Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
Signed-off-by: mao3267 <chenvincent610@gmail.com>
  • Loading branch information
thomasjpfan authored and mao3267 committed Aug 9, 2024
commit 59b59327491e84c2b64a25e41e919754b49444ba
17 changes: 17 additions & 0 deletions flytekit/image_spec/image_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ def __post_init__(self):
if self.registry:
self.registry = self.registry.lower()

parameters_str_list = [
"packages",
"conda_channels",
"conda_packages",
"apt_packages",
"pip_extra_index_url",
"entrypoint",
"commands",
]
for parameter in parameters_str_list:
attr = getattr(self, parameter)
parameter_is_None = attr is None
parameter_is_list_string = isinstance(attr, list) and all(isinstance(v, str) for v in attr)
if not (parameter_is_None or parameter_is_list_string):
error_msg = f"{parameter} must be a list of strings or None"
raise ValueError(error_msg)

def image_name(self) -> str:
"""Full image name with tag."""
image_name = self._image_name()
Expand Down
16 changes: 16 additions & 0 deletions tests/flytekit/unit/core/image_spec/test_image_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,19 @@ def test_no_build_during_execution():
ImageBuildEngine.build(spec)

ImageBuildEngine._build_image.assert_not_called()


@pytest.mark.parametrize(
"parameter_name", [
"packages", "conda_channels", "conda_packages",
"apt_packages", "pip_extra_index_url", "entrypoint", "commands"
]
)
@pytest.mark.parametrize("value", ["requirements.txt", [1, 2, 3]])
def test_image_spec_validation_string_list(parameter_name, value):
msg = f"{parameter_name} must be a list of strings or None"

input_params = {parameter_name: value}

with pytest.raises(ValueError, match=msg):
ImageSpec(**input_params)