equals func on exec + draft container subobject

This commit is contained in:
mr 2024-09-26 15:52:35 +02:00
parent 279090889f
commit 3d58416d9b
2 changed files with 12 additions and 0 deletions

View File

@ -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 {

View File

@ -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)