-
Notifications
You must be signed in to change notification settings - Fork 34
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
Strategy run API refactoring #262
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
This was referenced Jan 22, 2024
@eupp could you please rebase the PR onto |
eupp
force-pushed
the
strategy-run-api
branch
from
February 26, 2024 15:56
8ee4a03
to
bc30e38
Compare
ndkoval
requested changes
Feb 26, 2024
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/Strategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/stress/StressStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/Strategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/Strategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
@eupp could you please rebase the PR? |
Rebased. |
ndkoval
reviewed
Jun 11, 2024
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/stress/StressStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
ndkoval
approved these changes
Jun 11, 2024
@eupp please address the remaining minor comments and merge the PR 🎉 |
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
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.
This PR proposes a simple refactoring of the
Strategy
class API.Motivation
Currently, the
Strategy
API provides the following method to run the scenario:This method should run the scenario (some) number of times and returns the failure, in case if any invocation fails.
This API leads to code duplication in the current code base.
This PR proposes to change the API, so that the
Strategy
instead provides the method to run single invocation:This change allows to implement the previously duplicated functionality in a single place, as a bunch of
Strategy
interface extension methods.Note that in addition, the new API adds two (optional) methods to implement:
Thus, the pattern to run the strategy becomes as follows:
For deterministic strategies (like model checking strategy), consecutive calls of
runInvocation
withouthnextInvocation
calls, should lead to the same results:This change also simplifies implementation of the new features.
In Lincheck benchmarks #250 we need to collect the statistics of running each invocation (e.g. its running time). With the old API, this again would require the code duplication in all
Strategy
implementers.In Single Lincheck options class with
testingTime(..)
option #158 we want to implement the adaptive dynamic selection of the number of invocations to be run. This change requires to offload the decision on how many times to run the scenario from theStrategy
class into thePlanner
class. Again, with the new API this becomes trivial.