-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix that only allows creation of ModelRollouts with RolloutPeriodStartTime after that of previous ModelRollout #1076
Conversation
… given ModelLine with the latest RolloutPeriodStartTime in CreateModelRollout.kt. Update CreateModelRollout.kt to throw ModelRolloutInvalidArgsException if the RolloutPeriodStartTime of the ModelRollout to be created precedes that of the last ModelRollout. Create tests in ModelRolloutServiceTest.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @jojijac0b, @Marco-Premier, and @tristanvuong2021)
a discussion (no related file):
Would you mind also documenting this restriction in the API definition?
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 183 at r1 (raw file):
} private suspend fun TransactionScope.readModelRolloutData(
Perhaps this should be renamed to indicate that it's reading data for some previous ModelRollout? Also document what is meant by "previous" since that can be ambiguous. It looks like in this case it means the one for the given ModelLine with the least recent RolloutPeriodStartTime.
Suggestion:
readPreviousModelRolloutData
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 187 at r1 (raw file):
externalModelSuiteId: ExternalId, externalModelLineId: ExternalId, ): Struct? {
nit: Prefer converting to some more specific type immediately rather than consuming a free-from structure like Struct
. e.g. create a private data class for this purpose.
Code quote:
Struct
…sely reflect what is done in the function. Create data type to be returned by readLatestModelRolloutData. Add comments to explain why the error is thrown. Add comments to API definition to surface this limitation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @Marco-Premier, @SanjayVas, and @tristanvuong2021)
a discussion (no related file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
Would you mind also documenting this restriction in the API definition?
Commented limitation in API definition in model_rollouts_service.proto
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 183 at r1 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
Perhaps this should be renamed to indicate that it's reading data for some previous ModelRollout? Also document what is meant by "previous" since that can be ambiguous. It looks like in this case it means the one for the given ModelLine with the least recent RolloutPeriodStartTime.
Renamed to readLatestModelRolloutData to reflect the query returning the ModelRollout with the latest RolloutPeriodStartTime.
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 187 at r1 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
nit: Prefer converting to some more specific type immediately rather than consuming a free-from structure like
Struct
. e.g. create a private data class for this purpose.
Created data class LatestModelRolloutResult
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @jojijac0b, @Marco-Premier, and @tristanvuong2021)
a discussion (no related file):
Previously, jojijac0b wrote…
Commented limitation in API definition in model_rollouts_service.proto
I had meant a follow-up PR in the public API definition in the cross-media-measurement-api repo.
src/main/proto/wfa/measurement/internal/kingdom/model_rollouts_service.proto
line 27 at r2 (raw file):
// Internal service for persistence of ModelRollout entities. service ModelRollouts { // rollout_period_start_time of given `ModelRollout` must be later than that
Documentation should start with a summary fragment. e.g. "Creates a new ModelRollout
."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @jojijac0b and @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/service/internal/testing/ModelRolloutsServiceTest.kt
line 1051 at r2 (raw file):
@Test fun `createModelRollout succeeds with multiple model releases`() = runBlocking {
nit multiple model rollouts
Code quote:
model releases
…with multiple model rollouts. Remove comment in API definition(will create another PR in public API).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @Marco-Premier, @SanjayVas, and @tristanvuong2021)
a discussion (no related file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
I had meant a follow-up PR in the public API definition in the cross-media-measurement-api repo.
Deleted comment in model_rollouts_service.proto. Will create PR in public API.
src/main/proto/wfa/measurement/internal/kingdom/model_rollouts_service.proto
line 27 at r2 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
Documentation should start with a summary fragment. e.g. "Creates a new
ModelRollout
."
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @jojijac0b and @SanjayVas)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
val latestModelRolloutData = if (modelRollout.rolloutPeriodStartTime != modelRollout.rolloutPeriodEndTime) {
How does this case work with the restriction? Instant rollouts can be scheduled whenever? I am thinking about when an instant rollout is scheduled before the latest gradual rollout so the latest gradual rollout still has its previous rollout as the rollout before the instant rollout. If instant rollouts can be scheduled whenever, should the rollout right after the instant rollout have its previous rollout updated to be the instant rollout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
As an aside, I want to call out that TimeInterval had incorrect documentation added in world-federation-of-advertisers/cross-media-measurement-api#130. The meaning of TimeInterval did not change in that PR, meaning this line is incorrect:
If equal it represents an exact point in time.
TimeInterval was just our own version of google.type.Interval, which had not yet been published when we initially created the API definition. See world-federation-of-advertisers/cross-media-measurement-api#151
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
Relevant line from the google.type.Interval documentation:
When the start equals the end, the interval is empty (matches no time).
Previously, SanjayVas (Sanjay Vasandani) wrote…
That is true @tristanvuong2021 .
Previous model rollout should never be updated. |
Previously, Marco-Premier (marcopremier) wrote…
@SanjayVas this means that once we merge PR #151 we cannot rely on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @jojijac0b and @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
Previously, Marco-Premier (marcopremier) wrote…
@SanjayVas this means that once we merge PR #151 we cannot rely on
modelRollout.rolloutPeriodStartTime != modelRollout.rolloutPeriodEndTime
anymore. I'd suggest to add a new field in public apiinstant_rollout_time
which is REQUIRED only whentimeInterval
is not provided. What do you think?
Yes, a oneof
where you either have a rollout period or a rollout time sounds correct.
Note that there's not actually a PR yet for world-federation-of-advertisers/cross-media-measurement-api#151. Rather, I'm stating that world-federation-of-advertisers/cross-media-measurement-api#130 introduced a documentation bug where the documentation does not match the previous meaning/usage of TimeInterval
.
…time) ModelRollout's previous rollout to null. This will be treated as regular ModelRollout. Update test to reflect this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @Marco-Premier, @SanjayVas, and @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
Yes, a
oneof
where you either have a rollout period or a rollout time sounds correct.Note that there's not actually a PR yet for world-federation-of-advertisers/cross-media-measurement-api#151. Rather, I'm stating that world-federation-of-advertisers/cross-media-measurement-api#130 introduced a documentation bug where the documentation does not match the previous meaning/usage of
TimeInterval
.
Done. Instant ModelRollouts will now be treated as regular ModelRollouts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tristanvuong2021)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
Previously, jojijac0b wrote…
Done. Instant ModelRollouts will now be treated as regular ModelRollouts.
Ok @SanjayVas . I'd say we can wait for the PR to replace TimeInterval
to fix both: logic and documentation.
LMK if you disagree.
thanks
Previously, Marco-Premier (marcopremier) wrote…
Otherwise we can simply fix this on a separate PR and introduce the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
Previously, Marco-Premier (marcopremier) wrote…
Otherwise we can simply fix this on a separate PR and introduce the
oneof
I think the documentation for TimeInterval should be fixed now, which necessitates the introduction of a oneof
for this case. Swapping from TimeInterval to google.type.Interval after that should be trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/kingdom/deploy/gcloud/spanner/writers/CreateModelRollout.kt
line 76 at r3 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
I think the documentation for TimeInterval should be fixed now, which necessitates the introduction of a
oneof
for this case. Swapping from TimeInterval to google.type.Interval after that should be trivial.
Created PR for it: world-federation-of-advertisers/cross-media-measurement-api#154
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @jojijac0b)
…tTime after that of previous ModelRollout (#1076) Update query in readModelRolloutData to return the ModelRollout for a given ModelLine with the latest RolloutPeriodStartTime in CreateModelRollout.kt. Update CreateModelRollout.kt to throw ModelRolloutInvalidArgsException if the RolloutPeriodStartTime of the ModelRollout to be created precedes that of the last ModelRollout. Create tests in ModelRolloutServiceTest.kt. Update 'createModelRollout succeeds with multiple model releases' test to adhere to new RolloutPeriodStartTime limitations.
Update query in readModelRolloutData to return the ModelRollout for a given ModelLine with the latest RolloutPeriodStartTime in CreateModelRollout.kt. Update CreateModelRollout.kt to throw ModelRolloutInvalidArgsException if the RolloutPeriodStartTime of the ModelRollout to be created precedes that of the last ModelRollout. Create tests in ModelRolloutServiceTest.kt. Update 'createModelRollout succeeds with multiple model releases' test to adhere to new RolloutPeriodStartTime limitations.