Documentation
¶
Index ¶
- Constants
- Variables
- func BlackList(c *gin.Context)
- func BuildImagesByDockerfile(jobUuid, spaceName, imagePath string) (string, string)
- func BytesToHumanReadable(bytes int64) string
- func CancelJob(c *gin.Context)
- func CheckClusterNetworkPolicy()
- func CheckNodeportServiceEnv(c *gin.Context)
- func CheckWalletBlackList(jobSourceURI string) bool
- func CheckWalletBlackListForEcp(walletAddress string) bool
- func CheckWalletWhiteList(jobSourceURI string) bool
- func CheckWalletWhiteListForEcp(walletAddress string) bool
- func ContractABI(contractABI string) (abi.ABI, error)
- func ContractSigMethods(contractABI string) (methods map[string]abi.Method, err error)
- func CronTaskForEcp()
- func DeleteJob(namespace, jobUuid string, msg string) error
- func DeployImage(c *gin.Context)
- func DeployImageSpaceTask(jobData models.JobData, job models.FcpDeployImageReq, hostName string, ...)
- func DeploySpaceTask(jobData models.JobData, deployParam DeployParam, hostName string, ...)
- func DoProof(c *gin.Context)
- func DoUbiTaskForDocker(c *gin.Context)
- func DoUbiTaskForK8s(c *gin.Context)
- func DoZkTask(c *gin.Context)
- func ExtractExposedPort(dockerfilePath string) (string, error)
- func GenerateNodeID(cpRepoPath string) (string, string, string)
- func GeneratePriceConfig() error
- func GetAggregatedTaskInfo(taskContract string) (string, error)
- func GetCpBalance()
- func GetCpResource(c *gin.Context)
- func GetJobStatus(c *gin.Context)
- func GetNodeGpuResource(allPods []corev1.Pod, node *corev1.Node) map[string]GpuData
- func GetNodeId(cpRepoPath string) string
- func GetNodeResource(allPods []corev1.Pod, node *corev1.Node) (map[string]GpuData, map[string]int64, *models.NodeResource)
- func GetOwnerAddressAndWorkerAddress() (string, string, error)
- func GetPrice(c *gin.Context)
- func GetPublicKey(c *gin.Context)
- func GetServiceProviderInfo(c *gin.Context)
- func GetSpaceLog(c *gin.Context)
- func GetTaskInfoOnChain(taskContract string) (models.EcpTaskInfo, error)
- func GetToken() (string, error)
- func ImportImageToContainerd(tarFile string) error
- func InitComputingProvider(cpRepoPath string) string
- func ReNewJob(c *gin.Context)
- func ReceiveJob(c *gin.Context)
- func ReceiveUbiProof(c *gin.Context)
- func RestartResourceExporter() error
- func RestartTraefikService() error
- func RetryFn(fn func() error, maxRetries int, delay time.Duration) error
- func StatisticalSources(c *gin.Context)
- func SyncCpAccountInfo() (*models.Account, error)
- func TransactionInputParas(ethClient *ethclient.Client, sigMethods map[string]abi.Method, ...) ([]interface{}, error)
- func ValidateName(name string) error
- func WhiteList(c *gin.Context)
- type Config
- type CpBalanceService
- type CpInfoService
- type CpResourceSummary
- type CronTask
- type Deploy
- func (d *Deploy) DeployImageToK8s(containerResource models.DeployJobParam) error
- func (d *Deploy) DeploySshTaskToK8s(containerResource yaml.ContainerResource, nodePort int32) error
- func (d *Deploy) DockerfileToK8s()
- func (d *Deploy) ModelInferenceToK8s() error
- func (d *Deploy) WithDockerfile(image, dockerfilePath string) *Deploy
- func (d *Deploy) WithGpuIndex(index []string) *Deploy
- func (d *Deploy) WithGpuProductName(gpuProductName string) *Deploy
- func (d *Deploy) WithHardware(cpu, memory, storage int, gpuModel string, gpuNum int) *Deploy
- func (d *Deploy) WithImage(images string) *Deploy
- func (d *Deploy) WithIpWhiteList(ipWhiteList []string) *Deploy
- func (d *Deploy) WithModelSettingFile(modelsSettingFile string) *Deploy
- func (d *Deploy) WithSpaceName(spaceName string) *Deploy
- func (d *Deploy) WithSpacePath(spacePath string) *Deploy
- func (d *Deploy) WithSshKey(sshKey string) *Deploy
- func (d *Deploy) WithYamlInfo(yamlPath string) *Deploy
- func (d *Deploy) YamlToK8s(nodePort int32) error
- type DeployParam
- type DockerService
- func (ds *DockerService) BuildImage(jobUuid, buildPath, imageName string) error
- func (ds *DockerService) CheckRunningContainer(containerName string) (bool, string, error)
- func (ds *DockerService) CleanResourceForDocker(onlyClearContainer bool)
- func (ds *DockerService) CleanResourceForK8s()
- func (ds *DockerService) ContainerCreateAndStart(config *container.Config, hostConfig *container.HostConfig, ...) error
- func (ds *DockerService) ContainerLogs(containerName string) (string, error)
- func (ds *DockerService) CreateNetwork(networkName string) error
- func (ds *DockerService) GetContainerLogStream(ctx context.Context, containerName string) (io.ReadCloser, error)
- func (ds *DockerService) GetContainerStatus() (map[string]string, error)
- func (ds *DockerService) IsExistContainer(containerName string) bool
- func (ds *DockerService) PullImage(imageName string) error
- func (ds *DockerService) PushImage(imagesName string) error
- func (ds *DockerService) RemoveContainerByName(containerName string) error
- func (ds *DockerService) RemoveImage(imageId string) error
- func (ds *DockerService) SaveDockerImage(imageName string) (string, error)
- type EcpJobService
- func (cpServ EcpJobService) DeleteContainerByUuid(uuid string) (err error)
- func (cpServ EcpJobService) GetEcpJobByUuid(uuid string) (*models.EcpJobEntity, error)
- func (cpServ EcpJobService) GetEcpJobList(status []string) ([]models.EcpJobEntity, error)
- func (cpServ EcpJobService) GetEcpJobs(jobUuid string) ([]models.EcpJobEntity, error)
- func (cpServ EcpJobService) GetEcpJobsByLimit(tailNum int) ([]models.EcpJobEntity, error)
- func (cpServ EcpJobService) SaveEcpJobEntity(job *models.EcpJobEntity) (err error)
- func (cpServ EcpJobService) UpdateEcpJobEntity(jobUuid, status string) (err error)
- func (cpServ EcpJobService) UpdateEcpJobEntityContainerName(jobUuid string, containerName string) (err error)
- func (cpServ EcpJobService) UpdateEcpJobEntityMessage(jobUuid string, message string) (err error)
- func (cpServ EcpJobService) UpdateEcpJobEntityPortsAndServiceUrl(jobUuid, portMap, serviceUrl string) (err error)
- func (cpServ EcpJobService) UpdateEcpJobEntityRewardAndBlock(jobUuid string, blockNumber int64, reward float64) (err error)
- type ErrorLine
- type GPUInfo
- type GPUManager
- func (gm *GPUManager) AllocateGPU(key string, count int) ([]string, error)
- func (gm *GPUManager) CheckAvailableGPU() (string, bool)
- func (gm *GPUManager) GetGPU(key string) (GPUInfo, bool)
- func (gm *GPUManager) ReleaseGPU(key string, count int, indexs []string) error
- func (gm *GPUManager) UpdateGPU(key string, gpuInfo GPUInfo)
- type GpuData
- type HardwareField
- type HardwarePrice
- type HttpClient
- func (c *HttpClient) Get(api string, queries url.Values, dest any) error
- func (c *HttpClient) PostForm(api string, data url.Values, dest any) error
- func (c *HttpClient) PostJSON(api string, data any, dest any) error
- func (c *HttpClient) Request(method string, api string, body io.Reader, dest any, contentType ...string) (err error)
- type ImageJobService
- func (*ImageJobService) CheckJobCondition(c *gin.Context)
- func (*ImageJobService) DeleteJob(c *gin.Context)
- func (*ImageJobService) DeployInference(c *gin.Context, deployJob models.DeployJobParam, totalCost float64, ...)
- func (imageJob *ImageJobService) DeployJob(c *gin.Context)
- func (*ImageJobService) DeployMining(c *gin.Context, deployJob models.DeployJobParam, totalCost float64, ...)
- func (*ImageJobService) DockerLogsHandler(c *gin.Context)
- func (*ImageJobService) GetJobStatus(c *gin.Context)
- type JobService
- func (jobServ JobService) DeleteJobEntityByJobUuId(jobUuid string, jobStatus int) error
- func (jobServ JobService) DeleteJobEntityBySpaceUuId(spaceUuid, jobUuid string, jobStatus int) error
- func (jobServ JobService) GetJobEntityByJobUuid(jobUuid string) (models.JobEntity, error)
- func (jobServ JobService) GetJobEntityBySpaceUuid(spaceUuid string) int64
- func (jobServ JobService) GetJobEntityByTaskUuid(taskUuid string) (models.JobEntity, error)
- func (jobServ JobService) GetJobList(status int, tailNum int) (list []*models.JobEntity, err error)
- func (jobServ JobService) GetJobListByNoReward() (list []*models.JobEntity, err error)
- func (jobServ JobService) SaveJobEntity(job *models.JobEntity) (err error)
- func (jobServ JobService) UpdateJobEntityByJobUuid(job *models.JobEntity) (err error)
- func (jobServ JobService) UpdateJobEntityStatusByJobUuid(jobUuid string, status int) (err error)
- func (jobServ JobService) UpdateJobResultUrlByJobUuid(jobUuid string, resultUrl string) (err error)
- func (jobServ JobService) UpdateJobReward(taskUuid string, amount string) (err error)
- func (jobServ JobService) UpdateJobScannedBlock(taskUuid string, end uint64) (err error)
- type K8sService
- func (s *K8sService) AddNodeLabel(nodeName, key string) error
- func (s *K8sService) AddNodeLabelForArchitecture(nodeName, key string) error
- func (s *K8sService) CheckServiceNodePort(targetNodePort int32) (bool, int32, error)
- func (s *K8sService) CreateConfigMap(ctx context.Context, k8sNameSpace, jobUuid, 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) CreateServiceByNodePort(ctx context.Context, nameSpace, taskUuid string, containerPort int32, ...) (result *coreV1.Service, err error)
- func (s *K8sService) DeleteDeployRs(ctx context.Context, namespace, jobUuid 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) GetAPIServerEndpoint() string
- func (s *K8sService) GetAllActivePod(ctx context.Context) ([]coreV1.Pod, error)
- func (s *K8sService) GetClusterRuntime() (string, error)
- func (s *K8sService) GetDeploymentActiveCount() (int, 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) GetGlobalNetworkPolicy(gnpName string) (*calicov3.GlobalNetworkPolicy, error)
- func (s *K8sService) GetGlobalNetworkSet(gnsName string) (*calicov3.GlobalNetworkSet, error)
- func (s *K8sService) GetNameSpace(ctx context.Context, nameSpace string, opts metaV1.GetOptions) (result *coreV1.Namespace, err error)
- func (s *K8sService) GetNodeGpuSummary(ctx context.Context) (map[string]map[string]GpuData, error)
- func (s *K8sService) GetPodLogByPodName(namespace, podName string, podLogOptions *coreV1.PodLogOptions) (string, error)
- func (s *K8sService) GetPods(namespace, jobUuid string) (bool, error)
- func (s *K8sService) GetResourceExporterPodLog(ctx context.Context) (map[string]models.CollectNodeInfo, error)
- func (s *K8sService) GetResourceExporterPodLogForNode(ctx context.Context) (map[string]models.NodeResource, error)
- func (s *K8sService) GetResourceExporterVersion() (string, error)
- func (s *K8sService) GetServiceByName(ctx context.Context, namespace, serviceName string, opts metaV1.GetOptions) (result *coreV1.Service, err error)
- func (s *K8sService) GetUsedNodePorts() (map[int32]struct{}, 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) UpdateContainerLogToFile(jobUuid string)
- func (s *K8sService) WaitForPodRunningByHttp(namespace, jobUuid, serviceIp string) (string, error)
- func (s *K8sService) WaitForPodRunningByTcp(namespace, jobUuid string) (string, error)
- type ResultChecker
- type SendProofResp
- type SequenceTask
- type Sequencer
- 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 TaskGroup
- type TaskListResp
- type TaskManagerContract
- type TaskPaymentService
- type TaskService
- func (taskServ TaskService) GetTaskByUuid(uuid string) (*models.TaskEntity, error)
- func (taskServ TaskService) GetTaskEntity(taskId int64) (*models.TaskEntity, error)
- func (taskServ TaskService) GetTaskList(tailNum int, taskStatus ...int) (list []*models.TaskEntity, err error)
- func (taskServ TaskService) GetTaskListNoRewardForFilC2() (list []*models.TaskEntity, err error)
- func (taskServ TaskService) GetTaskListNoRewardForMining() (list []*models.TaskEntity, err error)
- func (taskServ TaskService) SaveTaskEntity(task *models.TaskEntity) (err error)
- func (taskServ TaskService) UpdateTaskEntityByTaskId(task *models.TaskEntity) (err error)
- func (taskServ TaskService) UpdateTaskEntityByTaskUuId(task *models.TaskEntity) (err error)
- func (taskServ TaskService) UpdateTaskStatusById(taskId int, status int) (err error)
- func (taskServ TaskService) UpdateTaskStatusByUuid(uuid string, status int) (err error)
- type TaskStatus
- type TokenResp
- 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 (
TransferInterval = 10000
)
Variables ¶
View Source
var NetworkPolicyFlag bool
View Source
var TaskMap sync.Map
Functions ¶
func BuildImagesByDockerfile ¶
func BytesToHumanReadable ¶ added in v0.7.0
func CheckClusterNetworkPolicy ¶ added in v0.7.0
func CheckClusterNetworkPolicy()
func CheckNodeportServiceEnv ¶ added in v0.7.0
func CheckWalletBlackList ¶ added in v0.6.0
func CheckWalletBlackListForEcp ¶ added in v1.0.0
func CheckWalletWhiteList ¶ added in v0.4.6
func CheckWalletWhiteListForEcp ¶ added in v1.0.0
func ContractSigMethods ¶ added in v1.0.0
func CronTaskForEcp ¶ added in v0.5.0
func CronTaskForEcp()
func DeployImage ¶ added in v1.0.0
func DeployImageSpaceTask ¶ added in v1.0.0
func DeploySpaceTask ¶
func DoUbiTaskForDocker ¶ added in v0.4.6
func DoUbiTaskForK8s ¶ added in v0.4.6
func ExtractExposedPort ¶
func GeneratePriceConfig ¶ added in v0.6.5
func GeneratePriceConfig() error
func GetAggregatedTaskInfo ¶ added in v0.6.2
func GetCpBalance ¶ added in v1.0.1
func GetCpBalance()
func GetCpResource ¶ added in v0.4.6
func GetJobStatus ¶ added in v0.5.0
func GetNodeGpuResource ¶ added in v1.1.0
func GetNodeResource ¶
func GetOwnerAddressAndWorkerAddress ¶ added in v0.5.0
func GetPublicKey ¶ added in v0.6.4
func GetServiceProviderInfo ¶
func GetSpaceLog ¶
func GetTaskInfoOnChain ¶ added in v0.5.0
func GetTaskInfoOnChain(taskContract string) (models.EcpTaskInfo, error)
func ImportImageToContainerd ¶ added in v0.6.5
func InitComputingProvider ¶
func ReceiveJob ¶
func ReceiveUbiProof ¶
func RestartResourceExporter ¶ added in v0.5.0
func RestartResourceExporter() error
func RestartTraefikService ¶ added in v1.0.0
func RestartTraefikService() error
func StatisticalSources ¶
func SyncCpAccountInfo ¶ added in v0.5.0
func TransactionInputParas ¶ added in v1.0.0
func ValidateName ¶ added in v1.0.0
Types ¶
type CpBalanceService ¶ added in v1.0.1
func NewCpBalanceService ¶ added in v1.0.1
func NewCpBalanceService() CpBalanceService
func (CpBalanceService) GetCpBalance ¶ added in v1.0.1
func (cpServ CpBalanceService) GetCpBalance(cpAccount string) (*models.CpBalanceEntity, error)
func (CpBalanceService) SaveCpBalance ¶ added in v1.0.1
func (cpServ CpBalanceService) SaveCpBalance(cpBalance models.CpBalanceEntity) (err error)
func (CpBalanceService) UpdateCpBalance ¶ added in v1.0.1
func (cpServ CpBalanceService) UpdateCpBalance(cpBalance models.CpBalanceEntity) error
type CpInfoService ¶ added in v0.5.0
func NewCpInfoService ¶ added in v0.5.0
func NewCpInfoService() CpInfoService
func (CpInfoService) GetCpInfoEntityByAccountAddress ¶ added in v0.5.0
func (cpServ CpInfoService) GetCpInfoEntityByAccountAddress(accountAddress string) (*models.CpInfoEntity, error)
func (CpInfoService) SaveCpInfoEntity ¶ added in v0.5.0
func (cpServ CpInfoService) SaveCpInfoEntity(cp *models.CpInfoEntity) (err error)
func (CpInfoService) UpdateCpInfoByNodeId ¶ added in v0.5.0
func (cpServ CpInfoService) UpdateCpInfoByNodeId(cp *models.CpInfoEntity) (err error)
type CpResourceSummary ¶ added in v0.5.0
type CpResourceSummary struct {
ClusterInfo []*models.NodeResource
}
type CronTask ¶
type CronTask struct {
// contains filtered or unexported fields
}
func NewCronTask ¶
func (*CronTask) CheckCpBalance ¶ added in v1.0.1
func (task *CronTask) CheckCpBalance()
func (*CronTask) DeleteSpaceLog ¶ added in v1.0.2
func (task *CronTask) DeleteSpaceLog()
func (*CronTask) UpdateContainerLog ¶ added in v1.0.2
func (task *CronTask) UpdateContainerLog()
type Deploy ¶
func (*Deploy) DeployImageToK8s ¶ added in v1.0.0
func (d *Deploy) DeployImageToK8s(containerResource models.DeployJobParam) error
func (*Deploy) DeploySshTaskToK8s ¶ added in v0.7.0
func (d *Deploy) DeploySshTaskToK8s(containerResource yaml.ContainerResource, nodePort int32) error
func (*Deploy) DockerfileToK8s ¶
func (d *Deploy) DockerfileToK8s()
func (*Deploy) ModelInferenceToK8s ¶
func (*Deploy) WithDockerfile ¶
func (*Deploy) WithGpuIndex ¶ added in v1.0.0
func (*Deploy) WithGpuProductName ¶
func (*Deploy) WithHardware ¶ added in v0.4.6
func (*Deploy) WithIpWhiteList ¶ added in v0.7.0
func (*Deploy) WithModelSettingFile ¶
func (*Deploy) WithSpaceName ¶ added in v0.6.5
func (*Deploy) WithSpacePath ¶
func (*Deploy) WithSshKey ¶ added in v0.7.0
func (*Deploy) WithYamlInfo ¶
type DeployParam ¶ added in v0.6.4
type DeployParam struct { ContainsYaml bool YamlFilePath string BuildImagePath string ModelsSettingFilePath string }
func DownloadSpaceResources ¶ added in v0.6.5
func DownloadSpaceResources(jobUuid string, files []models.SpaceFile) (DeployParam, error)
type DockerService ¶
type DockerService struct {
// contains filtered or unexported fields
}
func NewDockerService ¶
func NewDockerService() *DockerService
func (*DockerService) BuildImage ¶
func (ds *DockerService) BuildImage(jobUuid, buildPath, imageName string) error
func (*DockerService) CheckRunningContainer ¶ added in v0.5.0
func (ds *DockerService) CheckRunningContainer(containerName string) (bool, string, error)
func (*DockerService) CleanResourceForDocker ¶ added in v0.6.4
func (ds *DockerService) CleanResourceForDocker(onlyClearContainer bool)
func (*DockerService) CleanResourceForK8s ¶ added in v0.6.4
func (ds *DockerService) CleanResourceForK8s()
func (*DockerService) ContainerCreateAndStart ¶ added in v0.4.6
func (ds *DockerService) ContainerCreateAndStart(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) error
func (*DockerService) ContainerLogs ¶ added in v0.4.6
func (ds *DockerService) ContainerLogs(containerName string) (string, error)
func (*DockerService) CreateNetwork ¶ added in v1.0.0
func (ds *DockerService) CreateNetwork(networkName string) error
func (*DockerService) GetContainerLogStream ¶ added in v0.4.8
func (ds *DockerService) GetContainerLogStream(ctx context.Context, containerName string) (io.ReadCloser, error)
func (*DockerService) GetContainerStatus ¶ added in v0.7.0
func (ds *DockerService) GetContainerStatus() (map[string]string, error)
func (*DockerService) IsExistContainer ¶ added in v0.6.0
func (ds *DockerService) IsExistContainer(containerName string) bool
func (*DockerService) PullImage ¶ added in v0.4.6
func (ds *DockerService) PullImage(imageName string) error
func (*DockerService) PushImage ¶
func (ds *DockerService) PushImage(imagesName string) error
func (*DockerService) RemoveContainerByName ¶ added in v0.5.0
func (ds *DockerService) RemoveContainerByName(containerName string) error
func (*DockerService) RemoveImage ¶
func (ds *DockerService) RemoveImage(imageId string) error
func (*DockerService) SaveDockerImage ¶ added in v0.6.5
func (ds *DockerService) SaveDockerImage(imageName string) (string, error)
type EcpJobService ¶ added in v0.7.0
func NewEcpJobService ¶ added in v0.7.0
func NewEcpJobService() EcpJobService
func (EcpJobService) DeleteContainerByUuid ¶ added in v0.7.0
func (cpServ EcpJobService) DeleteContainerByUuid(uuid string) (err error)
func (EcpJobService) GetEcpJobByUuid ¶ added in v0.7.0
func (cpServ EcpJobService) GetEcpJobByUuid(uuid string) (*models.EcpJobEntity, error)
func (EcpJobService) GetEcpJobList ¶ added in v1.0.0
func (cpServ EcpJobService) GetEcpJobList(status []string) ([]models.EcpJobEntity, error)
func (EcpJobService) GetEcpJobs ¶ added in v0.7.0
func (cpServ EcpJobService) GetEcpJobs(jobUuid string) ([]models.EcpJobEntity, error)
func (EcpJobService) GetEcpJobsByLimit ¶ added in v1.0.0
func (cpServ EcpJobService) GetEcpJobsByLimit(tailNum int) ([]models.EcpJobEntity, error)
func (EcpJobService) SaveEcpJobEntity ¶ added in v0.7.0
func (cpServ EcpJobService) SaveEcpJobEntity(job *models.EcpJobEntity) (err error)
func (EcpJobService) UpdateEcpJobEntity ¶ added in v0.7.0
func (cpServ EcpJobService) UpdateEcpJobEntity(jobUuid, status string) (err error)
func (EcpJobService) UpdateEcpJobEntityContainerName ¶ added in v0.7.1
func (cpServ EcpJobService) UpdateEcpJobEntityContainerName(jobUuid string, containerName string) (err error)
func (EcpJobService) UpdateEcpJobEntityMessage ¶ added in v1.0.0
func (cpServ EcpJobService) UpdateEcpJobEntityMessage(jobUuid string, message string) (err error)
func (EcpJobService) UpdateEcpJobEntityPortsAndServiceUrl ¶ added in v1.0.0
func (cpServ EcpJobService) UpdateEcpJobEntityPortsAndServiceUrl(jobUuid, portMap, serviceUrl string) (err error)
func (EcpJobService) UpdateEcpJobEntityRewardAndBlock ¶ added in v0.7.1
func (cpServ EcpJobService) UpdateEcpJobEntityRewardAndBlock(jobUuid string, blockNumber int64, reward float64) (err error)
type GPUManager ¶ added in v1.0.0
type GPUManager struct {
// contains filtered or unexported fields
}
func NewGpuManager ¶ added in v1.0.0
func NewGpuManager() *GPUManager
func (*GPUManager) AllocateGPU ¶ added in v1.0.0
func (gm *GPUManager) AllocateGPU(key string, count int) ([]string, error)
func (*GPUManager) CheckAvailableGPU ¶ added in v1.0.0
func (gm *GPUManager) CheckAvailableGPU() (string, bool)
func (*GPUManager) GetGPU ¶ added in v1.0.0
func (gm *GPUManager) GetGPU(key string) (GPUInfo, bool)
func (*GPUManager) ReleaseGPU ¶ added in v1.0.0
func (gm *GPUManager) ReleaseGPU(key string, count int, indexs []string) error
func (*GPUManager) UpdateGPU ¶ added in v1.0.0
func (gm *GPUManager) UpdateGPU(key string, gpuInfo GPUInfo)
type HardwareField ¶ added in v0.6.5
func GetStructByTag ¶ added in v0.6.5
func GetStructByTag(v interface{}) ([]HardwareField, error)
type HardwarePrice ¶ added in v0.6.5
type HardwarePrice struct { TARGET_CPU string `toml:"TARGET_CPU" tag:"1"` TARGET_MEMORY string `toml:"TARGET_MEMORY" tag:"2"` TARGET_HD_EPHEMERAL string `toml:"TARGET_HD_EPHEMERAL" tag:"3"` TARGET_GPU_DEFAULT string `toml:"TARGET_GPU_DEFAULT" tag:"4"` GpusPrice map[string]string }
func ReadPriceConfig ¶ added in v0.6.5
func ReadPriceConfig() (HardwarePrice, error)
type HttpClient ¶ added in v0.6.2
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶ added in v0.6.2
func NewHttpClient(host string, header http.Header) *HttpClient
type ImageJobService ¶ added in v0.7.0
type ImageJobService struct { }
func NewImageJobService ¶ added in v0.7.0
func NewImageJobService() *ImageJobService
func (*ImageJobService) CheckJobCondition ¶ added in v0.7.0
func (*ImageJobService) CheckJobCondition(c *gin.Context)
func (*ImageJobService) DeleteJob ¶ added in v0.7.0
func (*ImageJobService) DeleteJob(c *gin.Context)
func (*ImageJobService) DeployInference ¶ added in v1.0.0
func (*ImageJobService) DeployInference(c *gin.Context, deployJob models.DeployJobParam, totalCost float64, logUrl string)
func (*ImageJobService) DeployJob ¶ added in v0.7.0
func (imageJob *ImageJobService) DeployJob(c *gin.Context)
func (*ImageJobService) DeployMining ¶ added in v1.0.0
func (*ImageJobService) DeployMining(c *gin.Context, deployJob models.DeployJobParam, totalCost float64, logUrl string, price string)
func (*ImageJobService) DockerLogsHandler ¶ added in v1.0.0
func (*ImageJobService) DockerLogsHandler(c *gin.Context)
func (*ImageJobService) GetJobStatus ¶ added in v0.7.0
func (*ImageJobService) GetJobStatus(c *gin.Context)
type JobService ¶ added in v0.5.0
func NewJobService ¶ added in v0.5.0
func NewJobService() JobService
func (JobService) DeleteJobEntityByJobUuId ¶ added in v0.6.5
func (jobServ JobService) DeleteJobEntityByJobUuId(jobUuid string, jobStatus int) error
func (JobService) DeleteJobEntityBySpaceUuId ¶ added in v0.5.0
func (jobServ JobService) DeleteJobEntityBySpaceUuId(spaceUuid, jobUuid string, jobStatus int) error
func (JobService) GetJobEntityByJobUuid ¶ added in v0.5.0
func (jobServ JobService) GetJobEntityByJobUuid(jobUuid string) (models.JobEntity, error)
func (JobService) GetJobEntityBySpaceUuid ¶ added in v0.5.0
func (jobServ JobService) GetJobEntityBySpaceUuid(spaceUuid string) int64
func (JobService) GetJobEntityByTaskUuid ¶ added in v0.5.0
func (jobServ JobService) GetJobEntityByTaskUuid(taskUuid string) (models.JobEntity, error)
func (JobService) GetJobList ¶ added in v0.5.0
func (JobService) GetJobListByNoReward ¶ added in v0.6.2
func (jobServ JobService) GetJobListByNoReward() (list []*models.JobEntity, err error)
func (JobService) SaveJobEntity ¶ added in v0.5.0
func (jobServ JobService) SaveJobEntity(job *models.JobEntity) (err error)
func (JobService) UpdateJobEntityByJobUuid ¶ added in v0.5.0
func (jobServ JobService) UpdateJobEntityByJobUuid(job *models.JobEntity) (err error)
func (JobService) UpdateJobEntityStatusByJobUuid ¶ added in v1.1.0
func (jobServ JobService) UpdateJobEntityStatusByJobUuid(jobUuid string, status int) (err error)
func (JobService) UpdateJobResultUrlByJobUuid ¶ added in v0.5.0
func (jobServ JobService) UpdateJobResultUrlByJobUuid(jobUuid string, resultUrl string) (err error)
func (JobService) UpdateJobReward ¶ added in v0.6.2
func (jobServ JobService) UpdateJobReward(taskUuid string, amount string) (err error)
func (JobService) UpdateJobScannedBlock ¶ added in v0.6.2
func (jobServ JobService) UpdateJobScannedBlock(taskUuid string, end uint64) (err 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) AddNodeLabelForArchitecture ¶ added in v0.7.1
func (s *K8sService) AddNodeLabelForArchitecture(nodeName, key string) error
func (*K8sService) CheckServiceNodePort ¶ added in v0.7.0
func (s *K8sService) CheckServiceNodePort(targetNodePort int32) (bool, int32, 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, ipWhiteList []string) (*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) CreateServiceByNodePort ¶ added in v0.4.6
func (*K8sService) DeleteDeployRs ¶
func (s *K8sService) DeleteDeployRs(ctx context.Context, namespace, jobUuid 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) GetAPIServerEndpoint ¶
func (s *K8sService) GetAPIServerEndpoint() string
func (*K8sService) GetAllActivePod ¶
func (*K8sService) GetClusterRuntime ¶ added in v0.6.5
func (s *K8sService) GetClusterRuntime() (string, error)
func (*K8sService) GetDeploymentActiveCount ¶
func (s *K8sService) GetDeploymentActiveCount() (int, error)
func (*K8sService) GetDeploymentImages ¶
func (*K8sService) GetDeploymentStatus ¶
func (s *K8sService) GetDeploymentStatus(namespace, spaceUuid string) (string, error)
func (*K8sService) GetGlobalNetworkPolicy ¶ added in v0.7.0
func (s *K8sService) GetGlobalNetworkPolicy(gnpName string) (*calicov3.GlobalNetworkPolicy, error)
func (*K8sService) GetGlobalNetworkSet ¶ added in v0.7.0
func (s *K8sService) GetGlobalNetworkSet(gnsName string) (*calicov3.GlobalNetworkSet, error)
func (*K8sService) GetNameSpace ¶
func (s *K8sService) GetNameSpace(ctx context.Context, nameSpace string, opts metaV1.GetOptions) (result *coreV1.Namespace, err error)
func (*K8sService) GetNodeGpuSummary ¶
func (*K8sService) GetPodLogByPodName ¶ added in v0.4.5
func (s *K8sService) GetPodLogByPodName(namespace, podName string, podLogOptions *coreV1.PodLogOptions) (string, error)
func (*K8sService) GetResourceExporterPodLog ¶
func (s *K8sService) GetResourceExporterPodLog(ctx context.Context) (map[string]models.CollectNodeInfo, error)
func (*K8sService) GetResourceExporterPodLogForNode ¶ added in v1.1.0
func (s *K8sService) GetResourceExporterPodLogForNode(ctx context.Context) (map[string]models.NodeResource, error)
func (*K8sService) GetResourceExporterVersion ¶ added in v1.1.0
func (s *K8sService) GetResourceExporterVersion() (string, error)
func (*K8sService) GetServiceByName ¶
func (s *K8sService) GetServiceByName(ctx context.Context, namespace, serviceName string, opts metaV1.GetOptions) (result *coreV1.Service, err error)
func (*K8sService) GetUsedNodePorts ¶ added in v0.7.0
func (s *K8sService) GetUsedNodePorts() (map[int32]struct{}, 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) UpdateContainerLogToFile ¶ added in v1.0.2
func (s *K8sService) UpdateContainerLogToFile(jobUuid string)
func (*K8sService) WaitForPodRunningByHttp ¶ added in v0.4.6
func (s *K8sService) WaitForPodRunningByHttp(namespace, jobUuid, serviceIp string) (string, error)
func (*K8sService) WaitForPodRunningByTcp ¶ added in v0.4.6
func (s *K8sService) WaitForPodRunningByTcp(namespace, jobUuid string) (string, error)
type ResultChecker ¶ added in v0.6.2
type ResultChecker interface {
Check() error
}
type SendProofResp ¶ added in v0.6.2
type SequenceTask ¶ added in v0.6.2
type SequenceTask struct { Id int `json:"id"` Uuid string `json:"uuid"` Type int `json:"type"` InputParam string `json:"input_param"` VerifyParam string `json:"verify_param"` ResourceType int `json:"resource_type"` Deadline int `json:"deadline"` Proof string `json:"proof"` CheckCode string `json:"check_code"` Reward string `json:"reward"` Status string `json:"status"` SequenceCid string `json:"sequence_cid"` SettlementCid string `json:"settlement_cid"` SequenceTaskAddr string `json:"sequence_task_addr"` SettlementTaskAddr string `json:"settlement_task_addr"` }
type Sequencer ¶ added in v0.6.2
type Sequencer struct {
// contains filtered or unexported fields
}
func NewSequencer ¶ added in v0.6.2
func NewSequencer() *Sequencer
func (*Sequencer) SendTaskProof ¶ added in v0.6.2
func (s *Sequencer) SendTaskProof(data []byte) (SendProofResp, error)
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, error)
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 ¶
type TaskGroup ¶ added in v0.6.2
type TaskGroup struct { Items []*models.TaskEntity Ids []int64 Uuids []string Type int // 1: contract 2: sequncer 3: mining }
type TaskListResp ¶ added in v0.6.2
type TaskListResp struct { Code int `json:"code"` Msg string `json:"msg"` Data struct { Total int `json:"total"` List []SequenceTask `json:"list"` } `json:"data"` }
type TaskManagerContract ¶ added in v0.6.2
type TaskManagerContract struct {
// contains filtered or unexported fields
}
func NewTaskManagerContract ¶ added in v0.6.2
func NewTaskManagerContract() (*TaskManagerContract, error)
func (*TaskManagerContract) Scan ¶ added in v0.6.2
func (taskManager *TaskManagerContract) Scan() error
type TaskPaymentService ¶ added in v0.7.1
type TaskPaymentService struct {
// contains filtered or unexported fields
}
func NewTaskPaymentService ¶ added in v0.7.1
func NewTaskPaymentService() *TaskPaymentService
func (*TaskPaymentService) ScannerChainGetTaskPayment ¶ added in v0.7.1
func (tps *TaskPaymentService) ScannerChainGetTaskPayment()
type TaskService ¶ added in v0.5.0
func NewTaskService ¶ added in v0.5.0
func NewTaskService() TaskService
func (TaskService) GetTaskByUuid ¶ added in v1.0.0
func (taskServ TaskService) GetTaskByUuid(uuid string) (*models.TaskEntity, error)
func (TaskService) GetTaskEntity ¶ added in v0.5.0
func (taskServ TaskService) GetTaskEntity(taskId int64) (*models.TaskEntity, error)
func (TaskService) GetTaskList ¶ added in v0.5.0
func (taskServ TaskService) GetTaskList(tailNum int, taskStatus ...int) (list []*models.TaskEntity, err error)
func (TaskService) GetTaskListNoRewardForFilC2 ¶ added in v1.0.2
func (taskServ TaskService) GetTaskListNoRewardForFilC2() (list []*models.TaskEntity, err error)
func (TaskService) GetTaskListNoRewardForMining ¶ added in v1.0.2
func (taskServ TaskService) GetTaskListNoRewardForMining() (list []*models.TaskEntity, err error)
func (TaskService) SaveTaskEntity ¶ added in v0.5.0
func (taskServ TaskService) SaveTaskEntity(task *models.TaskEntity) (err error)
func (TaskService) UpdateTaskEntityByTaskId ¶ added in v0.6.2
func (taskServ TaskService) UpdateTaskEntityByTaskId(task *models.TaskEntity) (err error)
func (TaskService) UpdateTaskEntityByTaskUuId ¶ added in v1.0.2
func (taskServ TaskService) UpdateTaskEntityByTaskUuId(task *models.TaskEntity) (err error)
func (TaskService) UpdateTaskStatusById ¶ added in v1.0.0
func (taskServ TaskService) UpdateTaskStatusById(taskId int, status int) (err error)
func (TaskService) UpdateTaskStatusByUuid ¶ added in v1.0.0
func (taskServ TaskService) UpdateTaskStatusByUuid(uuid string, status int) (err error)
type TaskStatus ¶ added in v0.7.1
Source Files
¶
- buildspace.go
- cron_task.go
- deploy.go
- docker_service.go
- ecp_image_service.go
- entity_service.go
- gpu_cache.go
- http.go
- k8s_service.go
- provider.go
- resource_price.go
- resources_sumary.go
- scan_task_payment.go
- scanner_service.go
- sequence_service.go
- space_service.go
- storage_service.go
- ubi_service.go
- wire_gen.go
- wsclient.go
Click to show internal directories.
Click to hide internal directories.