dmo

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Name of this event.
	Name string `gorm:"type:varchar(128);column:name" json:"name"`
	// Kind of object involved by event.
	Kind string `gorm:"type:varchar(32);column:kind" json:"kind"`
	// Type of this event.
	Type string `gorm:"type:varchar(32);column:type" json:"type"`
	// Involved Object Namespace.
	ObjNamespace string `gorm:"type:varchar(64);column:obj_namespace" json:"obj_namespace"`
	// Involved Object Name.
	ObjName string `gorm:"type:varchar(64);column:obj_name" json:"obj_name"`
	// Involved Object UID.
	ObjUID string `gorm:"type:varchar(64);column:obj_uid" json:"obj_uid"`
	// Reason(short, machine understandable string) of this event.
	Reason string `gorm:"type:varchar(128);column:reason" json:"reason"`
	// Message(long, human understandable description) of this event.
	Message string `gorm:"type:text;column:message" json:"message"`
	// Number of times this event has occurred.
	Count int32 `gorm:"type:integer(32);column:reason" json:"count"`
	// Region indicates the physical region(IDC) this job located in.
	Region *string `gorm:"type:varchar(64);column:region" json:"region,omitempty"`
	// The time at which the event was first recorded.
	FirstTimestamp time.Time `gorm:"type:datetime;column:first_timestamp" json:"first_timestamp"`
	// The time at which the most recent occurrence of this event was recorded.
	LastTimestamp time.Time `gorm:"type:datetime;column:last_timestamp" json:"last_timestamp"`
}

Event contains fields collected from original Event object, they will be persisted by storage backend.

func (Event) TableName

func (e Event) TableName() string

type Job

type Job struct {
	// Primary ID auto incremented by underlying database.
	ID uint64 `gorm:"column:id;not null;AUTO_INCREMENT;primary_key" json:"id"`
	// Metadata we concerned aggregated from job object.
	Name      string                 `gorm:"type:varchar(128);column:name" json:"name"`
	Namespace string                 `gorm:"type:varchar(128);column:namespace" json:"namespace"`
	JobID     string                 `gorm:"type:varchar(64);column:job_id" json:"job_id"`
	Version   string                 `gorm:"type:varchar(32);column:version" json:"version"`
	Status    apiv1.JobConditionType `gorm:"type:varchar(32);column:status" json:"status"`
	// Kind of this job: TFJob, PytorchJob...
	Kind string `gorm:"type:varchar(32);column:kind" json:"kind"`
	// Resources this job requested, including replicas and resources of each type,
	// it's formatted as follows:
	// {
	//   "PS": {
	//     "replicas": 1,
	//     "resources": {"cpu":2, "memory": "10Gi"}
	//   },
	//   "Worker": {
	//     "replicas": 2,
	//     "resources": {"cpu":2, "memory": "10Gi"}
	//   }
	// }
	Resources string `gorm:"type:text;column:resources" json:"resources"`
	// DeployRegion indicates the physical region(IDC) this job located in,
	// reserved for jobs running in across-region-clusters.
	DeployRegion *string `gorm:"type:varchar(64);column:deploy_region" json:"deploy_region,omitempty"`
	// Fields reserved for multi-tenancy job management scenarios, indicating
	// which tenant this job belongs to and who's the owner(user).
	Tenant *string `gorm:"type:varchar(255);column:tenant" json:"tenant,omitempty"`
	Owner  *string `gorm:"type:varchar(255);column:owner" json:"owner,omitempty"`
	// Deleted indicates that whether this job has been deleted or not.
	Deleted *int `gorm:"type:tinyint(4);column:deleted" json:"deleted,omitempty"`
	// IsInEtcd indicates that whether record of this job has been removed from etcd.
	// Deleted job could stay up in etcd due to different runtime policies.
	IsInEtcd *int `gorm:"type:tinyint(4);column:is_in_etcd" json:"is_in_etcd,omitempty"`
	// Timestamps of different job phases and status transitions.
	GmtCreated  time.Time  `gorm:"type:datetime;column:gmt_created" json:"gmt_created"`
	GmtModified time.Time  `gorm:"type:datetime;column:gmt_modified" json:"gmt_modified"`
	GmtFinished *time.Time `gorm:"type:datetime;column:gmt_finished" json:"gmt_finished,omitempty"`
}

