adding workspace to catalog
This commit is contained in:
parent
2891dc8a68
commit
1ca983db36
@ -11,6 +11,7 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||||
|
w3 "cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||||
)
|
)
|
||||||
|
|
||||||
var models = map[string]func() utils.DBObject{
|
var models = map[string]func() utils.DBObject{
|
||||||
@ -21,6 +22,7 @@ var models = map[string]func() utils.DBObject{
|
|||||||
utils.PROCESSING_RESOURCE.String(): func() utils.DBObject { return &p.ProcessingResource{} },
|
utils.PROCESSING_RESOURCE.String(): func() utils.DBObject { return &p.ProcessingResource{} },
|
||||||
utils.WORKFLOW.String(): func() utils.DBObject { return &w2.Workflow{} },
|
utils.WORKFLOW.String(): func() utils.DBObject { return &w2.Workflow{} },
|
||||||
utils.WORKFLOW_EXECUTION.String(): func() utils.DBObject { return &workflow_execution.WorkflowExecution{} },
|
utils.WORKFLOW_EXECUTION.String(): func() utils.DBObject { return &workflow_execution.WorkflowExecution{} },
|
||||||
|
utils.WORKSPACE.String(): func() utils.DBObject { return &w3.Workspace{} },
|
||||||
}
|
}
|
||||||
|
|
||||||
func Model(model int) utils.DBObject {
|
func Model(model int) utils.DBObject {
|
||||||
|
@ -9,19 +9,6 @@ import (
|
|||||||
|
|
||||||
type ProcessingResource struct {
|
type ProcessingResource struct {
|
||||||
resources.AbstractResource
|
resources.AbstractResource
|
||||||
Container string `bson:"container,omitempty" json:"container,omitempty"` // We could create a specific class for container, that could check if the name exists/is available
|
|
||||||
Repository string `bson:"repository,omitempty" json:"repository,omitempty"` // Indicate where to find the container image => Could add a struct handling authentication to the repo
|
|
||||||
Command string `bson:"command,omitempty" json:"command,omitempty"`
|
|
||||||
Arguments []string `bson:"arguments,omitempty" json:"arguments,omitempty"`
|
|
||||||
Environment []map[string]string `bson:"environment,omitempty" json:"environment,omitempty"` // a key/value struct is what ressembles the most a NAME=VALUE struct
|
|
||||||
|
|
||||||
ExecutionRequirements *ExecutionRequirementsModel `json:"execution_requirements,omitempty"`
|
|
||||||
|
|
||||||
Price uint `bson:"price,omitempty" json:"price,omitempty"`
|
|
||||||
License string `bson:"license,omitempty" json:"license,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExecutionRequirementsModel struct {
|
|
||||||
CPUs uint `bson:"cp_us,omitempty" json:"cp_us,omitempty"`
|
CPUs uint `bson:"cp_us,omitempty" json:"cp_us,omitempty"`
|
||||||
GPUs uint `bson:"gp_us,omitempty" json:"gp_us,omitempty"`
|
GPUs uint `bson:"gp_us,omitempty" json:"gp_us,omitempty"`
|
||||||
RAM uint `bson:"ram,omitempty" json:"ram,omitempty"`
|
RAM uint `bson:"ram,omitempty" json:"ram,omitempty"`
|
||||||
@ -29,6 +16,9 @@ type ExecutionRequirementsModel struct {
|
|||||||
Parallel bool `bson:"parallel,omitempty" json:"parallel,omitempty"`
|
Parallel bool `bson:"parallel,omitempty" json:"parallel,omitempty"`
|
||||||
ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"`
|
ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"`
|
||||||
DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"`
|
DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"`
|
||||||
|
|
||||||
|
// Price uint `bson:"price,omitempty" json:"price,omitempty"`
|
||||||
|
// License string `bson:"license,omitempty" json:"license,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
package processing
|
package processing
|
||||||
|
|
||||||
import (
|
/*
|
||||||
"testing"
|
|
||||||
|
|
||||||
resources "cloud.o-forge.io/core/oc-lib/models/resources"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestStoreOneProcessing(t *testing.T) {
|
func TestStoreOneProcessing(t *testing.T) {
|
||||||
p := ProcessingResource{Container: "totoCont",
|
p := ProcessingResource{Container: "totoCont",
|
||||||
AbstractResource: resources.AbstractResource{
|
AbstractResource: resources.AbstractResource{
|
||||||
@ -43,3 +35,4 @@ func TestLoadOneProcessing(t *testing.T) {
|
|||||||
new_s, _, _ := sma.StoreOne(&p)
|
new_s, _, _ := sma.StoreOne(&p)
|
||||||
assert.Equal(t, p, new_s)
|
assert.Equal(t, p, new_s)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -6,8 +6,8 @@ type WorkflowSchedule struct {
|
|||||||
Id string `json:"id" bson:"id"`
|
Id string `json:"id" bson:"id"`
|
||||||
Name string `json:"name" bson:"name"`
|
Name string `json:"name" bson:"name"`
|
||||||
Start time.Time `json:"start" bson:"start"`
|
Start time.Time `json:"start" bson:"start"`
|
||||||
End time.Time `json:"end" bson:"end"`
|
End time.Time `json:"end,omitempty" bson:"end,omitempty"`
|
||||||
Cron string `json:"cron" bson:"cron"`
|
Cron string `json:"cron,omitempty" bson:"cron,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *WorkflowSchedule) GetAllDates() (timetable []time.Time) {
|
func (ws *WorkflowSchedule) GetAllDates() (timetable []time.Time) {
|
||||||
|
Loading…
Reference in New Issue
Block a user