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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  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) (ne .Status "WAITING") ($.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">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
  224. {{end}}
  225. </div>
  226. <div class="ac-display-inblock title_text acc-margin-bottom">
  227. <span class="cti-mgRight-sm">{{TimeSinceUnix1 .CreatedUnix}}</span>
  228. <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:
  229. <span id="{{.VersionName}}-status-span"><i id="icon"
  230. style="vertical-align: middle;" class="{{.Status}}"></i><span id="text"
  231. style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span>
  232. </span>
  233. <span
  234. class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span>
  235. <span class="cti-mgRight-sm uc-accordionTitle-black"
  236. id="{{.VersionName}}-duration-span">{{$.duration}}</span>
  237. <span class="refresh-status" data-tooltip="刷新" style="cursor: pointer;" data-inverted="" data-version="{{.VersionName}}"><i
  238. class="redo icon redo-color"></i></span>
  239. </div>
  240. </span>
  241. </span>
  242. </div>
  243. </div>
  244. </div>
  245. <div class="{{if eq $k 0}}active{{end}} content">
  246. <div class="content-pad">
  247. <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);">
  248. <a class="active item"
  249. data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a>
  250. <a class="item" data-tab="second{{$k}}"
  251. onclick="javascript:parseInfo()">{{$.i18n.Tr "repo.cloudbrain.runinfo"}}</a>
  252. <a class="item log_bottom" data-tab="third{{$k}}"
  253. data-version="{{.VersionName}}">{{$.i18n.Tr "repo.modelarts.log"}}</a>
  254. <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>
  255. </div>
  256. <div class="ui tab active" data-tab="first{{$k}}">
  257. <div style="padding-top: 10px;">
  258. <div class="tab_2_content">
  259. <div class="ac-grid ac-grid-col2">
  260. <div class="ac-grid-col">
  261. <table class="ti-form">
  262. <tbody class="ti-text-form">
  263. <tr class="ti-no-ng-animate">
  264. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  265. {{$.i18n.Tr "repo.cloudbrain_task"}}
  266. </td>
  267. <td class="ti-text-form-content">
  268. <div class="text-span text-span-w">
  269. {{.DisplayJobName}}
  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.status"}}
  276. </td>
  277. <td class="ti-text-form-content">
  278. <div class="text-span text-span-w" id="{{.VersionName}}-status">
  279. {{.Status}}
  280. </div>
  281. </td>
  282. </tr>
  283. <tr class="ti-no-ng-animate">
  284. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  285. {{$.i18n.Tr "repo.modelarts.train_job.start_time"}}
  286. </td>
  287. <td class="ti-text-form-content">
  288. <div class="text-span text-span-w">
  289. <span style="font-size: 12px;">
  290. {{if not (eq .StartTime 0)}}
  291. {{TimeSinceUnix1 .StartTime}}
  292. {{else}}
  293. --
  294. {{end}}
  295. </span>
  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.train_job.dura_time"}}
  302. </td>
  303. <td class="ti-text-form-content">
  304. <div class="text-span text-span-w"
  305. id="{{.VersionName}}-duration">
  306. {{$.duration}}
  307. </div>
  308. </td>
  309. </tr>
  310. <tr class="ti-no-ng-animate">
  311. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  312. {{$.i18n.Tr "repo.modelarts.train_job.resource_type"}}
  313. </td>
  314. <td class="ti-text-form-content resorce_type">
  315. <div class="text-span text-span-w"></div>
  316. </td>
  317. </tr>
  318. <tr class="ti-no-ng-animate">
  319. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  320. {{$.i18n.Tr "repo.modelarts.train_job.standard"}}
  321. </td>
  322. <td class="ti-text-form-content spec">
  323. <div class="text-span text-span-w"></div>
  324. </td>
  325. </tr>
  326. </tbody>
  327. </table>
  328. </div>
  329. <div class="ac-grid-col">
  330. <table class="ti-form">
  331. <tbody class="ti-text-form">
  332. <tr class="ti-no-ng-animate">
  333. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  334. {{$.i18n.Tr "cloudbrain.mirror"}}
  335. </td>
  336. <td class="ti-text-form-content">
  337. <div class="text-span text-span-w" id="{{.VersionName}}-mirror">
  338. <span class="ui poping up clipboard" data-position="top center" id="clipboard-btn" style="cursor:pointer"
  339. data-clipboard-text="{{.Image}}"
  340. data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
  341. data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
  342. data-content="{{$.i18n.Tr "repo.copy_link"}}"
  343. data-variation="inverted tiny"
  344. >
  345. <span title="{{.Image}}">{{.Image}}</span>
  346. </span>
  347. </div>
  348. </td>
  349. </tr>
  350. <tr class="ti-no-ng-animate">
  351. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  352. {{$.i18n.Tr "repo.modelarts.code_version"}}
  353. </td>
  354. <td class="ti-text-form-content">
  355. <div class="text-span text-span-w">
  356. {{.BranchName}}
  357. </div>
  358. </td>
  359. </tr>
  360. <tr class="ti-no-ng-animate">
  361. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  362. {{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
  363. </td>
  364. <td class="ti-text-form-content">
  365. <div class="text-span text-span-w">
  366. {{.BootFile}}
  367. </div>
  368. </td>
  369. </tr>
  370. <tr class="ti-no-ng-animate">
  371. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  372. {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
  373. </td>
  374. <td class="ti-text-form-content">
  375. <div class="text-span text-span-w" title="{{.Parameters}}">
  376. {{.Parameters}}
  377. </div>
  378. </td>
  379. </tr>
  380. <tr class="ti-no-ng-animate">
  381. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  382. {{$.i18n.Tr "repo.modelarts.train_job.description"}}
  383. </td>
  384. <td class="ti-text-form-content">
  385. <div class="text-span text-span-w" title="{{.Description}}">
  386. {{.Description}}
  387. </div>
  388. </td>
  389. </tr>
  390. </tbody>
  391. </table>
  392. </div>
  393. </div>
  394. <div style="clear:both">
  395. <table style="border:none" class="ui fixed small stackable table">
  396. <thead>
  397. <tr><th style="color: #8a8e99;font-size:12px" class="three wide left aligned">{{$.i18n.Tr "dataset.file"}}</th>
  398. </tr></thead>
  399. <tbody>
  400. {{range $m ,$n := $.datasetDownload}}
  401. <tr>
  402. <td style="word-wrap: break-word;word-break: break-all;">
  403. {{if eq .IsDelete true}}
  404. {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}})
  405. {{else}}
  406. <a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a>
  407. {{end}}
  408. </td>
  409. </tr>
  410. {{end}}
  411. </tbody>
  412. </table>
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. <div class="ui tab" data-tab="second{{$k}}">
  418. <div>
  419. <div class="ui message message{{.VersionName}}" style="display: none;">
  420. <div id="header"></div>
  421. </div>
  422. <div class="ui attached log" id="log_state{{.VersionName}}"
  423. style="height: 390px !important; overflow: auto;">
  424. <input type="hidden" id="json_value" value="{{$.result.JobStatus.AppExitDiagnostics}}">
  425. <input type="hidden" id="ExitDiagnostics" value="{{$.ExitDiagnostics}}">
  426. <span id="info_display" class="info_text">
  427. </span>
  428. </div>
  429. </div>
  430. </div>
  431. <div class="ui tab" data-tab="third{{$k}}">
  432. <div>
  433. <a id="{{.VersionName}}-log-down"
  434. class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}}'
  435. href="/api/v1/repos/{{$.RepoRelPath}}/cloudbrain/{{.ID}}/download_log_file">
  436. <i class="ri-download-cloud-2-line"></i>
  437. <span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.modelarts.download_log"}}</span>
  438. </a>
  439. </div>
  440. <div style="position: relative;border: 1px solid rgba(0,0,0,.2);padding: 0 10px;margin-top: 10px;">
  441. <span>
  442. <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;"
  443. class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a>
  444. </span>
  445. <span class="log-info-{{.VersionName}}">
  446. <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;"
  447. class="log_bottom" data-version="{{.VersionName}}"><i
  448. class="icon-to-bottom"></i></a>
  449. </span>
  450. <div class="ui message message{{.VersionName}}" style="display: none;">
  451. <div id="header"></div>
  452. </div>
  453. <div class="ui attached log log-scroll" id="log{{.VersionName}}" data-version="{{.VersionName}}"
  454. style="height: 300px !important; overflow: auto;">
  455. <div class="ui inverted active dimmer">
  456. <div class="ui loader"></div>
  457. </div>
  458. <input type="hidden" name="end_line" value>
  459. <input type="hidden" name="start_line" value>
  460. <pre id="log_file{{.VersionName}}"></pre>
  461. </div>
  462. </div>
  463. </div>
  464. <div class="ui tab" data-tab="four{{$k}}">
  465. <input type="hidden" name="model{{.VersionName}}" value="-1">
  466. <input type="hidden" name="modelback{{.VersionName}}" value="-1">
  467. <div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
  468. <div class="active section">result</div>
  469. <div class="divider"> / </div>
  470. </div>
  471. <div id="dir_list{{.VersionName}}">
  472. </div>
  473. <div style="display:flex;align-items: center;justify-content: end;color: #f2711c;">
  474. <i class="ri-error-warning-line" style="margin-right:0.5rem;"></i>
  475. <span>{{$.i18n.Tr "repo.file_limit_100"}}</span>
  476. </div>
  477. </div>
  478. </div>
  479. </div>
  480. </div>
  481. {{end}} {{template "base/paginate" .}}
  482. </div>
  483. <!-- 确认模态框 -->
  484. <div id="deletemodel">
  485. <div class="ui basic modal">
  486. <div class="ui icon header">
  487. <i class="trash icon"></i> 删除任务
  488. </div>
  489. <div class="content">
  490. <p>你确认删除该任务么?此任务一旦删除不可恢复。</p>
  491. </div>
  492. <div class="actions">
  493. <div class="ui red basic inverted cancel button">
  494. <i class="remove icon"></i> 取消操作
  495. </div>
  496. <div class="ui green basic inverted ok button">
  497. <i class="checkmark icon"></i> 确定操作
  498. </div>
  499. </div>
  500. </div>
  501. </div>
  502. <!--
  503. <div id="menuContent" class="menuContent" style="display:none; position: absolute;z-index:9999">
  504. <ul id="treeDemo" class="ztree" style="margin-top:0; width: 83%; height: 100%;"></ul>
  505. </div> -->
  506. <!-- 创建模型 -->
  507. <div id="newmodel">
  508. <div class="ui modal second">
  509. <div class="header" style="padding: 1rem;background-color: rgba(240, 240, 240, 100);">
  510. <h4 id="model_header">{{.i18n.Tr "repo.model.manage.import_new_model"}}</h4>
  511. </div>
  512. <div class="content content-padding">
  513. <form id="formId" method="POST" class="ui form">
  514. <div class="ui error message">
  515. </div>
  516. {{$.CsrfTokenHtml}}
  517. <input type="hidden" name="trainTaskCreate" value="true">
  518. <div class="required inline field">
  519. <label>{{.i18n.Tr "repo.modelarts.train_job"}}</label>
  520. <input type="hidden" class="width83" id="JobId" name="JobId" readonly required>
  521. <input type="hidden" id="VersionName" name="VersionName" value="V0001">
  522. <input style="width: 45%;" id="JobName" readonly required>
  523. </div>
  524. <div class="required inline field" id="modelname">
  525. <label>{{.i18n.Tr "repo.model.manage.model_name"}}</label>
  526. <input style="width: 45%;" id="name" name="Name" required maxlength="25"
  527. onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  528. </div>
  529. <div class="required inline field" id="verionname">
  530. <label>{{.i18n.Tr "repo.modelconvert.modelversion"}}</label>
  531. <input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255">
  532. </div>
  533. <div class="unite min_title inline field required">
  534. <label>{{.i18n.Tr "repo.model.manage.engine"}}</label>
  535. <div class="ui dropdown selection search width70" id="choice_Engine">
  536. <input type="hidden" id="Engine" name="Engine" required>
  537. <div class="default text">{{.i18n.Tr "repo.model.manage.select.engine"}}</div>
  538. <i class="dropdown icon"></i>
  539. <div class="menu" id="job-Engine">
  540. <option class="active item" data-value="0">PyTorch</option>
  541. <option class="item" data-value="1">TensorFlow</option>
  542. <option class="item" data-value="4">PaddlePaddle</option>
  543. <option class="item" data-value="5">OneFlow</option>
  544. <option class="item" data-value="6">MXNet</option>
  545. <option class="item" data-value="3">Other</option>
  546. </div>
  547. </div>
  548. </div>
  549. <div class="unite min_title inline fields required">
  550. <div class="field required">
  551. <label for="modelSelectedFile">{{.i18n.Tr "repo.model.manage.modelfile"}}</label>
  552. </div>
  553. <div class="thirteen wide field" style="position:relative">
  554. <input id="modelSelectedFile" type="text" readonly required onclick="showMenu();" name="modelSelectedFile">
  555. <div id="menuContent" class="menuContent" style="display:none;">
  556. <ul id="treeDemo" class="ztree"></ul>
  557. </div>
  558. </div>
  559. </div>
  560. <div class="inline field">
  561. <label>{{.i18n.Tr "repo.model.manage.modellabel"}}</label>
  562. <input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255"
  563. placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'>
  564. </div>
  565. <div class="inline field">
  566. <label for="description">{{.i18n.Tr "repo.model.manage.modeldesc"}}</label>
  567. <textarea style="width: 83%;margin-left: 7px;" id="Description" name="Description" rows="3"
  568. maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}'
  569. onchange="this.value=this.value.substring(0, 255)"
  570. onkeydown="this.value=this.value.substring(0, 255)"
  571. onkeyup="this.value=this.value.substring(0, 256)"></textarea>
  572. </div>
  573. <div class="inline field" style="margin-left: 75px;">
  574. <button onclick="createModel()" type="button" class="ui create_train_job green button"
  575. style="position: absolute;">
  576. {{.i18n.Tr "repo.model.manage.sava_model"}}
  577. </button>
  578. </div>
  579. </form>
  580. <div class="actions" style="display: inline-block;margin-left: 180px;">
  581. <button class="ui button cancel">{{.i18n.Tr "repo.cloudbrain.cancel"}}</button>
  582. </div>
  583. </div>
  584. </div>
  585. </div>
  586. </div>
  587. {{template "base/footer" .}}
  588. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.core.js"></script>
  589. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.excheck.js"></script>
  590. <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  591. <script>
  592. var setting = {
  593. check: {
  594. enable: true,
  595. chkboxType: {"Y":"ps", "N":"ps"}
  596. },
  597. view: {
  598. dblClickExpand: false
  599. },
  600. callback: {
  601. beforeClick: beforeClick,
  602. onCheck: onCheck
  603. }
  604. };
  605. function beforeClick(treeId, treeNode) {
  606. var zTree = $.fn.zTree.getZTreeObj("treeDemo");
  607. zTree.checkNode(treeNode, !treeNode.checked, null, true);
  608. return false;
  609. }
  610. function onCheck(e, treeId, treeNode) {
  611. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  612. nodes = zTree.getCheckedNodes(true),
  613. v = "";
  614. for (var i=0, l=nodes.length; i<l; i++) {
  615. if(nodes[i].isParent){
  616. continue;
  617. }
  618. var pathNodes = nodes[i].getPath();
  619. var path ="";
  620. for(var j=0;j<pathNodes.length;j++){
  621. if(j ==0){
  622. path += pathNodes[j].name;
  623. }else{
  624. path += "/" + pathNodes[j].name;
  625. }
  626. }
  627. v += path + ";";
  628. }
  629. if (v.length > 0 ) v = v.substring(0, v.length-1);
  630. var cityObj = $("#modelSelectedFile");
  631. cityObj.attr("value", v);
  632. }
  633. function showMenu() {
  634. var cityObj = $("#modelSelectedFile");
  635. var cityOffset = $("#modelSelectedFile").offset();
  636. //$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
  637. $("#menuContent").slideDown("fast");
  638. $("body").bind("mousedown", onBodyDown);
  639. }
  640. function hideMenu() {
  641. $("#menuContent").fadeOut("fast");
  642. $("body").unbind("mousedown", onBodyDown);
  643. }
  644. function onBodyDown(event) {
  645. if (!(event.target.id == "menuBtn" || event.target.id == "modelSelectedFile" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
  646. hideMenu();
  647. }
  648. }
  649. let dirKey="isOnlyDir--:&";
  650. function loadSelectedModelFile(trainJob){
  651. console.log("trainJob=" + trainJob);
  652. $('#choice_file').dropdown('clear')
  653. $("#model-file").empty()
  654. if(trainJob ==null || trainJob ==""){
  655. console.log("trainJob is null");
  656. }else{
  657. $.get(`/${userName}/${repoPath}/modelmanage/query_train_model?jobName=${trainJob.JobName}&type=0&VersionName=${trainJob.VersionName}`, (data) => {
  658. const n_length = data.length
  659. let file_html=''
  660. let firstFileName =''
  661. var zNodes=[];
  662. var nodesMap={};
  663. for (let i=0;i<n_length;i++){
  664. var parentNodeMap = nodesMap;
  665. var fileSplits = data[i].FileName.split("/");
  666. for(let j=0;j < fileSplits.length;j++){
  667. if(fileSplits[j] == ""){
  668. break;
  669. }
  670. if(parentNodeMap[fileSplits[j]] == null){
  671. parentNodeMap[fileSplits[j]] = {};
  672. }
  673. parentNodeMap = parentNodeMap[fileSplits[j]];
  674. }
  675. }
  676. for (let i=0;i<n_length;i++){
  677. var parentNodeMap = nodesMap;
  678. var fileSplits = data[i].FileName.split("/");
  679. for(let j=0;j < fileSplits.length;j++){
  680. if(fileSplits[j] == ""){
  681. if(data[i].FileName[data[i].FileName.length -1] =="/"){
  682. if(Object.keys(parentNodeMap).length ==0){
  683. parentNodeMap[dirKey]="true";
  684. }
  685. }
  686. break;
  687. }
  688. parentNodeMap = parentNodeMap[fileSplits[j]];
  689. }
  690. }
  691. convertToNode(zNodes,nodesMap);
  692. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  693. })
  694. }
  695. }
  696. function convertToNode(nodeList,nodesMap){
  697. var keyList = Object.keys(nodesMap);
  698. keyList.sort(function(a,b){
  699. return a-b;
  700. });
  701. var isFirst = true;
  702. for(var i=0; i<keyList.length;i++){
  703. var node = {};
  704. node["name"] = keyList[i];
  705. nodeList.push(node);
  706. if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){
  707. if(nodesMap[keyList[i]][dirKey] != null){
  708. node["open"] = false;
  709. node["isParent"] = true;
  710. }else{
  711. node["children"]=[];
  712. if(isFirst){
  713. node["open"] = true;
  714. isFirst= false;
  715. }
  716. convertToNode(node["children"],nodesMap[keyList[i]]);
  717. }
  718. }
  719. }
  720. }
  721. function showcreate(obj) {
  722. $('.ui.modal.second')
  723. .modal({
  724. centered: false,
  725. onShow: function () {
  726. $('input[name="Version"]').addClass('model_disabled')
  727. // $('input[name="JobId"]').text(obj.JobName)
  728. $('#JobName').val(obj.DisplayJobName).addClass('model_disabled')
  729. $('input[name="JobId"]').val(obj.JobID)
  730. $('input[name="VersionName"]').val("V0001")
  731. $('#choice_Engine .default.text').text("PyTorch");
  732. $('#choice_Engine input[name="Engine"]').val(0)
  733. $('#choice_Engine .default.text').css({ "color": "rgb(0, 0, 0,0.87)" })
  734. $('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" })
  735. createModelName();
  736. loadSelectedModelFile(obj);
  737. },
  738. onHide: function () {
  739. var cityObj = $("#modelSelectedFile");
  740. cityObj.attr("value", "");
  741. document.getElementById("formId").reset();
  742. $('.ui.dimmer').css({ "background-color": "" })
  743. $('.ui.error.message').text()
  744. $('.ui.error.message').css('display', 'none')
  745. }
  746. })
  747. .modal('show')
  748. }
  749. function createModel() {
  750. if(!$('input#modelSelectedFile').val()){
  751. $('input#modelSelectedFile').parent().addClass('error')
  752. return
  753. }
  754. let url_href = `/${userName}/${repoPath}/modelmanage/create_new_model`
  755. let data = $("#formId").serialize()
  756. $("#mask").css({ "display": "block", "z-index": "9999" })
  757. $.ajax({
  758. url: url_href,
  759. type: 'POST',
  760. data: data,
  761. success: function (res) {
  762. $('input[name="Engine_name"]').val("");
  763. $('input[name="Engine"]').val("");
  764. location.href = `/${userName}/${repoPath}/modelmanage/show_model`
  765. $('.ui.modal.second').modal('hide')
  766. },
  767. error: function (xhr) {
  768. // 隐藏 loading
  769. // 只有请求不正常(状态码不为200)才会执行
  770. $('.ui.error.message').text(xhr.responseText)
  771. $('.ui.error.message').css('display', 'block')
  772. },
  773. complete: function (xhr) {
  774. $("#mask").css({ "display": "none", "z-index": "1" })
  775. }
  776. })
  777. }
  778. function createModelName() {
  779. let repoName = location.pathname.split('/')[2]
  780. let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4)
  781. $('#name').val(modelName)
  782. $('#version').val("0.0.1")
  783. }
  784. $('.menu .item').tab()
  785. $(document).ready(function () {
  786. $('.ui.accordion').accordion({ selector: { trigger: '.icon' } });
  787. });
  788. $(document).ready(function () {
  789. $('.secondary.menu .item').tab();
  790. });
  791. let userName
  792. let repoPath
  793. let jobID
  794. let downlaodFlag = {{ $.canDownload }}
  795. let taskID = {{ $.task.ID }}
  796. let realJobName = {{ $.task.JobName }}
  797. $(document).ready(function () {
  798. let url = window.location.href;
  799. let urlArr = url.split('/')
  800. userName = urlArr.slice(-5)[0]
  801. repoPath = urlArr.slice(-4)[0]
  802. jobID = urlArr.slice(-1)[0]
  803. })
  804. function stopBubbling(e) {
  805. e = window.event || e;
  806. if (e.stopPropagation) {
  807. e.stopPropagation(); //阻止事件 冒泡传播
  808. } else {
  809. e.cancelBubble = true; //ie兼容
  810. }
  811. }
  812. function loadLog(version_name) {
  813. document.getElementById("mask").style.display = "block"
  814. let startLine = $('input[name=end_line]').val();
  815. if(startLine==""){
  816. startLine=0;
  817. }
  818. let endLine = $('input[name=end_line]').val();
  819. if(endLine==""){
  820. endLine = 50;
  821. }
  822. $.get(`/${userName}/${repoPath}/cloudbrain/train-job/${jobID}/get_log?endLine=${endLine}&startLine=${startLine}`, (data) => {
  823. $('input[name=end_line]').val(data.EndLine)
  824. $('input[name=start_line]').val(data.StartLine)
  825. $(`#log_file${version_name}`).text(data.Content)
  826. document.getElementById("mask").style.display = "none"
  827. }).fail(function (err) {
  828. console.log(err);
  829. document.getElementById("mask").style.display = "none"
  830. });
  831. }
  832. function refreshStatus(version_name) {
  833. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`, (data) => {
  834. // header status and duration
  835. //$(`#${version_name}-duration-span`).text(data.JobDuration)
  836. $(`#${version_name}-status-span span`).text(data.JobStatus)
  837. $(`#${version_name}-status-span i`).attr("class", data.JobStatus)
  838. // detail status and duration
  839. //$('#'+version_name+'-duration').text(data.JobDuration)
  840. $('#' + version_name + '-status').text(data.JobStatus)
  841. loadLog(version_name)
  842. }).fail(function (err) {
  843. console.log(err);
  844. });
  845. stopBubbling(arguments.callee.caller.arguments[0])
  846. }
  847. function parseInfo() {
  848. let jsonValue = document.getElementById("json_value").value;
  849. let jsonObj = JSON.parse(jsonValue);
  850. let podRoleName = jsonObj["podRoleName"];
  851. let html = "";
  852. if (podRoleName != null) {
  853. let task0 = podRoleName["task1-0"];
  854. let podEvents = jsonObj["podEvents"];
  855. let podEventArray = podEvents[task0];
  856. if (podEventArray != null) {
  857. for (var i = 0; i < podEventArray.length; i++) {
  858. if (podEventArray[i]["reason"] != "") {
  859. html += "<p><b>[" + podEventArray[i]["reason"] + "]</b></p>";
  860. html += "<p>" + podEventArray[i]["message"] + "</p>";
  861. html += "<p>" + podEventArray[i]["action"] + "</p>";
  862. }
  863. }
  864. }
  865. let extras = jsonObj["extras"];
  866. if (extras != null) {
  867. for (var i = 0; i < extras.length; i++) {
  868. if (extras[i]["reason"] != "") {
  869. html += "<p><b>[" + extras[i]["reason"] + "]</b></p>";
  870. html += "<p>" + extras[i]["message"] + "</p>";
  871. html += "<p>" + extras[i]["action"] + "</p>";
  872. }
  873. }
  874. }
  875. }
  876. let string = document.getElementById("ExitDiagnostics").value;
  877. string = string.replace(/\r\n/g, "<br>")
  878. string = string.replace(/\n/g, "<br>");
  879. string = string.replace(/(\r\n)|(\n)/g, '<br>');
  880. if (string != "") {
  881. html += "<p><b>[ExitDiagnostics]</b></p>";
  882. html += "<p>" + string + "</p>";
  883. }
  884. document.getElementById("info_display").innerHTML = html;
  885. }
  886. ;(function() {
  887. var SPEC = {{ .Spec }};
  888. var showPoint = false;
  889. var specStr = window.renderSpecStr(SPEC, showPoint, {
  890. gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
  891. free: {{$.i18n.Tr "cloudbrain.free"}},
  892. point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
  893. memory: {{$.i18n.Tr "cloudbrain.memory"}},
  894. shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
  895. });
  896. $('td.ti-text-form-content.spec div').text(specStr);
  897. SPEC && $('td.ti-text-form-content.resorce_type div').text(getListValueWithKey(ACC_CARD_TYPE, SPEC.AccCardType));
  898. })();
  899. </script>