Skip to content

Commit c90d7bf

Browse files
committed
[occ][executor] Handle COMPLETE_INIT transition explicitly
Therefore INITIALIZING_DEVICE is not an intermediate state any more, from the OCC point of view.
1 parent 88863f0 commit c90d7bf

4 files changed

Lines changed: 29 additions & 21 deletions

File tree

executor/executorcmd/transitioner/fairmq.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ func (cm *FairMQ) stateForFmqState(fmqStateName string) string {
114114

115115
func (cm *FairMQ) doConfigure(evt string, src string, dst string, args map[string]string) (finalState string, err error) {
116116
var state string
117-
state, err = cm.DoTransition(EventInfo{fairmq.EvtINIT_DEVICE, cm.fmqStateForState(src), fairmq.INITIALIZED, args})
117+
state, err = cm.DoTransition(EventInfo{fairmq.EvtINIT_DEVICE, cm.fmqStateForState(src), fairmq.INITIALIZING_DEVICE, args})
118+
if state != fairmq.INITIALIZING_DEVICE {
119+
finalState = cm.stateForFmqState(state)
120+
return
121+
}
122+
123+
state, err = cm.DoTransition(EventInfo{fairmq.EvtCOMPLETE_INIT, fairmq.INITIALIZING_DEVICE, fairmq.INITIALIZED, nil})
118124
if state != fairmq.INITIALIZED {
119125
finalState = cm.stateForFmqState(state)
120126
return

executor/executorcmd/transitioner/fairmq/states.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
package fairmq
2626

2727
const(
28-
OK = "OK"
29-
ERROR = "ERROR"
30-
IDLE = "IDLE"
31-
INITIALIZED = "INITIALIZED"
32-
BOUND = "BOUND"
33-
DEVICE_READY = "DEVICE READY"
34-
READY = "READY"
35-
RUNNING = "RUNNING"
36-
EXITING = "EXITING"
28+
OK = "OK"
29+
ERROR = "ERROR"
30+
IDLE = "IDLE"
31+
INITIALIZING_DEVICE = "INITIALIZING DEVICE"
32+
INITIALIZED = "INITIALIZED"
33+
BOUND = "BOUND"
34+
DEVICE_READY = "DEVICE READY"
35+
READY = "READY"
36+
RUNNING = "RUNNING"
37+
EXITING = "EXITING"
3738
)

executor/executorcmd/transitioner/fairmq/transitions.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
package fairmq
2626

2727
const(
28-
EvtAUTO = "Auto"
29-
EvtINIT_DEVICE = "INIT DEVICE"
30-
EvtBIND = "BIND"
31-
EvtCONNECT = "INITIALIZED"
32-
EvtINIT_TASK = "INIT TASK"
33-
EvtRUN = "RUN"
34-
EvtSTOP = "STOP"
35-
EvtRESET_TASK = "RESET TASK"
36-
EvtRESET_DEVICE = "RESET DEVICE"
37-
EvtEND = "END"
28+
EvtAUTO = "Auto"
29+
EvtINIT_DEVICE = "INIT DEVICE"
30+
EvtCOMPLETE_INIT = "COMPLETE INIT"
31+
EvtBIND = "BIND"
32+
EvtCONNECT = "INITIALIZED"
33+
EvtINIT_TASK = "INIT TASK"
34+
EvtRUN = "RUN"
35+
EvtSTOP = "STOP"
36+
EvtRESET_TASK = "RESET TASK"
37+
EvtRESET_DEVICE = "RESET DEVICE"
38+
EvtEND = "END"
3839
)

occ/plugin/OccPluginServer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ OccPluginServer::Transition(grpc::ServerContext* context,
424424

425425
bool OccPluginServer::isIntermediateState(const std::string& state)
426426
{
427-
return state.find("INITIALIZING") != std::string::npos ||
427+
return state.find("INITIALIZING TASK") != std::string::npos ||
428428
state.find("RESETTING") != std::string::npos ||
429429
state.find("BINDING") != std::string::npos ||
430430
state.find("CONNECTING") != std::string::npos;

0 commit comments

Comments
 (0)