47 lines
1.9 KiB
Go
47 lines
1.9 KiB
Go
package processing
|
|
|
|
import (
|
|
resources "cloud.o-forge.io/core/oc-lib/models/resources"
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
)
|
|
|
|
type Processing struct {
|
|
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"`
|
|
GPUs uint `bson:"gp_us,omitempty" json:"gp_us,omitempty"`
|
|
RAM uint `bson:"ram,omitempty" json:"ram,omitempty"`
|
|
|
|
Parallel bool `bson:"parallel,omitempty" json:"parallel,omitempty"`
|
|
ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"`
|
|
DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"`
|
|
}
|
|
|
|
func (p *Processing) GetType() resources.ResourceType {
|
|
return resources.PROCESSING
|
|
}
|
|
|
|
func (d *Processing) GetAccessor(driver utils.Driver) utils.Accessor {
|
|
var data utils.Accessor
|
|
switch driver {
|
|
case utils.MONGO:
|
|
data = &ProcessingMongoAccessor{}
|
|
default:
|
|
data = &ProcessingMongoAccessor{}
|
|
}
|
|
data.SetLogger()
|
|
return data
|
|
}
|