Last active
February 28, 2020 05:51
-
-
Save mgreenly/95b9e95dd04a388b4992c470607048bc to your computer and use it in GitHub Desktop.
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
Rules = { | |
enter: [ 'created' ], | |
exit: [ 'completed' ], | |
uncancelable: %w[ completing completed ], | |
tasks: [ | |
{ | |
name: 'tag', | |
desc: 'taggable', | |
transitions: [ | |
{ from: { state: 'tagging', :status: 'pending' }, to: { state: 'tagged' } }, | |
{ from: { state: 'tagging', :status: 'pending' }, to: { state: 'tagged' status: 'aborted' } }, | |
] | |
}, | |
{ | |
name: 'complete', | |
desc: 'completable', | |
transitions: [ | |
{ from: { state: 'completing', :status: 'pending' }, to: { state: 'completed', status: 'succeeded' } }, | |
{ from: { state: 'completing', :status: 'canceling' }, to: { state: 'completed', status: 'canceled' } }, | |
{ from: { state: 'completing', :status: 'aborting' }, to: { state: 'completed', status: 'aborted' } }, | |
] | |
} | |
] | |
transitions: [ | |
# pending | |
{ retriable: true, from: { state: 'created', status: 'pending' }, to: { state: 'tagging' } } | |
{ retriable: true, from: { state: 'tagged', status: 'pending' }, to: { state: 'scheduling' } } | |
# canceling | |
{ from: { state: 'created', status: 'canceling' }, to: { state: 'completing' } } | |
{ from: { state: 'tagged', status: 'canceling' }, to: { state: 'completing' } } | |
# aborting | |
{ from: { state: 'tagged', status: 'aborting' }, to: { state: 'completing' } } | |
] | |
} |
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
--- | |
enter: | |
- created | |
exit: | |
- completed | |
cancelable: | |
- created | |
- tagging | |
- tagged | |
tasks: | |
- name: tag | |
desc: taggable | |
transitions: | |
- from: | |
state: tagging | |
status: pending | |
to: | |
state: tagged | |
- name: complete | |
desc: completable | |
transitions: | |
- from: | |
state: completing | |
status: pending | |
to: | |
state: completed | |
status: succeeded | |
- from: | |
state: completing | |
status: canceling | |
to: | |
state: completed | |
status: canceled | |
- from: | |
state: completing | |
status: aborting | |
to: | |
state: completed | |
status: aborted | |
transitions: | |
- retriable: true | |
from: | |
state: created | |
status: pending | |
to: | |
state: tagging | |
- retriable: true | |
from: | |
state: tagged | |
status: pending | |
to: | |
state: scheduling | |
- from: | |
state: tagged | |
status: canceling | |
to: | |
state: completing | |
- from: | |
state: tagged | |
status: aborting | |
to: | |
state: completing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment