Documentation ¶
Index ¶
- Constants
- Variables
- func BuildImagesByDockerfile(jobUuid, spaceUuid, spaceName, imagePath string) (string, string)
- func BuildSpaceTaskImage(spaceUuid string, files []models.SpaceFile) (bool, string, string, string, error)
- func DeleteJob(c *gin.Context)
- func DeploySpaceTask(jobSourceURI, hostName string, duration int, jobUuid string) string
- func DoProof(c *gin.Context)
- func ExtractExposedPort(dockerfilePath string) (string, error)
- func GenerateNodeID(cpRepoPath string) (string, string, string)
- func GetRedisClient() redis.Conn
- func GetServiceProviderInfo(c *gin.Context)
- func GetSpaceLog(c *gin.Context)
- func InitComputingProvider(cpRepoPath string) string
- func ReNewJob(c *gin.Context)
- func ReceiveJob(c *gin.Context)
- func Reconnect(nodeID string) string
- func RedeployJob(c *gin.Context)
- func RemoveContainerIfExists(imageName string) error
- func RetrieveJobMetadata(key string) (models.CacheSpaceDetail, error)
- func RunContainer(imageName, dockerfilePath string) string
- func RunSyncTask(nodeId string)
- func StatisticalSources(c *gin.Context)
- type CeleryService
- type Deploy
- func (d *Deploy) DockerfileToK8s()
- func (d *Deploy) ModelInferenceToK8s() error
- func (d *Deploy) WithDockerfile(image, dockerfilePath string) *Deploy
- func (d *Deploy) WithModelSettingFile(modelsSettingFile string) *Deploy
- func (d *Deploy) WithSpaceInfo(spaceUuid, spaceName string) *Deploy
- func (d *Deploy) WithSpacePath(spacePath string) *Deploy
- func (d *Deploy) WithYamlInfo(yamlPath string) *Deploy
- func (d *Deploy) YamlToK8s()
- type DockerService
- type ErrorLine
- type K8sService
- func (s *K8sService) AddNodeLabel(nodeName, key string) error
- func (s *K8sService) CreateConfigMap(ctx context.Context, k8sNameSpace, spaceUuid, basePath, configName string) (*coreV1.ConfigMap, error)
- func (s *K8sService) CreateDeployment(ctx context.Context, nameSpace string, deploy *appV1.Deployment) (result *appV1.Deployment, err error)
- func (s *K8sService) CreateIngress(ctx context.Context, k8sNameSpace, spaceUuid, hostName string, port int32) (*networkingv1.Ingress, error)
- func (s *K8sService) CreateNameSpace(ctx context.Context, nameSpace *coreV1.Namespace, opts metaV1.CreateOptions) (result *coreV1.Namespace, err error)
- func (s *K8sService) CreateNetworkPolicy(ctx context.Context, namespace string) (*networkingv1.NetworkPolicy, error)
- func (s *K8sService) CreateService(ctx context.Context, nameSpace, spaceUuid string, containerPort int32) (result *coreV1.Service, err error)
- func (s *K8sService) DeleteDeployRs(ctx context.Context, namespace, spaceUuid string) error
- func (s *K8sService) DeleteDeployment(ctx context.Context, namespace, deploymentName string) error
- func (s *K8sService) DeleteIngress(ctx context.Context, nameSpace, ingressName string) error
- func (s *K8sService) DeleteNameSpace(ctx context.Context, nameSpace string) error
- func (s *K8sService) DeletePod(ctx context.Context, namespace, spaceUuid string) error
- func (s *K8sService) DeleteService(ctx context.Context, namespace, serviceName string) error
- func (s *K8sService) GetDeploymentImages(ctx context.Context, namespace, deploymentName string) ([]string, error)
- func (s *K8sService) GetDeploymentStatus(namespace, spaceUuid string) (string, error)
- func (s *K8sService) GetNameSpace(ctx context.Context, nameSpace string, opts metaV1.GetOptions) (result *coreV1.Namespace, err error)
- func (s *K8sService) GetPodLog(ctx context.Context) (map[string]*strings.Builder, error)
- func (s *K8sService) GetPods(namespace, spaceUuid string) (bool, error)
- func (s *K8sService) GetServiceByName(ctx context.Context, namespace, serviceName string, opts metaV1.GetOptions) (result *coreV1.Service, err error)
- func (s *K8sService) ListNamespace(ctx context.Context) ([]string, error)
- func (s *K8sService) ListUsedImage(ctx context.Context, nameSpace string) ([]string, error)
- func (s *K8sService) PodDoCommand(namespace, podName, containerName string, podCmd []string) error
- func (s *K8sService) StatisticalSources(ctx context.Context) ([]*models.NodeResource, error)
- func (s *K8sService) WaitForPodRunning(namespace, spaceUuid, serviceIp string) (string, error)
- type ScheduleTask
- type StorageService
- func (storage *StorageService) CreateBucket(bucketName string)
- func (storage *StorageService) CreateFolder(folderName string)
- func (storage *StorageService) DeleteBucket(bucketName string) error
- func (storage *StorageService) GetGatewayUrl() (*string, error)
- func (storage *StorageService) UploadFileToBucket(objectName, filePath string, replace bool) (*bucket.OssFile, error)
- type WsClient
Constants ¶
View Source
const ( ResourceCpu string = "cpu" ResourceMem string = "mem" ResourceStorage string = "storage" )
View Source
const ( PingMsg = "ping" PingPeriod = 3 * time.Second )
View Source
const BuildFileName = "build.log"
Variables ¶
View Source
var NotFoundError = errors.New("not found resource")
View Source
var NotFoundRedisKey = stErr.New("not found redis key")
Functions ¶
func BuildImagesByDockerfile ¶
func BuildSpaceTaskImage ¶
func DeploySpaceTask ¶
func ExtractExposedPort ¶
func GetRedisClient ¶
func GetServiceProviderInfo ¶
func GetSpaceLog ¶
func InitComputingProvider ¶
func ReceiveJob ¶
func RedeployJob ¶
func RemoveContainerIfExists ¶
func RetrieveJobMetadata ¶
func RetrieveJobMetadata(key string) (models.CacheSpaceDetail, error)
func RunContainer ¶
func RunSyncTask ¶
func RunSyncTask(nodeId string)
func StatisticalSources ¶
Types ¶
type CeleryService ¶
type CeleryService struct {
// contains filtered or unexported fields
}
func NewCeleryService ¶
func NewCeleryService() *CeleryService
func (*CeleryService) DelayTask ¶
func (s *CeleryService) DelayTask(taskName string, params ...interface{}) (*gocelery.AsyncResult, error)
func (*CeleryService) RegisterTask ¶
func (s *CeleryService) RegisterTask(taskName string, task interface{})
func (*CeleryService) Start ¶
func (s *CeleryService) Start()
func (*CeleryService) Stop ¶
func (s *CeleryService) Stop()
type Deploy ¶
type Deploy struct { SpacePath string TaskType string DeployName string // contains filtered or unexported fields }
func (*Deploy) DockerfileToK8s ¶
func (d *Deploy) DockerfileToK8s()
func (*Deploy) ModelInferenceToK8s ¶
func (*Deploy) WithDockerfile ¶
func (*Deploy) WithModelSettingFile ¶
func (*Deploy) WithSpaceInfo ¶
func (*Deploy) WithSpacePath ¶
func (*Deploy) WithYamlInfo ¶
type DockerService ¶
type DockerService struct {
// contains filtered or unexported fields
}
func NewDockerService ¶
func NewDockerService() *DockerService
func (*DockerService) BuildImage ¶
func (ds *DockerService) BuildImage(buildPath, imageName string) error
func (*DockerService) CleanResource ¶
func (ds *DockerService) CleanResource()
func (*DockerService) PushImage ¶
func (ds *DockerService) PushImage(imagesName string) error
func (*DockerService) RemoveImage ¶
func (ds *DockerService) RemoveImage(imageId string) error
type K8sService ¶
type K8sService struct { Version string // contains filtered or unexported fields }
func NewK8sService ¶
func NewK8sService() *K8sService
func (*K8sService) AddNodeLabel ¶
func (s *K8sService) AddNodeLabel(nodeName, key string) error
func (*K8sService) CreateConfigMap ¶
func (*K8sService) CreateDeployment ¶
func (s *K8sService) CreateDeployment(ctx context.Context, nameSpace string, deploy *appV1.Deployment) (result *appV1.Deployment, err error)
func (*K8sService) CreateIngress ¶
func (s *K8sService) CreateIngress(ctx context.Context, k8sNameSpace, spaceUuid, hostName string, port int32) (*networkingv1.Ingress, error)
func (*K8sService) CreateNameSpace ¶
func (s *K8sService) CreateNameSpace(ctx context.Context, nameSpace *coreV1.Namespace, opts metaV1.CreateOptions) (result *coreV1.Namespace, err error)
func (*K8sService) CreateNetworkPolicy ¶
func (s *K8sService) CreateNetworkPolicy(ctx context.Context, namespace string) (*networkingv1.NetworkPolicy, error)
func (*K8sService) CreateService ¶
func (*K8sService) DeleteDeployRs ¶
func (s *K8sService) DeleteDeployRs(ctx context.Context, namespace, spaceUuid string) error
func (*K8sService) DeleteDeployment ¶
func (s *K8sService) DeleteDeployment(ctx context.Context, namespace, deploymentName string) error
func (*K8sService) DeleteIngress ¶
func (s *K8sService) DeleteIngress(ctx context.Context, nameSpace, ingressName string) error
func (*K8sService) DeleteNameSpace ¶
func (s *K8sService) DeleteNameSpace(ctx context.Context, nameSpace string) error
func (*K8sService) DeletePod ¶
func (s *K8sService) DeletePod(ctx context.Context, namespace, spaceUuid string) error
func (*K8sService) DeleteService ¶
func (s *K8sService) DeleteService(ctx context.Context, namespace, serviceName string) error
func (*K8sService) GetDeploymentImages ¶
func (*K8sService) GetDeploymentStatus ¶
func (s *K8sService) GetDeploymentStatus(namespace, spaceUuid string) (string, error)
func (*K8sService) GetNameSpace ¶
func (s *K8sService) GetNameSpace(ctx context.Context, nameSpace string, opts metaV1.GetOptions) (result *coreV1.Namespace, err error)
func (*K8sService) GetPods ¶
func (s *K8sService) GetPods(namespace, spaceUuid string) (bool, error)
func (*K8sService) GetServiceByName ¶
func (s *K8sService) GetServiceByName(ctx context.Context, namespace, serviceName string, opts metaV1.GetOptions) (result *coreV1.Service, err error)
func (*K8sService) ListNamespace ¶
func (s *K8sService) ListNamespace(ctx context.Context) ([]string, error)
func (*K8sService) ListUsedImage ¶
func (*K8sService) PodDoCommand ¶
func (s *K8sService) PodDoCommand(namespace, podName, containerName string, podCmd []string) error
func (*K8sService) StatisticalSources ¶
func (s *K8sService) StatisticalSources(ctx context.Context) ([]*models.NodeResource, error)
func (*K8sService) WaitForPodRunning ¶
func (s *K8sService) WaitForPodRunning(namespace, spaceUuid, serviceIp string) (string, error)
type ScheduleTask ¶
func NewScheduleTask ¶
func NewScheduleTask() *ScheduleTask
func (*ScheduleTask) Run ¶
func (s *ScheduleTask) Run()
type StorageService ¶
type StorageService struct { McsApiKey string `json:"mcs_api_key"` McsAccessToken string `json:"mcs_access_token"` NetWork string `json:"net_work"` BucketName string `json:"bucket_name"` // contains filtered or unexported fields }
func NewStorageService ¶
func NewStorageService() *StorageService
func (*StorageService) CreateBucket ¶
func (storage *StorageService) CreateBucket(bucketName string)
func (*StorageService) CreateFolder ¶
func (storage *StorageService) CreateFolder(folderName string)
func (*StorageService) DeleteBucket ¶
func (storage *StorageService) DeleteBucket(bucketName string) error
func (*StorageService) GetGatewayUrl ¶
func (storage *StorageService) GetGatewayUrl() (*string, error)
func (*StorageService) UploadFileToBucket ¶
Click to show internal directories.
Click to hide internal directories.