|
- {{template "base/head" .}}
- <style>
-
- /* 遮罩层css效果图 */
- .inline.required.field.cloudbrain_benchmark {
- display: none;
- }
-
- .inline.required.field.cloudbrain_snn4imagenet {
- display: none;
- }
-
- .inline.required.field.cloudbrain_brainscore {
- display: none;
- }
-
-
- </style>
-
- {{template "custom/global_mask" .}}
-
- <div class="repository">
- {{template "repo/header" .}}
- <div class="repository new repo ui middle very relaxed page grid">
- <div class="column">
- <div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}"></div>
- {{if eq .NotStopTaskCount 0}}
- {{template "base/alert" .}}
- {{end}}
- <div class="ui negative message" id="messageInfo" style="display:none;">
- <p></p>
- </div>
- {{template "custom/alert_cb" .}}
- <form id="form_id" class="ui form" action="{{.Link}}" method="post">
- {{.CsrfTokenHtml}}
- <input type="hidden" name='isBranches' value="{{.Branches}}">
- <h3 class="ui top attached header">
- {{.i18n.Tr "repo.cloudbrain.new"}}
- </h3>
- <div class="ui attached segment">
- <div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
- <div class="ui blue small menu compact selectcloudbrain">
- <a class="active item" href="{{.RepoLink}}/cloudbrain/create">
- <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
- height="16">
- <path fill="none" d="M0 0h24v24H0z" />
- <path
- d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" />
- </svg>
- CPU/GPU
- </a>
- <a class="item" href="{{.RepoLink}}/modelarts/notebook/create">
- <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
- height="16">
- <path fill="none" d="M0 0h24v24H0z" />
- <path
- d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" />
- </svg>
- Ascend NPU</a>
- </div>
- </div>
- <div class="inline field">
- <label></label>
- {{template "custom/task_wait_count" .}}
- </div>
- <div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.task_name"}}</label>
- <input name="display_job_name" id="cloudbrain_job_name"
- placeholder="{{.i18n.Tr "cloudbrain.task_name"}}" value="{{.display_job_name}}" tabindex="3"
- autofocus required maxlength="255" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
- </div>
-
- <div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.task_type"}}</label>
- <select id="cloudbrain_job_type" class="ui search dropdown"
- placeholder="{{.i18n.Tr "cloudbrain.task_type"}}" style='width:385px' name="job_type">
- <option name="job_type" value="DEBUG">DEBUG</option>
- </select>
- </div>
-
- <div class="inline required field cloudbrain_benchmark">
- <label style="vertical-align: top; margin-top:9px">数据集类别</label>
- <select class="ui search dropdown" multiple="multiple" id="cloudbrain_benchmark_category"
- style='width:385px'>
- {{range .benchmark_categories}}
- <option value="{{.Value}}">{{.Value}}</option>
- {{end}}
- </select>
- <div class="mini ui buttons" style="vertical-align: top; margin-top:9px">
- <button class="ui button reset">重置</button>
- <div class="or"></div>
- <button class="ui positive button active all_selected">全选</button>
- </div>
- </div>
- <input id="store_category" type="hidden" name="get_benchmark_category">
- <div class="inline required field">
- <label>{{.i18n.Tr "repo.modelarts.code_version"}}</label>
- <select class="ui dropdown width80 left2 {{if not .Branches}}error{{end}}" id="code_version"
- name="branch_name">
- {{if .branch_name}}
- <option name="branch_name" value="{{.branch_name}}">{{.branch_name}}</option>
- {{range $k, $v :=.Branches}}
- {{ if ne $v $.branch_name }}
- <option name="branch_name" value="{{$v}}">{{$v}}</option>
- {{end}}
- {{end}}
- {{else}}
- <option name="branch_name" value="{{.branchName}}">{{.branchName}}</option>
- {{range $k, $v :=.Branches}}
- {{ if ne $v $.branchName }}
- <option name="branch_name" value="{{$v}}">{{$v}}</option>
- {{end}}
- {{end}}
- {{end}}
- </select>
- </div>
- <!--<div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
- <select id="cloudbrain_gpu_type" class="ui search dropdown gpu-type" placeholder="选择GPU类型"
- style='width:385px' name="gpu_type">
- {{range .gpu_types}}
- <option value="{{.Queue}}">{{.Value}}</option>
- {{end}}
- </select>
- </div>-->
-
- <div id="images-new-cb">
-
- </div>
- <div id="select-multi-dataset">
-
- </div>
-
- <!--<div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
- <select id="cloudbrain_resource_spec" class="ui search dropdown"
- placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
- name="resource_spec_id">
- {{range .resource_specs}}
- <option name="resource_spec_id" value="{{.Id}}">
- {{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}}
- </option>
- {{end}}
- </select>
- </div>-->
-
- <div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
- <select id="__specs__" class="ui search dropdown"
- placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' ovalue="{{.spec_id}}"
- {{if .CloudBrainPaySwitch}}blance="{{.PointAccount.Balance}}"{{end}}
- name="spec_id">
- </select>
- <span><i class="question circle icon link"></i></span>
- <a href="{{AppSubUrl}}/resource_desc" target="_blank">{{.i18n.Tr "custom.resource_description"}}</a>
- {{if .CloudBrainPaySwitch}}
- <div class="cloudbrain_resource_spec_blance_tip" style="padding:0 5px;margin:6px 0;margin-left:265px;font-size:12px;width: 50%!important;">
- <span>{{$.i18n.Tr "points.balance_of_points"}}<span style="color:red;margin: 0 3px">{{.PointAccount.Balance}}</span>{{$.i18n.Tr "points.points"}}</span><span>{{$.i18n.Tr "points.expected_time"}}<span style="color:red;margin: 0 3px" class="can-use-time"></span>{{$.i18n.Tr "points.hours"}}</span>
- <span style="float:right;">
- <i class="question circle icon link" data-position="right center" data-variation="mini"></i>
- <a href="{{AppSubUrl}}/reward/point/rule" target="_blank">{{$.i18n.Tr "points.points_acquisition_instructions"}}</a>
- </span>
- </div>
- {{end}}
- </div>
-
- <div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.dataset_storage_path"}}</label>
- <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3"
- disabled autofocus required maxlength="255" readonly="readonly">
- </div>
- <div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.model_storage_path"}}</label>
- <input name="model_path" id="cloudbrain_model_path" value="{{.model_path}}" tabindex="3"
- disabled autofocus required maxlength="255" readonly="readonly">
- </div>
- <div class="inline required field">
- <label>{{.i18n.Tr "cloudbrain.code_storage_path"}}</label>
- <input name="code_path" id="cloudbrain_code_path" value="{{.code_path}}" tabindex="3" disabled
- autofocus required maxlength="255" readonly="readonly">
- </div>
- <div class="inline required field cloudbrain_benchmark">
- <label>{{.i18n.Tr "cloudbrain.benchmark_path"}}</label>
- <input name="benchmark_path" id="cloudbrain_benchmark_path" value="{{.benchmark_path}}"
- tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
- </div>
- <div class="inline required field cloudbrain_snn4imagenet">
- <label>{{.i18n.Tr "cloudbrain.snn4imagenet_path"}}</label>
- <input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}"
- tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
- </div>
- <div class="inline required field cloudbrain_brainscore">
- <label>{{.i18n.Tr "cloudbrain.brainscore_path"}}</label>
- <input name="brainscore_path" id="cloudbrain_brainscore_path" value="{{.brainscore_path}}"
- tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
- </div>
- <div class="inline required field" hidden>
- <label>{{.i18n.Tr "cloudbrain.start_command"}}</label>
- <textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea>
- </div>
-
- <div class="inline field">
- <label></label>
- <button class="ui green button {{if eq .NotStopTaskCount 1}}disabled{{end}}">
- {{.i18n.Tr "repo.cloudbrain.new"}}
- </button>
- <a class="ui button cancel"
- href="{{.RepoLink}}/debugjob?debugListType=all">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- {{template "base/footer" .}}
- <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
- <script>
- let form = document.getElementById('form_id');
- $('#messageInfo').css('display', 'none')
- function clearValue() {
- context = inputs[0]
- context.value = ''
- $(".icon.icons").css("visibility", "hidden")
- }
- var isValidate = false;
- function validate(){
- $('.ui.form').form({
- on: 'blur',
- fields: {
- display_job_name:{
- identifier : 'display_job_name',
- rules: [
- {
- type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
- }
- ]
- },
- spec_id: {
- identifier: 'spec_id',
- rules: [{ type: 'empty' }]
- }
- },
- onSuccess: function(){
- isValidate = true;
- },
- onFailure: function(e){
- isValidate = false;
- return false;
- }
- })
- }
- validate();
- let createFlag = false
- form.onsubmit = function (e) {
- if (!isValidate) return false;
- if(createFlag) return false
- let value_task = $("input[name='display_job_name']").val()
- let value_image = $("input[name='image']").val()
- let value_data = $("input[name='attachment']").val()
- let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/
- let flag = re.test(value_task)
- if (!flag) {
- $('#messageInfo').css('display', 'block')
- let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。'
- $('#messageInfo p').text(str)
- return false
- }
- let min_value_task = value_task.toLowerCase()
- $("input[name='display_job_name']").attr("value", min_value_task)
- createFlag = true
- document.getElementById("mask").style.display = "block"
- }
-
- // 页面加载完毕后遮罩层隐藏
- document.onreadystatechange = function () {
- if (document.readyState === "complete") {
- document.getElementById("mask").style.display = "none"
- }
-
- }
-
- $('#cloudbrain_benchmark_category')
- .dropdown({
- placeholder: "选择数据集类别",
- })
- $(".ui.button.reset").click(function (e) {
- e.preventDefault()
- $('#cloudbrain_benchmark_category')
- .dropdown("clear", true)
- })
- $(".ui.positive.button.active.all_selected").click(function (e) {
- e.preventDefault()
- var selected_value = new Array()
- $("#cloudbrain_benchmark_category option").each(function () {
- selected_value.push($(this).val())
- });
- $('#cloudbrain_benchmark_category')
- .dropdown("set exactly", selected_value)
- })
-
- $(function () {
- $("#cloudbrain_job_type").change(function () {
- if ($(this).val() == 'BENCHMARK') {
- $(".cloudbrain_benchmark").show();
- } else if ($(this).val() == 'SNN4IMAGENET') {
- $(".cloudbrain_snn4imagenet").show();
- } else if ($(this).val() == 'BRAINSCORE') {
- $(".cloudbrain_brainscore").show();
- } else {
- $(".cloudbrain_benchmark").hide();
- $(".cloudbrain_snn4imagenet").hide();
- $(".cloudbrain_brainscore").hide();
- }
- })
- })
-
- $('.ui.green.button').click(function () {
- if (!$('input[name="isBranches"]').val()) {
- return false
- }
- selected_value = $("#cloudbrain_benchmark_category").val()
- $('#store_category').attr("value", selected_value)
- validate();
- })
-
- ;(function() {
- var SPECS = {{ .debug_specs }};
- var showPoint = {{ .CloudBrainPaySwitch }};
- window.renderSpecsSelect($('#__specs__'), SPECS, showPoint, {
- gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
- free: {{$.i18n.Tr "cloudbrain.free"}},
- point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
- memory: {{$.i18n.Tr "cloudbrain.memory"}},
- shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
- });
- })();
- </script>
|