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.

show.tmpl 25 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
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
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
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
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
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
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
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
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
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
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
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. {{template "base/head" .}}
  2. <style>
  3. .according-panel-heading{
  4. box-sizing: border-box;
  5. padding: 8px 16px;
  6. color: #252b3a;
  7. background-color: #f2f5fc;
  8. line-height: 1.5;
  9. cursor: pointer;
  10. -moz-user-select: none;
  11. -webkit-user-select: none;
  12. -ms-user-select: none;
  13. -khtml-user-select: none;
  14. user-select: none;
  15. }
  16. .accordion-panel-title {
  17. margin-top: 0;
  18. margin-bottom: 0;
  19. color: #252b3a;
  20. }
  21. .accordion-panel-title-content{
  22. vertical-align: middle;
  23. display: inline-block;
  24. width: calc(100% - 32px);
  25. }
  26. .acc-margin-bottom {
  27. margin-bottom: 5px;
  28. }
  29. .title_text {
  30. font-size: 12px;
  31. }
  32. .ac-display-inblock {
  33. display: inline-block;
  34. }
  35. .cti-mgRight-sm {
  36. margin-right: 8px;
  37. }
  38. .ac-text-normal {
  39. font-size: 14px;
  40. color: #575d6c;
  41. }
  42. .uc-accordionTitle-black {
  43. color: #333;
  44. }
  45. .accordion-border{
  46. border:1px solid #cce2ff;
  47. }
  48. .padding0{
  49. padding: 0 !important;
  50. }
  51. .content-pad{
  52. padding: 15px 35px;
  53. }
  54. .content-margin{
  55. margin:10px 5px ;
  56. }
  57. .tab_2_content {
  58. min-height: 360px;
  59. margin-left: 10px;
  60. }
  61. .ac-grid {
  62. display: block;
  63. *zoom: 1;
  64. }
  65. .ac-grid-col {
  66. float: left;
  67. width: 100%;
  68. }
  69. .ac-grid-col2 .ac-grid-col {
  70. width: 50%;
  71. }
  72. .ti-form {
  73. text-align: left;
  74. max-width: 100%;
  75. vertical-align: middle;
  76. }
  77. .ti-form>tbody {
  78. font-size: 12px;
  79. }
  80. .ti-form>tbody, .ti-form>tbody>tr {
  81. vertical-align: inherit;
  82. }
  83. .ti-text-form-label {
  84. padding-bottom: 20px;
  85. padding-right: 20px;
  86. color: #8a8e99;
  87. font-size: 12px;
  88. white-space: nowrap;
  89. width: 80px;
  90. line-height: 30px;
  91. }
  92. .ti-text-form-content{
  93. line-height: 30px;
  94. padding-bottom: 20px;
  95. }
  96. .ti-form>tbody>tr>td {
  97. vertical-align: top;
  98. white-space: normal;
  99. }
  100. td, th {
  101. padding: 0;
  102. }
  103. .ac-grid-col .text-span {
  104. overflow: hidden;
  105. text-overflow: ellipsis;
  106. white-space: nowrap;
  107. }
  108. .redo-color{
  109. color: #3291F8;
  110. }
  111. .ti-action-menu-item:not(:last-child){
  112. margin-right: 10px;
  113. padding-right: 11px;
  114. text-decoration: none!important;
  115. color: #526ecc;
  116. cursor: pointer;
  117. display: inline-block;
  118. -moz-user-select: none;
  119. -webkit-user-select: none;
  120. -ms-user-select: none;
  121. -khtml-user-select: none;
  122. user-select: none;
  123. position: relative;
  124. }
  125. .ti-action-menu-item:not(:last-child):after {
  126. content: "";
  127. display: inline-block;
  128. position: absolute;
  129. height: 12px;
  130. right: 0;
  131. top: 50%;
  132. -webkit-transform: translateY(-6px);
  133. -ms-transform: translateY(-6px);
  134. -o-transform: translateY(-6px);
  135. transform: translateY(-6px);
  136. border-right: 1px solid #dfe1e6;
  137. }
  138. .text-width80{
  139. width: 100px;
  140. line-height: 30px;
  141. }
  142. </style>
  143. <div class="repository">
  144. {{template "repo/header" .}}
  145. <div class="ui container">
  146. <h4 class="ui header" id="vertical-segment">
  147. <a href="javascript:window.history.back();"><i class="arrow left icon"></i>返回</a>
  148. </h4>
  149. {{range $k ,$v := .version_list_task}}
  150. <div class="ui accordion">
  151. <div class="title padding0">
  152. <div class="according-panel-heading">
  153. <div class="accordion-panel-title">
  154. <i class="dropdown icon"></i>
  155. <span class="accordion-panel-title-content">
  156. <span>
  157. <div style="float: right;">
  158. <a class="ti-action-menu-item">创建模型</a>
  159. <a class="ti-action-menu-item" href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version?version_name={{.VersionName}}">修改</a>
  160. <a class="ti-action-menu-item" onclick="stopVersion({{.VersionName}})">停止</a>
  161. <a class="ti-action-menu-item" onclick="deleteVersion({{.VersionName}})" style="color: #FF4D4F;">删除</a>
  162. </div>
  163. <div class="ac-display-inblock title_text acc-margin-bottom">
  164. <span class="cti-mgRight-sm">2021/11/08 19:35:19</span>
  165. <span class="cti-mgRight-sm"> 当前版本:{{.VersionName}}</span>
  166. <span class="cti-mgRight-sm"> 父版本:{{.FatherVersionName}}</span>
  167. <span class="cti-mgRight-sm ac-text-normal title_text">状态:
  168. <span id="{{.VersionName}}-status-span"><i id="icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span>
  169. </span>
  170. <span class="ac-text-normal title_text">运行时间:</span>
  171. <span class="cti-mgRight-sm uc-accordionTitle-black" id="{{.VersionName}}-duration-span">{{.TrainJobDuration}}</span>
  172. <span data-tooltip="刷新" data-inverted="" onclick="refreshStatus({{.VersionName}})"><i class="redo icon redo-color"></i></span>
  173. </div>
  174. </span>
  175. </span>
  176. </div>
  177. </div>
  178. </div>
  179. <div class="content accordion-border">
  180. <div class="content-pad">
  181. <div class="ui pointing secondary menu">
  182. <a class="active item" data-tab="first{{$k}}">配置信息</a>
  183. <a class="item" data-tab="second{{$k}}" onclick="loadLog({{.VersionName}})">日志文件</a>
  184. <a class="item" data-tab="third{{$k}}">模型下载</a>
  185. </div>
  186. <div class="ui tab active" data-tab="first{{$k}}">
  187. <div style="padding-top: 10px;">
  188. <div class="tab_2_content">
  189. <div class="ac-grid ac-grid-col2">
  190. <div class="ac-grid-col">
  191. <table class="ti-form">
  192. <tbody class="ti-text-form">
  193. <tr class="ti-no-ng-animate">
  194. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  195. 任务名称
  196. </td>
  197. <td class="ti-text-form-content">
  198. <div class="text-span text-span-w">
  199. {{.JobName}}
  200. </div>
  201. </td>
  202. </tr>
  203. <tr class="ti-no-ng-animate">
  204. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  205. 状态
  206. </td>
  207. <td class="ti-text-form-content">
  208. <div class="text-span text-span-w" id="{{.VersionName}}-status">
  209. {{.Status}}
  210. </div>
  211. </td>
  212. </tr>
  213. <tr class="ti-no-ng-animate">
  214. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  215. 运行版本
  216. </td>
  217. <td class="ti-text-form-content">
  218. <div class="text-span text-span-w">
  219. {{.VersionName}}
  220. </div>
  221. </td>
  222. </tr>
  223. <tr class="ti-no-ng-animate">
  224. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  225. 开始时间
  226. </td>
  227. <td class="ti-text-form-content">
  228. <div class="text-span text-span-w">
  229. 空白
  230. </div>
  231. </td>
  232. </tr>
  233. <tr class="ti-no-ng-animate">
  234. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  235. 运行时间
  236. </td>
  237. <td class="ti-text-form-content">
  238. <div class="text-span text-span-w" id="{{.VersionName}}-duration">
  239. {{.TrainJobDuration}}
  240. </div>
  241. </td>
  242. </tr>
  243. <tr class="ti-no-ng-animate">
  244. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  245. 规格
  246. </td>
  247. <td class="ti-text-form-content">
  248. <div class="text-span text-span-w">
  249. {{.FlavorName}}
  250. </div>
  251. </td>
  252. </tr>
  253. <tr class="ti-no-ng-animate">
  254. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  255. 计算节点
  256. </td>
  257. <td class="ti-text-form-content">
  258. <div class="text-span text-span-w">
  259. {{.WorkServerNumber}}
  260. </div>
  261. </td>
  262. </tr>
  263. </tbody>
  264. </table>
  265. </div>
  266. <div class="ac-grid-col">
  267. <table class="ti-form">
  268. <tbody class="ti-text-form">
  269. <tr class="ti-no-ng-animate">
  270. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  271. AI引擎
  272. </td>
  273. <td class="ti-text-form-content">
  274. <div class="text-span text-span-w">
  275. {{.EngineName}}
  276. </div>
  277. </td>
  278. </tr>
  279. <tr class="ti-no-ng-animate">
  280. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  281. 代码分支
  282. </td>
  283. <td class="ti-text-form-content">
  284. <div class="text-span text-span-w">
  285. {{.BranchName}}
  286. </div>
  287. </td>
  288. </tr>
  289. <tr class="ti-no-ng-animate">
  290. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  291. 启动文件
  292. </td>
  293. <td class="ti-text-form-content">
  294. <div class="text-span text-span-w">
  295. {{.BootFile}}
  296. </div>
  297. </td>
  298. </tr>
  299. <tr class="ti-no-ng-animate">
  300. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  301. 训练数据集
  302. </td>
  303. <td class="ti-text-form-content">
  304. <div class="text-span text-span-w">
  305. {{.DatasetName}}
  306. </div>
  307. </td>
  308. </tr>
  309. <tr class="ti-no-ng-animate">
  310. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  311. 运行参数
  312. </td>
  313. <td class="ti-text-form-content">
  314. <div class="text-span text-span-w">
  315. {{.Parameters}}
  316. </div>
  317. </td>
  318. </tr>
  319. <tr class="ti-no-ng-animate">
  320. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  321. 训练输出位置
  322. </td>
  323. <td class="ti-text-form-content">
  324. <div class="text-span text-span-w">
  325. {{.TrainUrl}}
  326. </div>
  327. </td>
  328. </tr>
  329. <tr class="ti-no-ng-animate">
  330. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  331. 描述
  332. </td>
  333. <td class="ti-text-form-content">
  334. <div class="text-span text-span-w">
  335. <!-- {{.TrainUrl}} -->
  336. </div>
  337. </td>
  338. </tr>
  339. </tbody>
  340. </table>
  341. </div>
  342. </div>
  343. </div>
  344. </div>
  345. </div>
  346. <div class="ui tab" data-tab="second{{$k}}">
  347. <div>
  348. <div class="ui message" style="display: none;">
  349. <div id="header"></div>
  350. </div>
  351. <div class="ui top attached segment" style="background: #f0f0f0;">
  352. <div class="center aligned">
  353. <label>{{$.i18n.Tr "repo.modelarts.log"}}:</label>
  354. <!-- <span class="fitted file_name">{{.}}</span> -->
  355. <!-- <input type="hidden" name="file_name" value>
  356. <input type="hidden" name="start_line" value>
  357. <input type="hidden" name="end_line" value> -->
  358. </div>
  359. </div>
  360. <div class="ui attached segment log" style="height: 300px !important; overflow: auto;">
  361. <input type="hidden" class="version_name" name="version_name" value={{.VersionName}}>
  362. <input type="hidden" name="end_line" value>
  363. <input type="hidden" name="start_line" value>
  364. <pre id="log_file{{.VersionName}}"></pre>
  365. </div>
  366. </div>
  367. </div>
  368. <div class="ui tab" data-tab="third{{$k}}">
  369. <div class="content-pad">
  370. asdasd
  371. </div>
  372. </div>
  373. </div>
  374. </div>
  375. </div>
  376. {{end}}
  377. </div>
  378. </div>
  379. {{template "base/footer" .}}
  380. <script>
  381. console.log({{.version_list_task}})
  382. $('.menu .item').tab()
  383. // $('.ui.style.accordion').accordion();
  384. // $(document).ready(function(){
  385. // $('.ui.accordion').accordion({selector:{trigger:'.icon'}});
  386. // });
  387. $(document).ready(function(){
  388. $('.secondary.menu .item').tab();
  389. });
  390. var userName
  391. var repoPath
  392. var jobID
  393. $(document).ready(function(){
  394. var url = window.location.href;
  395. var urlArr = url.split('/')
  396. userName = urlArr.slice(-5)[0]
  397. repoPath = urlArr.slice(-4)[0]
  398. jobID = urlArr.slice(-1)[0]
  399. })
  400. function stopBubbling(e) {
  401. e = window.event || e;
  402. if (e.stopPropagation) {
  403. e.stopPropagation(); //阻止事件 冒泡传播
  404. } else {
  405. e.cancelBubble = true; //ie兼容
  406. }
  407. }
  408. // document.ready(refreshStatus(version_name))
  409. function refreshStatus(version_name){
  410. $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`,(data)=>{
  411. console.log(data)
  412. // header status and duration
  413. $(`#${version_name}-duration-span`).text(data.JobDuration)
  414. $(`#${version_name}-status-span span`).text(data.JobStatus)
  415. $(`#${version_name}-status-span i`).attr("class",data.JobStatus)
  416. // detail status and duration
  417. $('#'+version_name+'-duration').text(data.JobDuration)
  418. $('#'+version_name+'-status').text(data.JobStatus)
  419. }).fail(function(err) {
  420. console.log(err);
  421. });
  422. stopBubbling(arguments.callee.caller.arguments[0])
  423. }
  424. function deleteVersion(version_name){
  425. $.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/del_version`,{version_name:version_name}).fail(function(err) {
  426. console.log(err);
  427. });
  428. stopBubbling(arguments.callee.caller.arguments[0])
  429. }
  430. function stopVersion(version_name){
  431. $.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/stop_version`,{version_name:version_name}).fail(function(err) {
  432. console.log(err);
  433. });
  434. stopBubbling(arguments.callee.caller.arguments[0])
  435. }
  436. function loadLog(version_name){
  437. $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&lines=20&order=asc`, (data) => {
  438. $('input[name=end_line]').val(data.EndLine)
  439. $('input[name=start_line]').val(data.StartLine)
  440. $(`#log_file${version_name}`).text(data.Content)
  441. }).fail(function(err) {
  442. console.log(err);
  443. });
  444. }
  445. $(".log").scroll(function () {
  446. var scrollTop = $(this)[0].scrollTop; // 滚动距离
  447. var scrollHeight = $(this)[0].scrollHeight; // 文档高度
  448. var divHeight = $(this).height(); // 可视区高度
  449. let version_name=$(this).find('input[name=version_name]').val()
  450. if(parseInt(scrollTop) + divHeight + 18 == scrollHeight){
  451. var end_line = $('input[name=end_line]').val()
  452. $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&order=desc`, (data) => {
  453. if (data.Lines == 0){
  454. $('#header').text('您已翻阅至日志底部')
  455. $('.message').css('display', 'block')
  456. setTimeout(function(){
  457. $('.message').css('display', 'none')
  458. }, 1000)
  459. }else{
  460. $('input[name=end_line]').val(data.EndLine)
  461. $('.log').append('<pre>' + data.Content)
  462. }
  463. }).fail(function(err) {
  464. console.log(err);
  465. });
  466. }
  467. if(scrollTop == 0){
  468. var start_line = $('input[name=start_line]').val()
  469. $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${start_line}&order=asc`, (data) => {
  470. if (data.Lines == 0){
  471. $('#header').text('您已翻阅至日志顶部')
  472. $('.message').css('display', 'block')
  473. setTimeout(function(){
  474. $('.message').css('display', 'none')
  475. }, 1000)
  476. }else{
  477. $('input[name=start_line]').val(data.StartLine) //如果变动就改变所对应的值
  478. $(".log").prepend('<pre>' + data.Content)
  479. }
  480. }).fail(function(err) {
  481. console.log(err);
  482. });
  483. }
  484. })
  485. </script>