| @@ -16,7 +16,8 @@ type JobSetSumbitReq struct { | |||||
| } | } | ||||
| type JobSetSumbitResp struct { | type JobSetSumbitResp struct { | ||||
| JobSetID string `json:"jobSetID"` | |||||
| JobSetID string `json:"jobSetID"` | |||||
| FilesUploadScheme models.JobSetFilesUploadScheme `json:"filesUploadScheme"` | |||||
| } | } | ||||
| func (c *Client) JobSetSumbit(req JobSetSumbitReq) (*JobSetSumbitResp, error) { | func (c *Client) JobSetSumbit(req JobSetSumbitReq) (*JobSetSumbitResp, error) { | ||||
| @@ -49,14 +50,15 @@ func (c *Client) JobSetSumbit(req JobSetSumbitReq) (*JobSetSumbitResp, error) { | |||||
| return nil, fmt.Errorf("unknow response content type: %s", contType) | return nil, fmt.Errorf("unknow response content type: %s", contType) | ||||
| } | } | ||||
| type JobSetSetLocalFileReq struct { | |||||
| type JobSetLocalFileUploadedReq struct { | |||||
| JobSetID string `json:"jobSetID"` | JobSetID string `json:"jobSetID"` | ||||
| LocalPath string `json:"localPath"` | LocalPath string `json:"localPath"` | ||||
| Error string `json:"error"` | |||||
| PackageID int64 `json:"packageID"` | PackageID int64 `json:"packageID"` | ||||
| } | } | ||||
| func (c *Client) JobSetSetLocalFile(req JobSetSetLocalFileReq) error { | |||||
| url, err := url.JoinPath(c.baseURL, "/jobSet/setLocalFile") | |||||
| func (c *Client) JobSetLocalFileUploaded(req JobSetLocalFileUploadedReq) error { | |||||
| url, err := url.JoinPath(c.baseURL, "/jobSet/localFileUploaded") | |||||
| if err != nil { | if err != nil { | ||||
| return err | return err | ||||
| } | } | ||||
| @@ -40,7 +40,7 @@ func Test_JobSet(t *testing.T) { | |||||
| So(err, ShouldBeNil) | So(err, ShouldBeNil) | ||||
| So(id.JobSetID, ShouldNotBeEmpty) | So(id.JobSetID, ShouldNotBeEmpty) | ||||
| err = cli.JobSetSetLocalFile(JobSetSetLocalFileReq{ | |||||
| err = cli.JobSetLocalFileUploaded(JobSetLocalFileUploadedReq{ | |||||
| JobSetID: id.JobSetID, | JobSetID: id.JobSetID, | ||||
| LocalPath: "code", | LocalPath: "code", | ||||
| PackageID: 1, | PackageID: 1, | ||||
| @@ -14,11 +14,12 @@ import ( | |||||
| ) | ) | ||||
| type PackageUploadReq struct { | type PackageUploadReq struct { | ||||
| UserID int64 `json:"userID"` | |||||
| BucketID int64 `json:"bucketID"` | |||||
| Name string `json:"name"` | |||||
| Redundancy models.TypedRedundancyInfo `json:"redundancy"` | |||||
| Files PackageUploadFileIterator `json:"-"` | |||||
| UserID int64 `json:"userID"` | |||||
| BucketID int64 `json:"bucketID"` | |||||
| Name string `json:"name"` | |||||
| Redundancy models.TypedRedundancyInfo `json:"redundancy"` | |||||
| NodeAffinity *int64 `json:"nodeAffinity"` | |||||
| Files PackageUploadFileIterator `json:"-"` | |||||
| } | } | ||||
| type IterPackageUploadFile struct { | type IterPackageUploadFile struct { | ||||
| @@ -23,7 +23,8 @@ func Test_Object(t *testing.T) { | |||||
| fileData[i] = byte(i) | fileData[i] = byte(i) | ||||
| } | } | ||||
| _, err := cli.PackageUpload(PackageUploadReq{ | |||||
| nodeAff := int64(2) | |||||
| upResp, err := cli.PackageUpload(PackageUploadReq{ | |||||
| UserID: 0, | UserID: 0, | ||||
| BucketID: 1, | BucketID: 1, | ||||
| Name: uuid.NewString(), | Name: uuid.NewString(), | ||||
| @@ -31,6 +32,7 @@ func Test_Object(t *testing.T) { | |||||
| Type: models.RedundancyRep, | Type: models.RedundancyRep, | ||||
| Info: models.NewRepRedundancyInfo(1), | Info: models.NewRepRedundancyInfo(1), | ||||
| }, | }, | ||||
| NodeAffinity: &nodeAff, | |||||
| Files: iterator.Array( | Files: iterator.Array( | ||||
| &IterPackageUploadFile{ | &IterPackageUploadFile{ | ||||
| Path: "test", | Path: "test", | ||||
| @@ -55,11 +57,11 @@ func Test_Object(t *testing.T) { | |||||
| // So(downFileData, ShouldResemble, fileData) | // So(downFileData, ShouldResemble, fileData) | ||||
| // downFs.Close() | // downFs.Close() | ||||
| //err = cli.PackageDelete(PackageDeleteReq{ | |||||
| // UserID: 0, | |||||
| // PackageID: upResp.PackageID, | |||||
| //}) | |||||
| //So(err, ShouldBeNil) | |||||
| err = cli.PackageDelete(PackageDeleteReq{ | |||||
| UserID: 0, | |||||
| PackageID: upResp.PackageID, | |||||
| }) | |||||
| So(err, ShouldBeNil) | |||||
| }) | }) | ||||
| } | } | ||||
| @@ -118,3 +118,43 @@ func JobSetInfoFromJSON(data []byte) (*JobSetInfo, error) { | |||||
| return &ret, nil | return &ret, nil | ||||
| } | } | ||||
| const ( | |||||
| FileScheduleActionNo = "No" | |||||
| FileScheduleActionMove = "Move" | |||||
| FileScheduleActionLoad = "Load" | |||||
| ) | |||||
| type FileScheduleScheme struct { | |||||
| Action string `json:"action"` | |||||
| TargetStorageID int64 `json:"targetStorageID"` | |||||
| } | |||||
| const ( | |||||
| ImageScheduleActionNo = "No" | |||||
| ImageScheduleActionImport = "Import" | |||||
| ) | |||||
| type ImageScheduleScheme struct { | |||||
| Action string `json:"action"` | |||||
| } | |||||
| type JobScheduleScheme struct { | |||||
| TargetSlwNodeID int64 `json:"targetSlwNodeID"` | |||||
| Dataset FileScheduleScheme `json:"dataset"` | |||||
| Code FileScheduleScheme `json:"code"` | |||||
| Image ImageScheduleScheme `json:"image"` | |||||
| } | |||||
| type JobSetPreScheduleScheme struct { | |||||
| JobSchemes map[string]JobScheduleScheme `json:"jobSchemes"` // 任务的预调度方案。Key为LocalJobIDs | |||||
| } | |||||
| type JobSetFilesUploadScheme struct { | |||||
| LocalFileSchemes []LocalFileUploadScheme `json:"localFileUploadSchemes"` | |||||
| } | |||||
| type LocalFileUploadScheme struct { | |||||
| LocalPath string `json:"localPath"` | |||||
| UploadToStgNodeID *int64 `json:"uploadToStgNodeID"` | |||||
| } | |||||