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 45 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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  1. {{template "base/head" .}}
  2. <link rel="stylesheet" href="/self/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
  3. <style>
  4. .according-panel-heading {
  5. box-sizing: border-box;
  6. padding: 8px 16px;
  7. color: #252b3a;
  8. background-color: #f2f5fc;
  9. line-height: 1.5;
  10. cursor: pointer;
  11. -moz-user-select: none;
  12. -webkit-user-select: none;
  13. -ms-user-select: none;
  14. -khtml-user-select: none;
  15. user-select: none;
  16. }
  17. .accordion-panel-title {
  18. margin-top: 0;
  19. margin-bottom: 0;
  20. color: #252b3a;
  21. }
  22. .accordion-panel-title-content {
  23. vertical-align: middle;
  24. display: inline-block;
  25. width: calc(100% - 32px);
  26. cursor: default;
  27. }
  28. .acc-margin-bottom {
  29. margin-bottom: 5px;
  30. }
  31. .title_text {
  32. font-size: 12px;
  33. }
  34. .ac-display-inblock {
  35. display: inline-block;
  36. }
  37. .cti-mgRight-sm {
  38. margin-right: 8px;
  39. }
  40. .ac-text-normal {
  41. font-size: 14px;
  42. color: #575d6c;
  43. }
  44. .uc-accordionTitle-black {
  45. color: #333;
  46. }
  47. .accordion-border {
  48. border: 1px solid #cce2ff;
  49. }
  50. .padding0 {
  51. padding: 0 !important;
  52. }
  53. .content-pad {
  54. padding: 15px 35px;
  55. }
  56. .content-margin {
  57. margin: 10px 5px;
  58. }
  59. .tab_2_content {
  60. min-height: 360px;
  61. margin-left: 10px;
  62. }
  63. .ac-grid {
  64. display: block;
  65. *zoom: 1;
  66. }
  67. .ac-grid-col {
  68. float: left;
  69. width: 100%;
  70. }
  71. .ac-grid-col2 .ac-grid-col {
  72. width: 50%;
  73. }
  74. .ti-form {
  75. text-align: left;
  76. max-width: 100%;
  77. vertical-align: middle;
  78. }
  79. .ti-form>tbody {
  80. font-size: 12px;
  81. }
  82. .ti-form>tbody,
  83. .ti-form>tbody>tr {
  84. vertical-align: inherit;
  85. }
  86. .ti-text-form-label {
  87. padding-bottom: 20px;
  88. padding-right: 20px;
  89. color: #8a8e99;
  90. font-size: 12px;
  91. white-space: nowrap !important;
  92. width: 80px;
  93. line-height: 30px;
  94. }
  95. .ti-text-form-content {
  96. line-height: 30px;
  97. padding-bottom: 20px;
  98. }
  99. .ti-form>tbody>tr>td {
  100. vertical-align: top;
  101. white-space: normal;
  102. }
  103. td,
  104. th {
  105. padding: 0;
  106. }
  107. .info_text {
  108. padding-bottom: 20px;
  109. padding-right: 20px;
  110. font-size: 12px;
  111. }
  112. .ac-grid-col .text-span {
  113. width: 450px;
  114. overflow: hidden;
  115. text-overflow: ellipsis;
  116. white-space: nowrap;
  117. }
  118. .redo-color {
  119. color: #3291F8;
  120. }
  121. .ti-action-menu-item:not(:last-child) {
  122. margin-right: 10px;
  123. padding-right: 11px;
  124. text-decoration: none !important;
  125. color: #526ecc;
  126. cursor: pointer;
  127. display: inline-block;
  128. -moz-user-select: none;
  129. -webkit-user-select: none;
  130. -ms-user-select: none;
  131. -khtml-user-select: none;
  132. user-select: none;
  133. position: relative;
  134. }
  135. .ti-action-menu-item:not(:last-child):after {
  136. content: "";
  137. display: inline-block;
  138. position: absolute;
  139. height: 12px;
  140. right: 0;
  141. top: 50%;
  142. -webkit-transform: translateY(-6px);
  143. -ms-transform: translateY(-6px);
  144. -o-transform: translateY(-6px);
  145. transform: translateY(-6px);
  146. border-right: 1px solid #dfe1e6;
  147. }
  148. .text-width80 {
  149. width: 100px;
  150. line-height: 30px;
  151. }
  152. .border-according {
  153. border: 1px solid #dfe1e6;
  154. }
  155. .disabled {
  156. cursor: default;
  157. pointer-events: none;
  158. color: rgba(0, 0, 0, .6) !important;
  159. opacity: .45 !important;
  160. }
  161. .pad20 {
  162. border: 0px !important;
  163. }
  164. .model_file_bread {
  165. margin-bottom: -0.5rem !important;
  166. padding-left: 1rem;
  167. padding-top: 0.5rem;
  168. }
  169. .menuContent{
  170. position: absolute;
  171. background: #ffffff;
  172. left: 0;
  173. right: 26px;
  174. top: 36px;
  175. z-index:999;
  176. border: 1px solid #96c8da;
  177. border-top: 0;
  178. border-bottom-right-radius: 4px;
  179. border-bottom-left-radius: 4px;
  180. box-shadow: 0 2px 3px 0 rgb(34 36 38 / 15%);
  181. }
  182. </style>
  183. <div id="mask">
  184. <div id="loadingPage">
  185. <div class="rect1"></div>
  186. <div class="rect2"></div>
  187. <div class="rect3"></div>
  188. <div class="rect4"></div>
  189. <div class="rect5"></div>
  190. </div>
  191. </div>
  192. <div class="repository">
  193. {{template "repo/header" .}}
  194. <div class="ui container">
  195. <h4 class="ui header" id="vertical-segment">
  196. <div class="ui breadcrumb">
  197. <a class="section" href="{{.RepoLink}}/debugjob?debugListType=all">
  198. {{.i18n.Tr "repo.cloudbrain"}}
  199. </a>
  200. <div class="divider"> / </div>
  201. <a class="section" href="{{$.RepoLink}}/modelarts/train-job">
  202. {{$.i18n.Tr "repo.modelarts.train_job"}}
  203. </a>
  204. <div class="divider"> / </div>
  205. <div class="active section">{{.displayJobName}}</div>
  206. </div>
  207. </h4>
  208. {{range $k ,$v := .version_list_task}}
  209. <div class="ui accordion border-according" id="accordion{{.VersionName}}"
  210. data-repopath="{{$.RepoRelPath}}/cloudbrain" data-jobid="{{.ID}}" data-version="{{.VersionName}}">
  211. <input type="hidden" id="jobId_input" name="jobId_input" value="{{.JobID}}">
  212. <div class="{{if eq $k 0}}active{{end}} title padding0">
  213. <div class="according-panel-heading">
  214. <div class="accordion-panel-title">
  215. <i class="dropdown icon"></i>
  216. <span class="accordion-panel-title-content">
  217. <span>
  218. <div style="float: right;">
  219. {{if and ($.canDownload) (eq .Status "SUCCEEDED") ($.Permission.CanWrite $.UnitTypeModelManage) }}
  220. <a class="ti-action-menu-item" id="{{.VersionName}}-create-model"
  221. onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
  222. {{else}}
  223. <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model"
  224. onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
  225. {{end}}
  226. </div>
  227. <div class="ac-display-inblock title_text acc-margin-bottom">
  228. <span class="cti-mgRight-sm">{{TimeSinceUnix1 .CreatedUnix}}</span>
  229. <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:
  230. <span id="{{.VersionName}}-status-span"><i id="icon"
  231. style="vertical-align: middle;" class="{{.Status}}"></i><span id="text"
  232. style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span>
  233. </span>
  234. <span
  235. class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span>
  236. <span class="cti-mgRight-sm uc-accordionTitle-black"
  237. id="{{.VersionName}}-duration-span">{{$.duration}}</span>
  238. <span class="refresh-status" data-tooltip="刷新" style="cursor: pointer;" data-inverted="" data-version="{{.VersionName}}"><i
  239. class="redo icon redo-color"></i></span>
  240. </div>
  241. </span>
  242. </span>
  243. </div>
  244. </div>
  245. </div>
  246. <div class="{{if eq $k 0}}active{{end}} content">
  247. <div class="content-pad">
  248. <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);">
  249. <a class="active item"
  250. data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a>
  251. <a class="item" data-tab="second{{$k}}"
  252. onclick="javascript:parseInfo()">{{$.i18n.Tr "repo.cloudbrain.runinfo"}}</a>
  253. <a class="item log_bottom" data-tab="third{{$k}}"
  254. data-version="{{.VersionName}}">{{$.i18n.Tr "repo.modelarts.log"}}</a>
  255. <a class="item load-model-file" data-tab="four{{$k}}" data-gpu-flag="true" data-download-flag="{{$.canDownload}}" data-path="{{$.RepoLink}}/cloudbrain/train-job/{{.JobID}}/model_list" data-version="{{.VersionName}}" data-parents="" data-filename="" data-init="init" >{{$.i18n.Tr "repo.model_download"}}</a>
  256. </div>
  257. <div class="ui tab active" data-tab="first{{$k}}">
  258. <div style="padding-top: 10px;">
  259. <div class="tab_2_content">
  260. <div class="ac-grid ac-grid-col2">
  261. <div class="ac-grid-col">
  262. <table class="ti-form">
  263. <tbody class="ti-text-form">
  264. <tr class="ti-no-ng-animate">
  265. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  266. {{$.i18n.Tr "repo.cloudbrain_task"}}
  267. </td>
  268. <td class="ti-text-form-content">
  269. <div class="text-span text-span-w">
  270. {{.DisplayJobName}}
  271. </div>
  272. </td>
  273. </tr>
  274. <tr class="ti-no-ng-animate">
  275. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  276. {{$.i18n.Tr "repo.modelarts.status"}}
  277. </td>
  278. <td class="ti-text-form-content">
  279. <div class="text-span text-span-w" id="{{.VersionName}}-status">
  280. {{.Status}}
  281. </div>
  282. </td>
  283. </tr>
  284. <tr class="ti-no-ng-animate">
  285. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  286. {{$.i18n.Tr "repo.modelarts.train_job.start_time"}}
  287. </td>
  288. <td class="ti-text-form-content">
  289. <div class="text-span text-span-w">
  290. <span style="font-size: 12px;">
  291. {{if not (eq .StartTime 0)}}
  292. {{TimeSinceUnix1 .StartTime}}
  293. {{else}}
  294. --
  295. {{end}}
  296. </span>
  297. </div>
  298. </td>
  299. </tr>
  300. <tr class="ti-no-ng-animate">
  301. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  302. {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
  303. </td>
  304. <td class="ti-text-form-content">
  305. <div class="text-span text-span-w"
  306. id="{{.VersionName}}-duration">
  307. {{$.duration}}
  308. </div>
  309. </td>
  310. </tr>
  311. <tr class="ti-no-ng-animate">
  312. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  313. {{$.i18n.Tr "repo.modelarts.train_job.resource_type"}}
  314. </td>
  315. <td class="ti-text-form-content">
  316. <div class="text-span text-span-w">
  317. {{$.resource_type}}
  318. </div>
  319. </td>
  320. </tr>
  321. <tr class="ti-no-ng-animate">
  322. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  323. {{$.i18n.Tr "repo.modelarts.train_job.standard"}}
  324. </td>
  325. <td class="ti-text-form-content">
  326. <div class="text-span text-span-w">
  327. {{$.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}}
  328. </div>
  329. </td>
  330. </tr>
  331. </tbody>
  332. </table>
  333. </div>
  334. <div class="ac-grid-col">
  335. <table class="ti-form">
  336. <tbody class="ti-text-form">
  337. <tr class="ti-no-ng-animate">
  338. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  339. {{$.i18n.Tr "cloudbrain.mirror"}}
  340. </td>
  341. <td class="ti-text-form-content">
  342. <div class="text-span text-span-w" id="{{.VersionName}}-mirror">
  343. <span class="ui poping up clipboard" data-position="top center" id="clipboard-btn" style="cursor:pointer"
  344. data-clipboard-text="{{.Image}}"
  345. data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
  346. data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
  347. data-content="{{$.i18n.Tr "repo.copy_link"}}"
  348. data-variation="inverted tiny"
  349. >
  350. <span title="{{.Image}}">{{.Image}}</span>
  351. </span>
  352. </div>
  353. </td>
  354. </tr>
  355. <tr class="ti-no-ng-animate">
  356. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  357. {{$.i18n.Tr "repo.modelarts.code_version"}}
  358. </td>
  359. <td class="ti-text-form-content">
  360. <div class="text-span text-span-w">
  361. {{.BranchName}}
  362. </div>
  363. </td>
  364. </tr>
  365. <tr class="ti-no-ng-animate">
  366. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  367. {{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
  368. </td>
  369. <td class="ti-text-form-content">
  370. <div class="text-span text-span-w">
  371. {{.BootFile}}
  372. </div>
  373. </td>
  374. </tr>
  375. <tr class="ti-no-ng-animate">
  376. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  377. {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
  378. </td>
  379. <td class="ti-text-form-content">
  380. <div class="text-span text-span-w" title="{{.Parameters}}">
  381. {{.Parameters}}
  382. </div>
  383. </td>
  384. </tr>
  385. <tr class="ti-no-ng-animate">
  386. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  387. {{$.i18n.Tr "repo.modelarts.train_job.description"}}
  388. </td>
  389. <td class="ti-text-form-content">
  390. <div class="text-span text-span-w" title="{{.Description}}">
  391. {{.Description}}
  392. </div>
  393. </td>
  394. </tr>
  395. </tbody>
  396. </table>
  397. </div>
  398. </div>
  399. <div style="clear:both">
  400. <table style="border:none" class="ui fixed small stackable table">
  401. <thead>
  402. <tr><th style="color: #8a8e99;font-size:12px" class="three wide left aligned">{{$.i18n.Tr "dataset.file"}}</th>
  403. </tr></thead>
  404. <tbody>
  405. {{range $m ,$n := $.datasetDownload}}
  406. <tr>
  407. <td style="word-wrap: break-word;word-break: break-all;">
  408. {{if eq .IsDelete true}}
  409. {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}})
  410. {{else}}
  411. <a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a>
  412. {{end}}
  413. </td>
  414. </tr>
  415. {{end}}
  416. </tbody>
  417. </table>
  418. </div>
  419. </div>
  420. </div>
  421. </div>
  422. <div class="ui tab" data-tab="second{{$k}}">
  423. <div>
  424. <div class="ui message message{{.VersionName}}" style="display: none;">
  425. <div id="header"></div>
  426. </div>
  427. <div class="ui attached log" id="log_state{{.VersionName}}"
  428. style="height: 390px !important; overflow: auto;">
  429. <input type="hidden" id="json_value" value="{{$.result.JobStatus.AppExitDiagnostics}}">
  430. <input type="hidden" id="ExitDiagnostics" value="{{$.ExitDiagnostics}}">
  431. <span id="info_display" class="info_text">
  432. </span>
  433. </div>
  434. </div>
  435. </div>
  436. <div class="ui tab" data-tab="third{{$k}}">
  437. <div>
  438. <a id="{{.VersionName}}-log-down"
  439. class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}}'
  440. href="/api/v1/repos/{{$.RepoRelPath}}/cloudbrain/{{.ID}}/download_log_file">
  441. <i class="ri-download-cloud-2-line"></i>
  442. <span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.modelarts.download_log"}}</span>
  443. </a>
  444. </div>
  445. <div
  446. style="position: relative;border: 1px solid rgba(0,0,0,.2);padding: 0 10px;margin-top: 10px;">
  447. <span>
  448. <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;"
  449. class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a>
  450. </span>
  451. <span class="log-info-{{.VersionName}}">
  452. <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;"
  453. class="log_bottom" data-version="{{.VersionName}}"><i
  454. class="icon-to-bottom"></i></a>
  455. </span>
  456. <div class="ui message message{{.VersionName}}" style="display: none;">
  457. <div id="header"></div>
  458. </div>
  459. <div class="ui attached log log-scroll" id="log{{.VersionName}}" data-version="{{.VersionName}}"
  460. style="height: 300px !important; overflow: auto;">
  461. <div class="ui inverted active dimmer">
  462. <div class="ui loader"></div>
  463. </div>
  464. <input type="hidden" name="end_line" value>
  465. <input type="hidden" name="start_line" value>
  466. <pre id="log_file{{.VersionName}}"></pre>
  467. </div>
  468. </div>
  469. </div>
  470. <div class="ui tab" data-tab="four{{$k}}">
  471. <input type="hidden" name="model{{.VersionName}}" value="-1">
  472. <input type="hidden" name="modelback{{.VersionName}}" value="-1">
  473. <div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
  474. <div class="active section">result</div>
  475. <div class="divider"> / </div>
  476. </div>
  477. <div id="dir_list{{.VersionName}}">
  478. </div>
  479. <div style="display:flex;align-items: center;justify-content: end;color: #f2711c;">
  480. <i class="ri-error-warning-line" style="margin-right:0.5rem;"></i>
  481. <span>{{$.i18n.Tr "repo.file_limit_100"}}</span>
  482. </div>
  483. </div>
  484. </div>
  485. </div>
  486. </div>
  487. {{end}} {{template "base/paginate" .}}
  488. </div>
  489. <!-- 确认模态框 -->
  490. <div id="deletemodel">
  491. <div class="ui basic modal">
  492. <div class="ui icon header">
  493. <i class="trash icon"></i> 删除任务
  494. </div>
  495. <div class="content">
  496. <p>你确认删除该任务么?此任务一旦删除不可恢复。</p>
  497. </div>
  498. <div class="actions">
  499. <div class="ui red basic inverted cancel button">
  500. <i class="remove icon"></i> 取消操作
  501. </div>
  502. <div class="ui green basic inverted ok button">
  503. <i class="checkmark icon"></i> 确定操作
  504. </div>
  505. </div>
  506. </div>
  507. </div>
  508. <!--
  509. <div id="menuContent" class="menuContent" style="display:none; position: absolute;z-index:9999">
  510. <ul id="treeDemo" class="ztree" style="margin-top:0; width: 83%; height: 100%;"></ul>
  511. </div> -->
  512. <!-- 创建模型 -->
  513. <div id="newmodel">
  514. <div class="ui modal second">
  515. <div class="header" style="padding: 1rem;background-color: rgba(240, 240, 240, 100);">
  516. <h4 id="model_header">{{.i18n.Tr "repo.model.manage.import_new_model"}}</h4>
  517. </div>
  518. <div class="content content-padding">
  519. <form id="formId" method="POST" class="ui form">
  520. <div class="ui error message">
  521. </div>
  522. {{$.CsrfTokenHtml}}
  523. <input type="hidden" name="trainTaskCreate" value="true">
  524. <div class="required inline field">
  525. <label>{{.i18n.Tr "repo.model.manage.createtrainjob"}}</label>
  526. <input type="hidden" class="width83" id="JobId" name="JobId" readonly required>
  527. <input type="hidden" id="VersionName" name="VersionName" value="V0001">
  528. <input style="width: 45%;" id="JobName" readonly required>
  529. </div>
  530. <div class="required inline field" id="modelname">
  531. <label>{{.i18n.Tr "repo.model.manage.model_name"}}</label>
  532. <input style="width: 45%;" id="name" name="Name" required maxlength="25"
  533. onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  534. </div>
  535. <div class="required inline field" id="verionname">
  536. <label>{{.i18n.Tr "repo.modelconvert.modelversion"}}</label>
  537. <input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255">
  538. </div>
  539. <div class="unite min_title inline field required">
  540. <label>{{.i18n.Tr "repo.model.manage.engine"}}</label>
  541. <div class="ui dropdown selection search width70" id="choice_Engine">
  542. <input type="hidden" id="Engine" name="Engine" required>
  543. <div class="default text">{{.i18n.Tr "repo.model.manage.select.engine"}}</div>
  544. <i class="dropdown icon"></i>
  545. <div class="menu" id="job-Engine">
  546. <option class="active item" data-value="0">PyTorch</option>
  547. <option class="item" data-value="1">TensorFlow</option>
  548. <option class="item" data-value="4">PaddlePaddle</option>
  549. <option class="item" data-value="5">OneFlow</option>
  550. <option class="item" data-value="6">MXNet</option>
  551. <option class="item" data-value="3">Other</option>
  552. </div>
  553. </div>
  554. </div>
  555. <div class="unite min_title inline fields required">
  556. <div class="field required">
  557. <label for="modelSelectedFile">{{.i18n.Tr "repo.model.manage.modelfile"}}</label>
  558. </div>
  559. <div class="thirteen wide field" style="position:relative">
  560. <input id="modelSelectedFile" type="text" readonly required onclick="showMenu();" name="modelSelectedFile" >
  561. <div id="menuContent" class="menuContent" style="display:none;">
  562. <ul id="treeDemo" class="ztree"></ul>
  563. </div>
  564. </div>
  565. </div>
  566. <div class="inline field">
  567. <label>{{.i18n.Tr "repo.model.manage.modellabel"}}</label>
  568. <input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255"
  569. placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'>
  570. </div>
  571. <div class="inline field">
  572. <label for="description">{{.i18n.Tr "repo.model.manage.modeldesc"}}</label>
  573. <textarea style="width: 83%;margin-left: 7px;" id="Description" name="Description" rows="3"
  574. maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}'
  575. onchange="this.value=this.value.substring(0, 255)"
  576. onkeydown="this.value=this.value.substring(0, 255)"
  577. onkeyup="this.value=this.value.substring(0, 256)"></textarea>
  578. </div>
  579. <div class="inline field" style="margin-left: 75px;">
  580. <button onclick="createModel()" type="button" class="ui create_train_job green button"
  581. style="position: absolute;">
  582. {{.i18n.Tr "repo.model.manage.sava_model"}}
  583. </button>
  584. </div>
  585. </form>
  586. <div class="actions" style="display: inline-block;margin-left: 180px;">
  587. <button class="ui button cancel">{{.i18n.Tr "repo.cloudbrain.cancel"}}</button>
  588. </div>
  589. </div>
  590. </div>
  591. </div>
  592. </div>
  593. {{template "base/footer" .}}
  594. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.core.js"></script>
  595. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.excheck.js"></script>
  596. <script>
  597. var setting = {
  598. check: {
  599. enable: true,
  600. chkboxType: {"Y":"ps", "N":"ps"}
  601. },
  602. view: {
  603. dblClickExpand: false
  604. },
  605. callback: {
  606. beforeClick: beforeClick,
  607. onCheck: onCheck
  608. }
  609. };
  610. function beforeClick(treeId, treeNode) {
  611. var zTree = $.fn.zTree.getZTreeObj("treeDemo");
  612. zTree.checkNode(treeNode, !treeNode.checked, null, true);
  613. return false;
  614. }
  615. function onCheck(e, treeId, treeNode) {
  616. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  617. nodes = zTree.getCheckedNodes(true),
  618. v = "";
  619. for (var i=0, l=nodes.length; i<l; i++) {
  620. if(nodes[i].isParent){
  621. continue;
  622. }
  623. var pathNodes = nodes[i].getPath();
  624. var path ="";
  625. for(var j=0;j<pathNodes.length;j++){
  626. if(j ==0){
  627. path += pathNodes[j].name;
  628. }else{
  629. path += "/" + pathNodes[j].name;
  630. }
  631. }
  632. v += path + ";";
  633. }
  634. if (v.length > 0 ) v = v.substring(0, v.length-1);
  635. var cityObj = $("#modelSelectedFile");
  636. cityObj.attr("value", v);
  637. }
  638. function showMenu() {
  639. var cityObj = $("#modelSelectedFile");
  640. var cityOffset = $("#modelSelectedFile").offset();
  641. //$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
  642. $("#menuContent").slideDown("fast");
  643. $("body").bind("mousedown", onBodyDown);
  644. }
  645. function hideMenu() {
  646. $("#menuContent").fadeOut("fast");
  647. $("body").unbind("mousedown", onBodyDown);
  648. }
  649. function onBodyDown(event) {
  650. if (!(event.target.id == "menuBtn" || event.target.id == "modelSelectedFile" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
  651. hideMenu();
  652. }
  653. }
  654. let dirKey="isOnlyDir--:&";
  655. function loadSelectedModelFile(trainJob){
  656. console.log("trainJob=" + trainJob);
  657. $('#choice_file').dropdown('clear')
  658. $("#model-file").empty()
  659. if(trainJob ==null || trainJob ==""){
  660. console.log("trainJob is null");
  661. }else{
  662. $.get(`/${userName}/${repoPath}/modelmanage/query_train_model?jobName=${trainJob.JobName}&type=0&VersionName=${trainJob.VersionName}`, (data) => {
  663. const n_length = data.length
  664. let file_html=''
  665. let firstFileName =''
  666. var zNodes=[];
  667. var nodesMap={};
  668. for (let i=0;i<n_length;i++){
  669. var parentNodeMap = nodesMap;
  670. var fileSplits = data[i].FileName.split("/");
  671. for(let j=0;j < fileSplits.length;j++){
  672. if(fileSplits[j] == ""){
  673. break;
  674. }
  675. if(parentNodeMap[fileSplits[j]] == null){
  676. parentNodeMap[fileSplits[j]] = {};
  677. }
  678. parentNodeMap = parentNodeMap[fileSplits[j]];
  679. }
  680. }
  681. for (let i=0;i<n_length;i++){
  682. var parentNodeMap = nodesMap;
  683. var fileSplits = data[i].FileName.split("/");
  684. for(let j=0;j < fileSplits.length;j++){
  685. if(fileSplits[j] == ""){
  686. if(data[i].FileName[data[i].FileName.length -1] =="/"){
  687. if(Object.keys(parentNodeMap).length ==0){
  688. parentNodeMap[dirKey]="true";
  689. }
  690. }
  691. break;
  692. }
  693. parentNodeMap = parentNodeMap[fileSplits[j]];
  694. }
  695. }
  696. convertToNode(zNodes,nodesMap);
  697. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  698. })
  699. }
  700. }
  701. function convertToNode(nodeList,nodesMap){
  702. var keyList = Object.keys(nodesMap);
  703. keyList.sort(function(a,b){
  704. return a-b;
  705. });
  706. var isFirst = true;
  707. for(var i=0; i<keyList.length;i++){
  708. var node = {};
  709. node["name"] = keyList[i];
  710. nodeList.push(node);
  711. if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){
  712. if(nodesMap[keyList[i]][dirKey] != null){
  713. node["open"] = false;
  714. node["isParent"] = true;
  715. }else{
  716. node["children"]=[];
  717. if(isFirst){
  718. node["open"] = true;
  719. isFirst= false;
  720. }
  721. convertToNode(node["children"],nodesMap[keyList[i]]);
  722. }
  723. }
  724. }
  725. }
  726. function showcreate(obj) {
  727. $('.ui.modal.second')
  728. .modal({
  729. centered: false,
  730. onShow: function () {
  731. $('input[name="Version"]').addClass('model_disabled')
  732. // $('input[name="JobId"]').text(obj.JobName)
  733. $('#JobName').val(obj.DisplayJobName).addClass('model_disabled')
  734. $('input[name="JobId"]').val(obj.JobID)
  735. $('input[name="VersionName"]').val("V0001")
  736. $('#choice_Engine .default.text').text("PyTorch");
  737. $('#choice_Engine input[name="Engine"]').val(0)
  738. $('#choice_Engine .default.text').css({ "color": "rgb(0, 0, 0,0.87)" })
  739. $('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" })
  740. createModelName();
  741. loadSelectedModelFile(obj);
  742. },
  743. onHide: function () {
  744. var cityObj = $("#modelSelectedFile");
  745. cityObj.attr("value", "");
  746. document.getElementById("formId").reset();
  747. $('.ui.dimmer').css({ "background-color": "" })
  748. $('.ui.error.message').text()
  749. $('.ui.error.message').css('display', 'none')
  750. }
  751. })
  752. .modal('show')
  753. }
  754. function createModel() {
  755. let url_href = `/${userName}/${repoPath}/modelmanage/create_new_model`
  756. let data = $("#formId").serialize()
  757. $("#mask").css({ "display": "block", "z-index": "9999" })
  758. $.ajax({
  759. url: url_href,
  760. type: 'POST',
  761. data: data,
  762. success: function (res) {
  763. $('input[name="Engine_name"]').val("");
  764. $('input[name="Engine"]').val("");
  765. location.href = `/${userName}/${repoPath}/modelmanage/show_model`
  766. $('.ui.modal.second').modal('hide')
  767. },
  768. error: function (xhr) {
  769. // 隐藏 loading
  770. // 只有请求不正常(状态码不为200)才会执行
  771. $('.ui.error.message').text(xhr.responseText)
  772. $('.ui.error.message').css('display', 'block')
  773. },
  774. complete: function (xhr) {
  775. $("#mask").css({ "display": "none", "z-index": "1" })
  776. }
  777. })
  778. }
  779. function createModelName() {
  780. let repoName = location.pathname.split('/')[2]
  781. let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4)
  782. $('#name').val(modelName)
  783. $('#version').val("0.0.1")
  784. }
  785. $('.menu .item').tab()
  786. $(document).ready(function () {
  787. $('.ui.accordion').accordion({ selector: { trigger: '.icon' } });
  788. });
  789. $(document).ready(function () {
  790. $('.secondary.menu .item').tab();
  791. });
  792. let userName
  793. let repoPath
  794. let jobID
  795. let downlaodFlag = {{ $.canDownload }}
  796. let taskID = {{ $.task.ID }}
  797. let realJobName = {{ $.task.JobName }}
  798. $(document).ready(function () {
  799. let url = window.location.href;
  800. let urlArr = url.split('/')
  801. userName = urlArr.slice(-5)[0]
  802. repoPath = urlArr.slice(-4)[0]
  803. jobID = urlArr.slice(-1)[0]
  804. })
  805. function stopBubbling(e) {
  806. e = window.event || e;
  807. if (e.stopPropagation) {
  808. e.stopPropagation(); //阻止事件 冒泡传播
  809. } else {
  810. e.cancelBubble = true; //ie兼容
  811. }
  812. }
  813. function loadLog(version_name) {
  814. document.getElementById("mask").style.display = "block"
  815. let startLine = $('input[name=end_line]').val();
  816. if(startLine==""){
  817. startLine=0;
  818. }
  819. let endLine = $('input[name=end_line]').val();
  820. if(endLine==""){
  821. endLine = 50;
  822. }
  823. $.get(`/${userName}/${repoPath}/cloudbrain/train-job/${jobID}/get_log?endLine=${endLine}&startLine=${startLine}`, (data) => {
  824. $('input[name=end_line]').val(data.EndLine)
  825. $('input[name=start_line]').val(data.StartLine)
  826. $(`#log_file${version_name}`).text(data.Content)
  827. document.getElementById("mask").style.display = "none"
  828. }).fail(function (err) {
  829. console.log(err);
  830. document.getElementById("mask").style.display = "none"
  831. });
  832. }
  833. function refreshStatus(version_name) {
  834. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`, (data) => {
  835. // header status and duration
  836. //$(`#${version_name}-duration-span`).text(data.JobDuration)
  837. $(`#${version_name}-status-span span`).text(data.JobStatus)
  838. $(`#${version_name}-status-span i`).attr("class", data.JobStatus)
  839. // detail status and duration
  840. //$('#'+version_name+'-duration').text(data.JobDuration)
  841. $('#' + version_name + '-status').text(data.JobStatus)
  842. loadLog(version_name)
  843. }).fail(function (err) {
  844. console.log(err);
  845. });
  846. stopBubbling(arguments.callee.caller.arguments[0])
  847. }
  848. function parseInfo() {
  849. let jsonValue = document.getElementById("json_value").value;
  850. let jsonObj = JSON.parse(jsonValue);
  851. let podRoleName = jsonObj["podRoleName"];
  852. let html = "";
  853. if (podRoleName != null) {
  854. let task0 = podRoleName["task1-0"];
  855. let podEvents = jsonObj["podEvents"];
  856. let podEventArray = podEvents[task0];
  857. if (podEventArray != null) {
  858. for (var i = 0; i < podEventArray.length; i++) {
  859. if (podEventArray[i]["reason"] != "") {
  860. html += "<p><b>[" + podEventArray[i]["reason"] + "]</b></p>";
  861. html += "<p>" + podEventArray[i]["message"] + "</p>";
  862. html += "<p>" + podEventArray[i]["action"] + "</p>";
  863. }
  864. }
  865. }
  866. let extras = jsonObj["extras"];
  867. if (extras != null) {
  868. for (var i = 0; i < extras.length; i++) {
  869. if (extras[i]["reason"] != "") {
  870. html += "<p><b>[" + extras[i]["reason"] + "]</b></p>";
  871. html += "<p>" + extras[i]["message"] + "</p>";
  872. html += "<p>" + extras[i]["action"] + "</p>";
  873. }
  874. }
  875. }
  876. }
  877. let string = document.getElementById("ExitDiagnostics").value;
  878. string = string.replace(/\r\n/g, "<br>")
  879. string = string.replace(/\n/g, "<br>");
  880. string = string.replace(/(\r\n)|(\n)/g, '<br>');
  881. if (string != "") {
  882. html += "<p><b>[ExitDiagnostics]</b></p>";
  883. html += "<p>" + string + "</p>";
  884. }
  885. document.getElementById("info_display").innerHTML = html;
  886. }
  887. </script>