workflow scheduler create booking with a booking execution lot id
This commit is contained in:
		@@ -128,8 +128,8 @@ func (wfa *Workflow) CheckBooking(caller *tools.HTTPCaller) (bool, error) {
 | 
				
			|||||||
	return true, nil
 | 
						return true, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (wf *Workflow) Planify(start time.Time, end *time.Time, request *tools.APIRequest) (float64, map[tools.DataType][]pricing.PricedItemITF, *Workflow, error) {
 | 
					func (wf *Workflow) Planify(start time.Time, end *time.Time, request *tools.APIRequest) (float64, map[tools.DataType]map[string]pricing.PricedItemITF, *Workflow, error) {
 | 
				
			||||||
	priceds := map[tools.DataType][]pricing.PricedItemITF{}
 | 
						priceds := map[tools.DataType]map[string]pricing.PricedItemITF{}
 | 
				
			||||||
	ps, priceds, err := plan[*resources.ProcessingResource](tools.PROCESSING_RESOURCE, wf, priceds, request, wf.Graph.IsProcessing,
 | 
						ps, priceds, err := plan[*resources.ProcessingResource](tools.PROCESSING_RESOURCE, wf, priceds, request, wf.Graph.IsProcessing,
 | 
				
			||||||
		func(res resources.ResourceInterface, priced pricing.PricedItemITF) (time.Time, float64) {
 | 
							func(res resources.ResourceInterface, priced pricing.PricedItemITF) (time.Time, float64) {
 | 
				
			||||||
			return start.Add(time.Duration(wf.Graph.GetAverageTimeProcessingBeforeStart(0, res.GetID(), request)) * time.Second), priced.GetExplicitDurationInS()
 | 
								return start.Add(time.Duration(wf.Graph.GetAverageTimeProcessingBeforeStart(0, res.GetID(), request)) * time.Second), priced.GetExplicitDurationInS()
 | 
				
			||||||
@@ -189,12 +189,12 @@ func (wf *Workflow) Planify(start time.Time, end *time.Time, request *tools.APIR
 | 
				
			|||||||
	return longest, priceds, wf, nil
 | 
						return longest, priceds, wf, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func plan[T resources.ResourceInterface](dt tools.DataType, wf *Workflow, priceds map[tools.DataType][]pricing.PricedItemITF, request *tools.APIRequest,
 | 
					func plan[T resources.ResourceInterface](dt tools.DataType, wf *Workflow, priceds map[tools.DataType]map[string]pricing.PricedItemITF, request *tools.APIRequest,
 | 
				
			||||||
	f func(graph.GraphItem) bool, start func(resources.ResourceInterface, pricing.PricedItemITF) (time.Time, float64), end func(time.Time, float64) *time.Time) ([]T, map[tools.DataType][]pricing.PricedItemITF, error) {
 | 
						f func(graph.GraphItem) bool, start func(resources.ResourceInterface, pricing.PricedItemITF) (time.Time, float64), end func(time.Time, float64) *time.Time) ([]T, map[tools.DataType]map[string]pricing.PricedItemITF, error) {
 | 
				
			||||||
	resources := []T{}
 | 
						resources := []T{}
 | 
				
			||||||
	for _, item := range wf.GetGraphItems(f) {
 | 
						for _, item := range wf.GetGraphItems(f) {
 | 
				
			||||||
		if priceds[dt] == nil {
 | 
							if priceds[dt] == nil {
 | 
				
			||||||
			priceds[dt] = []pricing.PricedItemITF{}
 | 
								priceds[dt] = map[string]pricing.PricedItemITF{}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		dt, realItem := item.GetResource()
 | 
							dt, realItem := item.GetResource()
 | 
				
			||||||
		if realItem == nil {
 | 
							if realItem == nil {
 | 
				
			||||||
@@ -212,7 +212,7 @@ func plan[T resources.ResourceInterface](dt tools.DataType, wf *Workflow, priced
 | 
				
			|||||||
			priced.SetLocationEnd(*e)
 | 
								priced.SetLocationEnd(*e)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		resources = append(resources, realItem.(T))
 | 
							resources = append(resources, realItem.(T))
 | 
				
			||||||
		priceds[dt] = append(priceds[dt], priced)
 | 
							priceds[dt][item.ID] = priced
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return resources, priceds, nil
 | 
						return resources, priceds, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user