workflow scheduler create booking with a booking execution lot id
This commit is contained in:
parent
576f53f81b
commit
c7c1535ba9
@ -23,7 +23,7 @@ func GetPlannerNearestStart(start time.Time, planned map[tools.DataType][]pricin
|
||||
return near
|
||||
}
|
||||
|
||||
func GetPlannerLongestTime(end *time.Time, planned map[tools.DataType][]pricing.PricedItemITF, request *tools.APIRequest) float64 {
|
||||
func GetPlannerLongestTime(end *time.Time, planned map[tools.DataType]map[string]pricing.PricedItemITF, request *tools.APIRequest) float64 {
|
||||
if end == nil {
|
||||
return -1
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
*/
|
||||
type WorkflowExecution struct {
|
||||
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
||||
PeerBookByResource map[string]map[string][]string `json:"peer_book_by_resource,omitempty" bson:"peer_book_by_resource,omitempty"` // BookByResource is a map of the resource id and the list of the booking id
|
||||
PeerBookByGraph map[string]map[string][]string `json:"peer_book_by_graph,omitempty" bson:"peer_book_by_graph,omitempty"` // BookByResource is a map of the resource id and the list of the booking id
|
||||
ExecutionsID string `json:"executions_id,omitempty" bson:"executions_id,omitempty"`
|
||||
ExecDate time.Time `json:"execution_date,omitempty" bson:"execution_date,omitempty" validate:"required"` // ExecDate is the execution date of the workflow, is required
|
||||
EndDate *time.Time `json:"end_date,omitempty" bson:"end_date,omitempty"` // EndDate is the end date of the workflow
|
||||
@ -109,23 +109,23 @@ func (d *WorkflowExecution) VerifyAuth(request *tools.APIRequest) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (d *WorkflowExecution) Book(executionsID string, wfID string, priceds map[tools.DataType][]pricing.PricedItemITF) []*booking.Booking {
|
||||
func (d *WorkflowExecution) Book(executionsID string, wfID string, priceds map[tools.DataType]map[string]pricing.PricedItemITF) []*booking.Booking {
|
||||
booking := d.bookEach(executionsID, wfID, tools.STORAGE_RESOURCE, priceds[tools.STORAGE_RESOURCE])
|
||||
booking = append(booking, d.bookEach(executionsID, wfID, tools.PROCESSING_RESOURCE, priceds[tools.PROCESSING_RESOURCE])...)
|
||||
return booking
|
||||
}
|
||||
|
||||
func (d *WorkflowExecution) bookEach(executionsID string, wfID string, dt tools.DataType, priceds []pricing.PricedItemITF) []*booking.Booking {
|
||||
func (d *WorkflowExecution) bookEach(executionsID string, wfID string, dt tools.DataType, priceds map[string]pricing.PricedItemITF) []*booking.Booking {
|
||||
items := []*booking.Booking{}
|
||||
for _, priced := range priceds {
|
||||
if d.PeerBookByResource == nil {
|
||||
d.PeerBookByResource = map[string]map[string][]string{}
|
||||
for itemID, priced := range priceds {
|
||||
if d.PeerBookByGraph == nil {
|
||||
d.PeerBookByGraph = map[string]map[string][]string{}
|
||||
}
|
||||
if d.PeerBookByResource[priced.GetCreatorID()] == nil {
|
||||
d.PeerBookByResource[priced.GetCreatorID()] = map[string][]string{}
|
||||
if d.PeerBookByGraph[priced.GetCreatorID()] == nil {
|
||||
d.PeerBookByGraph[priced.GetCreatorID()] = map[string][]string{}
|
||||
}
|
||||
if d.PeerBookByResource[priced.GetCreatorID()][priced.GetID()] == nil {
|
||||
d.PeerBookByResource[priced.GetCreatorID()][priced.GetID()] = []string{}
|
||||
if d.PeerBookByGraph[priced.GetCreatorID()][itemID] == nil {
|
||||
d.PeerBookByGraph[priced.GetCreatorID()][itemID] = []string{}
|
||||
}
|
||||
start := d.ExecDate
|
||||
if s := priced.GetLocationStart(); s != nil {
|
||||
@ -148,8 +148,8 @@ func (d *WorkflowExecution) bookEach(executionsID string, wfID string, dt tools.
|
||||
ExpectedEndDate: &end,
|
||||
}
|
||||
items = append(items, bookingItem)
|
||||
d.PeerBookByResource[priced.GetCreatorID()][priced.GetID()] = append(
|
||||
d.PeerBookByResource[priced.GetCreatorID()][priced.GetID()], bookingItem.GetID())
|
||||
d.PeerBookByGraph[priced.GetCreatorID()][itemID] = append(
|
||||
d.PeerBookByGraph[priced.GetCreatorID()][itemID], bookingItem.GetID())
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user