Job contains fields collected from original Job object and extra info that we concerned about, they will be persisted by storage backend.

func (*Job) BeforeCreate

func (job *Job) BeforeCreate(scope *gorm.Scope) error

BeforeUpdate update gmt_modified timestamp.

func (*Job) BeforeUpdate

func (job *Job) BeforeUpdate(scope *gorm.Scope) error

BeforeUpdate update gmt_modified timestamp.

func (Job) TableName

func (job Job) TableName() string

type Pod

type Pod struct {
	// Primary ID auto incremented by underlying database.
	ID uint64 `gorm:"column:id;not null;AUTO_INCREMENT;primary_key" json:"id"`
	// Metadata we concerned aggregated from pod object.
	Name      string      `gorm:"type:varchar(128);column:name" json:"name"`
	Namespace string      `gorm:"type:varchar(128);column:namespace" json:"namespace"`
	PodID     string      `gorm:"type:varchar(64);column:pod_id" json:"pod_id"`
	Version   string      `gorm:"type:varchar(32);column:version" json:"version"`
	Status    v1.PodPhase `gorm:"type:varchar(32);column:status" json:"status"`
	Image     string      `gorm:"type:varchar(255);column:image" json:"image"`
	// Job ID of this pod controlled by.
	JobID string `gorm:"type:varchar(64);column:job_id" json:"job_id"`
	// Replica type of this pod figured in training job.
	ReplicaType string `gorm:"type:varchar(32);column:replica_type" json:"replica_type"`
	// Resources this pod requested, marshaled from a ResourceRequirements object.
	Resources string `gorm:"type:varchar(1024);column:resources" json:"resources"`
	// IP information allocated for this pod.
	HostIP *string `gorm:"type:varchar(64);column:host_ip" json:"host_ip,omitempty"`
	PodIP  *string `gorm:"type:varchar(64);column:pod_ip" json:"pod_ip,omitempty"`
	// DeployRegion indicates the physical region(IDC) this pod located in,
	DeployRegion *string `gorm:"type:varchar(64);column:deploy_region" json:"deploy_region,omitempty"`
	// Deleted indicates that whether this pod has been deleted or not.
	Deleted *int `gorm:"type:tinyint(4);column:deleted" json:"is_del,omitempty"`
	// IsInEtcd indicates that whether record of this pod has been removed from etcd.
	// Deleted pod could stay up in etcd due to different runtime policies.
	IsInEtcd *int `gorm:"type:tinyint(4);column:is_in_etcd" json:"is_in_etcd,omitempty"`
	// Optional remark text reserved.
	Remark *string `gorm:"type:text;column:remark" json:"remark,omitempty"`
	// Timestamps of different pod phases and status transitions.
	GmtCreated  time.Time  `gorm:"type:datetime;column:gmt_created" json:"gmt_created"`
	GmtModified time.Time  `gorm:"type:datetime;column:gmt_modified" json:"gmt_modified"`
	GmtStarted  *time.Time `gorm:"type:datetime;column:gmt_started" json:"gmt_started,omitempty"`
	GmtFinished *time.Time `gorm:"type:datetime;column:gmt_finished" json:"gmt_finished,omitempty"`
}

Pod contains fields collected from original Pod object and extra info that we concerned about, they will be persisted by storage backend.

func (*Pod) BeforeCreate

func (pod *Pod) BeforeCreate(scope *gorm.Scope) error

BeforeCreate update gmt_modified timestamp.

func (*Pod) BeforeUpdate

func (pod *Pod) BeforeUpdate(scope *gorm.Scope) error

BeforeUpdate update gmt_modified timestamp.

func (Pod) TableName

func (pod Pod) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL