From 81d7276f475fbbbfeefaad625d5173aa2a460423 Mon Sep 17 00:00:00 2001 From: Olivier Wulveryck Date: Sat, 12 Dec 2015 09:34:38 +0100 Subject: [PATCH] Ok but really poor performances --- orchestrator/graph.go | 2 +- orchestrator/node.go | 6 +++--- orchestrator/structure.go | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/orchestrator/graph.go b/orchestrator/graph.go index ed7cb2d..6645eaf 100644 --- a/orchestrator/graph.go +++ b/orchestrator/graph.go @@ -46,7 +46,7 @@ func (v *Graph) Run(stop <-chan time.Time) { node := <-cs[i] go func() { for { - node.Wait <- m + node.Wait <- *v l.Lock() defer l.Unlock() co.Wait() diff --git a/orchestrator/node.go b/orchestrator/node.go index 02e8564..5467098 100644 --- a/orchestrator/node.go +++ b/orchestrator/node.go @@ -20,7 +20,6 @@ along with this program. If not, see . package orchestrator import ( - "github.com/owulveryck/gorchestrator/structure" "math/rand" "time" ) @@ -39,12 +38,13 @@ type Node struct { // Run executes the artifact of a given node func (n *Node) Run() <-chan Message { c := make(chan Message) - waitForIt := make(chan structure.Matrix) // Shared between all messages. + waitForIt := make(chan Graph) // Shared between all messages. go func() { n.State = ToRun for n.State <= ToRun { c <- Message{n.ID, n.State, waitForIt} - m := <-waitForIt + g := <-waitForIt + m := g.Digraph s := m.Dim() n.State = Running for i := 0; i < s; i++ { diff --git a/orchestrator/structure.go b/orchestrator/structure.go index e5fb4f5..1b5c922 100644 --- a/orchestrator/structure.go +++ b/orchestrator/structure.go @@ -21,13 +21,12 @@ package orchestrator import ( "encoding/json" - "github.com/owulveryck/gorchestrator/structure" ) type Message struct { ID int State int - Wait chan structure.Matrix + Wait chan Graph } // Error is a type used when any error related to the input or node structure occurs