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

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
4 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
4 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
2 years ago
4 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
3 years ago
3 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
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 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
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
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
2 years ago
2 years ago
3 years ago
2 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
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. {{template "base/head" .}}
  2. <style>
  3. /* 遮罩层css效果图 */
  4. #mask {
  5. position: fixed;
  6. top: 0px;
  7. left: 0px;
  8. right: 0px;
  9. bottom: 0px;
  10. filter: alpha(opacity=60);
  11. background-color: #777;
  12. z-index: 1000;
  13. display: none;
  14. opacity: 0.8;
  15. -moz-opacity: 0.5;
  16. padding-top: 100px;
  17. color: #000000
  18. }
  19. /* 加载圈css效果图 */
  20. #loadingPage {
  21. margin: 200px auto;
  22. width: 50px;
  23. height: 40px;
  24. text-align: center;
  25. font-size: 10px;
  26. display: block;
  27. }
  28. #loadingPage>div {
  29. background-color: green;
  30. height: 100%;
  31. width: 6px;
  32. display: inline-block;
  33. -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
  34. animation: sk-stretchdelay 1.2s infinite ease-in-out;
  35. }
  36. #loadingPage .rect2 {
  37. -webkit-animation-delay: -1.1s;
  38. animation-delay: -1.1s;
  39. }
  40. #loadingPage .rect3 {
  41. -webkit-animation-delay: -1.0s;
  42. animation-delay: -1.0s;
  43. }
  44. #loadingPage .rect4 {
  45. -webkit-animation-delay: -0.9s;
  46. animation-delay: -0.9s;
  47. }
  48. #loadingPage .rect5 {
  49. -webkit-animation-delay: -0.8s;
  50. animation-delay: -0.8s;
  51. }
  52. @-webkit-keyframes sk-stretchdelay {
  53. 0%,
  54. 40%,
  55. 100% {
  56. -webkit-transform: scaleY(0.4)
  57. }
  58. 20% {
  59. -webkit-transform: scaleY(1.0)
  60. }
  61. }
  62. @keyframes sk-stretchdelay {
  63. 0%,
  64. 40%,
  65. 100% {
  66. transform: scaleY(0.4);
  67. -webkit-transform: scaleY(0.4);
  68. }
  69. 20% {
  70. transform: scaleY(1.0);
  71. -webkit-transform: scaleY(1.0);
  72. }
  73. }
  74. .inline.required.field.cloudbrain_benchmark {
  75. display: none;
  76. }
  77. .inline.required.field.cloudbrain_snn4imagenet {
  78. display: none;
  79. }
  80. .inline.required.field.cloudbrain_brainscore {
  81. display: none;
  82. }
  83. .icons {
  84. /* position: absolute !important;
  85. right: 150px;
  86. top: 14px;
  87. z-index: 2; */
  88. }
  89. </style>
  90. <div id="mask">
  91. <div id="loadingPage">
  92. <div class="rect1"></div>
  93. <div class="rect2"></div>
  94. <div class="rect3"></div>
  95. <div class="rect4"></div>
  96. <div class="rect5"></div>
  97. </div>
  98. </div>
  99. <div class="repository">
  100. {{template "repo/header" .}}
  101. <div class="repository new repo ui middle very relaxed page grid">
  102. <div class="column">
  103. <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>
  104. {{template "base/alert" .}}
  105. <div class="ui negative message" id="messageInfo">
  106. <p></p>
  107. </div>
  108. <form id="form_id" class="ui form" action="{{.Link}}" method="post">
  109. {{.CsrfTokenHtml}}
  110. <input type="hidden" name='isBranches' value="{{.Branches}}">
  111. <h3 class="ui top attached header">
  112. {{.i18n.Tr "repo.cloudbrain.new"}}
  113. </h3>
  114. <div class="ui attached segment">
  115. <div class="inline required field">
  116. <label>{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  117. <div class="ui blue small menu compact selectcloudbrain">
  118. <a class="active item" href="{{.RepoLink}}/cloudbrain/create">
  119. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  120. height="16">
  121. <path fill="none" d="M0 0h24v24H0z" />
  122. <path
  123. 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" />
  124. </svg>
  125. CPU/GPU
  126. </a>
  127. <a class="item" href="{{.RepoLink}}/modelarts/notebook/create">
  128. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  129. height="16">
  130. <path fill="none" d="M0 0h24v24H0z" />
  131. <path
  132. 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" />
  133. </svg>
  134. Ascend NPU</a>
  135. </div>
  136. {{template "custom/wait_count" .}}
  137. </div>
  138. <div class="inline required field">
  139. <label>{{.i18n.Tr "cloudbrain.task_name"}}</label>
  140. <input name="display_job_name" id="cloudbrain_job_name"
  141. placeholder="{{.i18n.Tr "cloudbrain.task_name"}}" value="{{.display_job_name}}" tabindex="3"
  142. autofocus required maxlength="255" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  143. </div>
  144. <div class="inline required field">
  145. <label>{{.i18n.Tr "cloudbrain.task_type"}}</label>
  146. <select id="cloudbrain_job_type" class="ui search dropdown"
  147. placeholder="{{.i18n.Tr "cloudbrain.task_type"}}" style='width:385px' name="job_type">
  148. <option name="job_type" value="DEBUG">DEBUG</option>
  149. </select>
  150. </div>
  151. <div class="inline required field cloudbrain_benchmark">
  152. <label style="vertical-align: top; margin-top:9px">数据集类别</label>
  153. <select class="ui search dropdown" multiple="multiple" id="cloudbrain_benchmark_category"
  154. style='width:385px'>
  155. {{range .benchmark_categories}}
  156. <option value="{{.Value}}">{{.Value}}</option>
  157. {{end}}
  158. </select>
  159. <div class="mini ui buttons" style="vertical-align: top; margin-top:9px">
  160. <button class="ui button reset">重置</button>
  161. <div class="or"></div>
  162. <button class="ui positive button active all_selected">全选</button>
  163. </div>
  164. </div>
  165. <input id="store_category" type="hidden" name="get_benchmark_category">
  166. <div class="inline required field">
  167. <label>{{.i18n.Tr "repo.modelarts.code_version"}}</label>
  168. <select class="ui dropdown width80 left2 {{if not .Branches}}error{{end}}" id="code_version"
  169. name="branch_name">
  170. {{if .branch_name}}
  171. <option name="branch_name" value="{{.branch_name}}">{{.branch_name}}</option>
  172. {{range $k, $v :=.Branches}}
  173. {{ if ne $v $.branch_name }}
  174. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  175. {{end}}
  176. {{end}}
  177. {{else}}
  178. <option name="branch_name" value="{{.branchName}}">{{.branchName}}</option>
  179. {{range $k, $v :=.Branches}}
  180. {{ if ne $v $.branchName }}
  181. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  182. {{end}}
  183. {{end}}
  184. {{end}}
  185. </select>
  186. </div>
  187. <div class="inline required field">
  188. <label>{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
  189. <select id="cloudbrain_gpu_type" class="ui search dropdown gpu-type" placeholder="选择GPU类型"
  190. style='width:385px' name="gpu_type">
  191. {{range .gpu_types}}
  192. <option value="{{.Queue}}">{{.Value}}</option>
  193. {{end}}
  194. </select>
  195. </div>
  196. <div id="images-new-cb">
  197. </div>
  198. <div id="select-multi-dataset">
  199. </div>
  200. <div class="inline required field">
  201. <label>{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  202. <select id="cloudbrain_resource_spec" class="ui search dropdown"
  203. placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
  204. name="resource_spec_id">
  205. {{range .resource_specs}}
  206. <option name="resource_spec_id" value="{{.Id}}">
  207. {{$.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}}
  208. </option>
  209. {{end}}
  210. </select>
  211. </div>
  212. <div class="inline required field">
  213. <label>{{.i18n.Tr "cloudbrain.dataset_storage_path"}}</label>
  214. <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3"
  215. disabled autofocus required maxlength="255" readonly="readonly">
  216. </div>
  217. <div class="inline required field">
  218. <label>{{.i18n.Tr "cloudbrain.model_storage_path"}}</label>
  219. <input name="model_path" id="cloudbrain_model_path" value="{{.model_path}}" tabindex="3"
  220. disabled autofocus required maxlength="255" readonly="readonly">
  221. </div>
  222. <div class="inline required field">
  223. <label>{{.i18n.Tr "cloudbrain.code_storage_path"}}</label>
  224. <input name="code_path" id="cloudbrain_code_path" value="{{.code_path}}" tabindex="3" disabled
  225. autofocus required maxlength="255" readonly="readonly">
  226. </div>
  227. <div class="inline required field cloudbrain_benchmark">
  228. <label>{{.i18n.Tr "cloudbrain.benchmark_path"}}</label>
  229. <input name="benchmark_path" id="cloudbrain_benchmark_path" value="{{.benchmark_path}}"
  230. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  231. </div>
  232. <div class="inline required field cloudbrain_snn4imagenet">
  233. <label>{{.i18n.Tr "cloudbrain.snn4imagenet_path"}}</label>
  234. <input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}"
  235. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  236. </div>
  237. <div class="inline required field cloudbrain_brainscore">
  238. <label>{{.i18n.Tr "cloudbrain.brainscore_path"}}</label>
  239. <input name="brainscore_path" id="cloudbrain_brainscore_path" value="{{.brainscore_path}}"
  240. tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  241. </div>
  242. <div class="inline required field" hidden>
  243. <label>{{.i18n.Tr "cloudbrain.start_command"}}</label>
  244. <textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea>
  245. </div>
  246. <div class="inline field">
  247. <label></label>
  248. <button class="ui green button">
  249. {{.i18n.Tr "repo.cloudbrain.new"}}
  250. </button>
  251. <a class="ui button cancel"
  252. href="{{.RepoLink}}/debugjob?debugListType=all">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  253. </div>
  254. </div>
  255. </form>
  256. </div>
  257. </div>
  258. </div>
  259. {{template "base/footer" .}}
  260. <script>
  261. let form = document.getElementById('form_id');
  262. $('#messageInfo').css('display', 'none')
  263. function clearValue() {
  264. context = inputs[0]
  265. context.value = ''
  266. $(".icon.icons").css("visibility", "hidden")
  267. }
  268. form.onsubmit = function (e) {
  269. let value_task = $("input[name='display_job_name']").val()
  270. let value_image = $("input[name='image']").val()
  271. let value_data = $("input[name='attachment']").val()
  272. let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/
  273. let flag = re.test(value_task)
  274. if (!flag) {
  275. $('#messageInfo').css('display', 'block')
  276. let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。'
  277. $('#messageInfo p').text(str)
  278. return false
  279. }
  280. let min_value_task = value_task.toLowerCase()
  281. $("input[name='display_job_name']").attr("value", min_value_task)
  282. document.getElementById("mask").style.display = "block"
  283. }
  284. // 页面加载完毕后遮罩层隐藏
  285. document.onreadystatechange = function () {
  286. if (document.readyState === "complete") {
  287. document.getElementById("mask").style.display = "none"
  288. }
  289. }
  290. $('#cloudbrain_benchmark_category')
  291. .dropdown({
  292. placeholder: "选择数据集类别",
  293. })
  294. console.log("=======================")
  295. // $(document).ready(function(){
  296. // let waitNums = $('.cloudbrain-type').data('queue').split('map')[1]
  297. // let test = new Map()
  298. // let waitNumsArray = waitNums.split(' ')
  299. // waitNumsArray.forEach((element,index) => {
  300. // if(index===0){
  301. // test.set(element.slice(1,-2),parseInt(element.slice(-1)))
  302. // }else if(index===waitNumsArray.length-1){
  303. // test.set(element.slice(0,-3),parseInt(element.slice(-2,-1)))
  304. // }else{
  305. // test.set(element.slice(0,-2),parseInt(element.slice(-1)))
  306. // }
  307. // });
  308. // console.log(test)
  309. // $('.ui.search.dropdown.gpu-type').dropdown({
  310. // onChange: function(value, text, $selectedItem) {
  311. // console.log("=-------------",value)
  312. // console.log("=-------------",test.get(value))
  313. // let gpuTypeNums= test.get(value)
  314. // $('#gpu-nums').text("{{.i18n.Tr "repo.wait_count_start"}}"+gpuTypeNums+"{{.i18n.Tr "repo.wait_count_end"}}")
  315. // }
  316. // });
  317. // })
  318. // $('#cloudbrain_image').select2({
  319. // placeholder: "选择镜像"
  320. // });
  321. $(".ui.button.reset").click(function (e) {
  322. e.preventDefault()
  323. $('#cloudbrain_benchmark_category')
  324. .dropdown("clear", true)
  325. })
  326. $(".ui.positive.button.active.all_selected").click(function (e) {
  327. e.preventDefault()
  328. var selected_value = new Array()
  329. $("#cloudbrain_benchmark_category option").each(function () {
  330. selected_value.push($(this).val())
  331. });
  332. $('#cloudbrain_benchmark_category')
  333. .dropdown("set exactly", selected_value)
  334. })
  335. $(function () {
  336. $("#cloudbrain_job_type").change(function () {
  337. if ($(this).val() == 'BENCHMARK') {
  338. $(".cloudbrain_benchmark").show();
  339. } else if ($(this).val() == 'SNN4IMAGENET') {
  340. $(".cloudbrain_snn4imagenet").show();
  341. } else if ($(this).val() == 'BRAINSCORE') {
  342. $(".cloudbrain_brainscore").show();
  343. } else {
  344. $(".cloudbrain_benchmark").hide();
  345. $(".cloudbrain_snn4imagenet").hide();
  346. $(".cloudbrain_brainscore").hide();
  347. }
  348. })
  349. })
  350. $('.ui.green.button').click(function () {
  351. if (!$('input[name="isBranches"]').val()) {
  352. return false
  353. }
  354. selected_value = $("#cloudbrain_benchmark_category").val()
  355. $('#store_category').attr("value", selected_value)
  356. })
  357. </script>