diff --git a/models/common/planner.go b/models/common/planner.go index 7db0c75..fac93c3 100644 --- a/models/common/planner.go +++ b/models/common/planner.go @@ -33,7 +33,7 @@ func GetPlannerLongestTime(end *time.Time, planned map[tools.DataType][]pricing. continue } newS := priced.GetLocationEnd() - if longestTime < newS.Sub(*end).Seconds() { + if end == nil && longestTime < newS.Sub(*end).Seconds() { longestTime = newS.Sub(*end).Seconds() } // get the nearest start from start var diff --git a/models/workflow_execution/workflow_scheduler.go b/models/workflow_execution/workflow_scheduler.go index 7269644..4c380fb 100644 --- a/models/workflow_execution/workflow_scheduler.go +++ b/models/workflow_execution/workflow_scheduler.go @@ -58,6 +58,7 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest) } wf := res.(*workflow.Workflow) longest, priceds, wf, err := wf.Planify(ws.Start, ws.End, request) + fmt.Println("longest", longest, err) if err != nil { return false, wf, []*WorkflowExecutions{}, err } @@ -67,6 +68,7 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest) ws.Warning = "The workflow may be too long to be executed in the given time frame, we will try to book it anyway\n" } execs, err := ws.getExecutions(wf) + fmt.Println("execs", execs, err) if err != nil { return false, wf, []*WorkflowExecutions{}, err } @@ -75,6 +77,7 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest) for _, booking := range bookings { _, err := (&peer.Peer{}).LaunchPeerExecution(booking.DestPeerID, "", tools.BOOKING, tools.POSTCHECK, booking.Serialize(booking), request.Caller) + fmt.Println("booking", booking, err) if err != nil { return false, wf, execs, err } @@ -97,7 +100,7 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (* } ok, wf, executions, err := ws.CheckBooking(wfID, request) if !ok || err != nil { - return nil, []*WorkflowExecutions{}, errors.New("could not book the workflow" + fmt.Sprintf("%v", err)) + return nil, []*WorkflowExecutions{}, errors.New("could not book the workflow : " + fmt.Sprintf("%v", err)) } ws.Workflow = wf