You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

new.tmpl 14 kB

5 years ago
3 years ago
5 years ago
5 years ago
4 years ago
3 years ago
3 years ago
5 years ago
5 years ago
3 years ago
4 years ago
5 years ago
3 years ago
5 years ago
4 years ago
4 years ago
5 years ago
3 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
5 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
3 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. {{template "base/head" .}}
  2. <style>
  3. /* 遮罩层css效果图 */
  4. .inline.required.field.cloudbrain_benchmark {
  5. display: none;
  6. }
  7. .inline.required.field.cloudbrain_snn4imagenet {
  8. display: none;
  9. }
  10. .inline.required.field.cloudbrain_brainscore {
  11. display: none;
  12. }
  13. </style>
  14. {{template "custom/global_mask" .}}
  15. <div class="repository">
  16. {{template "repo/header" .}}
  17. <div class="repository new repo ui middle very relaxed page grid">
  18. <div class="column">
  19. <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>
  20. {{template "base/alert" .}}
  21. <div class="ui negative message" id="messageInfo">
  22. <p></p>
  23. </div>
  24. <form id="form_id" class="ui form" action="{{.Link}}" method="post">
  25. {{.CsrfTokenHtml}}
  26. <input type="hidden" name='isBranches' value="{{.Branches}}">
  27. <h3 class="ui top attached header">
  28. {{.i18n.Tr "repo.cloudbrain.new"}}
  29. </h3>
  30. <div class="ui attached segment">
  31. <div class="inline required field">
  32. <label>{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  33. <div class="ui blue small menu compact selectcloudbrain">
  34. <a class="active item" href="{{.RepoLink}}/cloudbrain/create">
  35. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  36. height="16">
  37. <path fill="none" d="M0 0h24v24H0z" />
  38. <path
  39. 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" />
  40. </svg>
  41. CPU/GPU
  42. </a>
  43. <a class="item" href="{{.RepoLink}}/modelarts/notebook/create">
  44. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  45. height="16">
  46. <path fill="none" d="M0 0h24v24H0z" />
  47. <path
  48. 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" />
  49. </svg>
  50. Ascend NPU</a>
  51. </div>
  52. {{template "custom/wait_count" .}}
  53. </div>
  54. <div class="inline required field">
  55. <label>{{.i18n.Tr "cloudbrain.task_name"}}</label>
  56. <input name="display_job_name" id="cloudbrain_job_name"
  57. placeholder="{{.i18n.Tr "cloudbrain.task_name"}}" value="{{.display_job_name}}" tabindex="3"
  58. autofocus required maxlength="255" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  59. </div>
  60. <div class="inline required field">
  61. <label>{{.i18n.Tr "cloudbrain.task_type"}}</label>
  62. <select id="cloudbrain_job_type" class="ui search dropdown"
  63. placeholder="{{.i18n.Tr "cloudbrain.task_type"}}" style='width:385px' name="job_type">
  64. <option name="job_type" value="DEBUG">DEBUG</option>
  65. </select>
  66. </div>
  67. <div class="inline required field cloudbrain_benchmark">
  68. <label style="vertical-align: top; margin-top:9px">数据集类别</label>
  69. <select class="ui search dropdown" multiple="multiple" id="cloudbrain_benchmark_category"
  70. style='width:385px'>
  71. {{range .benchmark_categories}}
  72. <option value="{{.Value}}">{{.Value}}</option>
  73. {{end}}
  74. </select>
  75. <div class="mini ui buttons" style="vertical-align: top; margin-top:9px">
  76. <button class="ui button reset">重置</button>
  77. <div class="or"></div>
  78. <button class="ui positive button active all_selected">全选</button>
  79. </div>
  80. </div>
  81. <input id="store_category" type="hidden" name="get_benchmark_category">
  82. <div class="inline required field">
  83. <label>{{.i18n.Tr "repo.modelarts.code_version"}}</label>
  84. <select class="ui dropdown width80 left2 {{if not .Branches}}error{{end}}" id="code_version"
  85. name="branch_name">
  86. {{if .branch_name}}
  87. <option name="branch_name" value="{{.branch_name}}">{{.branch_name}}</option>
  88. {{range $k, $v :=.Branches}}
  89. {{ if ne $v $.branch_name }}
  90. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  91. {{end}}
  92. {{end}}
  93. {{else}}
  94. <option name="branch_name" value="{{.branchName}}">{{.branchName}}</option>
  95. {{range $k, $v :=.Branches}}
  96. {{ if ne $v $.branchName }}
  97. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  98. {{end}}
  99. {{end}}
  100. {{end}}
  101. </select>
  102. </div>
  103. <div class="inline required field">
  104. <label>{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
  105. <select id="cloudbrain_gpu_type" class="ui search dropdown gpu-type" placeholder="选择GPU类型"
  106. style='width:385px' name="gpu_type">
  107. {{range .gpu_types}}
  108. <option value="{{.Queue}}">{{.Value}}</option>
  109. {{end}}
  110. </select>
  111. </div>
  112. <div id="images-new-cb">
  113. </div>
  114. <div id="select-multi-dataset">
  115. </div>
  116. <div class="inline required field">
  117. <label>{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  118. <select id="cloudbrain_resource_spec" class="ui search dropdown"
  119. placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
  120. name="resource_spec_id">
  121. {{range .resource_specs}}
  122. <option name="resource_spec_id" value="{{.Id}}">
  123. {{$.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}}
  124. </option>
  125. {{end}}
  126. </select>
  127. </div>
  128. <div class="inline required field">
  129. <label>{{.i18n.Tr "cloudbrain.dataset_storage_path"}}</label>
  130. <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3"
  131. disabled autofocus required maxlength="255" readonly="readonly">
  132. </div>
  133. <div class="inline required field">
  134. <label>{{.i18n.Tr "cloudbrain.model_storage_path"}}</label>
  135. <input name="model_path" id="cloudbrain_model_path" value="{{.model_path}}" tabindex="3"
  136. disabled autofocus required maxlength="255" readonly="readonly">
  137. </div>
  138. <div class="inline required field">
  139. <label>{{.i18n.Tr "cloudbrain.code_storage_path"}}</label>
  140. <input name="code_path" id="cloudbrain_code_path" value="{{.code_path}}" tabindex="3" disabled
  141. autofocus required maxlength="255" readonly="readonly">
  142. </div>
  143. <div class="inline required field cloudbrain_benchmark">
  144. <label>{{.i18n.Tr "cloudbrain.benchmark_path"}}</label>
  145. <input name="benchmark_path" id="cloudbrain_benchmark_path" value="{{.benchmark_path}}"
  146. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  147. </div>
  148. <div class="inline required field cloudbrain_snn4imagenet">
  149. <label>{{.i18n.Tr "cloudbrain.snn4imagenet_path"}}</label>
  150. <input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}"
  151. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  152. </div>
  153. <div class="inline required field cloudbrain_brainscore">
  154. <label>{{.i18n.Tr "cloudbrain.brainscore_path"}}</label>
  155. <input name="brainscore_path" id="cloudbrain_brainscore_path" value="{{.brainscore_path}}"
  156. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  157. </div>
  158. <div class="inline required field" hidden>
  159. <label>{{.i18n.Tr "cloudbrain.start_command"}}</label>
  160. <textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea>
  161. </div>
  162. <div class="inline field">
  163. <label></label>
  164. <button class="ui green button">
  165. {{.i18n.Tr "repo.cloudbrain.new"}}
  166. </button>
  167. <a class="ui button cancel"
  168. href="{{.RepoLink}}/debugjob?debugListType=all">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  169. </div>
  170. </div>
  171. </form>
  172. </div>
  173. </div>
  174. </div>
  175. {{template "base/footer" .}}
  176. <script>
  177. let form = document.getElementById('form_id');
  178. $('#messageInfo').css('display', 'none')
  179. function clearValue() {
  180. context = inputs[0]
  181. context.value = ''
  182. $(".icon.icons").css("visibility", "hidden")
  183. }
  184. function validate(){
  185. $('.ui.form').form({
  186. on: 'blur',
  187. fields: {
  188. display_job_name:{
  189. identifier : 'display_job_name',
  190. rules: [
  191. {
  192. type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
  193. }
  194. ]
  195. },
  196. },
  197. onSuccess: function(){
  198. },
  199. onFailure: function(e){
  200. return false;
  201. }
  202. })
  203. }
  204. validate();
  205. form.onsubmit = function (e) {
  206. let value_task = $("input[name='display_job_name']").val()
  207. let value_image = $("input[name='image']").val()
  208. let value_data = $("input[name='attachment']").val()
  209. let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/
  210. let flag = re.test(value_task)
  211. if (!flag) {
  212. $('#messageInfo').css('display', 'block')
  213. let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。'
  214. $('#messageInfo p').text(str)
  215. return false
  216. }
  217. let min_value_task = value_task.toLowerCase()
  218. $("input[name='display_job_name']").attr("value", min_value_task)
  219. document.getElementById("mask").style.display = "block"
  220. }
  221. // 页面加载完毕后遮罩层隐藏
  222. document.onreadystatechange = function () {
  223. if (document.readyState === "complete") {
  224. document.getElementById("mask").style.display = "none"
  225. }
  226. }
  227. $('#cloudbrain_benchmark_category')
  228. .dropdown({
  229. placeholder: "选择数据集类别",
  230. })
  231. $(".ui.button.reset").click(function (e) {
  232. e.preventDefault()
  233. $('#cloudbrain_benchmark_category')
  234. .dropdown("clear", true)
  235. })
  236. $(".ui.positive.button.active.all_selected").click(function (e) {
  237. e.preventDefault()
  238. var selected_value = new Array()
  239. $("#cloudbrain_benchmark_category option").each(function () {
  240. selected_value.push($(this).val())
  241. });
  242. $('#cloudbrain_benchmark_category')
  243. .dropdown("set exactly", selected_value)
  244. })
  245. $(function () {
  246. $("#cloudbrain_job_type").change(function () {
  247. if ($(this).val() == 'BENCHMARK') {
  248. $(".cloudbrain_benchmark").show();
  249. } else if ($(this).val() == 'SNN4IMAGENET') {
  250. $(".cloudbrain_snn4imagenet").show();
  251. } else if ($(this).val() == 'BRAINSCORE') {
  252. $(".cloudbrain_brainscore").show();
  253. } else {
  254. $(".cloudbrain_benchmark").hide();
  255. $(".cloudbrain_snn4imagenet").hide();
  256. $(".cloudbrain_brainscore").hide();
  257. }
  258. })
  259. })
  260. $('.ui.green.button').click(function () {
  261. if (!$('input[name="isBranches"]').val()) {
  262. return false
  263. }
  264. selected_value = $("#cloudbrain_benchmark_category").val()
  265. $('#store_category').attr("value", selected_value)
  266. })
  267. </script>