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

Retry up to 10 times when error requesting Koina predictions #3197

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nickshulman
Copy link
Contributor

Here's one way that we could deal with errors that we get from the Koina server.
However, given that the failure always seems to happen on the 1000th request, it should probably be fixed on the server side.

This change makes it retry up to 10 times.

Other changes:

  1. Fix inefficient use of "Enumerable.Skip" in "EnumerateBatches". When this code was originally written in 2019 it seems that the developer did not realize that "Skip" requires iterating over all of the skipped elements. This fix might make the "EnumerateBatches" part fast enough that it would not make sense to be doing it in ParallelEx.
  2. Speed up "RefreshProgressTextbox". It was doing too many string concatenations
  3. I added an application setting to Settings.settings which then required fixing inconsistencies in App.config. Brian Pratt is probably going to fix those inconsistencies in a separate pull request.

@@ -142,8 +143,11 @@ protected void UpdateSearchEngineProgress(IProgressStatus status)
}

// look at the last 10 lines for the same message and if found do not relog the same message
if (_progressTextItems.Skip(Math.Max(0, _progressTextItems.Count - 10)).Any(entry => entry.Message == message))
Copy link
Member

Choose a reason for hiding this comment

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

It seems this blatant missing optimization has been in .NET since 2016 or so, but alas doesn't seem to have made it into Framework.

@@ -690,7 +690,7 @@
<setting name="MixedMoleculeSettingsTab" serializeAs="String">
<value>0</value>
</setting>
<setting name="Prosit" serializeAs="String">
<setting name="Koina" serializeAs="String">
Copy link
Contributor

Choose a reason for hiding this comment

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

Leave these changes for Brian Pratt's static analysis PR. Stick to only the one settings change required for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants