From befe803070b17eef3ba9ed50813574f99132e9a1 Mon Sep 17 00:00:00 2001 From: JeshuaRen <270813223@qq.com> Date: Wed, 14 May 2025 09:40:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=9A=E7=9F=A5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdks/scheduler/models.go | 52 +++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/sdks/scheduler/models.go b/sdks/scheduler/models.go index 4038cc0..9e77968 100644 --- a/sdks/scheduler/models.go +++ b/sdks/scheduler/models.go @@ -409,10 +409,11 @@ type DataPreprocessJobInfo struct { type DataReturnJobInfo struct { serder.Metadata `union:"DataReturn"` JobInfoBase - Type string `json:"type"` - BucketID cdssdk.BucketID `json:"bucketID"` - TargetLocalJobID string `json:"targetLocalJobID"` - ReportMessage []ReportMessage `json:"reportMessage"` + Type string `json:"type"` + BucketID cdssdk.BucketID `json:"bucketID"` + TargetLocalJobID string `json:"targetLocalJobID"` + Report TrainJobStatusReport `json:"report"` + //ReportMessage []ReportMessage `json:"reportMessage"` } // MultiInstanceJobInfo 多实例(推理任务) @@ -665,8 +666,9 @@ type BindingJobOutput struct { type DataReturnJobOutput struct { serder.Metadata `union:"DataReturn"` JobOutputBase - Type string `json:"type"` - ReportMessage []ReportMessage `json:"reportMessage"` + Type string `json:"type"` + Report TrainJobStatusReport `json:"report"` + //ReportMessage []ReportMessage `json:"reportMessage"` } type ReportMessage struct { @@ -677,3 +679,41 @@ type ReportMessage struct { ClusterID ClusterID `json:"clusterID"` Output string `json:"output"` } + +type JobStatusReport interface { + Report() +} + +var JobStatusReportTypeUnion = types.NewTypeUnion[JobStatusReport]( + (*TrainJobStatusReport)(nil), + (*InferenceJobStatusReport)(nil), +) + +var _ = serder.UseTypeUnionInternallyTagged(&JobStatusReportTypeUnion, "type") + +type JobStatusReportBase struct{} + +func (d *JobStatusReportBase) Report() {} + +type TrainJobStatusReport struct { + serder.Metadata `union:"Train"` + JobStatusReportBase + Type string `json:"type"` + TaskName string `json:"taskName"` + TaskID string `json:"taskID"` + Status bool `json:"status"` + Message string `json:"message"` + ClusterID ClusterID `json:"clusterID"` + Output string `json:"output"` +} + +type InferenceJobStatusReport struct { + serder.Metadata `union:"Inference"` + JobStatusReportBase + Type string `json:"type"` + TaskName string `json:"taskName"` + TaskID string `json:"taskID"` + Status bool `json:"status"` + Message string `json:"message"` + URL string `json:"url"` +}