-
Notifications
You must be signed in to change notification settings - Fork 10
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 sqlite busy errors #347
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…f an sqlite error is a busy error and log it.
✅ Deploy Preview for foyle canceled.
|
Comment on lines
+373
to
+401
// isLearnable returns true if the session is eligible for learning and false otherwise | ||
func isLearnable(session *logspb.Session) bool { | ||
// Make sure there is a cell execution log event. | ||
// Right now we rely on the cell execution log event to get the actual cell content. | ||
// So we can't learn from sessions without cell execution events. TN013 has some ideas for how we could | ||
// learn in the event of non cell execution events. | ||
execEvent := getLastExecEvent(session) | ||
|
||
if execEvent == nil { | ||
// Since the cell wasn't successfully executed we don't learn from it | ||
sessProcessed.WithLabelValues("noexec").Inc() | ||
return false | ||
} | ||
|
||
log := zapr.NewLogger(zap.L()) | ||
if session.GetFullContext() == nil { | ||
sessProcessed.WithLabelValues("nocontext").Inc() | ||
log.Error(errors.New("Session missing fullcontext"), "contextId", session.GetContextId()) | ||
return false | ||
} | ||
|
||
if session.GetFullContext().GetNotebook() == nil { | ||
sessProcessed.WithLabelValues("nonotebook").Inc() | ||
log.Error(errors.New("Session missing notebook"), "contextId", session.GetContextId()) | ||
return false | ||
} | ||
|
||
if session.GetFullContext().GetSelected() == 0 { | ||
// If its the first cell we can't learn from it because what would we use as context to predict it? |
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.
Suggested change
// isLearnable returns true if the session is eligible for learning and false otherwise | |
func isLearnable(session *logspb.Session) bool { | |
// Make sure there is a cell execution log event. | |
// Right now we rely on the cell execution log event to get the actual cell content. | |
// So we can't learn from sessions without cell execution events. TN013 has some ideas for how we could | |
// learn in the event of non cell execution events. | |
execEvent := getLastExecEvent(session) | |
if execEvent == nil { | |
// Since the cell wasn't successfully executed we don't learn from it | |
sessProcessed.WithLabelValues("noexec").Inc() | |
return false | |
} | |
log := zapr.NewLogger(zap.L()) | |
if session.GetFullContext() == nil { | |
sessProcessed.WithLabelValues("nocontext").Inc() | |
log.Error(errors.New("Session missing fullcontext"), "contextId", session.GetContextId()) | |
return false | |
} | |
if session.GetFullContext().GetNotebook() == nil { | |
sessProcessed.WithLabelValues("nonotebook").Inc() | |
log.Error(errors.New("Session missing notebook"), "contextId", session.GetContextId()) | |
return false | |
} | |
if session.GetFullContext().GetSelected() == 0 { | |
// If its the first cell we can't learn from it because what would we use as context to predict it? | |
// isLearnable determines if the session is learnable based on the presence of execution events and contextual information. | |
func isLearnable(session *logspb.Session) bool { | |
// Make sure there is a cell execution log event. | |
// Right now we rely on the cell execution log event to get the actual cell content. | |
// So we can't learn from sessions without cell execution events. TN013 has some ideas for how we could | |
// learn in the event of non cell execution events. | |
execEvent := getLastExecEvent(session) | |
if execEvent == nil { | |
// Since the cell wasn't successfully executed we don't learn from it | |
sessProcessed.WithLabelValues("noexec").Inc() | |
return false | |
} | |
log := zapr.NewLogger(zap.L()) | |
if session.GetFullContext() == nil { | |
sessProcessed.WithLabelValues("nocontext").Inc() | |
log.Error(errors.New("session missing full context"), "contextId", session.GetContextId()) | |
return false | |
} | |
if session.GetFullContext().GetNotebook() == nil { | |
sessProcessed.WithLabelValues("nonotebook").Inc() | |
log.Error(errors.New("session missing notebook"), "contextId", session.GetContextId()) | |
return false | |
} | |
if session.GetFullContext().GetSelected() == 0 { | |
// If it's the first cell we can't learn from it because what would we use as context to predict it? |
add comment to isLearnable function, fix typos in error messages
Comment on lines
+408
to
+410
// getLasExecEvent returns the last successful execution event in the session | ||
// or null if there isn't one. | ||
func getLastExecEvent(session *logspb.Session) *v1alpha1.LogEvent { |
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.
Suggested change
// getLasExecEvent returns the last successful execution event in the session | |
// or null if there isn't one. | |
func getLastExecEvent(session *logspb.Session) *v1alpha1.LogEvent { | |
// getLastExecEvent retrieves the last successful execution log event from a session. | |
func getLastExecEvent(session *logspb.Session) *v1alpha1.LogEvent { |
add comment to getLastExecEvent function
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix sqlite busy errors with session based learning
There were a couple different errors
By default sqlite doesn't have any retries for SQLITE_BUSY errors. We could configure a timeout for retries using a PRAGMA; we should probably do that but I want to hold off to see if this PR fixes the contention.
Use ko to create docker images as part of the development process