|
@@ -40,6 +40,8 @@ var ( |
|
|
categories *models.Categories |
|
|
categories *models.Categories |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var jobNamePattern = regexp.MustCompile(`^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$`) |
|
|
|
|
|
|
|
|
// MustEnableDataset check if repository enable internal cb |
|
|
// MustEnableDataset check if repository enable internal cb |
|
|
func MustEnableCloudbrain(ctx *context.Context) { |
|
|
func MustEnableCloudbrain(ctx *context.Context) { |
|
|
if !ctx.Repo.CanRead(models.UnitTypeCloudBrain) { |
|
|
if !ctx.Repo.CanRead(models.UnitTypeCloudBrain) { |
|
@@ -200,6 +202,11 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { |
|
|
gpuQueue := setting.JobType |
|
|
gpuQueue := setting.JobType |
|
|
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath |
|
|
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath |
|
|
resourceSpecId := form.ResourceSpecId |
|
|
resourceSpecId := form.ResourceSpecId |
|
|
|
|
|
|
|
|
|
|
|
if !jobNamePattern.MatchString(jobName) { |
|
|
|
|
|
ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplModelArtsNew, &form) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) && jobType != string(models.JobTypeBrainScore) { |
|
|
if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) && jobType != string(models.JobTypeBrainScore) { |
|
|
log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) |
|
|
log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) |
|
|