forked from ci4s/pipeline-convert
资源id采用配置
This commit is contained in:
parent
9075541f23
commit
720e2cf186
|
|
@ -100,7 +100,13 @@ type AutoMLConfig struct {
|
|||
|
||||
type AutoMLBaseConfig struct {
|
||||
GitRepoConfig GitRepoConfig `yaml:"git-repo-config"`
|
||||
Image string `json:"image"`
|
||||
Image string `yaml:"image"`
|
||||
ResourceID int32 `yaml:"resource-id"`
|
||||
}
|
||||
|
||||
type GitCloneConfig struct {
|
||||
ResourceID int32 `yaml:"resource-id"`
|
||||
Image string `yaml:"image"`
|
||||
}
|
||||
|
||||
type config struct {
|
||||
|
|
@ -119,6 +125,7 @@ type config struct {
|
|||
HyperOptimizationConfig HyperOptimizationConfig `yaml:"hyper-optimization"`
|
||||
ActivateLearningConfig ActivateLearningConfig `yaml:"activate-learning"`
|
||||
AutoMLConfig AutoMLConfig `yaml:"auto-ml"`
|
||||
GitCloneConfig GitCloneConfig `yaml:"git-clone-config"`
|
||||
}
|
||||
|
||||
type RunConfig struct {
|
||||
|
|
|
|||
|
|
@ -340,10 +340,11 @@ func (c *ConvertHandler) buildAutoVideoMLComponent(req AutoVideoMLConfig,
|
|||
|
||||
func (c *ConvertHandler) buildAutoTableMLComponent(req AutoTableMLConfig,
|
||||
frameCode *model.Component) (*model.Component, error) {
|
||||
if req.Resource == 0 {
|
||||
req.Resource = 31
|
||||
resourceID := configs.RConfig.GetConfig().AutoMLConfig.TableGitRepoConfig.ResourceID
|
||||
if resourceID == 0 {
|
||||
return nil, fmt.Errorf("resource id can not be empty")
|
||||
}
|
||||
resource, err := c.manageService.GetResourceByID(req.Resource)
|
||||
resource, err := c.manageService.GetResourceByID(resourceID)
|
||||
if err != nil {
|
||||
log.Errorf("get resource by id error:%v", err)
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -392,26 +392,27 @@ type CodeConfig struct {
|
|||
}
|
||||
|
||||
func (c *ConvertHandler) buildGitCloneComponent(value string, path string) (*model.Component, error) {
|
||||
//defaultResource := "{\"name\":\"CPU-GPU\",\"value\":{\"detail_type\":\"3060\",\"gpu\":0,\"cpu\":1,\"memory\":\"1GB\"}}"
|
||||
resource := manageclient.Resource{
|
||||
Id: 28,
|
||||
ResourceId: 0,
|
||||
ComputingResource: "",
|
||||
Description: "",
|
||||
CpuCores: 1,
|
||||
MemoryGb: 1,
|
||||
GpuMemoryGb: 0,
|
||||
GpuNums: 0,
|
||||
CreditPerHour: 0,
|
||||
Labels: "accelertor=cpu",
|
||||
resourceID := configs.RConfig.GetConfig().GitCloneConfig.ResourceID
|
||||
if resourceID == 0 {
|
||||
return nil, fmt.Errorf("resource id is empty")
|
||||
}
|
||||
|
||||
resource, err := c.manageService.GetResourceByID(resourceID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
image := configs.RConfig.GetConfig().GitCloneConfig.Image
|
||||
if stringutils.IsEmpty(image) {
|
||||
return nil, fmt.Errorf("git clone image is empty")
|
||||
}
|
||||
component := &model.Component{
|
||||
CategoryID: parse.GitCloneCategoryID,
|
||||
ComponentName: parse.GitClone,
|
||||
ComponentLabel: "代码拉取组件",
|
||||
Description: "代码拉取组件",
|
||||
Image: "172.20.32.187/pipeline-component/built-in/git:202409031108",
|
||||
Resource: resource,
|
||||
Image: image,
|
||||
Resource: *resource,
|
||||
TaskID: parse.GitClone + "-" + stringutils.GetUUID(),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue