fractalide / fractalide-oz

Proof of concept
GNU Affero General Public License v3.0
12 stars 3 forks source link

Newhalt #78

Closed dmichiels closed 9 years ago

dmichiels commented 9 years ago

fix #63

This PR allows to stop gracefully components.

Each component had the default input port : 'HALT'. When an IP is received in this port, the component will halt. As it is at the IPs level, the component must have ended is previous execution (in fact, respect all the condition for a new execution). So this procedure will not stop the current execution. The component can do specify a special action before halting by creating the 'HALT' port, like clean a socket. An example is show in the displayHalt.oz component.

At the creation of a sub-component, a virtual input port 'HALT' is binded to all the 'HALT' inside port. That allows to shutdown a subcomponent.

The component 'halt.oz' let the user stop a graph. As the components know their "mother sub-component", it is possible to send an IP to the virtual 'HALT' port.

Also, creating a "supervisor" for halting the graph is possible by creating a special halt component.

sjmackenzie commented 9 years ago

This looks quite excellent.

Quick question: If I close a component within the editor, would the halt propagate from the application's components d into the editor? Would my editor be halted?

sjmackenzie commented 9 years ago

What are your thoughts on making the 'HALT' port is displayHalt.oz on line 11 implicit d not explicit?

Ie whenever a component is created a HALT port is created (similar to the OPTIONS port)

This saves developers having to remember one extra piece of information. Ie. remember to include a HALT port.

dmichiels commented 9 years ago

Question : If I close a component within the editor, would the halt propagate from the application's components d into the editor? Would my editor be halted?

No, the halt will propagate downward. It is possible to shutdown a branch of the graph.

Question : What are your thoughts on making the 'HALT' port is displayHalt.oz on line 11 implicit d not explicit?

Interesting idea, but I don't see how to put it in practice. The fact is that we need to know when the user implement a special shutdown, and we can't analyse the procedure... But as the developers will do {Ins.'HALT'.get}, I suppose they will remember they need the input port 'HALT', as for all other ones?

sjmackenzie commented 9 years ago

Downward propagation of the halt is a good way.

So lot me get this right, halt is an abnormal way to kill the program? Ie as fast as possible, yet keeping it relatively clean.

Maybe your current implementation (a commendable effort!) Is the right way to go? There is full control and nothing is hidden. Lets just see how it plays out!

Maybe create an issue to detail the idea behind the two different ways?

Great work!