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

chore(v2): Fetch cache result from MLMD and put cache result into argo output artifacts/parameters #5957

Merged
merged 40 commits into from
Jul 9, 2021

Conversation

capri-xiyue
Copy link
Contributor

Description of your changes:
Fixed #5819
Fetch cache result from MLMD and put cache result into argo output artifacts/parameters

Checklist:

@capri-xiyue
Copy link
Contributor Author

/test kubeflow-pipelines-v2-go-test

@capri-xiyue capri-xiyue changed the title WIP chore(v2): Fetch cache result from MLMD and put cache result into argo output artifacts/parameters chore(v2): Fetch cache result from MLMD and put cache result into argo output artifacts/parameters Jun 30, 2021
@Bobgy
Copy link
Contributor

Bobgy commented Jul 7, 2021

@capri-xiyue can you fix the bug in a separate PR?
We can do another e2e release after merging it.

@capri-xiyue
Copy link
Contributor Author

/test kubeflow-pipeline-backend-test

@capri-xiyue
Copy link
Contributor Author

@Bobgy It's ready for early review.
I verified in local that the cache works
This task reused artifacts of previous runs.
Screen Shot 2021-07-07 at 8 06 45 PM

"github.com/kubeflow/pipelines/backend/src/v2/common"
"github.com/kubeflow/pipelines/backend/src/v2/common/mlmd"
pb "github.com/kubeflow/pipelines/backend/src/v2/third_party/pipeline_spec"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

backend/src/v2 uses out-dated pipelinespec. The fix of v2 package takes time. As a workaround, I temporarily pasted out-dated pipeline spec that v2 is using.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the catch! I will update pipeline spec in a separate PR.

@capri-xiyue
Copy link
Contributor Author

@Bobgy , this PR is ready for review. I disable caching in this PR. Will enabling caching in the PR of caching e2e test.

@capri-xiyue
Copy link
Contributor Author

/test kubeflow-pipelines-samples-v2

1 similar comment
@capri-xiyue
Copy link
Contributor Author

/test kubeflow-pipelines-samples-v2

@capri-xiyue
Copy link
Contributor Author

capri-xiyue commented Jul 8, 2021

The sample-v2 test failure is not because of this PR.
The master also has the same issue #5997

@@ -412,7 +412,11 @@ func TestCreateRun_ThroughPipelineID(t *testing.T) {
expectedRuntimeWorkflow.Annotations = map[string]string{util.AnnotationKeyRunName: "run1"}
expectedRuntimeWorkflow.Spec.Arguments.Parameters = []v1alpha1.Parameter{{Name: "param1", Value: v1alpha1.AnyStringPtr("world")}}
expectedRuntimeWorkflow.Spec.ServiceAccountName = defaultPipelineRunnerServiceAccount

expectedRuntimeWorkflow.Spec.PodMetadata = &v1alpha1.Metadata{
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding this to every test makes tests harder to read, shall we add the label consistently in AddMetadata method on 410 line?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or another approach is changing the AddMetadata method to remove runtime metadata. In all tests, we remove test unrelated metadata from generated workflow before comparison with expectation

}

func (c *Client) CreateExecutionCache(ctx context.Context, task *api.Task) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be in cache package? I think putting task records is theoretically unrelated to cache, just that cache uses these records

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cache package has the Client(Currently the client is only used for storing cache entries). Therefore, I put it in the cache package. If later, we decide to put task records for every task(not just for tasks where cache is enabled), I think it makes sense to move it to other package like kfp package.

}

func GetOutputParamsFromCachedExecution(cachedExecution *ml_metadata.Execution) (map[string]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: consider avoiding stutter in naming?
GetOutputParams(cachedExecution ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}
MLMDOutputArtifactByName := make(map[string]*pb.Artifact)
for _, artifact := range MLMDOutputArtifacts {
name := extractNameFromURI(*artifact.Uri)
Copy link
Contributor

Choose a reason for hiding this comment

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

Name should be taken from the event that connects artifact and the original execution.
See event.path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. I printed the event.path. It records the id of the artifact which will change every time.

Copy link
Contributor

Choose a reason for hiding this comment

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

@capri-xiyue strange, did you check event.artifactId or event.path?
Refer to code

Path: eventPath(oa.Name),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I printed the wrong one. Fixed it in the refactor PR.

v2/metadata/client.go Show resolved Hide resolved
v2/metadata/client.go Show resolved Hide resolved
@Bobgy
Copy link
Contributor

Bobgy commented Jul 9, 2021

/retest

@capri-xiyue
Copy link
Contributor Author

/test kubeflow-pipelines-samples-v2

@capri-xiyue
Copy link
Contributor Author

I will submit another PR to resolve the comments.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot google-oss-robot merged commit 724e5b4 into kubeflow:master Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v2compat] Fetch cache result from MLMD and put cache result into argo output artifacts/parameters
3 participants