-
Notifications
You must be signed in to change notification settings - Fork 26
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
Same event cannot trigger a different transition based on current state #11
Comments
Indeed, the current design is lacking in this regard: the main focus is on states (and reaching a new state) rather than on events. I see two options for this feature:
The main issue I see with the second option is about transition implementations: the behavior would likely differ between "pause while idle" and "pause from pause_requested". What APIs would you expect to see for this feature? |
I think the second option is more obvious at definition stage (btw it is the one chosen by Fysom and it works well). On the behavior difference, after all it is the expectation: trigger other processing based on the event received. Callbacks should know the src, dst and state of the transition to perform different processing. Regards From: Raphaël Barrois [mailto:notifications@github.com] Indeed, the current design is lacking in this regard: the main focus is on states (and reaching a new state) rather than on events. I see two options for this feature:
The main issue I see with the second option is about transition implementations: the behavior would likely differ between "pause while idle" and "pause from pause_requested". What APIs would you expect to see for this feature? — Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc This message and its attachments may contain confidential or privileged information that may be protected by law; |
Hello,
I was about to use Xworkflows in my project, with its native support for Django. But once implemented, I discovered a limitation that I cannot overcome: the same event cannot trigger a different transition based on current state.
So, the following implementation does not work (I have commented out lines NOK).
Xworkflows definitions appear to be more transition-based than event-based...
I previously checked (and run) Fysom package, which has support for this feature, not so well integrated to Django models though.
STEP_STATES = (
('idle', _(u"Idle")),
('pending', _(u"Pending")),
('running', _(u"Running")),
('pause_requested', _(u"Pause requested")),
('stop_requested', _(u"Stop requested")),
('bypassed', _(u"Bypassed")),
('revoked', _(u"Revoked")),
('waiting', _(u"Waiting")),
('stopped', _(u"Stopped")),
('paused', _(u"Paused")),
('success', _(u"Success")),
('error', _(u"Error")),
('last_success', _(u"Last execution success")),
('last_error', _(u"Last execution error")),
)
STEP_TRANSITIONS = (
('init', 'idle', 'pending'),
('ignore', 'idle', 'idle'),
#('ignore', 'success', 'last_success'),
#('ignore', 'error', 'last_error'),
('start', 'pending', 'running'),
#('pause', 'pause_requested', 'paused'),
#('start', 'stop_requested', 'stopped'),
#('start', 'bypassed', 'bypassed'),
('bypass', ('idle', 'pending'), 'bypassed'),
('pause', ('idle', 'pending'), 'pause_requested'),
('stop', ('idle', 'pending'), 'stop_requested'),
('revoke', 'stop_requested', 'stopped'),
('wait', 'running', 'waiting'),
('continue', 'waiting', 'running'),
('success', 'running', 'success'),
('error', 'running', 'error')
)
STEP_INITIAL_STATE = 'idle'
The text was updated successfully, but these errors were encountered: