diff --git a/models/peer/peer.go b/models/peer/peer.go index a8f4ac0..b915c34 100644 --- a/models/peer/peer.go +++ b/models/peer/peer.go @@ -73,7 +73,7 @@ func (p *Peer) IsMySelf() (bool, string) { } // LaunchPeerExecution launches an execution on a peer -func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) { +func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) { p.UUID = peerID return cache.LaunchPeerExecution(peerID, dataID, dt, method, body, caller) // Launch the execution on the peer through the cache } diff --git a/models/peer/peer_cache.go b/models/peer/peer_cache.go index e69dd3c..737e014 100644 --- a/models/peer/peer_cache.go +++ b/models/peer/peer_cache.go @@ -15,11 +15,11 @@ import ( * it defines the execution data */ type PeerExecution struct { - Method string `json:"method" bson:"method"` - Url string `json:"url" bson:"url"` - Body map[string]interface{} `json:"body" bson:"body"` - DataType int `json:"data_type" bson:"data_type"` - DataID string `json:"data_id" bson:"data_id"` + Method string `json:"method" bson:"method"` + Url string `json:"url" bson:"url"` + Body interface{} `json:"body" bson:"body"` + DataType int `json:"data_type" bson:"data_type"` + DataID string `json:"data_id" bson:"data_id"` } var cache = &PeerCache{} // Singleton instance of the peer cache @@ -84,7 +84,7 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string, caller *tools // LaunchPeerExecution launches an execution on a peer func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string, - dt tools.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) { + dt tools.DataType, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) { fmt.Println("Launching peer execution on", caller.URLS, dt, method) methods := caller.URLS[dt] // Get the methods url of the data type if m, ok := methods[method]; !ok || m == "" { @@ -128,7 +128,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string, } // exec executes the method on the peer -func (p *PeerCache) exec(url string, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) error { +func (p *PeerCache) exec(url string, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) error { var b []byte var err error fmt.Println("Executing", method, "on", url, "with", body) diff --git a/models/workflow_execution/workflow_scheduler.go b/models/workflow_execution/workflow_scheduler.go index 4c380fb..0e9fabd 100644 --- a/models/workflow_execution/workflow_scheduler.go +++ b/models/workflow_execution/workflow_scheduler.go @@ -63,7 +63,7 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest) return false, wf, []*WorkflowExecutions{}, err } ws.DurationS = longest - ws.Message = "We estimate that the workflow will start at " + ws.Start.String() + " and last " + fmt.Sprintf("%v", ws.DurationS) + "seconds." + ws.Message = "We estimate that the workflow will start at " + ws.Start.String() + " and last " + fmt.Sprintf("%v", ws.DurationS) + " seconds." if ws.End != nil && ws.Start.Add(time.Duration(longest)*time.Second).After(*ws.End) { ws.Warning = "The workflow may be too long to be executed in the given time frame, we will try to book it anyway\n" } @@ -155,7 +155,7 @@ func (ws *WorkflowSchedule) getDates() ([]Schedule, error) { schedule := []Schedule{} if len(ws.Cron) > 0 { // if cron is set then end date should be set if ws.End == nil { - return schedule, errors.New("a cron task should have an end date.") + return schedule, errors.New("a cron task should have an end date") } if ws.DurationS <= 0 { ws.DurationS = ws.End.Sub(ws.Start).Seconds()