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

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
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 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
3 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
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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. .select2-container .select2-selection--single{
  81. height:38px !important;
  82. }
  83. .select2-container--default .select2-selection--single {
  84. border : 1px solid rgba(34,36,38,.15) !important;
  85. }
  86. .select2-container--default .select2-selection--single .select2-selection__rendered{
  87. line-height: 38px !important;
  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. {{template "base/alert" .}}
  104. <form id="form_id" class="ui form" action="{{.Link}}" method="post">
  105. {{.CsrfTokenHtml}}
  106. <h3 class="ui top attached header">
  107. {{.i18n.Tr "repo.cloudbrain.new"}}
  108. </h3>
  109. <div class="ui attached segment">
  110. <div class="inline required field">
  111. <label>任务名称</label>
  112. <input name="job_name" id="cloudbrain_job_name" placeholder="任务名称" value="{{.job_name}}" tabindex="3" autofocus required maxlength="255">
  113. </div>
  114. <div class="inline required field" style="{{if .is_benchmark_enabled}}display:block;{{else if .is_snn4imagenet_enabled}}display:block;{{else}}display:none;{{end}}">
  115. <label>任务类型</label>
  116. <select id="cloudbrain_job_type" class="ui search dropdown" placeholder="选择任务类型" style='width:385px' name="job_type">
  117. <option name="job_type" value="DEBUG">DEBUG</option>
  118. <option name="job_type" value="BENCHMARK">BENCHMARK</option>
  119. <option name="job_type" value="SNN4IMAGENET">SNN4IMAGENET</option>
  120. </select>
  121. </div>
  122. <div class="inline required field cloudbrain_benchmark">
  123. <label style="vertical-align: top; margin-top:9px">数据集类别</label>
  124. <select class="ui search dropdown" multiple="multiple" id="cloudbrain_benchmark_category" style='width:385px'>
  125. {{range .benchmark_categories}}
  126. <option value="{{.Value}}">{{.Value}}</option>
  127. {{end}}
  128. </select>
  129. <div class="mini ui buttons" style="vertical-align: top; margin-top:9px">
  130. <button class="ui button reset">重置</button>
  131. <div class="or"></div>
  132. <button class="ui positive button active all_selected">全选</button>
  133. </div>
  134. </div>
  135. <input id="store_category" type="hidden" name="get_benchmark_category">
  136. <div class="inline required field cloudbrain_benchmark">
  137. <label>GPU类型</label>
  138. <select id="cloudbrain_gpu_type" class="ui search dropdown" placeholder="选择GPU类型" style='width:385px' name="gpu_type">
  139. {{range .gpu_types}}
  140. <option value="{{.Queue}}">{{.Value}}</option>
  141. {{end}}
  142. </select>
  143. </div>
  144. <div class="inline required field">
  145. <label>镜像</label>
  146. <input type="text" list="cloudbrain_image" placeholder="选择镜像" name="image">
  147. <datalist class="ui search" id="cloudbrain_image" style='width:385px;' name="image">
  148. {{range .images}}
  149. <option name="image" value="{{.Place}}">{{.PlaceView}}</option>
  150. {{end}}
  151. {{range .public_images}}
  152. <option name="image" value="{{.Place}}">{{.PlaceView}}</option>
  153. {{end}}
  154. </datalist>
  155. </div>
  156. <div class="inline required field">
  157. <label>数据集(只有zip格式的数据集才能发起云脑任务)</label>
  158. <select id="cloudbrain_dataset" class="ui search dropdown" placeholder="选择数据集" style='width:385px' name="attachment">
  159. {{range .attachments}}
  160. <option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option>
  161. {{end}}
  162. </select>
  163. </div>
  164. <div class="inline required field">
  165. <label>资源规格</label>
  166. <select id="cloudbrain_resource_spec" class="ui search dropdown" placeholder="选择资源规格" style='width:385px' name="resource_spec_id">
  167. {{range .resource_specs}}
  168. <option name="resource_spec_id" value="{{.Id}}">GPU数:{{.GpuNum}},CPU数:{{.CpuNum}},内存(MB):{{.MemMiB}},共享内存(MB):{{.ShareMemMiB}}</option>
  169. {{end}}
  170. </select>
  171. </div>
  172. <div class="inline required field">
  173. <label>数据集存放路径</label>
  174. <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  175. </div>
  176. <div class="inline required field">
  177. <label>模型存放路径</label>
  178. <input name="model_path" id="cloudbrain_model_path" value="{{.model_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  179. </div>
  180. <div class="inline required field">
  181. <label>代码存放路径</label>
  182. <input name="code_path" id="cloudbrain_code_path" value="{{.code_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  183. </div>
  184. <div class="inline required field cloudbrain_benchmark">
  185. <label>benchmark脚本存放路径</label>
  186. <input name="benchmark_path" id="cloudbrain_benchmark_path" value="{{.benchmark_path}}" tabindex="3" autofocus required maxlength="255" readonly="readonly">
  187. </div>
  188. <div class="inline required field cloudbrain_snn4imagenet">
  189. <label>snn4imagenet脚本存放路径</label>
  190. <input name="snn4imagenet_path" id="cloudbrain_snn4imagenet_path" value="{{.snn4imagenet_path}}" tabindex="3" autofocus required maxlength="255" readonly="readonly">
  191. </div>
  192. <div class="inline required field" hidden>
  193. <label>启动命令</label>
  194. <textarea name="command" rows="10" readonly="readonly">{{.command}}</textarea>
  195. </div>
  196. <div class="inline field">
  197. <label></label>
  198. <button class="ui green button" >
  199. {{.i18n.Tr "repo.cloudbrain.new"}}
  200. </button>
  201. <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  202. </div>
  203. </div>
  204. </form>
  205. </div>
  206. </div>
  207. </div>
  208. {{template "base/footer" .}}
  209. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  210. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  211. <script>
  212. let url_href = window.location.pathname.split('create')[0]
  213. $(".ui.button").attr('href',url_href)
  214. let form = document.getElementById('form_id');
  215. let value_image = $("input[name='image']").val()
  216. console.log("value_image",$("input[name='image']").val())
  217. form.onsubmit = function(e){
  218. let value_task = $("input[name='job_name']").val()
  219. let value_image = $("input[name='image']").val()
  220. let re = /^[a-zA-Z0-9-.]+$/
  221. let flag = re.test(value_task)
  222. if(!flag){
  223. alert("任务名称只能包含字母,数字,'-',和'.'")
  224. return false
  225. }
  226. if(!value_image){
  227. alert("镜像为空")
  228. return false
  229. }
  230. let min_value_task = value_task.toLowerCase()
  231. console.log(min_value_task)
  232. $("input[name='job_name']").attr("value",min_value_task)
  233. document.getElementById("mask").style.display = "block"
  234. }
  235. // 页面加载完毕后遮罩层隐藏
  236. document.onreadystatechange = function() {
  237. if (document.readyState === "complete") {
  238. document.getElementById("mask").style.display = "none"
  239. }
  240. }
  241. $('#cloudbrain_benchmark_category')
  242. .dropdown({
  243. placeholder: "选择数据集类别",
  244. })
  245. $('select.dropdown')
  246. .dropdown();
  247. // $('#cloudbrain_image').select2({
  248. // placeholder: "选择镜像"
  249. // });
  250. $(".ui.button.reset").click(function(e){
  251. e.preventDefault()
  252. $('#cloudbrain_benchmark_category')
  253. .dropdown("clear", true)
  254. })
  255. $(".ui.positive.button.active.all_selected").click(function(e){
  256. e.preventDefault()
  257. var selected_value = new Array()
  258. $("#cloudbrain_benchmark_category option").each(function(){
  259. selected_value.push($(this).val())
  260. });
  261. $('#cloudbrain_benchmark_category')
  262. .dropdown("set exactly", selected_value)
  263. })
  264. $(function() {
  265. $("#cloudbrain_job_type").change(function() {
  266. if ($(this).val() == 'BENCHMARK') {
  267. $(".cloudbrain_benchmark").show();
  268. } else if ($(this).val() == 'SNN4IMAGENET') {
  269. $(".cloudbrain_snn4imagenet").show();
  270. } else {
  271. $(".cloudbrain_benchmark").hide();
  272. $(".cloudbrain_snn4imagenet").hide();
  273. }
  274. })
  275. })
  276. $('.ui.green.button').click(function() {
  277. selected_value = $("#cloudbrain_benchmark_category").val()
  278. $('#store_category').attr("value", selected_value)
  279. })
  280. </script>