add workflow func tools
This commit is contained in:
parent
de0b910e09
commit
2de218782f
models/workflow
~/.vscode-root
Cache/Cache_Data
15651df7a7ad0fa5_05283edf90cf4ab50_0a97c96d98c7c4739_0d121e2a6335b7510_0fe88ee4465dbfb2c_0index
index-dir
CachedData/f1e16e1e6214d7c44d078b1f0607b2388f29d729
agent-1bcd1eefb5c644cce46c9f5e51a34a08.codeagent-478816df9ae9f58203b9562e441e1088.codeapplicationinsights-core-js-31ac3d5cc04603df584dbd5478dbdf3e.codeapplicationinsights-shims-2e2442b528c14b4f4a474c579a93816b.codebindings-4e7db64f6c9ef7fb68537cadc73a607e.codebindings-d0ed156a47e4cc502e09d38019fa81d9.codeclone-29233bfeb8daf40f410b07ebde3d9eca.codeclone-fb9a8c84d62826fc60e384cfe504b86c.codecommon-1615926972e0461a0a54f4f38b5afa20.codecommon-5a906a026d552a54ebdd9334eb51cb4c.codecompile-b6bd2958eb7888f6123a3a6fec4a8339.codeconstants-337c5657ec87e7cadee76b06792dcfda.codeconstants-59c9500636cc8acb4a7166d285bf89b5.codeconstants-60a15eb897190e97eb1d9acfde3a649e.codeconstants-8eceaa20b52ccda45c720d3e4bf85ca4.codecopy-11bd08dc77d20e177db1fe8ed491a1ce.codecopy-sync-9b9af4a5b2aefd09b1f07ec047a5b3d6.codedevdeviceid-c6b716affdd493c89369f56b900b2054.codedynamicproto-js-55d95f2ba4421508768808d88146fa29.codeemmetNodeMain-33bcda475c8eacc319583dc1ca8d6d97.codeexpand-ef669ae8985c9da23aa9f396a37746b2.codeextension-006dd0a474493b19f967605cd22ce17c.codeextension-2ac39eebe739e37f8432644a4ac630a9.codeextension-58f035ec3ac1e8e792a8a74316b8b543.codeextensionHostProcess-a67bb2c775cd481e91789f9f920af022.codeextensionHostProcess.nls-c1651001f284d2dec8d5ea5d9276ce15.codefile-a8cdee438228a0bebc70e2a48cff2e8e.codefind-made-7a5e7cd5e5d6a6b61d14e080bffd9913.codefind-made-a3e2fed3d74bfbbc42a3258edfc8307c.codegraceful-fs-4eeb817bcf5732255fbb9d61f99a9260.codegraceful-fs-b297e984daa30d268ea25dc499672000.codehelpers-4d4c2fc01d2cd4ac89fb7f45466cf507.codehelpers-7f356f27db16db1092c9ecbe0dde2d69.codehelpers-ebf2f50c7f91fd72084075a9083fc076.codehelpers-ec69cc4a05dac5f0d6ef25f56f1f4b1e.codeindex-03c8049b5877d935c1d4eb09684e9489.codeindex-0b1797acf215b52d10f82ddeae9466dd.codeindex-0cb0e094810108d60614f384c896281b.codeindex-0e79bc2d812c3550c298f024723b3a2b.codeindex-1da529c5ea664a9f4a5ec75cc155acaa.codeindex-2a9b44a3e27535c260e905efe8287fd4.codeindex-2df75e8e9e9d1b21c3af00c8f6bb1fac.codeindex-2ebc92ae5adf08a6b3d19d40752710ff.codeindex-3d16a587aeeaddf8ac336fefa99931c8.codeindex-3d2a3051201600b5851d9d926b9bf503.codeindex-4f33bd4e7d69a6c813b56978521945b2.codeindex-509883a5b1581ac5877bd38015765b5f.codeindex-552078d07afcd0010ab42dec4179b7f5.codeindex-55c949c4cbcfa20564ec32b850c3064a.codeindex-58f9ff89ec61f8292271fdcb4ae6fa4a.codeindex-5a146b35b5e35a858242d824f5cc0b5b.codeindex-5fc89b74b0a770ec96f545662d7166c4.codeindex-61cd59565e5756f6c2bfd3e7844ac38e.codeindex-64cfa84c084ca5d48fde61d91f796ace.codeindex-688105348226f2d1822e6c73bac6caf8.codeindex-76e2bf19f4a7719dbcff926c1ded9962.codeindex-788f346532369753f4fa6860ce3da31f.codeindex-7aecbda6aa833bf882cdf170e5e4d76f.codeindex-7e120589f812829237a18438a37cc881.codeindex-84e56ae0fc7ca9c51c391ab3ebe7db81.codeindex-85093265f80684c4943283c07c6883ef.codeindex-8c3af1109c60fdde78538ac247bbd65f.codeindex-8c8eb9d9ad33eb70f7bf8261ef639210.codeindex-915d06de437a5c4b97752edebdde1c4e.codeindex-95742fd213b366833fccf7df2d444ddc.codeindex-97015584f93842f93d0bd688589e57bb.codeindex-999c5664d46581e3d70a7c1e83691910.codeindex-a051643318d60cfdb8b70b62a9edb5a4.codeindex-a2fb08521e3625ea838c34e001dcf71f.codeindex-a58163a78bfd82d121aec04529831428.codeindex-aa4bba60694cfc648938ab9f9989914c.codeindex-addc1878a2abf6a1754f4df6286523bd.codeindex-b7ec4b692dd1a6ed3738692b4dbc5f77.codeindex-bf629fa9033db636d8a7820f3fd91ae2.codeindex-c100e3c92767d2d7a3ed604280397b64.codeindex-c37d20f47594bed8d58591561e394c97.codeindex-c4b239bad78b2369a349d52b1a2f7253.codeindex-c64c184c7ec3d1df34bfb9006b1812d6.codeindex-ca22c7d74bbb45e875a0dd907f33a5f8.codeindex-ce8f0061e59153a3ca6e3f576755af7d.codeindex-d30cbcb3fdae95ae5575a68edeb6fd0f.code
chrome
js
09cea43e3ae58f3c_0178c7b379642224f_08314143799db71ad_08803d5a712120b05_09069a2968f50df74_0bbf482237432a1fc_0d24d9b4d698e3813_0index
index-dir
wasm
@ -26,6 +26,100 @@ type AbstractWorkflow struct {
|
||||
Shared []string `json:"shared,omitempty" bson:"shared,omitempty"` // Shared is the ID of the shared workflow
|
||||
}
|
||||
|
||||
func (w AbstractWorkflow) isADependancy(id string) (bool, []string) {
|
||||
dependancyOfIDs := []string{}
|
||||
isDeps := false
|
||||
for _, link := range w.Graph.Links {
|
||||
source := w.Graph.Items[link.Destination.ID].Processing
|
||||
if id == link.Source.ID && source != nil {
|
||||
isDeps = true
|
||||
dependancyOfIDs = append(dependancyOfIDs, link.Destination.ID)
|
||||
}
|
||||
wourceWF := w.Graph.Items[link.Destination.ID].Workflow
|
||||
if id == link.Source.ID && wourceWF != nil {
|
||||
isDeps = true
|
||||
dependancyOfIDs = append(dependancyOfIDs, link.Destination.ID)
|
||||
}
|
||||
}
|
||||
return isDeps, dependancyOfIDs
|
||||
}
|
||||
|
||||
func (w *AbstractWorkflow) GetStoragesByRelatedProcessing(processingID string, relatedToData bool, ignoreRelation bool) (map[string][]utils.DBObject, map[string]map[string][]utils.DBObject) {
|
||||
storages := make(map[string][]utils.DBObject)
|
||||
datasRelatedToStorage := make(map[string]map[string][]utils.DBObject)
|
||||
for _, link := range w.Graph.Links {
|
||||
inout := "in"
|
||||
storageID := link.Source.ID // Default value because we are looking for the input storage cause processing is destination
|
||||
nodeID := link.Destination.ID // we considers that the processing is the destination
|
||||
node := w.Graph.Items[link.Source.ID].Storage // we are looking for the storage as source
|
||||
if node == nil { // if the source is not a storage, we consider that the destination is the storage
|
||||
inout = "out"
|
||||
storageID = link.Destination.ID // then we are looking for the output storage
|
||||
nodeID = link.Source.ID // and the processing is the source
|
||||
node = w.Graph.Items[link.Destination.ID].Storage // we are looking for the storage as destination
|
||||
}
|
||||
if processingID == nodeID && node != nil { // if the storage is linked to the processing
|
||||
if storages[inout] == nil {
|
||||
storages[inout] = []utils.DBObject{}
|
||||
}
|
||||
if !ignoreRelation {
|
||||
datasRelatedToStorage[storageID], _ = w.GetDatasByRelatedProcessing(processingID, false, true)
|
||||
if relatedToData && len(datasRelatedToStorage[storageID]) > 0 {
|
||||
storages[inout] = append(storages[inout], node)
|
||||
} else if !relatedToData && len(datasRelatedToStorage[storageID]) == 0 {
|
||||
storages[inout] = append(storages[inout], node)
|
||||
}
|
||||
} else {
|
||||
storages[inout] = append(storages[inout], node)
|
||||
}
|
||||
}
|
||||
}
|
||||
return storages, datasRelatedToStorage
|
||||
}
|
||||
|
||||
func (w *AbstractWorkflow) GetDatasByRelatedProcessing(dataID string, relatedToStorage bool, ignoreRelation bool) (map[string][]utils.DBObject, map[string]map[string][]utils.DBObject) {
|
||||
datas := make(map[string][]utils.DBObject)
|
||||
datasRelatedToData := make(map[string]map[string][]utils.DBObject)
|
||||
for _, link := range w.Graph.Links {
|
||||
inout := "in"
|
||||
dataID := link.Source.ID // Default value because we are looking for the input storage cause processing is destination
|
||||
nodeID := link.Destination.ID // we considers that the processing is the destination
|
||||
node := w.Graph.Items[link.Source.ID].Data // we are looking for the storage as source
|
||||
if node == nil { // if the source is not a storage, we consider that the destination is the storage
|
||||
inout = "out"
|
||||
dataID = link.Destination.ID // then we are looking for the output storage
|
||||
nodeID = link.Source.ID // and the processing is the source
|
||||
node = w.Graph.Items[link.Destination.ID].Data // we are looking for the storage as destination
|
||||
}
|
||||
if dataID == nodeID && node != nil { // if the storage is linked to the processing
|
||||
if datas[inout] == nil {
|
||||
datas[inout] = []utils.DBObject{}
|
||||
}
|
||||
datas[inout] = append(datas[inout], node)
|
||||
if !ignoreRelation {
|
||||
datasRelatedToData[dataID], _ = w.GetStoragesByRelatedProcessing(dataID, false, true)
|
||||
if relatedToStorage && len(datasRelatedToData[dataID]) > 0 {
|
||||
datas[inout] = append(datas[inout], node)
|
||||
} else if !relatedToStorage && len(datasRelatedToData[dataID]) == 0 {
|
||||
datas[inout] = append(datas[inout], node)
|
||||
}
|
||||
} else {
|
||||
datas[inout] = append(datas[inout], node)
|
||||
}
|
||||
}
|
||||
}
|
||||
return datas, datasRelatedToData
|
||||
}
|
||||
|
||||
func (w *AbstractWorkflow) getProcessingsByRelatedProcessing() (list_computings []graph.GraphItem) {
|
||||
for _, item := range w.Graph.Items {
|
||||
if item.Processing != nil {
|
||||
list_computings = append(list_computings, item)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// tool function to check if a link is a link between a datacenter and a resource
|
||||
func (w *AbstractWorkflow) isDCLink(link graph.GraphLink) (bool, string) {
|
||||
if w.Graph == nil || w.Graph.Items == nil {
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user