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

Feature/vertex compiler #411

Merged
merged 9 commits into from
Sep 11, 2023
Merged

Conversation

GeorgesLorre
Copy link
Collaborator

No description provided.

@@ -41,7 +41,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">= 3.8"
python = ">= 3.8 < 3.12"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

kfp(v2) only supports up to python 3.12

src/fondant/compiler.py Outdated Show resolved Hide resolved
"type": "String",
def from_fondant_component_spec(cls, fondant_component: ComponentSpec):
"""Generate a Kubeflow component spec from a ComponentOp."""
input_definitions = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

split now between artifacts and parameters

Copy link
Contributor

@PhilippeMoussalli PhilippeMoussalli left a comment

Choose a reason for hiding this comment

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

Thanks Geroges! Really nice work, looking clean ✨

Still a bit concerned on how this will end up integrating with KFP. Just out of curiosity, what would break with your current implementation if you switch back to v1 and import from v2?

"bool": "Boolean",
"dict": "JsonObject",
"list": "JsonArray",
"str": "STRING",
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we can import this dict and use it?

https://github.com/kubeflow/pipelines/blob/2b05ec867fad84e24fe73ef7515e3b5849297e79/sdk/python/kfp/dsl/types/type_utils.py#L56

We can maybe do the same for V1 as well instead of defining our own custom one
https://github.com/kubeflow/pipelines/blob/2b05ec867fad84e24fe73ef7515e3b5849297e79/sdk/python/kfp/dsl/types/type_utils.py#L86

FYI I just stumbled on this when trying to look out for the v2 types since I couldn't find them in the docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll add it as a task


else:
component_task = kubeflow_component_op(
metadata=metadata,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not follow the same approach as the KFP compiler and set the input manifest as optional?


component_op = component["fondant_component_op"]
# convert ComponentOp to Kubeflow component
kubeflow_component_op = self.kfp.components.load_component_from_text(
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this is the only difference between the two compiler (the SDK changed for this function). Can we perhaps reuse the same function instead of defining it twice. Seems like there is quite a bit of overlap

if is_kubeflow_output:
# Save to the expected base path directory
safe_component_name = self.spec.name.replace(" ", "_").lower()
save_path_base_path = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we then no longer saving the manifest relative to the basepath? We need it for data exploration
#368 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added as task

@GeorgesLorre GeorgesLorre force-pushed the feature/vertex-compiler branch from 0fc188c to bc197e9 Compare September 6, 2023 14:27
@GeorgesLorre GeorgesLorre marked this pull request as ready for review September 7, 2023 15:12
@GeorgesLorre GeorgesLorre requested a review from mrchtr September 7, 2023 15:13
@GeorgesLorre
Copy link
Collaborator Author

Thanks Geroges! Really nice work, looking clean ✨

Still a bit concerned on how this will end up integrating with KFP. Just out of curiosity, what would break with your current implementation if you switch back to v1 and import from v2?

I'll add it as a task

@@ -0,0 +1,31 @@
name: LAION retrieval
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are different component spcs added?

VALID_PIPELINE / "kubeflow_pipeline.yml",
) as truth:
assert yaml.safe_load(src) == yaml.safe_load(truth)
# @pytest.mark.usefixtures("_freeze_time")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you re-introduce this again?

Copy link
Contributor

Choose a reason for hiding this comment

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

ahh ok never mind it's because of the new API, would tackle it in another ticket

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes indeed I don't want to keep adding to this PR.

added as a task: #393

description=info["description"],
type=info["type"],
default=info["default"] if "default" in info else None,
args = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

A lof of repeated code between input and output arguments, can be one put in one function

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed but this will probably be removed once we use the component spec as base for building the arguments and not the KubeflowComponentSpec.

#393

)

# Set image pull policy to always
component_task.container.set_image_pull_policy("Always")
Copy link
Contributor

Choose a reason for hiding this comment

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

might be nice to keep the image pull policy (unless it's another function in v2 in which case we can tackle it separately or create a task for it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added as a task: #393

@@ -83,7 +83,7 @@ def now(cls):
@pytest.fixture(params=TEST_PIPELINES)
def setup_pipeline(request, tmp_path, monkeypatch):
pipeline = Pipeline(
pipeline_name="test_pipeline",
pipeline_name="testpipeline",
Copy link
Contributor

Choose a reason for hiding this comment

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

any special reason for this name change?

"--output_manifest_path",
"{{$.outputs.artifacts['output_manifest_path'].uri}}",
],
"command": ["python3", "main.py"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we use here fondant execute main instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah really ? Where do we do that ? I just took over the way we did it for kfpv1.

Copy link
Contributor

Choose a reason for hiding this comment

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

We changed while resolving this: #362

Copy link
Contributor

Choose a reason for hiding this comment

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

See comment above

@GeorgesLorre GeorgesLorre force-pushed the feature/vertex-compiler branch from cdca57b to 4aaf2ed Compare September 11, 2023 07:54
"implementation": {
"container": {
"image": fondant_component.image,
"command": [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is the command that you replaced, we're using this now for the components based on this PR https://github.com/ml6team/fondant/commits/main?before=82b5131ac8e72c620917d65c31c80b0b903e4d83+35&branch=main&qualified_name=refs%2Fheads%2Fmain

Can you replace and check if all still runs fine?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

Copy link
Contributor

@PhilippeMoussalli PhilippeMoussalli left a comment

Choose a reason for hiding this comment

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

Thanks Georges!

@GeorgesLorre GeorgesLorre merged commit b1f430c into feature/kfp-v2 Sep 11, 2023
@GeorgesLorre GeorgesLorre deleted the feature/vertex-compiler branch September 11, 2023 11:13
GeorgesLorre added a commit that referenced this pull request Sep 29, 2023
GeorgesLorre added a commit that referenced this pull request Oct 2, 2023
GeorgesLorre added a commit that referenced this pull request Oct 2, 2023
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