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 16 kB

4 years ago
2 years ago
4 years ago
4 years ago
3 years ago
2 years ago
3 years ago
4 years ago
4 years ago
2 years ago
3 years ago
4 years ago
3 years ago
4 years ago
2 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
2 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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" style="display:none;">
  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. </div>
  53. <div class="inline field">
  54. <label></label>
  55. {{template "custom/task_wait_count" .}}
  56. </div>
  57. <div class="inline required field">
  58. <label>{{.i18n.Tr "cloudbrain.task_name"}}</label>
  59. <input name="display_job_name" id="cloudbrain_job_name"
  60. placeholder="{{.i18n.Tr "cloudbrain.task_name"}}" value="{{.display_job_name}}" tabindex="3"
  61. autofocus required maxlength="255" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  62. </div>
  63. <div class="inline required field">
  64. <label>{{.i18n.Tr "cloudbrain.task_type"}}</label>
  65. <select id="cloudbrain_job_type" class="ui search dropdown"
  66. placeholder="{{.i18n.Tr "cloudbrain.task_type"}}" style='width:385px' name="job_type">
  67. <option name="job_type" value="DEBUG">DEBUG</option>
  68. </select>
  69. </div>
  70. <div class="inline required field cloudbrain_benchmark">
  71. <label style="vertical-align: top; margin-top:9px">数据集类别</label>
  72. <select class="ui search dropdown" multiple="multiple" id="cloudbrain_benchmark_category"
  73. style='width:385px'>
  74. {{range .benchmark_categories}}
  75. <option value="{{.Value}}">{{.Value}}</option>
  76. {{end}}
  77. </select>
  78. <div class="mini ui buttons" style="vertical-align: top; margin-top:9px">
  79. <button class="ui button reset">重置</button>
  80. <div class="or"></div>
  81. <button class="ui positive button active all_selected">全选</button>
  82. </div>
  83. </div>
  84. <input id="store_category" type="hidden" name="get_benchmark_category">
  85. <div class="inline required field">
  86. <label>{{.i18n.Tr "repo.modelarts.code_version"}}</label>
  87. <select class="ui dropdown width80 left2 {{if not .Branches}}error{{end}}" id="code_version"
  88. name="branch_name">
  89. {{if .branch_name}}
  90. <option name="branch_name" value="{{.branch_name}}">{{.branch_name}}</option>
  91. {{range $k, $v :=.Branches}}
  92. {{ if ne $v $.branch_name }}
  93. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  94. {{end}}
  95. {{end}}
  96. {{else}}
  97. <option name="branch_name" value="{{.branchName}}">{{.branchName}}</option>
  98. {{range $k, $v :=.Branches}}
  99. {{ if ne $v $.branchName }}
  100. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  101. {{end}}
  102. {{end}}
  103. {{end}}
  104. </select>
  105. </div>
  106. <!--<div class="inline required field">
  107. <label>{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
  108. <select id="cloudbrain_gpu_type" class="ui search dropdown gpu-type" placeholder="选择GPU类型"
  109. style='width:385px' name="gpu_type">
  110. {{range .gpu_types}}
  111. <option value="{{.Queue}}">{{.Value}}</option>
  112. {{end}}
  113. </select>
  114. </div>-->
  115. <div id="images-new-cb">
  116. </div>
  117. <div id="select-multi-dataset">
  118. </div>
  119. <!--<div class="inline required field">
  120. <label>{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  121. <select id="cloudbrain_resource_spec" class="ui search dropdown"
  122. placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
  123. name="resource_spec_id">
  124. {{range .resource_specs}}
  125. <option name="resource_spec_id" value="{{.Id}}">
  126. {{$.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}}
  127. </option>
  128. {{end}}
  129. </select>
  130. </div>-->
  131. <div class="inline required field">
  132. <label>{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  133. <select id="__specs__" class="ui search dropdown"
  134. placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
  135. name="spec_id">
  136. </select>
  137. </div>
  138. <div class="inline required field">
  139. <label>{{.i18n.Tr "cloudbrain.dataset_storage_path"}}</label>
  140. <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3"
  141. disabled autofocus required maxlength="255" readonly="readonly">
  142. </div>
  143. <div class="inline required field">
  144. <label>{{.i18n.Tr "cloudbrain.model_storage_path"}}</label>
  145. <input name="model_path" id="cloudbrain_model_path" value="{{.model_path}}" tabindex="3"
  146. disabled autofocus required maxlength="255" readonly="readonly">
  147. </div>
  148. <div class="inline required field">
  149. <label>{{.i18n.Tr "cloudbrain.code_storage_path"}}</label>
  150. <input name="code_path" id="cloudbrain_code_path" value="{{.code_path}}" tabindex="3" disabled
  151. autofocus required maxlength="255" readonly="readonly">
  152. </div>
  153. <div class="inline required field cloudbrain_benchmark">
  154. <label>{{.i18n.Tr "cloudbrain.benchmark_path"}}</label>
  155. <input name="benchmark_path" id="cloudbrain_benchmark_path" value="{{.benchmark_path}}"
  156. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  157. </div>
  158. <div class="inline required field cloudbrain_snn4imagenet">
  159. <label>{{.i18n.Tr "cloudbrain.snn4imagenet_path"}}</label>
  160. <input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}"
  161. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  162. </div>
  163. <div class="inline required field cloudbrain_brainscore">
  164. <label>{{.i18n.Tr "cloudbrain.brainscore_path"}}</label>
  165. <input name="brainscore_path" id="cloudbrain_brainscore_path" value="{{.brainscore_path}}"
  166. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  167. </div>
  168. <div class="inline required field" hidden>
  169. <label>{{.i18n.Tr "cloudbrain.start_command"}}</label>
  170. <textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea>
  171. </div>
  172. <div class="inline field">
  173. <label></label>
  174. <button class="ui green button">
  175. {{.i18n.Tr "repo.cloudbrain.new"}}
  176. </button>
  177. <a class="ui button cancel"
  178. href="{{.RepoLink}}/debugjob?debugListType=all">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  179. </div>
  180. </div>
  181. </form>
  182. </div>
  183. </div>
  184. </div>
  185. {{template "base/footer" .}}
  186. <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  187. <script>
  188. let form = document.getElementById('form_id');
  189. $('#messageInfo').css('display', 'none')
  190. function clearValue() {
  191. context = inputs[0]
  192. context.value = ''
  193. $(".icon.icons").css("visibility", "hidden")
  194. }
  195. function validate(){
  196. $('.ui.form').form({
  197. on: 'blur',
  198. fields: {
  199. display_job_name:{
  200. identifier : 'display_job_name',
  201. rules: [
  202. {
  203. type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
  204. }
  205. ]
  206. },
  207. },
  208. onSuccess: function(){
  209. },
  210. onFailure: function(e){
  211. return false;
  212. }
  213. })
  214. }
  215. validate();
  216. form.onsubmit = function (e) {
  217. let value_task = $("input[name='display_job_name']").val()
  218. let value_image = $("input[name='image']").val()
  219. let value_data = $("input[name='attachment']").val()
  220. let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/
  221. let flag = re.test(value_task)
  222. if (!flag) {
  223. $('#messageInfo').css('display', 'block')
  224. let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。'
  225. $('#messageInfo p').text(str)
  226. return false
  227. }
  228. let min_value_task = value_task.toLowerCase()
  229. $("input[name='display_job_name']").attr("value", min_value_task)
  230. document.getElementById("mask").style.display = "block"
  231. }
  232. // 页面加载完毕后遮罩层隐藏
  233. document.onreadystatechange = function () {
  234. if (document.readyState === "complete") {
  235. document.getElementById("mask").style.display = "none"
  236. }
  237. }
  238. $('#cloudbrain_benchmark_category')
  239. .dropdown({
  240. placeholder: "选择数据集类别",
  241. })
  242. $(".ui.button.reset").click(function (e) {
  243. e.preventDefault()
  244. $('#cloudbrain_benchmark_category')
  245. .dropdown("clear", true)
  246. })
  247. $(".ui.positive.button.active.all_selected").click(function (e) {
  248. e.preventDefault()
  249. var selected_value = new Array()
  250. $("#cloudbrain_benchmark_category option").each(function () {
  251. selected_value.push($(this).val())
  252. });
  253. $('#cloudbrain_benchmark_category')
  254. .dropdown("set exactly", selected_value)
  255. })
  256. $(function () {
  257. $("#cloudbrain_job_type").change(function () {
  258. if ($(this).val() == 'BENCHMARK') {
  259. $(".cloudbrain_benchmark").show();
  260. } else if ($(this).val() == 'SNN4IMAGENET') {
  261. $(".cloudbrain_snn4imagenet").show();
  262. } else if ($(this).val() == 'BRAINSCORE') {
  263. $(".cloudbrain_brainscore").show();
  264. } else {
  265. $(".cloudbrain_benchmark").hide();
  266. $(".cloudbrain_snn4imagenet").hide();
  267. $(".cloudbrain_brainscore").hide();
  268. }
  269. })
  270. })
  271. $('.ui.green.button').click(function () {
  272. if (!$('input[name="isBranches"]').val()) {
  273. return false
  274. }
  275. selected_value = $("#cloudbrain_benchmark_category").val()
  276. $('#store_category').attr("value", selected_value)
  277. })
  278. ;(function() {
  279. var SPECS = {{ .debug_specs }};
  280. var showPoint = true;
  281. window.renderSpecsSelect($('#__specs__'), SPECS, showPoint, {
  282. gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
  283. free: {{$.i18n.Tr "cloudbrain.free"}},
  284. point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
  285. memory: {{$.i18n.Tr "cloudbrain.memory"}},
  286. shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
  287. });
  288. })();
  289. </script>