State machine contains incorrect on_exit method after transition
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
automaton |
New
|
Undecided
|
Unassigned |
Bug Description
I've created a simple automaton:
state_space = [
{
{
]
There are 2 on_exit methods which lead to a method in a different object. When the automaton processes events ["STA", "STP:REDY"] it correctly processes "STA" and executes builder.on_exit_0. However when the machine is in state '1' the on_exit is still set to builder.on_exit_0.
I've tried to debug it with pdb and found this:
(Pdb) print(self.
+------
| Start | Event | End | On Enter | On Exit |
+------
| 0[^] | STA | 1 | . | bam_processor.
| @1 | STP:!REDY | 0 | . | bam_processor.
| @1 | STP:REDY | 0 | . | bam_processor.
+------
and at the same time:
(Pdb) print(self.
<bound method BatchBuilder.
As you can see the pformat() knows about correct on_exit_1 method while automaton.
description: | updated |
This is also suspicious to me:
state_space = [
' name': '0',
' next_states' : {
'STA' : '1'
} ,
' on_exit' : builder.on_exit_0,
' on_enter' : builder.on_enter_0
' name': '1',
' next_states' : {
'STP: REDY': '0',
'STP: !REDY': '0'
} ,
{
},
{
},
]
# build and initialize the automaton now
self.machine = machines. FiniteMachine. build(state_ space)
self.machine. default_ start_state = '0'
self.machine. initialize( )
I've tried to add on_enter method and for that I've got this automaton:
+------ -+----- ------+ -----+- ------- ------- ------- ------- ------- ------- ------- ------- ---+--- ------- ------- ------- ------- ------- ------- ------- ------- + -+----- ------+ -----+- ------- ------- ------- ------- ------- ------- ------- ------- ---+--- ------- ------- ------- ------- ------- ------- ------- ------- + modules. batch_module. BatchBuilder. on_exit_ 0 | modules. batch_module. BatchBuilder. on_enter_ 0 | . | modules. batch_module. BatchBuilder. on_enter_ 0 | . | -+----- ------+ -----+- ------- ------- ------- ------- ------- ------- ------- ------- ---+--- ------- ------- ------- ------- ------- ------- ------- ------- +
| Start | Event | End | On Enter | On Exit |
+------
| @0[^] | STA | 1 | . | bam_processor.
| 1 | STP:!REDY | 0 | bam_processor.
| 1 | STP:REDY | 0 | bam_processor.
+------
As you can see there are on_enter_0 callbacks at On Enter in state '1' while I defined it for state '0'.