@@ -155,10 +155,6 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond { | |||
if opts.RepoID > 0 { | |||
cond = cond.And(builder.Eq{"dataset.repo_id": opts.RepoID}) | |||
} | |||
if opts.RecommendOnly { | |||
cond = cond.And(builder.Eq{"dataset.recommend": opts.RecommendOnly}) | |||
} | |||
if opts.IncludePublic { | |||
cond = cond.And(builder.Eq{"dataset.status": DatasetStatusPublic}) | |||
cond = cond.And(builder.Eq{"attachment.is_private": false}) | |||
@@ -197,6 +193,10 @@ func generateFilterCond(opts *SearchDatasetOptions, cond builder.Cond) builder.C | |||
cond = cond.And(builder.Eq{"dataset.license": opts.License}) | |||
} | |||
if opts.RecommendOnly { | |||
cond = cond.And(builder.Eq{"dataset.recommend": opts.RecommendOnly}) | |||
} | |||
return cond | |||
} | |||
@@ -40,13 +40,11 @@ const ( | |||
tplCloudBrainBenchmarkNew base.TplName = "repo/cloudbrain/benchmark/new" | |||
tplCloudBrainBenchmarkShow base.TplName = "repo/cloudbrain/benchmark/show" | |||
tplCloudBrainImageSubmit base.TplName = "repo/cloudbrain/image/submit" | |||
tplCloudBrainImageEdit base.TplName = "repo/cloudbrain/image/edit" | |||
tplCloudBrainImageSubmit base.TplName = "repo/cloudbrain/image/submit" | |||
tplCloudBrainImageEdit base.TplName = "repo/cloudbrain/image/edit" | |||
tplCloudBrainTrainJobNew base.TplName = "repo/cloudbrain/trainjob/new" | |||
tplCloudBrainTrainJobShow base.TplName = "repo/cloudbrain/trainjob/show" | |||
) | |||
var ( | |||
@@ -601,6 +599,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo | |||
ctx.Data["dataset_path"] = cloudbrain.DataSetMountPath | |||
ctx.Data["model_path"] = cloudbrain.ModelMountPath | |||
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) | |||
ctx.Data["branchName"] = task.BranchName | |||
ctx.HTML(200, tpName) | |||
} | |||
@@ -1402,11 +1401,11 @@ func SyncCloudbrainStatus() { | |||
maxDuration = setting.MaxDuration | |||
} | |||
if task.Duration >= maxDuration { | |||
log.Info("begin to stop job(%s), because of the duration", task.JobName) | |||
if task.Duration >= maxDuration && task.JobType != string(models.JobTypeTrain) { | |||
log.Info("begin to stop job(%s), because of the duration", task.DisplayJobName) | |||
err = cloudbrain.StopJob(task.JobID) | |||
if err != nil { | |||
log.Error("StopJob(%s) failed:%v", task.JobName, err) | |||
log.Error("StopJob(%s) failed:%v", task.DisplayJobName, err) | |||
continue | |||
} | |||
task.Status = string(models.JobStopped) | |||
@@ -1416,7 +1415,8 @@ func SyncCloudbrainStatus() { | |||
task.ComputeAndSetDuration() | |||
err = models.UpdateJob(task) | |||
if err != nil { | |||
log.Error("UpdateJob(%s) failed:%v", task.JobName, err) | |||
log.Error("UpdateJob(%s) failed:%v", task.DisplayJobName, err) | |||
continue | |||
} | |||
} | |||
} | |||
@@ -51,6 +51,9 @@ const ( | |||
func DebugJobIndex(ctx *context.Context) { | |||
listType := ctx.Query("debugListType") | |||
if listType == "" { | |||
listType = models.AllResource | |||
} | |||
ctx.Data["ListType"] = listType | |||
MustEnableCloudbrain(ctx) | |||
repo := ctx.Repo.Repository | |||
@@ -56,7 +56,7 @@ | |||
margin:10px 5px ; | |||
} | |||
.tab_2_content { | |||
min-height: 380px; | |||
min-height: 420px; | |||
margin-left: 10px; | |||
} | |||
.ac-grid { | |||
@@ -291,6 +291,16 @@ td, th { | |||
</tr> | |||
<tr class="ti-no-ng-animate"> | |||
<td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
{{$.i18n.Tr "repo.modelarts.code_version"}} | |||
</td> | |||
<td class="ti-text-form-content"> | |||
<div class="text-span text-span-w" id="{{.VersionName}}-code"> | |||
{{.BranchName}} | |||
</div> | |||
</td> | |||
</tr> | |||
<tr class="ti-no-ng-animate"> | |||
<td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
{{$.i18n.Tr "cloudbrain.gpu_type"}} | |||
</td> | |||
@@ -838,13 +838,12 @@ td, th { | |||
} | |||
function logScroll(version_name) { | |||
let container = document.querySelector(`#log${version_name}`) | |||
let scrollTop = container.scrollTop | |||
let scrollHeight = container.scrollHeight | |||
let clientHeight = container.clientHeight | |||
let scrollLeft = container.scrollLeft | |||
if((parseInt(scrollTop) + clientHeight == scrollHeight || parseInt(scrollTop) + clientHeight +1 == scrollHeight || parseInt(scrollTop) + clientHeight - 1 == scrollHeight) && (scrollLeft===0)){ | |||
if(((parseInt(scrollTop) + clientHeight == scrollHeight || parseInt(scrollTop) + clientHeight +1 == scrollHeight || parseInt(scrollTop) + clientHeight - 1 == scrollHeight)) && parseInt(scrollTop)!==0 && scrollLeft==0){ | |||
let end_line = $(`#log${version_name} input[name=end_line]`).val() | |||
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, (data) => { | |||
if (data.Lines == 0){ | |||
@@ -867,12 +866,10 @@ td, th { | |||
console.log(err); | |||
}); | |||
} | |||
if(scrollTop == 1 && scrollLeft==0){ | |||
if([0,1,2,3,4,5,6,7,8,9,10].includes(scrollTop) && scrollLeft==0){ | |||
let start_line = $(`#log${version_name} input[name=start_line]`).val() | |||
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${start_line}&lines=50&order=asc`, (data) => { | |||
console.log("11111") | |||
if (data.Lines == 0){ | |||
$(`.message${version_name} #header`).text('您已翻阅至日志顶部') | |||
$(`.message${version_name}`).css('display', 'block') | |||
@@ -897,7 +894,6 @@ td, th { | |||
const dist = Math.ceil(needScrollTop / 10); | |||
_currentY += dist; | |||
//移动一个十分之一 | |||
console.log(_currentY, targetY) | |||
dom.scrollTo(currentX || 0, _currentY); | |||
// 如果移动幅度小于十个像素,直接移动,否则递归调用,实现动画效果 | |||
if (needScrollTop > 10 || needScrollTop < -10) { | |||
@@ -909,25 +905,31 @@ td, th { | |||
} | |||
$('.log_top').click(function(){ | |||
let logContentDom = document.querySelector('.log') | |||
if(!logContentDom) | |||
return | |||
let version_name = $('.log_top').data('version') | |||
// let logContentDom = document.querySelector('.log') | |||
// if(!logContentDom) | |||
// return | |||
// let version_name = $('.log_top').data('version') | |||
let version_name = $(this).data('version') | |||
let logContentDom = document.querySelector(`#log${version_name}`) | |||
$(`#log_file${version_name}`).siblings('pre').remove() | |||
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=&lines=50&order=asc`, (data) => { | |||
$(`#log${version_name} input[name=end_line]`).val(data.EndLine) //如果变动就改变所对应的值 | |||
$(`#log${version_name} input[name=start_line]`).val(data.StartLine) | |||
$(`#log${version_name}`).prepend('<pre>' + data.Content) | |||
$(`.message${version_name} #header`).text('您已翻阅至日志顶部') | |||
$(`.message${version_name}`).css('display', 'block') | |||
setTimeout(function(){ | |||
$(`.message${version_name}`).css('display', 'none') | |||
}, 1000) | |||
scrollAnimation(logContentDom, logContentDom.scrollTop, 0); | |||
}) | |||
}) | |||
$('.log_bottom').click(function(){ | |||
let logContentDom = document.querySelector('.log') | |||
let version_name = $('.log_bottom').data('version') | |||
console.log($(`#log${version_name}`).siblings('pre')) | |||
$('.log_bottom').click(function(e){ | |||
let version_name = $(this).data('version') | |||
let logContentDom = document.querySelector(`#log${version_name}`) | |||
$(`#log_file${version_name}`).siblings('pre').remove() | |||
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=&lines=50&order=desc`, (data) => { | |||
@@ -22,7 +22,7 @@ | |||
<el-dropdown-menu slot="dropdown"> | |||
<el-dropdown-item :command="{label:'全部',private:''}">全部</el-dropdown-item> | |||
<el-dropdown-item :command="{label:'公开',private:false}">公开</el-dropdown-item> | |||
<el-dropdown-item :command="{label:'公开',private:true}">私有</el-dropdown-item> | |||
<el-dropdown-item :command="{label:'私有',private:true}">私有</el-dropdown-item> | |||
</el-dropdown-menu> | |||
</el-dropdown> | |||
</div> | |||