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.

modelarts.go 17 kB

4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. package modelarts
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "path"
  6. "strconv"
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/context"
  9. "code.gitea.io/gitea/modules/log"
  10. "code.gitea.io/gitea/modules/notification"
  11. "code.gitea.io/gitea/modules/setting"
  12. "code.gitea.io/gitea/modules/storage"
  13. )
  14. const (
  15. //notebook
  16. storageTypeOBS = "obs"
  17. autoStopDuration = 4 * 60 * 60
  18. autoStopDurationMs = 4 * 60 * 60 * 1000
  19. DataSetMountPath = "/home/ma-user/work"
  20. NotebookEnv = "Python3"
  21. NotebookType = "Ascend"
  22. FlavorInfo = "Ascend: 1*Ascend 910 CPU: 24 核 96GiB (modelarts.kat1.xlarge)"
  23. //train-job
  24. // ResourcePools = "{\"resource_pool\":[{\"id\":\"pool1328035d\", \"value\":\"专属资源池\"}]}"
  25. // Engines = "{\"engine\":[{\"id\":1, \"value\":\"Ascend-Powered-Engine\"}]}"
  26. // EngineVersions = "{\"version\":[{\"id\":118,\"value\":\"MindSpore-1.0.0-c75-python3.7-euleros2.8-aarch64\"}," +
  27. // "{\"id\":119,\"value\":\"MindSpore-1.1.1-c76-python3.7-euleros2.8-aarch64\"}," +
  28. // "{\"id\":120,\"value\":\"MindSpore-1.1.1-c76-tr5-python3.7-euleros2.8-aarch64\"}," +
  29. // "{\"id\":117,\"value\":\"TF-1.15-c75-python3.7-euleros2.8-aarch64\"}" +
  30. // "]}"
  31. // TrainJobFlavorInfo = "{\"flavor\":[{\"code\":\"modelarts.bm.910.arm.public.2\",\"value\":\"Ascend : 2 * Ascend 910 CPU:48 核 512GiB\"}," +
  32. // "{\"code\":\"modelarts.bm.910.arm.public.8\",\"value\":\"Ascend : 8 * Ascend 910 CPU:192 核 2048GiB\"}," +
  33. // "{\"code\":\"modelarts.bm.910.arm.public.4\",\"value\":\"Ascend : 4 * Ascend 910 CPU:96 核 1024GiB\"}," +
  34. // "{\"code\":\"modelarts.bm.910.arm.public.1\",\"value\":\"Ascend : 1 * Ascend 910 CPU:24 核 256GiB\"}" +
  35. // "]}"
  36. CodePath = "/code/"
  37. OutputPath = "/output/"
  38. ResultPath = "/result/"
  39. LogPath = "/log/"
  40. JobPath = "/job/"
  41. OrderDesc = "desc" //向下查询
  42. OrderAsc = "asc" //向上查询
  43. Lines = 500
  44. TrainUrl = "train_url"
  45. DataUrl = "data_url"
  46. ResultUrl = "result_url"
  47. CkptUrl = "ckpt_url"
  48. PerPage = 10
  49. IsLatestVersion = "1"
  50. NotLatestVersion = "0"
  51. DebugType = -1
  52. VersionCount = 1
  53. SortByCreateTime = "create_time"
  54. ConfigTypeCustom = "custom"
  55. TotalVersionCount = 1
  56. )
  57. var (
  58. poolInfos *models.PoolInfos
  59. FlavorInfos *models.FlavorInfos
  60. )
  61. type GenerateTrainJobReq struct {
  62. JobName string
  63. Uuid string
  64. Description string
  65. CodeObsPath string
  66. BootFile string
  67. BootFileUrl string
  68. DataUrl string
  69. TrainUrl string
  70. FlavorCode string
  71. LogUrl string
  72. PoolID string
  73. WorkServerNumber int
  74. EngineID int64
  75. Parameters []models.Parameter
  76. CommitID string
  77. IsLatestVersion string
  78. Params string
  79. BranchName string
  80. PreVersionId int64
  81. PreVersionName string
  82. FlavorName string
  83. VersionCount int
  84. EngineName string
  85. TotalVersionCount int
  86. }
  87. type GenerateTrainJobVersionReq struct {
  88. JobName string
  89. Uuid string
  90. Description string
  91. CodeObsPath string
  92. BootFile string
  93. BootFileUrl string
  94. DataUrl string
  95. TrainUrl string
  96. FlavorCode string
  97. LogUrl string
  98. PoolID string
  99. WorkServerNumber int
  100. EngineID int64
  101. Parameters []models.Parameter
  102. Params string
  103. PreVersionId int64
  104. CommitID string
  105. BranchName string
  106. FlavorName string
  107. EngineName string
  108. PreVersionName string
  109. TotalVersionCount int
  110. }
  111. type GenerateInferenceJobReq struct {
  112. JobName string
  113. Uuid string
  114. Description string
  115. CodeObsPath string
  116. BootFile string
  117. BootFileUrl string
  118. DataUrl string
  119. TrainUrl string
  120. FlavorCode string
  121. LogUrl string
  122. PoolID string
  123. WorkServerNumber int
  124. EngineID int64
  125. Parameters []models.Parameter
  126. CommitID string
  127. Params string
  128. BranchName string
  129. FlavorName string
  130. EngineName string
  131. LabelName string
  132. IsLatestVersion string
  133. VersionCount int
  134. TotalVersionCount int
  135. ModelName string
  136. ModelVersion string
  137. CkptName string
  138. ResultUrl string
  139. }
  140. type VersionInfo struct {
  141. Version []struct {
  142. ID int `json:"id"`
  143. Value string `json:"value"`
  144. } `json:"version"`
  145. }
  146. type Flavor struct {
  147. Info []struct {
  148. Code string `json:"code"`
  149. Value string `json:"value"`
  150. } `json:"flavor"`
  151. }
  152. type Engine struct {
  153. Info []struct {
  154. ID int `json:"id"`
  155. Value string `json:"value"`
  156. } `json:"engine"`
  157. }
  158. type ResourcePool struct {
  159. Info []struct {
  160. ID string `json:"id"`
  161. Value string `json:"value"`
  162. } `json:"resource_pool"`
  163. }
  164. // type Parameter struct {
  165. // Label string `json:"label"`
  166. // Value string `json:"value"`
  167. // }
  168. // type Parameters struct {
  169. // Parameter []Parameter `json:"parameter"`
  170. // }
  171. type Parameters struct {
  172. Parameter []struct {
  173. Label string `json:"label"`
  174. Value string `json:"value"`
  175. } `json:"parameter"`
  176. }
  177. func GenerateTask(ctx *context.Context, jobName, uuid, description, flavor string) error {
  178. var dataActualPath string
  179. if uuid != "" {
  180. dataActualPath = setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + "/"
  181. } else {
  182. userPath := setting.UserBasePath + ctx.User.Name + "/"
  183. isExist, err := storage.ObsHasObject(userPath)
  184. if err != nil {
  185. log.Error("ObsHasObject failed:%v", err.Error(), ctx.Data["MsgID"])
  186. return err
  187. }
  188. if !isExist {
  189. if err = storage.ObsCreateObject(userPath); err != nil {
  190. log.Error("ObsCreateObject failed:%v", err.Error(), ctx.Data["MsgID"])
  191. return err
  192. }
  193. }
  194. dataActualPath = setting.Bucket + "/" + userPath
  195. }
  196. if poolInfos == nil {
  197. json.Unmarshal([]byte(setting.PoolInfos), &poolInfos)
  198. }
  199. jobResult, err := CreateJob(models.CreateNotebookParams{
  200. JobName: jobName,
  201. Description: description,
  202. ProfileID: setting.ProfileID,
  203. Flavor: flavor,
  204. Pool: models.Pool{
  205. ID: poolInfos.PoolInfo[0].PoolId,
  206. Name: poolInfos.PoolInfo[0].PoolName,
  207. Type: poolInfos.PoolInfo[0].PoolType,
  208. },
  209. Spec: models.Spec{
  210. Storage: models.Storage{
  211. Type: storageTypeOBS,
  212. Location: models.Location{
  213. Path: dataActualPath,
  214. },
  215. },
  216. AutoStop: models.AutoStop{
  217. Enable: true,
  218. Duration: autoStopDuration,
  219. },
  220. },
  221. })
  222. if err != nil {
  223. log.Error("CreateJob failed: %v", err.Error())
  224. return err
  225. }
  226. err = models.CreateCloudbrain(&models.Cloudbrain{
  227. Status: string(models.JobWaiting),
  228. UserID: ctx.User.ID,
  229. RepoID: ctx.Repo.Repository.ID,
  230. JobID: jobResult.ID,
  231. JobName: jobName,
  232. JobType: string(models.JobTypeDebug),
  233. Type: models.TypeCloudBrainTwo,
  234. Uuid: uuid,
  235. ComputeResource: models.NPUResource,
  236. })
  237. if err != nil {
  238. return err
  239. }
  240. notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobResult.ID, jobName, models.ActionCreateDebugNPUTask)
  241. return nil
  242. }
  243. func GenerateNotebook2(ctx *context.Context, jobName, uuid, description, flavor string) error {
  244. if poolInfos == nil {
  245. json.Unmarshal([]byte(setting.PoolInfos), &poolInfos)
  246. }
  247. jobResult, err := createNotebook2(models.CreateNotebook2Params{
  248. JobName: jobName,
  249. Description: description,
  250. Flavor: flavor,
  251. Duration: autoStopDurationMs,
  252. ImageID: "59a6e9f5-93c0-44dd-85b0-82f390c5d53a",
  253. PoolID: poolInfos.PoolInfo[0].PoolId,
  254. Feature: models.NotebookFeature,
  255. Volume: models.VolumeReq{
  256. Capacity: 100,
  257. Category: models.EVSCategory,
  258. Ownership: models.ManagedOwnership,
  259. },
  260. WorkspaceID: "0",
  261. })
  262. if err != nil {
  263. log.Error("createNotebook2 failed: %v", err.Error())
  264. return err
  265. }
  266. err = models.CreateCloudbrain(&models.Cloudbrain{
  267. Status: string(models.JobWaiting),
  268. UserID: ctx.User.ID,
  269. RepoID: ctx.Repo.Repository.ID,
  270. JobID: jobResult.ID,
  271. JobName: jobName,
  272. JobType: string(models.JobTypeDebug),
  273. Type: models.TypeCloudBrainTwo,
  274. Uuid: uuid,
  275. ComputeResource: models.NPUResource,
  276. })
  277. if err != nil {
  278. return err
  279. }
  280. return nil
  281. }
  282. func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error) {
  283. jobResult, err := createTrainJob(models.CreateTrainJobParams{
  284. JobName: req.JobName,
  285. Description: req.Description,
  286. Config: models.Config{
  287. WorkServerNum: req.WorkServerNumber,
  288. AppUrl: req.CodeObsPath,
  289. BootFileUrl: req.BootFileUrl,
  290. DataUrl: req.DataUrl,
  291. EngineID: req.EngineID,
  292. TrainUrl: req.TrainUrl,
  293. LogUrl: req.LogUrl,
  294. PoolID: req.PoolID,
  295. CreateVersion: true,
  296. Flavor: models.Flavor{
  297. Code: req.FlavorCode,
  298. },
  299. Parameter: req.Parameters,
  300. },
  301. })
  302. if err != nil {
  303. log.Error("CreateJob failed: %v", err.Error())
  304. return err
  305. }
  306. attach, err := models.GetAttachmentByUUID(req.Uuid)
  307. if err != nil {
  308. log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error())
  309. return err
  310. }
  311. jobId := strconv.FormatInt(jobResult.JobID, 10)
  312. err = models.CreateCloudbrain(&models.Cloudbrain{
  313. Status: TransTrainJobStatus(jobResult.Status),
  314. UserID: ctx.User.ID,
  315. RepoID: ctx.Repo.Repository.ID,
  316. JobID: jobId,
  317. JobName: req.JobName,
  318. JobType: string(models.JobTypeTrain),
  319. Type: models.TypeCloudBrainTwo,
  320. VersionID: jobResult.VersionID,
  321. VersionName: jobResult.VersionName,
  322. Uuid: req.Uuid,
  323. DatasetName: attach.Name,
  324. CommitID: req.CommitID,
  325. IsLatestVersion: req.IsLatestVersion,
  326. ComputeResource: models.NPUResource,
  327. EngineID: req.EngineID,
  328. TrainUrl: req.TrainUrl,
  329. BranchName: req.BranchName,
  330. Parameters: req.Params,
  331. BootFile: req.BootFile,
  332. DataUrl: req.DataUrl,
  333. LogUrl: req.LogUrl,
  334. FlavorCode: req.FlavorCode,
  335. Description: req.Description,
  336. WorkServerNumber: req.WorkServerNumber,
  337. FlavorName: req.FlavorName,
  338. EngineName: req.EngineName,
  339. VersionCount: req.VersionCount,
  340. TotalVersionCount: req.TotalVersionCount,
  341. })
  342. if err != nil {
  343. log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error())
  344. return err
  345. }
  346. notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobId, req.JobName, models.ActionCreateTrainTask)
  347. return nil
  348. }
  349. func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, jobId string) (err error) {
  350. jobResult, err := createTrainJobVersion(models.CreateTrainJobVersionParams{
  351. Description: req.Description,
  352. Config: models.TrainJobVersionConfig{
  353. WorkServerNum: req.WorkServerNumber,
  354. AppUrl: req.CodeObsPath,
  355. BootFileUrl: req.BootFileUrl,
  356. DataUrl: req.DataUrl,
  357. EngineID: req.EngineID,
  358. TrainUrl: req.TrainUrl,
  359. LogUrl: req.LogUrl,
  360. PoolID: req.PoolID,
  361. Flavor: models.Flavor{
  362. Code: req.FlavorCode,
  363. },
  364. Parameter: req.Parameters,
  365. PreVersionId: req.PreVersionId,
  366. },
  367. }, jobId)
  368. if err != nil {
  369. log.Error("CreateJob failed: %v", err.Error())
  370. return err
  371. }
  372. attach, err := models.GetAttachmentByUUID(req.Uuid)
  373. if err != nil {
  374. log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error())
  375. return err
  376. }
  377. var jobTypes []string
  378. jobTypes = append(jobTypes, string(models.JobTypeTrain))
  379. repo := ctx.Repo.Repository
  380. VersionTaskList, VersionListCount, err := models.CloudbrainsVersionList(&models.CloudbrainsOptions{
  381. RepoID: repo.ID,
  382. Type: models.TypeCloudBrainTwo,
  383. JobTypes: jobTypes,
  384. JobID: strconv.FormatInt(jobResult.JobID, 10),
  385. })
  386. if err != nil {
  387. ctx.ServerError("Cloudbrain", err)
  388. return err
  389. }
  390. //将当前版本的isLatestVersion设置为"1"和任务数量更新,任务数量包括当前版本数VersionCount和历史创建的总版本数TotalVersionCount
  391. err = models.CreateCloudbrain(&models.Cloudbrain{
  392. Status: TransTrainJobStatus(jobResult.Status),
  393. UserID: ctx.User.ID,
  394. RepoID: ctx.Repo.Repository.ID,
  395. JobID: strconv.FormatInt(jobResult.JobID, 10),
  396. JobName: req.JobName,
  397. JobType: string(models.JobTypeTrain),
  398. Type: models.TypeCloudBrainTwo,
  399. VersionID: jobResult.VersionID,
  400. VersionName: jobResult.VersionName,
  401. Uuid: req.Uuid,
  402. DatasetName: attach.Name,
  403. CommitID: req.CommitID,
  404. IsLatestVersion: req.IsLatestVersion,
  405. PreVersionName: req.PreVersionName,
  406. ComputeResource: models.NPUResource,
  407. EngineID: req.EngineID,
  408. TrainUrl: req.TrainUrl,
  409. BranchName: req.BranchName,
  410. Parameters: req.Params,
  411. BootFile: req.BootFile,
  412. DataUrl: req.DataUrl,
  413. LogUrl: req.LogUrl,
  414. PreVersionId: req.PreVersionId,
  415. FlavorCode: req.FlavorCode,
  416. Description: req.Description,
  417. WorkServerNumber: req.WorkServerNumber,
  418. FlavorName: req.FlavorName,
  419. EngineName: req.EngineName,
  420. TotalVersionCount: VersionTaskList[0].TotalVersionCount + 1,
  421. VersionCount: VersionListCount + 1,
  422. })
  423. if err != nil {
  424. log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error())
  425. return err
  426. }
  427. //将训练任务的上一版本的isLatestVersion设置为"0"
  428. err = models.SetVersionCountAndLatestVersion(strconv.FormatInt(jobResult.JobID, 10), VersionTaskList[0].VersionName, VersionCount, NotLatestVersion, TotalVersionCount)
  429. if err != nil {
  430. ctx.ServerError("Update IsLatestVersion failed", err)
  431. return err
  432. }
  433. return err
  434. }
  435. func TransTrainJobStatus(status int) string {
  436. switch status {
  437. case 0:
  438. return "UNKNOWN"
  439. case 1:
  440. return "INIT"
  441. case 2:
  442. return "IMAGE_CREATING"
  443. case 3:
  444. return "IMAGE_FAILED"
  445. case 4:
  446. return "SUBMIT_TRYING"
  447. case 5:
  448. return "SUBMIT_FAILED"
  449. case 6:
  450. return "DELETE_FAILED"
  451. case 7:
  452. return "WAITING"
  453. case 8:
  454. return "RUNNING"
  455. case 9:
  456. return "KILLING"
  457. case 10:
  458. return "COMPLETED"
  459. case 11:
  460. return "FAILED"
  461. case 12:
  462. return "KILLED"
  463. case 13:
  464. return "CANCELED"
  465. case 14:
  466. return "LOST"
  467. case 15:
  468. return "SCALING"
  469. case 16:
  470. return "SUBMIT_MODEL_FAILED"
  471. case 17:
  472. return "DEPLOY_SERVICE_FAILED"
  473. case 18:
  474. return "CHECK_INIT"
  475. case 19:
  476. return "CHECK_RUNNING"
  477. case 20:
  478. return "CHECK_RUNNING_COMPLETED"
  479. case 21:
  480. return "CHECK_FAILED"
  481. default:
  482. return strconv.Itoa(status)
  483. }
  484. }
  485. func GetOutputPathByCount(TotalVersionCount int) (VersionOutputPath string) {
  486. talVersionCountToString := fmt.Sprintf("%04d", TotalVersionCount)
  487. VersionOutputPath = "V" + talVersionCountToString
  488. return VersionOutputPath
  489. }
  490. func GenerateInferenceJob(ctx *context.Context, req *GenerateInferenceJobReq) (err error) {
  491. jobResult, err := createInferenceJob(models.CreateInferenceJobParams{
  492. JobName: req.JobName,
  493. Description: req.Description,
  494. InfConfig: models.InfConfig{
  495. WorkServerNum: req.WorkServerNumber,
  496. AppUrl: req.CodeObsPath,
  497. BootFileUrl: req.BootFileUrl,
  498. DataUrl: req.DataUrl,
  499. EngineID: req.EngineID,
  500. // TrainUrl: req.TrainUrl,
  501. LogUrl: req.LogUrl,
  502. PoolID: req.PoolID,
  503. CreateVersion: true,
  504. Flavor: models.Flavor{
  505. Code: req.FlavorCode,
  506. },
  507. Parameter: req.Parameters,
  508. },
  509. })
  510. if err != nil {
  511. log.Error("CreateJob failed: %v", err.Error())
  512. return err
  513. }
  514. attach, err := models.GetAttachmentByUUID(req.Uuid)
  515. if err != nil {
  516. log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error())
  517. return err
  518. }
  519. jobID := strconv.FormatInt(jobResult.JobID, 10)
  520. err = models.CreateCloudbrain(&models.Cloudbrain{
  521. Status: TransTrainJobStatus(jobResult.Status),
  522. UserID: ctx.User.ID,
  523. RepoID: ctx.Repo.Repository.ID,
  524. JobID: jobID,
  525. JobName: req.JobName,
  526. JobType: string(models.JobTypeInference),
  527. Type: models.TypeCloudBrainTwo,
  528. VersionID: jobResult.VersionID,
  529. VersionName: jobResult.VersionName,
  530. Uuid: req.Uuid,
  531. DatasetName: attach.Name,
  532. CommitID: req.CommitID,
  533. EngineID: req.EngineID,
  534. TrainUrl: req.TrainUrl,
  535. BranchName: req.BranchName,
  536. Parameters: req.Params,
  537. BootFile: req.BootFile,
  538. DataUrl: req.DataUrl,
  539. LogUrl: req.LogUrl,
  540. FlavorCode: req.FlavorCode,
  541. Description: req.Description,
  542. WorkServerNumber: req.WorkServerNumber,
  543. FlavorName: req.FlavorName,
  544. EngineName: req.EngineName,
  545. LabelName: req.LabelName,
  546. IsLatestVersion: req.IsLatestVersion,
  547. VersionCount: req.VersionCount,
  548. TotalVersionCount: req.TotalVersionCount,
  549. ModelName: req.ModelName,
  550. ModelVersion: req.ModelVersion,
  551. CkptName: req.CkptName,
  552. ResultUrl: req.ResultUrl,
  553. })
  554. if err != nil {
  555. log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error())
  556. return err
  557. }
  558. notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, req.JobName, models.ActionCreateInferenceTask)
  559. return nil
  560. }