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(backend) V1 Pipelines add maximum_cache_staleness and default_cache_staleness #8270

Merged
merged 12 commits into from
Oct 4, 2022

Conversation

juliusvonkohout
Copy link
Member

@juliusvonkohout juliusvonkohout commented Sep 15, 2022

Description of your changes:

Part of #8177

Checklist:

@google-oss-prow
Copy link

@juliusvonkohout: you cannot LGTM your own PR.

In response to this:

/lgtm
/assign @chensun

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@juliusvonkohout
Copy link
Member Author

@chensun @james-jwu @zijianjoy as discussed yesterday in the KFP meeting i split off the simple cache changes. Please review and merge.

@Linchin
Copy link
Contributor

Linchin commented Sep 15, 2022

Thank you @juliusvonkohout! The PR looks good to me, just requesting some small changes.

@juliusvonkohout
Copy link
Member Author

Thank you @juliusvonkohout! The PR looks good to me, just requesting some small changes.

@Linchin is there something else that must be done? I think my new tests are sufficient for the basic functionality.

@Linchin
Copy link
Contributor

Linchin commented Sep 16, 2022

@juliusvonkohout Thank you for the work! Looks good.
/lgtm
/cc @chensun @gkcalat

Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

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

I recall someone had a design doc, and was about to update the doc per discussion points in the community meeting. Can we have the design updated and linked here? Thanks!

Set default to infinity. stalenessToSeconds() returns -1 on empty strings.
@google-oss-prow google-oss-prow bot removed the lgtm label Sep 29, 2022
@juliusvonkohout juliusvonkohout requested review from chensun and removed request for gkcalat and zijianjoy September 29, 2022 08:56
@juliusvonkohout juliusvonkohout requested review from Linchin and chensun and removed request for chensun and Linchin September 29, 2022 08:56
backend/src/cache/server/mutation.go Outdated Show resolved Hide resolved
backend/src/cache/server/mutation.go Outdated Show resolved Hide resolved
userCacheStalenessInSeconds = stalenessToSeconds(userCacheStaleness)
log.Printf("userCacheStalenessInSeconds: %d", userCacheStalenessInSeconds)
}
defaultCacheStaleness, exists := os.LookupEnv("DEFAULT_CACHE_STALENESS")
Copy link
Member

Choose a reason for hiding this comment

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

If userCacheStaleness exists, we shouldn't even care about defaultCacheStaleness, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, exactly that is happening. I just read the two environment variables and the Workflow annotation.
Then i calculate from all three values the staleness to use. So if a user/annotation value is set and less than MAXIMUM_CACHE_STALENESS, the user/annotation value is used instead of DEFAULT_CACHE_STALENESS.

	var cacheStalenessInSeconds int64 = -1
	var userCacheStalenessInSeconds int64 = -1
	var defaultCacheStalenessInSeconds int64 = -1
	var maximumCacheStalenessInSeconds int64 = -1

	userCacheStaleness, exists := annotations[MaxCacheStalenessKey]
	if exists {
		userCacheStalenessInSeconds = stalenessToSeconds(userCacheStaleness)
	}
	defaultCacheStaleness, exists := os.LookupEnv("DEFAULT_CACHE_STALENESS")
	if exists {
		defaultCacheStalenessInSeconds = stalenessToSeconds(defaultCacheStaleness)
	}
	maximumCacheStaleness, exists := os.LookupEnv("MAXIMUM_CACHE_STALENESS")
	if exists {
		maximumCacheStalenessInSeconds = stalenessToSeconds(maximumCacheStaleness)
	}

	if userCacheStalenessInSeconds < 0 {
		cacheStalenessInSeconds = defaultCacheStalenessInSeconds
	} else {
		cacheStalenessInSeconds = userCacheStalenessInSeconds
	}
	if cacheStalenessInSeconds > maximumCacheStalenessInSeconds {
		cacheStalenessInSeconds = maximumCacheStalenessInSeconds
	}
	log.Printf("cacheStalenessInSeconds: %d", cacheStalenessInSeconds)

Copy link
Member

Choose a reason for hiding this comment

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

Yes. I was thinking that something like this would be cleaner and free from waste operation. I don't have strong opinion though.

var cacheStalenessInSeconds int64 = -1

cacheStaleness, exists := annotations[MaxCacheStalenessKey]
if !exists {
    cacheStaleness, exists = os.LookupEnv("DEFAULT_CACHE_STALENESS")
} 
if exists {
    cacheStalenessInSeconds = stalenessToSeconds(cacheStaleness)
}
...
if cacheStalenessInSeconds > maximumCacheStalenessInSeconds {
    cacheStalenessInSeconds = maximumCacheStalenessInSeconds
}

Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Thanks!

@google-oss-prow google-oss-prow bot added the lgtm label Oct 4, 2022
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chensun

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

@juliusvonkohout
Copy link
Member Author

"2022-10-04 17:05:01 ERROR 503: Egress is over the account limit.." the build systems seems to be overloaded. i will rerun the tests.

@juliusvonkohout
Copy link
Member Author

/retest-required

@juliusvonkohout
Copy link
Member Author

@juliusvonkohout juliusvonkohout changed the title feat(backend) add maximum_cache_staleness and default_cache_staleness feat(backend) V1 Pipelines add maximum_cache_staleness and default_cache_staleness Nov 2, 2022
jlyaoyuli pushed a commit to jlyaoyuli/pipelines that referenced this pull request Jan 5, 2023
…kubeflow#8270)

* Update pipeline-install-config.yaml

* Update cache-deployment.yaml

* Update execution_cache_store_test.go

* Update execution_cache_store.go

* Update watcher.go

* Update mutation.go

* fix identation

* Update execution_cache_store_test.go

* Update execution_cache_store.go

* Update pipeline-install-config.yaml

Set default to infinity. stalenessToSeconds() returns -1 on empty strings.

* remove logging as requested by chensun
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.

3 participants