Not a proper WF model
This commit is contained in:
parent
0c825b65b0
commit
febabe67e7
@ -2,33 +2,27 @@ package oclib
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"slices"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/data"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/processing"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/storage"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/workflow/graph"
|
"cloud.o-forge.io/core/oc-lib/models/resources/workflow/graph"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AbstractWorkflow struct {
|
type AbstractWorkflow struct {
|
||||||
Graph *graph.Graph `bson:"graph,omitempty" json:"graph,omitempty"`
|
Graph *graph.Graph `bson:"graph,omitempty" json:"graph,omitempty"`
|
||||||
Datas map[string]data.DataResource `bson:"datas,omitempty" json:"datas,omitempty"`
|
Datas []string `bson:"datas,omitempty" json:"datas,omitempty"`
|
||||||
Storages map[string]storage.StorageResource `bson:"storages,omitempty" json:"storages,omitempty"`
|
Storages []string `bson:"storages,omitempty" json:"storages,omitempty"`
|
||||||
ProcessingResource map[string]processing.ProcessingResource `bson:"processing,omitempty" json:"processing,omitempty"`
|
ProcessingResource []string `bson:"processing,omitempty" json:"processing,omitempty"`
|
||||||
Datacenters map[string]datacenter.DatacenterResource `bson:"datacenters,omitempty" json:"datacenters,omitempty"`
|
Datacenters []string `bson:"datacenters,omitempty" json:"datacenters,omitempty"`
|
||||||
Workflows map[string]WorkflowResource `bson:"workflows,omitempty" json:"workflows,omitempty"`
|
Workflows []string `bson:"workflows,omitempty" json:"workflows,omitempty"`
|
||||||
Schedule *WorkflowSchedule `bson:"schedule,omitempty" json:"schedule,omitempty"`
|
Schedule *WorkflowSchedule `bson:"schedule,omitempty" json:"schedule,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *AbstractWorkflow) isDCLink(link graph.GraphLink) bool {
|
func (w *AbstractWorkflow) isDCLink(link graph.GraphLink) bool {
|
||||||
if _, exists := w.Datacenters[link.Destination.ID]; exists {
|
if slices.Contains(w.Datacenters, link.Destination.ID) || slices.Contains(w.Datacenters, link.Source.ID) {
|
||||||
return true
|
|
||||||
} else if _, exists := w.Datacenters[link.Source.ID]; exists {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user