updated runtasklogic

This commit is contained in:
tzwang 2025-03-13 17:59:29 +08:00
parent 1682755098
commit aa29c1b917
7 changed files with 20 additions and 7 deletions

View File

@ -103,6 +103,7 @@ func generateFilteredDataDistributes(clusters []*strategy.AssignedCluster, distr
code := &types.CodeDistribute{}
code.DataName = codeDistribute.DataName
code.PackageID = codeDistribute.PackageID
code.Output = codeDistribute.Output
clusterScheduledList := make([]*types.ClusterScheduled, 0)
if len(codeDistribute.Clusters) != 0 {

View File

@ -103,6 +103,7 @@ func (l *ScheduleRunTaskLogic) SaveResult(task *models.Task, results []*schedule
opt.ComputeCard = strings.ToUpper(r.Card)
opt.Replica = r.Replica
opt.Output = r.Output
adapterName, err := l.svcCtx.Scheduler.AiStorages.GetAdapterNameById(r.AdapterId)
if err != nil {
@ -274,10 +275,14 @@ func updateClustersByScheduledDatas(taskId int64, clustersWithDataDistributes *C
}
}
if cluster.CodeId == "" {
for _, distribute := range clustersWithDataDistributes.DataDistributes.Code {
for _, c := range distribute.Clusters {
if cluster.ClusterId == c.ClusterID {
//if cluster.CodeId == "" {
for _, distribute := range clustersWithDataDistributes.DataDistributes.Code {
for _, c := range distribute.Clusters {
if cluster.ClusterId == c.ClusterID {
cluster.Output = distribute.Output
if cluster.CodeId == "" {
if c.JsonData == "" {
continue
}
@ -291,6 +296,7 @@ func updateClustersByScheduledDatas(taskId int64, clustersWithDataDistributes *C
}
cluster.CodeId = jsonData.Id
}
}
}
}

View File

@ -196,6 +196,7 @@ func (s *AiStorage) SaveAiTask(taskId int64, opt option.Option, adapterName stri
Strategy: aiOpt.StrategyName,
Status: status,
Msg: msg,
Output: aiOpt.Output,
Card: aiOpt.ComputeCard,
StartTime: time.Now().Format(time.RFC3339),
CommitTime: time.Now(),

View File

@ -57,6 +57,7 @@ type AiResult struct {
Replica int32
Card string
Msg string
Output string
}
func NewAiScheduler(ctx context.Context, val string, scheduler *scheduler.Scheduler, option *option.AiOption) (*AiScheduler, error) {
@ -206,6 +207,7 @@ func (as *AiScheduler) AssignTask(clusters []*strategy.AssignedCluster, mode int
result.ClusterId = c.ClusterId
result.Strategy = as.option.StrategyName
result.Card = opt.ComputeCard
result.Output = opt.Output
ch <- result
wg.Done()
@ -319,9 +321,7 @@ func (as *AiScheduler) handleErrors(errs []interface{}, clusters []*strategy.Ass
}
//report status
if mode == executor.SUBMIT_MODE_STORAGE_SCHEDULE {
_ = jcs.StatusReport(as.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report)
}
_ = jcs.StatusReport(as.AiService.Conf.JcsMiddleware.JobStatusReportUrl, report)
logx.Errorf(errors.New(errmsg).Error())
return errors.New(errmsg)
@ -343,6 +343,7 @@ func updateAiOptionByMode(cluster *strategy.AssignedCluster, opt *option.AiOptio
opt.ResourcesRequired = cluster.ResourcesRequired
opt.Output = cluster.Output
default:
}

View File

@ -34,6 +34,8 @@ type AiOption struct {
Image string
Model interface{}
Output string
ResourcesRequired []map[string]interface{}
}

View File

@ -31,6 +31,7 @@ type AssignedCluster struct {
ImageId string
CodeId string
ModelId string
Output string
}
func GetStrategyNames() []string {

View File

@ -55,6 +55,7 @@ type (
Card string `db:"card"`
InferUrl string `db:"infer_url"`
ModelName string `db:"model_name"`
Output string `db:"output"`
}
)