-
Notifications
You must be signed in to change notification settings - Fork 656
TLA+ model for SwarmKit tasks #2613
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 file contains hidden or 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 file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| *.toolbox | ||
| *.tlaps | ||
| states | ||
| metadir |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ---------------------------- MODULE EventCounter ---------------------------- | ||
|
|
||
| EXTENDS Integers | ||
|
|
||
| \* The number of ``events'' that have occurred (always 0 if we're not keeping track). | ||
| VARIABLE nEvents | ||
|
|
||
| \* The maximum number of events to allow, or ``-1'' for unlimited. | ||
| maxEvents == -1 | ||
|
|
||
| InitEvents == | ||
| nEvents = 0 \* Start with the counter at zero | ||
|
|
||
| (* If we're counting events, increment the event counter. | ||
| We don't increment the counter when we don't have a maximum because that | ||
| would make the model infinite. | ||
| Actions tagged with CountEvent cannot happen once nEvents = maxEvents. *) | ||
| CountEvent == | ||
| IF maxEvents = -1 THEN | ||
| UNCHANGED nEvents | ||
| ELSE | ||
| /\ nEvents < maxEvents | ||
| /\ nEvents' = nEvents + 1 | ||
|
|
||
| ============================================================================= |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| WORKERS := 4 | ||
|
|
||
| TLA := docker run --rm -it --workdir /mnt -v ${PWD}:/mnt talex5/tla | ||
|
|
||
| .PHONY: all check pdfs tlaps | ||
|
|
||
| all: check pdfs tlaps | ||
|
|
||
| # Run the TLC model checker | ||
| check: | ||
| ${TLA} tlc -workers ${WORKERS} SwarmKit.tla -config models/SwarmKit.cfg | ||
| ${TLA} tlc -workers ${WORKERS} WorkerImpl.tla -config models/WorkerImpl.cfg | ||
|
|
||
| # Run the TLAPS proof checker | ||
| tlaps: | ||
| ${TLA} tlapm -I /usr/local/lib/tlaps SwarmKit.tla | ||
| ${TLA} tlapm -I /usr/local/lib/tlaps WorkerImpl.tla | ||
|
|
||
| # Generate a PDF file from a .tla file | ||
| %.pdf: %.tla | ||
| [ -d metadir ] || mkdir metadir | ||
| ${TLA} java tla2tex.TLA -shade -latexCommand pdflatex -latexOutputExt pdf -metadir metadir $< | ||
|
|
||
| pdfs: SwarmKit.pdf Types.pdf Tasks.pdf WorkerSpec.pdf EventCounter.pdf |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| This directory contains documentation for SwarmKit using [TLA+][] notation. | ||
|
|
||
| Run `make pdfs` to render these documents as PDF files. | ||
| The best one to start with is `SwarmKit.pdf`, which introduces the TLA+ notation | ||
| and describes the overall components of SwarmKit. | ||
|
|
||
| The specifications can also be executed by the TLC model checker to help find | ||
| mistakes. Use `make check` to run the checks. | ||
|
|
||
| If you want to edit these specifications, you will probably want to use the [TLA+ Toolbox][], | ||
| which provides a GUI. | ||
|
|
||
| [TLA+]: https://en.wikipedia.org/wiki/TLA%2B | ||
| [TLA+ Toolbox]: http://lamport.azurewebsites.net/tla/toolbox.html |
Oops, something went wrong.
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.
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.
Lets also clarify this by saying that the actual state is changed to COMPLETE by the agent.
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.
Actually, it says the agent handles these states on the line above the bit shown by GitHub's diff, so maybe it's OK as it is.
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.
OK, its fine as is.