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

feat: caching for custom task. #852

Merged
merged 9 commits into from
Feb 22, 2022

Conversation

ScrapCodes
Copy link
Contributor

Which issue is resolved by this Pull Request:
Resolves #

Description of your changes:

Environment tested:

  • Python Version (use python --version):
  • Tekton Version (use tkn version):
  • Kubernetes Version (use kubectl version):
  • OS (e.g. from /etc/os-release):

Checklist:

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ScrapCodes

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

return nil, fmt.Errorf("failed to create a new cache entry, %#v, Error: %v", entry, t.db.Error)
}
rowInsert := &model.TaskCache{}
d := t.db.Create(entry).Scan(rowInsert)
Copy link
Member

Choose a reason for hiding this comment

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

Sorry where do you define the database table here? I'm new to the gorm package so I'm not sure where you are referring to the task_caches table name. I only saw task_caches during the Get call.

@Tomcli
Copy link
Member

Tomcli commented Feb 16, 2022

Thanks @ScrapCodes, I ran this code in my new cluster and here is what I found

  1. The new caching package can create the cachedb with task_caches table. However, task_caches never get updated with new entries even though I ran the pipeline multiple times. Also, I don't see we are referring the task_caches table name anywhere outside of Get.
  2. We need to check for the label for pipelines.kubeflow.org/cache_enabled: "true" in the Run CR labels. Otherwise we skip the caching.
  3. We want to separate the caching package into its own directory just like the logger package.

@ScrapCodes ScrapCodes changed the title WIP: caching for custom task. feat: caching for custom task. Feb 17, 2022
@ScrapCodes
Copy link
Contributor Author

On resubmitting the same pipeline run.

$ k get runs
NAME                        SUCCEEDED   REASON     STARTTIME   COMPLETIONTIME
pr-loop-example-loop-task   True        CacheHit   28s         28s

}

// ReconcileKind compares the actual state with the desired, and attempts to converge the two.
// It then updates the Status block of the Run resource with the current status of the resource.
func (c *Reconciler) ReconcileKind(ctx context.Context, run *v1alpha1.Run) pkgreconciler.Event {
var merr error
logger := logging.FromContext(ctx)
err := CacheStore.Connect(params)
Copy link
Member

Choose a reason for hiding this comment

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

Can we also have an environment variable to disable the cache store for pipelineloop? I think the product team needs some time to migrate this behavior, so is better to have some flag that can turn it on/off.

@Tomcli
Copy link
Member

Tomcli commented Feb 19, 2022

Thanks @ScrapCodes, this looks good to me. We just need to have a flag to turn this feature on/off

@Tomcli
Copy link
Member

Tomcli commented Feb 19, 2022

The SDK didn't add the default caching labels for the pipeline loop run spec. Need to open an issue to handle this

@ScrapCodes
Copy link
Contributor Author

@Tomcli Thank you for all the help ! Please take a look again.

@ScrapCodes ScrapCodes force-pushed the caching-custom-task branch 2 times, most recently from 5a70668 to fb3d315 Compare February 21, 2022 12:17
@Tomcli
Copy link
Member

Tomcli commented Feb 21, 2022

Thanks @ScrapCodes, just a small typo

@Tomcli
Copy link
Member

Tomcli commented Feb 22, 2022

thanks @ScrapCodes, this is good for the initial version and we will get more feedbacks from the internal team to further improve this.

@Tomcli
Copy link
Member

Tomcli commented Feb 22, 2022

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Feb 22, 2022
@google-oss-prow google-oss-prow bot merged commit 14c6195 into kubeflow:master Feb 22, 2022
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.

2 participants