Quantcast

How to define custom state machine?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to define custom state machine?

Scott
Hello.

I have developed internal continuous delivery system based glu.
After first release, we have get a bunch of requirement.
So I'm considering my own statemache to reflect our own build life cycle.

But I had a hard time how to define custom statemachen.
I also look at below link.
http://pongasoft.github.io/glu/docs/latest/html/glu-script.html#glu-script-state-machine

Could you give any example about that?

Thank you in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to define custom state machine?

frenchyan
Administrator
I am not sure what you do not understand precisely, there is a small example of a brand new state machine: http://pongasoft.github.io/glu/docs/latest/html/meta-model.html#meta-model-statemachine

A state machine (for glu) is made up of state and transitions.

For example, the default state machine (https://github.com/pongasoft/glu/blob/master/agent/org.linkedin.glu.agent-api/src/main/groovy/org/linkedin/glu/agent/api/Agent.groovy#L28) has the states: NONE, installed, stopped and running with the "target" state (aka defaultEntryState) being running.

The transitions represent initial state, end state and action to execute in order to go from "initial state" to "end state". For example:

 installed: [[to: 'stopped', action: 'configure'], [to: 'NONE', action: 'uninstall']],

means: you can transition from state "installed" to state "stopped" by running the action "configure" or you can transition from state "installed" to state "NONE" by running the action "uninstall" 

The action maps directly to the closure you write in your script.

The one in the small example has the states: NONE, s1 and s2 with the "target" state (aka defaultEntryState) being s2

Yan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to define custom state machine?

Scott
Thank you quick reply.

Plugin Hook is what I want to know.
I'm wonder that I have to change soure code to define my statemachine.


Loading...