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

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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  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. cursor: default;
  26. }
  27. .acc-margin-bottom {
  28. margin-bottom: 5px;
  29. }
  30. .title_text {
  31. font-size: 12px;
  32. }
  33. .ac-display-inblock {
  34. display: inline-block;
  35. }
  36. .cti-mgRight-sm {
  37. margin-right: 8px;
  38. }
  39. .ac-text-normal {
  40. font-size: 14px;
  41. color: #575d6c;
  42. }
  43. .uc-accordionTitle-black {
  44. color: #333;
  45. }
  46. .accordion-border{
  47. border:1px solid #cce2ff;
  48. }
  49. .padding0{
  50. padding: 0 !important;
  51. }
  52. .content-pad{
  53. padding: 15px 35px;
  54. }
  55. .content-margin{
  56. margin:10px 5px ;
  57. }
  58. .tab_2_content {
  59. min-height: 360px;
  60. margin-left: 10px;
  61. }
  62. .ac-grid {
  63. display: block;
  64. *zoom: 1;
  65. }
  66. .ac-grid-col {
  67. float: left;
  68. width: 100%;
  69. }
  70. .ac-grid-col2 .ac-grid-col {
  71. width: 50%;
  72. }
  73. .ti-form {
  74. text-align: left;
  75. max-width: 100%;
  76. vertical-align: middle;
  77. }
  78. .ti-form>tbody {
  79. font-size: 12px;
  80. }
  81. .ti-form>tbody, .ti-form>tbody>tr {
  82. vertical-align: inherit;
  83. }
  84. .ti-text-form-label {
  85. padding-bottom: 20px;
  86. padding-right: 20px;
  87. color: #8a8e99;
  88. font-size: 12px;
  89. white-space: nowrap !important;
  90. width: 80px;
  91. line-height: 30px;
  92. }
  93. .ti-text-form-content{
  94. line-height: 30px;
  95. padding-bottom: 20px;
  96. }
  97. .ti-form>tbody>tr>td {
  98. vertical-align: top;
  99. white-space: normal;
  100. }
  101. td, th {
  102. padding: 0;
  103. }
  104. .ac-grid-col .text-span {
  105. width: 450px;
  106. overflow: hidden;
  107. text-overflow: ellipsis;
  108. white-space: nowrap;
  109. }
  110. .redo-color{
  111. color: #3291F8;
  112. }
  113. .ti-action-menu-item:not(:last-child){
  114. margin-right: 10px;
  115. padding-right: 11px;
  116. text-decoration: none!important;
  117. color: #526ecc;
  118. cursor: pointer;
  119. display: inline-block;
  120. -moz-user-select: none;
  121. -webkit-user-select: none;
  122. -ms-user-select: none;
  123. -khtml-user-select: none;
  124. user-select: none;
  125. position: relative;
  126. }
  127. .ti-action-menu-item:not(:last-child):after {
  128. content: "";
  129. display: inline-block;
  130. position: absolute;
  131. height: 12px;
  132. right: 0;
  133. top: 50%;
  134. -webkit-transform: translateY(-6px);
  135. -ms-transform: translateY(-6px);
  136. -o-transform: translateY(-6px);
  137. transform: translateY(-6px);
  138. border-right: 1px solid #dfe1e6;
  139. }
  140. .text-width80{
  141. width: 100px;
  142. line-height: 30px;
  143. }
  144. .border-according{
  145. border: 1px solid #dfe1e6;
  146. }
  147. .disabled {
  148. cursor: default;
  149. pointer-events: none;
  150. color: rgba(0,0,0,.6) !important;
  151. opacity: .45 !important;
  152. }
  153. .pad20{
  154. border:0px !important;
  155. }
  156. .model_file_bread{
  157. margin-bottom: -0.5rem !important;
  158. padding-left: 1rem;
  159. padding-top: 0.5rem ;
  160. }
  161. </style>
  162. <div id="mask">
  163. <div id="loadingPage">
  164. <div class="rect1"></div>
  165. <div class="rect2"></div>
  166. <div class="rect3"></div>
  167. <div class="rect4"></div>
  168. <div class="rect5"></div>
  169. </div>
  170. </div>
  171. <div class="repository">
  172. {{template "repo/header" .}}
  173. <div class="ui container">
  174. <h4 class="ui header" id="vertical-segment">
  175. <div class="ui breadcrumb">
  176. <a class="section" href="{{.RepoLink}}/debugjob?debugListType=all">
  177. {{.i18n.Tr "repo.cloudbrain"}}
  178. </a>
  179. <div class="divider"> / </div>
  180. <a class="section" href="{{$.RepoLink}}/modelarts/train-job">
  181. {{$.i18n.Tr "repo.modelarts.train_job"}}
  182. </a>
  183. <div class="divider"> / </div>
  184. <div class="active section">{{.displayJobName}}</div>
  185. </div>
  186. </h4>
  187. {{range $k ,$v := .version_list_task}}
  188. <div class="ui accordion border-according" id="accordion{{.VersionName}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}" data-version="{{.VersionName}}">
  189. <input type="hidden" id="jobId_input" name="jobId_input" value="{{.JobID}}">
  190. <div class="{{if eq $k 0}}active{{end}} title padding0">
  191. <div class="according-panel-heading">
  192. <div class="accordion-panel-title">
  193. <i class="dropdown icon"></i>
  194. <span class="accordion-panel-title-content">
  195. <span>
  196. <div class="ac-display-inblock title_text acc-margin-bottom">
  197. <span class="cti-mgRight-sm">{{TimeSinceUnix1 .CreatedUnix}}</span>
  198. <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:
  199. <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>
  200. </span>
  201. <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span>
  202. <span class="cti-mgRight-sm uc-accordionTitle-black" id="{{.VersionName}}-duration-span">{{$.duration}}</span>
  203. </div>
  204. </span>
  205. </span>
  206. </div>
  207. </div>
  208. </div>
  209. <div class="{{if eq $k 0}}active{{end}} content">
  210. <div class="content-pad">
  211. <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);">
  212. <a class="active item" data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a>
  213. <a class="item" data-tab="second{{$k}}" onclick="loadLog({{.VersionName}})">{{$.i18n.Tr "repo.modelarts.log"}}</a>
  214. <a class="item" data-tab="third{{$k}}" onclick="loadModelFile({{.VersionName}},'','','init')">{{$.i18n.Tr "repo.model_download"}}</a>
  215. </div>
  216. <div class="ui tab active" data-tab="first{{$k}}">
  217. <div style="padding-top: 10px;">
  218. <div class="tab_2_content">
  219. <div class="ac-grid ac-grid-col2">
  220. <div class="ac-grid-col">
  221. <table class="ti-form">
  222. <tbody class="ti-text-form">
  223. <tr class="ti-no-ng-animate">
  224. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  225. {{$.i18n.Tr "repo.cloudbrain_task"}}
  226. </td>
  227. <td class="ti-text-form-content">
  228. <div class="text-span text-span-w">
  229. {{.DisplayJobName}}
  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. {{$.i18n.Tr "repo.modelarts.status"}}
  236. </td>
  237. <td class="ti-text-form-content">
  238. <div class="text-span text-span-w" id="{{.VersionName}}-status">
  239. {{.Status}}
  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. {{$.i18n.Tr "repo.modelarts.train_job.start_time"}}
  246. </td>
  247. <td class="ti-text-form-content">
  248. <div class="text-span text-span-w">
  249. <span style="font-size: 12px;" class="">{{TimeSinceUnix1 .CreatedUnix}}</span>
  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. {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
  256. </td>
  257. <td class="ti-text-form-content">
  258. <div class="text-span text-span-w" id="{{.VersionName}}-duration">
  259. {{$.duration}}
  260. </div>
  261. </td>
  262. </tr>
  263. <tr class="ti-no-ng-animate">
  264. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  265. {{$.i18n.Tr "repo.modelarts.train_job.resource_type"}}
  266. </td>
  267. <td class="ti-text-form-content">
  268. <div class="text-span text-span-w">
  269. {{$.resource_type}}
  270. </div>
  271. </td>
  272. </tr>
  273. <tr class="ti-no-ng-animate">
  274. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  275. {{$.i18n.Tr "repo.modelarts.train_job.standard"}}
  276. </td>
  277. <td class="ti-text-form-content">
  278. <div class="text-span text-span-w">
  279. {{$.resource_spec}}
  280. </div>
  281. </td>
  282. </tr>
  283. </tbody>
  284. </table>
  285. </div>
  286. <div class="ac-grid-col">
  287. <table class="ti-form">
  288. <tbody class="ti-text-form">
  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" id="{{.VersionName}}-mirror">
  295. {{.Image}}
  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. {{$.i18n.Tr "repo.modelarts.code_version"}}
  302. </td>
  303. <td class="ti-text-form-content">
  304. <div class="text-span text-span-w">
  305. {{.BranchName}}
  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. {{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
  312. </td>
  313. <td class="ti-text-form-content">
  314. <div class="text-span text-span-w">
  315. {{.BootFile}}
  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. {{$.i18n.Tr "repo.modelarts.train_job.train_dataset"}}
  322. </td>
  323. <td class="ti-text-form-content">
  324. <div class="text-span text-span-w">
  325. {{.DatasetName}}
  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. {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
  332. </td>
  333. <td class="ti-text-form-content">
  334. <div class="text-span text-span-w" title="{{.Parameters}}">
  335. {{.Parameters}}
  336. </div>
  337. </td>
  338. </tr>
  339. <tr class="ti-no-ng-animate">
  340. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  341. {{$.i18n.Tr "repo.modelarts.train_job.description"}}
  342. </td>
  343. <td class="ti-text-form-content">
  344. <div class="text-span text-span-w" title="{{.Description}}">
  345. {{.Description}}
  346. </div>
  347. </td>
  348. </tr>
  349. </tbody>
  350. </table>
  351. </div>
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. <div class="ui tab" data-tab="second{{$k}}">
  357. <div>
  358. <div class="ui message message{{.VersionName}}" style="display: none;">
  359. <div id="header"></div>
  360. </div>
  361. <div class="ui attached log" id="log{{.VersionName}}" style="height: 300px !important; overflow: auto;">
  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. <input type="hidden" name="model{{.VersionName}}" value="-1">
  370. <input type="hidden" name="modelback{{.VersionName}}" value="-1">
  371. <div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
  372. <div class="active section">{{.VersionName}}</div>
  373. <div class="divider"> / </div>
  374. </div>
  375. <div id="dir_list{{.VersionName}}">
  376. </div>
  377. </div>
  378. </div>
  379. </div>
  380. </div>
  381. {{end}} {{template "base/paginate" .}}
  382. </div>
  383. <!-- 确认模态框 -->
  384. <div id="deletemodel">
  385. <div class="ui basic modal">
  386. <div class="ui icon header">
  387. <i class="trash icon"></i> 删除任务
  388. </div>
  389. <div class="content">
  390. <p>你确认删除该任务么?此任务一旦删除不可恢复。</p>
  391. </div>
  392. <div class="actions">
  393. <div class="ui red basic inverted cancel button">
  394. <i class="remove icon"></i> 取消操作
  395. </div>
  396. <div class="ui green basic inverted ok button">
  397. <i class="checkmark icon"></i> 确定操作
  398. </div>
  399. </div>
  400. </div>
  401. </div>
  402. </div>
  403. {{template "base/footer" .}}
  404. <script>
  405. $('.menu .item').tab()
  406. $(document).ready(function(){
  407. $('.ui.accordion').accordion({selector:{trigger:'.icon'}});
  408. });
  409. $(document).ready(function(){
  410. $('.secondary.menu .item').tab();
  411. });
  412. let userName
  413. let repoPath
  414. let jobID
  415. let downlaodFlag = {{$.canDownload}}
  416. let taskID = {{$.task.ID}}
  417. let realJobName = {{$.task.JobName}}
  418. $(document).ready(function(){
  419. let url = window.location.href;
  420. let urlArr = url.split('/')
  421. userName = urlArr.slice(-5)[0]
  422. repoPath = urlArr.slice(-4)[0]
  423. jobID = urlArr.slice(-1)[0]
  424. })
  425. function stopBubbling(e) {
  426. e = window.event || e;
  427. if (e.stopPropagation) {
  428. e.stopPropagation(); //阻止事件 冒泡传播
  429. } else {
  430. e.cancelBubble = true; //ie兼容
  431. }
  432. }
  433. let timeid = window.setInterval(loadJobStatus, 30000);
  434. $(document).ready(loadJobStatus);
  435. function loadLog(version_name){
  436. document.getElementById("mask").style.display = "block"
  437. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}/log?version_name=${version_name}&lines=50&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. document.getElementById("mask").style.display = "none"
  442. }).fail(function(err) {
  443. console.log(err);
  444. document.getElementById("mask").style.display = "none"
  445. });
  446. }
  447. function loadModelFile(version_name,parents,filename,init){
  448. parents = parents || ''
  449. filename = filename || ''
  450. init = init || ''
  451. console.log("start")
  452. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/train-job/${jobID}/model_list?version_name=${version_name}&parentDir=${parents}`, (data) => {
  453. $(`#dir_list${version_name}`).empty()
  454. renderDir(data,version_name)
  455. if(init==="init"){
  456. $(`input[name=model${version_name}]`).val("")
  457. $(`input[name=modelback${version_name}]`).val(version_name)
  458. $(`#file_breadcrumb${version_name}`).empty()
  459. let htmlBread = ""
  460. htmlBread += `<div class='active section'>${version_name}</div>`
  461. htmlBread += "<div class='divider'> / </div>"
  462. $(`#file_breadcrumb${version_name}`).append(htmlBread)
  463. }else{
  464. renderBrend(version_name,parents,filename,init)
  465. }
  466. }).fail(function(err) {
  467. console.log(err,version_name);
  468. });
  469. }
  470. function renderBrend(version_name,parents,filename,init){
  471. if(init=="folder"){
  472. let htmlBrend = ""
  473. let sectionName=$(`#file_breadcrumb${version_name} .active.section`).text()
  474. let parents1 = $(`input[name=model${version_name}]`).val()
  475. let filename1 = $(`input[name=modelback${version_name}]`).val()
  476. if(parents1===""){
  477. $(`#file_breadcrumb${version_name} .active.section`).replaceWith(`<a class='section' onclick="loadModelFile('${version_name}','${parents1}','','init')">${sectionName}</a>`)
  478. }else{
  479. $(`#file_breadcrumb${version_name} .active.section`).replaceWith(`<a class='section' onclick="loadModelFile('${version_name}','${parents1}','${filename1}')">${sectionName}</a>`)
  480. }
  481. htmlBrend += `<div class='active section'>${filename}</div>`
  482. htmlBrend += "<div class='divider'> / </div>"
  483. $(`#file_breadcrumb${version_name}`).append(htmlBrend)
  484. $(`input[name=model${version_name}]`).val(parents)
  485. $(`input[name=modelback${version_name}]`).val(filename)
  486. }else{
  487. $(`input[name=model${version_name}]`).val(parents)
  488. $(`input[name=modelback${version_name}]`).val(filename)
  489. $(`#file_breadcrumb${version_name} a.section:contains(${filename})`).nextAll().remove()
  490. $(`#file_breadcrumb${version_name} a.section:contains(${filename})`).replaceWith(`<div class='active section'>${filename}</div>`)
  491. $(`#file_breadcrumb${version_name} div.section:contains(${filename})`).append("<div class='divider'> / </div>")
  492. }
  493. }
  494. function renderDir(data,version_name){
  495. let html=""
  496. html += "<div class='ui grid' style='margin:0;'>"
  497. html += "<div class='row' style='padding: 0;'>"
  498. html += "<div class='ui sixteen wide column' style='padding:1rem;'>"
  499. html += "<div class='dir list'>"
  500. html += "<table id='repo-files-table' class='ui single line table pad20'>"
  501. html += '<tbody>'
  502. // html += "</tbody>"
  503. for(let i=0;i<data.Dirs.length;i++){
  504. let dirs_size = renderSize(data.Dirs[i].Size)
  505. html += "<tr>"
  506. html += "<td class='name six wid'>"
  507. html += "<span class='truncate'>"
  508. html += "<span class='octicon octicon-file-directory'>"
  509. html += "</span>"
  510. if(data.Dirs[i].IsDir){
  511. html += `<a onclick="loadModelFile('${version_name}','${data.Dirs[i].ParenDir}','${data.Dirs[i].FileName}','folder')">`
  512. html += "<span class='fitted'><i class='folder icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>"
  513. }else{
  514. if(downlaodFlag){
  515. html += `<a href="${location.href}/download_model?version_name=${version_name}&fileName=${data.Dirs[i].FileName}&parentDir=${data.Dirs[i].ParenDir}&jobName=${realJobName}">`
  516. }
  517. else{
  518. html += `<a class="disabled">`
  519. }
  520. html += "<span class='fitted'><i class='file icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>"
  521. }
  522. html += '</a>'
  523. html += "</span>"
  524. html += "</td>"
  525. html += "<td class='message seven wide'>"
  526. if(data.Dirs[i].IsDir){
  527. html += "<span class='truncate has-emoji'></span>"
  528. }else{
  529. html += "<span class='truncate has-emoji'>"+ `${dirs_size}` + "</span>"
  530. }
  531. html += "</td>"
  532. html += "<td class='text right age three wide'>"
  533. html += "<span class='truncate has-emoji'>" + data.Dirs[i].ModTime + "</span>"
  534. html += "</td>"
  535. html += "</tr>"
  536. }
  537. html += "</tbody>"
  538. html += "</table>"
  539. html += "</div>"
  540. html += "</div>"
  541. html += "</div>"
  542. html += "</div>"
  543. $(`#dir_list${version_name}`).append(html)
  544. }
  545. function renderSize(value){
  546. if(null==value||value==''){
  547. return "0 Bytes";
  548. }
  549. var unitArr = new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");
  550. var index=0;
  551. var srcsize = parseFloat(value);
  552. index=Math.floor(Math.log(srcsize)/Math.log(1024));
  553. var size =srcsize/Math.pow(1024,index);
  554. size=size.toFixed(0);//保留的小数位数
  555. return size+unitArr[index];
  556. }
  557. function loadJobStatus() {
  558. $(".ui.accordion.border-according").each((index, job) => {
  559. const jobID = job.dataset.jobid;
  560. const repoPath = job.dataset.repopath;
  561. const versionname = job.dataset.version
  562. // ['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED']
  563. // if (job.textContent.trim() == 'IMAGE_FAILED' || job.textContent.trim() == 'SUBMIT_FAILED' || job.textContent.trim() == 'DELETE_FAILED'
  564. // || job.textContent.trim() == 'KILLED' || job.textContent.trim() == 'COMPLETED' || job.textContent.trim() == 'FAILED'
  565. // || job.textContent.trim() == 'CANCELED' || job.textContent.trim() == 'LOST') {
  566. // return
  567. // }
  568. let status = $(`#${versionname}-status-span`).text()
  569. if(['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED','SUCCEEDED'].includes(status)){
  570. return
  571. }
  572. let stopArray=["KILLED","FAILED","START_FAILED","KILLING","COMPLETED","SUCCEEDED"]
  573. $.get(`/api/v1/repos/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`, (data) => {
  574. //$(`#${versionname}-duration-span`).text(data.JobDuration)
  575. $(`#${versionname}-status-span span`).text(data.JobStatus)
  576. $(`#${versionname}-status-span i`).attr("class",data.JobStatus)
  577. // detail status and duration
  578. //$('#'+versionname+'-duration').text(data.JobDuration)
  579. $('#'+versionname+'-status').text(data.JobStatus)
  580. if(stopArray.includes(data.JobStatus)){
  581. $('#'+versionname+'-stop').addClass('disabled')
  582. }
  583. if(data.JobStatus==="COMPLETED"){
  584. $('#'+versionname+'-create-model').removeClass('disabled').addClass('blue')
  585. }
  586. }).fail(function(err) {
  587. console.log(err);
  588. });
  589. });
  590. };
  591. function refreshStatus(version_name){
  592. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`,(data)=>{
  593. // header status and duration
  594. //$(`#${version_name}-duration-span`).text(data.JobDuration)
  595. $(`#${version_name}-status-span span`).text(data.JobStatus)
  596. $(`#${version_name}-status-span i`).attr("class",data.JobStatus)
  597. // detail status and duration
  598. //$('#'+version_name+'-duration').text(data.JobDuration)
  599. $('#'+version_name+'-status').text(data.JobStatus)
  600. loadLog(version_name)
  601. }).fail(function(err) {
  602. console.log(err);
  603. });
  604. stopBubbling(arguments.callee.caller.arguments[0])
  605. }
  606. </script>