From 3d58416d9ba7f089ce53d08496ffcd44e5895b15 Mon Sep 17 00:00:00 2001 From: mr Date: Thu, 26 Sep 2024 15:52:35 +0200 Subject: [PATCH] equals func on exec + draft container subobject --- models/resources/processing/processing.go | 8 ++++++++ models/workflow_execution/workflow_execution.go | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/models/resources/processing/processing.go b/models/resources/processing/processing.go index b76b892..525af6b 100644 --- a/models/resources/processing/processing.go +++ b/models/resources/processing/processing.go @@ -9,6 +9,13 @@ import ( "cloud.o-forge.io/core/oc-lib/tools" ) +type Container struct { + Image string `json:"image,omitempty" bson:"image,omitempty"` // Image is the container image + Command string `json:"command,omitempty" bson:"command,omitempty"` // Command is the container command + Args string `json:"args,omitempty" bson:"args,omitempty"` // Args is the container arguments + Env string `json:"env,omitempty" bson:"env,omitempty"` // Env is the container environment variables +} + /* * ProcessingResource is a struct that represents a processing resource * it defines the resource processing @@ -22,6 +29,7 @@ type ProcessingResource struct { Parallel bool `bson:"parallel,omitempty" json:"parallel,omitempty"` // Parallel is a flag that indicates if the processing is parallel ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"` // ScalingModel is the scaling model DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"` // DiskIO is the disk IO + Container Container `bson:"container,omitempty" json:"container,omitempty"` // Container is the container } func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject { diff --git a/models/workflow_execution/workflow_execution.go b/models/workflow_execution/workflow_execution.go index 92aea5c..f8bbd6d 100644 --- a/models/workflow_execution/workflow_execution.go +++ b/models/workflow_execution/workflow_execution.go @@ -85,6 +85,10 @@ type WorkflowExecution struct { WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"` // WorkflowID is the ID of the workflow } +func (wfa *WorkflowExecution) Equals(we *WorkflowExecution) bool { + return wfa.UUID == we.UUID && wfa.ExecDate.Equal(*we.ExecDate) && wfa.WorkflowID == we.WorkflowID +} + // tool to transform the argo status to a state func (wfa *WorkflowExecution) ArgoStatusToState(status string) *WorkflowExecution { status = strings.ToLower(status)