light modification

This commit is contained in:
mr 2025-01-22 14:13:10 +01:00
parent ed1e761052
commit e9278111a6
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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