light modification
This commit is contained in:
parent
ed1e761052
commit
e9278111a6
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user