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

3 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
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
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
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
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
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
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
4 years ago
3 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
4 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
3 years ago
3 years ago
3 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
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. {{template "base/head" .}}
  2. <style>
  3. .unite{
  4. font-family: SourceHanSansSC-medium !important;
  5. color: rgba(16, 16, 16, 100) !important;
  6. }
  7. .title{
  8. font-size: 16px !important;
  9. padding-left: 3rem !important;
  10. }
  11. .min_title{
  12. font-size: 14px !important;
  13. margin-bottom: 2rem !important;
  14. }
  15. .width{
  16. width:100% !important;
  17. }
  18. .width48{
  19. width: 48.5% !important;
  20. }
  21. .width80{
  22. width: 80.7% !important;
  23. margin-left: 10px;
  24. }
  25. .width85{
  26. width: 85% !important;
  27. margin-left: 4.5rem !important;
  28. }
  29. .width81{
  30. margin-left: 1.5rem;
  31. width: 81% !important;
  32. }
  33. .add{font-size: 18px;
  34. padding: 0.5rem;
  35. border: 1px solid rgba(187, 187, 187, 100);
  36. border-radius: 0px 5px 5px 0px;
  37. line-height: 21px;
  38. text-align: center;
  39. color: #C2C7CC;
  40. }
  41. .min{
  42. font-size: 18px;
  43. padding: 0.5rem;
  44. border: 1px solid rgba(187, 187, 187, 100);
  45. border-radius: 5px 0px 0px 5px;
  46. line-height: 21px;
  47. text-align: center;
  48. color: #C2C7CC;
  49. }
  50. .label-fix-width{
  51. width: 140px !important;
  52. text-align: right;
  53. font-family: SourceHanSansSC-medium !important;
  54. color: rgba(16, 16, 16, 100) !important;
  55. font-size: 14px !important;
  56. }
  57. </style>
  58. <!-- <div class="ui page dimmer">
  59. <div class="ui text loader">{{.i18n.Tr "loading"}}</div>
  60. </div> -->
  61. <div id="mask">
  62. <div id="loadingPage">
  63. <div class="rect1"></div>
  64. <div class="rect2"></div>
  65. <div class="rect3"></div>
  66. <div class="rect4"></div>
  67. <div class="rect5"></div>
  68. </div>
  69. </div>
  70. <div class="repository">
  71. {{template "repo/header" .}}
  72. <div class="ui container">
  73. <div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.cloudbraintype}}" data-repo-link="{{.RepoLink}}"></div>
  74. {{template "base/alert" .}}
  75. <h4 class="ui top attached header">
  76. {{.i18n.Tr "repo.modelarts.train_job.new"}}
  77. </h4>
  78. <div class="ui attached segment">
  79. <!-- equal width -->
  80. <form class="ui form" action="{{.Link}}" method="post">
  81. {{.CsrfTokenHtml}}
  82. <input type="hidden" name="action" value="update">
  83. <input type="hidden" id="ai_engine_name" name="engine_names" value="">
  84. <input type="hidden" id="ai_flaver_name" name="flaver_names" value="">
  85. <h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
  86. <div class="required inline min_title field">
  87. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  88. <div class="ui blue mini menu compact selectcloudbrain">
  89. <a class="item" href="{{.RepoLink}}/cloudbrain/train-job/create">
  90. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  91. height="16">
  92. <path fill="none" d="M0 0h24v24H0z" />
  93. <path
  94. 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" />
  95. </svg>
  96. CPU/GPU
  97. </a>
  98. <a class="active item" href="{{.RepoLink}}/modelarts/train-job/create">
  99. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  100. height="16">
  101. <path fill="none" d="M0 0h24v24H0z" />
  102. <path
  103. 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" />
  104. </svg>
  105. Ascend NPU</a>
  106. </div>
  107. </div>
  108. <div class="required inline min_title field">
  109. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
  110. <input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="64">
  111. <span class="tooltips" style="margin-left:11.5rem;display: block;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span>
  112. </div>
  113. <div class="inline min_title field">
  114. <label class="label-fix-width" style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}</label>
  115. <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="255" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 255)"></textarea>
  116. </div>
  117. <div class="ui divider"></div>
  118. <h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.parameter_setting"}}:</h4>
  119. <div class="required inline min_title field">
  120. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.code_version"}}</label>
  121. <select class="ui dropdown width80 left2" id="code_version" name="branch_name">
  122. {{if .branch_name}}
  123. <option name="branch_name" value="{{.branch_name}}">{{.branch_name}}</option>
  124. {{range $k, $v :=.Branches}}
  125. {{ if ne $v $.branch_name }}
  126. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  127. {{end}}
  128. {{end}}
  129. {{else}}
  130. <option name="branch_name" value="{{.branchName}}">{{.branchName}}</option>
  131. {{range $k, $v :=.Branches}}
  132. {{ if ne $v $.branchName }}
  133. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  134. {{end}}
  135. {{end}}
  136. {{end}}
  137. </select>
  138. </div>
  139. <div class="required inline min_title fields" style="width: 95%;">
  140. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.AI_driver"}}</label>
  141. <div class="field" style="flex: 1.5;">
  142. <select class="ui dropdown width" id="trainjob_engines">
  143. {{range .engines}}
  144. <option value="{{.Value}}">{{.Value}}</option>
  145. {{end}}
  146. </select>
  147. </div>
  148. <div class="field" style="flex: 2;" id="engine_name">
  149. <select class="ui dropdown width" id="trainjob_engine_versions" name="engine_id">
  150. {{range .engine_versions}}
  151. <option name="engine_id" value="{{.ID}}">{{.Value}}</option>
  152. {{end}}
  153. </select>
  154. </div>
  155. </div>
  156. <div class="inline field min_title required">
  157. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label>
  158. {{if .bootFile}}
  159. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="{{.bootFile}}" tabindex="3" autofocus required maxlength="255" >
  160. {{else}}
  161. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="" tabindex="3" autofocus required maxlength="255" >
  162. {{end}}
  163. <span>
  164. <i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i>
  165. </span>
  166. <a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
  167. </div>
  168. <div id="select-multi-dataset">
  169. </div>
  170. <span class="tooltips" style="margin-left: 11.5rem;margin-bottom: 1rem;">{{.i18n.Tr "cloudbrain.dataset_path_rule"}}</span>
  171. <div class="inline min_title field">
  172. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label>
  173. <span id="add_run_para" style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;"><i class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}</span>
  174. <input id="store_run_para" type="hidden" name="run_para_list">
  175. <div class="dynamic field" style="margin-top: 1rem;">
  176. {{if ne 0 (len .params)}}
  177. {{range $k ,$v := .params}}
  178. <div class="two fields width85" id="para{{$k}}">
  179. <div class="field">
  180. <input type="text" name="shipping_first-name" value={{$v.Label}} required>
  181. </div>
  182. <div class="field">
  183. <input type="text" name="shipping_last-name" value={{$v.Value}} required>
  184. </div>
  185. <span>
  186. <i class="trash icon"></i>
  187. </span>
  188. </div>
  189. {{end}}
  190. {{end}}
  191. </div>
  192. </div>
  193. <div class="required min_title field " style="display: none;">
  194. <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.resource_pool"}}</label>
  195. <select class="ui dropdown" id="trainjob_resource_pool" style='width:385px' name="pool_id">
  196. {{range .resource_pools}}
  197. <option value="{{.ID}}">{{.Value}}</option>
  198. {{end}}
  199. </select>
  200. </div>
  201. <div class="required grouped fields" style="display: none;">
  202. <label style="font-weight: normal;"
  203. for="resource_type">{{.i18n.Tr "repo.modelarts.train_job.resource_type"}}</label>
  204. <div class="field">
  205. <div class="ui grid">
  206. <div class="column">
  207. <div class="ui radio checkbox">
  208. <input type="radio" name="resource_type" checked="" tabindex="0">
  209. </div>
  210. </div>
  211. <div class="three wide column">train-private-1</div>
  212. <div class="three wide column">{{svg "octicon-verified" 16}} 运行中</div>
  213. <div class="three wide column"> CPU:192 核 2048GiB</div>
  214. </div>
  215. </div>
  216. </div>
  217. <div class="required inline min_title field" id="flaver_name">
  218. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
  219. <select class="ui dropdown width48" id="trainjob-flavor" name="flavor">
  220. {{range .flavor_infos}}
  221. <option name="flavor" value="{{.Code}}">{{.Value}}</option>
  222. {{end}}
  223. </select>
  224. </div>
  225. <div class="inline required min_title field">
  226. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.amount_of_compute_node"}}</label>
  227. <div class="ui labeled input" style="width: 5%;">
  228. <input style="border-radius: 0;text-align: center;" type="hidden" name="work_server_number"
  229. id="trainjob_work_server_num" tabindex="3" autofocus required maxlength="255" value="1"
  230. readonly>
  231. <div class="field" id="trainjob_work_server_num_select" name="work_server_number_select">
  232. <select class="ui dropdown width" style='width: 100%;' name="work_server_id">
  233. <option name="server_id" value="1">1</option>
  234. </select>
  235. </div>
  236. </div>
  237. </div>
  238. <div class="inline field" style="padding: 1rem 0;">
  239. <label class="label-fix-width"></label>
  240. <button class="ui create_train_job green button">
  241. {{.i18n.Tr "repo.cloudbrain.new"}}
  242. </button>
  243. <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  244. </div>
  245. <!-- 模态框 -->
  246. </form>
  247. </div>
  248. </div>
  249. </div>
  250. {{template "base/footer" .}}
  251. <script>
  252. let url_href = window.location.pathname.split('create')[0]
  253. $(".ui.button").attr('href', url_href)
  254. $('select.dropdown')
  255. .dropdown();
  256. $('.menu .item')
  257. .tab();
  258. // let sever_num = $("#trainjob_work_server_num_select .text").text() //$('#trainjob_work_server_num')
  259. // console.log("sever_num:",sever_num)
  260. // $('.add').click(function(){
  261. // sever_num.val(parseInt(sever_num.val())+1)
  262. // if(sever_num.val()>=26){
  263. // sever_num.val(parseInt(sever_num.val())-1)
  264. // }
  265. // })
  266. // $('.min').click(function(){
  267. // sever_num.val(parseInt(sever_num.val())-1)
  268. // if(sever_num.val()<=0){
  269. // sever_num.val(parseInt(sever_num.val())+1)
  270. // }
  271. // })
  272. // 参数增加、删除、修改、保存
  273. function Add_parameter(i) {
  274. value = '<div class="two fields width85" id= "para' + i + '">' +
  275. '<div class="field">' +
  276. '<input type="text" name="shipping_first-name" required placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}> ' +
  277. '</div> ' +
  278. '<div class="field"> ' +
  279. '<input type="text" name="shipping_last-name" required placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}>' +
  280. '</div>' +
  281. '<span>' +
  282. '<i class="trash icon">' +
  283. '</i>' +
  284. '</span>' +
  285. '</div>'
  286. $(".dynamic.field").append(value)
  287. }
  288. $('#add_run_para').click(function () {
  289. var len = $(".dynamic.field .two.fields").length
  290. Add_parameter(len)
  291. });
  292. $(".dynamic.field").on("click", ".trash.icon", function () {
  293. var index = $(this).parent().parent().index()
  294. $(this).parent().parent().remove()
  295. var len = $(".dynamic.field .two.fields").length
  296. $(".dynamic.field .two.fields").each(function () {
  297. var cur_index = $(this).index()
  298. $(this).attr('id', 'para' + cur_index)
  299. })
  300. });
  301. $('.ui.parameter.green.button').click(function () {
  302. var parameters = [];
  303. $('table tr').each(function () {
  304. $(this).find('td:eq(1)').each(function () {
  305. parameters.push($(this).text());
  306. })
  307. $(this).find('input').each(function () {
  308. parameters.push($(this).text())
  309. })
  310. });
  311. $('.ui.parameter.modal')
  312. .modal('hide');
  313. for (var i = 2; i < parameters.length; i++) {
  314. switch (i) {
  315. // 数据集uuid待完成
  316. // case (2):
  317. // console.log(1)
  318. // break;
  319. // $("#trainjob_datasets").val(parameters[i]);
  320. // console.log($("#trainjob_datasets").val())
  321. case (3):
  322. $("input[name='boot_file']").val(parameters[i]);
  323. break;
  324. case (4):
  325. var para = parameters[i].split(" ")
  326. for (var j = 0; j < para.length; j++) {
  327. var para_name = para[j].split('=')[0]
  328. var para_value = para[j].split('=')[1]
  329. var len = $(".dynamic.field .two.fields").length
  330. Add_parameter(len)
  331. var pid = 'para' + len
  332. $(".dynamic.field" + " #" + pid + "").find("input[name=shipping_first-name]").val(para_name)
  333. $(".dynamic.field" + " #" + pid + "").find("input[name=shipping_last-name]").val(para_value)
  334. }
  335. break;
  336. // 数据集pool_id待完成
  337. // case (5):
  338. // $("select[name='pool_id']").val(parameters[i]);
  339. // break;
  340. case (6):
  341. // $("input[name='work_server_number']").val(parameters[i]);
  342. break;
  343. }
  344. }
  345. })
  346. $('.ui.save.checkbox').click(function () {
  347. $(this).checkbox({
  348. onChange: function () {
  349. if ($('.ui.save.checkbox').checkbox('is checked')) {
  350. $('#save_para').removeClass("disabled")
  351. } else {
  352. $('#save_para').addClass("disabled")
  353. }
  354. }
  355. });
  356. })
  357. $('.question.circle.icon').hover(function () {
  358. $(this).popup('show')
  359. });
  360. $(".item.active.parameter_config").click(function () {
  361. $('.ui.parameter.modal')
  362. .modal('setting', 'closable', false)
  363. .modal('show');
  364. })
  365. $('.ui.deny.button').click(function () {
  366. $('.ui.parameter.modal')
  367. .modal('hide');
  368. })
  369. $('select.dropdown')
  370. .dropdown();
  371. function validate() {
  372. $('.ui.form')
  373. .form({
  374. on: 'blur',
  375. fields: {
  376. boot_file: {
  377. identifier: 'boot_file',
  378. rules: [
  379. {
  380. type: 'regExp[/.+\.py$/g]',
  381. }
  382. ]
  383. },
  384. display_job_name: {
  385. identifier: 'display_job_name',
  386. rules: [
  387. {
  388. type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]',
  389. }
  390. ]
  391. },
  392. attachment: {
  393. identifier: 'attachment',
  394. rules: [
  395. {
  396. type: 'empty',
  397. }
  398. ]
  399. },
  400. work_server_number: {
  401. identifier: 'work_server_number',
  402. rules: [
  403. {
  404. type: 'integer[1..25]',
  405. }
  406. ]
  407. }
  408. },
  409. onSuccess: function () {
  410. // $('.ui.page.dimmer').dimmer('show')
  411. document.getElementById("mask").style.display = "block"
  412. },
  413. onFailure: function (e) {
  414. return false;
  415. }
  416. })
  417. }
  418. document.onreadystatechange = function () {
  419. if (document.readyState === "complete") {
  420. document.getElementById("mask").style.display = "none"
  421. }
  422. }
  423. function send_run_para() {
  424. var run_parameters = []
  425. var msg = {}
  426. $(".dynamic.field .two.fields").each(function () {
  427. var para_name = $(this).find('input[name=shipping_first-name]').val()
  428. var para_value = $(this).find('input[name=shipping_last-name]').val()
  429. run_parameters.push({ "label": para_name, "value": para_value })
  430. })
  431. msg["parameter"] = run_parameters
  432. msg = JSON.stringify(msg)
  433. $('#store_run_para').val(msg)
  434. }
  435. function get_name() {
  436. let name1 = $("#engine_name .text").text()
  437. let name2 = $("#flaver_name .text").text()
  438. $("input#ai_engine_name").val(name1)
  439. $("input#ai_flaver_name").val(name2)
  440. let val_server_num_select = $("#trainjob_work_server_num_select .text").text()
  441. // console.log("val_server_num_select:",val_server_num_select)
  442. $("input#trainjob_work_server_num").val(val_server_num_select)
  443. }
  444. $('.ui.create_train_job.green.button').click(function (e) {
  445. get_name()
  446. send_run_para()
  447. validate()
  448. })
  449. </script>