diff --git a/backend/modules/evaluation/domain/service/expt_result_impl.go b/backend/modules/evaluation/domain/service/expt_result_impl.go index 4f498d2b2..b4ea071ad 100644 --- a/backend/modules/evaluation/domain/service/expt_result_impl.go +++ b/backend/modules/evaluation/domain/service/expt_result_impl.go @@ -1169,8 +1169,7 @@ func (e ExptResultServiceImpl) CalculateStats(ctx context.Context, exptID, space total = 0 cnt = 0 icnt = 0 - itotal = 0 - ioffset = 0 + ioffset = 1 pendingCnt = 0 failCnt = 0 @@ -1181,13 +1180,12 @@ func (e ExptResultServiceImpl) CalculateStats(ctx context.Context, exptID, space ) for i := 0; i < maxLoop; i++ { - itemResultList, t, err := e.ExptItemResultRepo.ListItemResultsByExptID(ctx, exptID, spaceID, entity.NewPage(offset, limit), false) + itemResultList, iTotal, err := e.ExptItemResultRepo.ListItemResultsByExptID(ctx, exptID, spaceID, entity.NewPage(ioffset, limit), false) if err != nil { return nil, err } - itotal += int(t) icnt += len(itemResultList) - ioffset += offset + ioffset++ for _, item := range itemResultList { switch item.Status { case entity.ItemRunState_Success: @@ -1203,7 +1201,7 @@ func (e ExptResultServiceImpl) CalculateStats(ctx context.Context, exptID, space default: } } - if icnt >= itotal || len(itemResultList) == 0 { + if icnt >= int(iTotal) || len(itemResultList) == 0 { break } time.Sleep(time.Millisecond * 30) diff --git a/backend/modules/evaluation/infra/repo/experiment/mysql/expt_item_result.go b/backend/modules/evaluation/infra/repo/experiment/mysql/expt_item_result.go index 13ea06570..0a222234a 100644 --- a/backend/modules/evaluation/infra/repo/experiment/mysql/expt_item_result.go +++ b/backend/modules/evaluation/infra/repo/experiment/mysql/expt_item_result.go @@ -191,6 +191,7 @@ func (dao *exptItemResultDAOImpl) ScanItemResults(ctx context.Context, exptID, c } func (dao *exptItemResultDAOImpl) ListItemResultsByExptID(ctx context.Context, exptID, spaceID int64, page entity.Page, desc bool) ([]*model.ExptItemResult, int64, error) { + db := dao.provider.NewSession(ctx) q := query.Use(db).ExptItemResult conds := []gen.Condition{ diff --git a/conf/evaluation.yaml b/conf/evaluation.yaml index 4890cdc88..332a0a844 100644 --- a/conf/evaluation.yaml +++ b/conf/evaluation.yaml @@ -37,9 +37,9 @@ evaluator_record_correction_rmq: consume_timeout: 10m expt_turn_result_filter_rmq: addr: 'cozeloop-namesrv:9876' - topic: 'stone_cozeloop_evaluation_expt_turn_result_filter' - consumer_group: 'stone_cozeloop_evaluation_expt_turn_result_filter_cg' - producer_group: 'stone_cozeloop_evaluation_expt_turn_result_filter_pg' + topic: 'cozeloop_evaluation_expt_turn_result_filter' + consumer_group: 'cozeloop_evaluation_expt_turn_result_filter_cg' + producer_group: 'cozeloop_evaluation_expt_turn_result_filter_pg' consume_timeout: 10m rate_limiter_conf: diff --git a/release/deployment/docker-compose/bootstrap/mysql-init/init-sql/expt_turn_result_filter_key_mapping.sql b/release/deployment/docker-compose/bootstrap/mysql-init/init-sql/expt_turn_result_filter_key_mapping.sql new file mode 100644 index 000000000..80f22c071 --- /dev/null +++ b/release/deployment/docker-compose/bootstrap/mysql-init/init-sql/expt_turn_result_filter_key_mapping.sql @@ -0,0 +1,14 @@ +CREATE TABLE `expt_turn_result_filter_key_mapping` +( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `space_id` bigint NOT NULL COMMENT '空间id', + `expt_id` bigint NOT NULL COMMENT '实验id', + `from_field` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '筛选项唯一键,评估器: evaluator_version_id,人工标准:tag_key_id', + `to_key` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ck侧的map key,评估器:key1 ~ key10,人工标准:key1 ~ key100', + `field_type` int NOT NULL COMMENT '映射类型,Evaluator —— 1,人工标注—— 2', + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `deleted_at` timestamp NULL DEFAULT NULL COMMENT '删除时间', + `created_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uniq_idx_space_expt_from_type` (`space_id`,`expt_id`,`field_type`,`from_field`) +) ENGINE=InnoDB AUTO_INCREMENT=6690 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='expt_turn_result_filter二级key映射表'; \ No newline at end of file diff --git a/release/deployment/docker-compose/bootstrap/rmq-init/init-subscription/subscriptions.cfg b/release/deployment/docker-compose/bootstrap/rmq-init/init-subscription/subscriptions.cfg index a30cdecb5..8d4d8e0f5 100644 --- a/release/deployment/docker-compose/bootstrap/rmq-init/init-subscription/subscriptions.cfg +++ b/release/deployment/docker-compose/bootstrap/rmq-init/init-subscription/subscriptions.cfg @@ -6,4 +6,4 @@ expt_online_eval_result_event=online_eval_result_local_test_cg evaluator_record_correction_event=evaluator_record_correction_local_test_cg trace_ingestion_event=collector_rmq_receiver trace_annotation_event=trace_annotation_event_cg -stone_cozeloop_evaluation_expt_turn_result_filter=stone_cozeloop_evaluation_expt_turn_result_filter_cg \ No newline at end of file +cozeloop_evaluation_expt_turn_result_filter=cozeloop_evaluation_expt_turn_result_filter_cg \ No newline at end of file diff --git a/release/deployment/helm-chart/charts/app/bootstrap/init/mysql/init-sql/expt_turn_result_filter_key_mapping.sql b/release/deployment/helm-chart/charts/app/bootstrap/init/mysql/init-sql/expt_turn_result_filter_key_mapping.sql new file mode 100644 index 000000000..80f22c071 --- /dev/null +++ b/release/deployment/helm-chart/charts/app/bootstrap/init/mysql/init-sql/expt_turn_result_filter_key_mapping.sql @@ -0,0 +1,14 @@ +CREATE TABLE `expt_turn_result_filter_key_mapping` +( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `space_id` bigint NOT NULL COMMENT '空间id', + `expt_id` bigint NOT NULL COMMENT '实验id', + `from_field` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '筛选项唯一键,评估器: evaluator_version_id,人工标准:tag_key_id', + `to_key` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ck侧的map key,评估器:key1 ~ key10,人工标准:key1 ~ key100', + `field_type` int NOT NULL COMMENT '映射类型,Evaluator —— 1,人工标注—— 2', + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `deleted_at` timestamp NULL DEFAULT NULL COMMENT '删除时间', + `created_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uniq_idx_space_expt_from_type` (`space_id`,`expt_id`,`field_type`,`from_field`) +) ENGINE=InnoDB AUTO_INCREMENT=6690 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='expt_turn_result_filter二级key映射表'; \ No newline at end of file diff --git a/release/deployment/helm-chart/charts/app/bootstrap/init/rmq/init-subscription/subscriptions.cfg b/release/deployment/helm-chart/charts/app/bootstrap/init/rmq/init-subscription/subscriptions.cfg index a30cdecb5..8d4d8e0f5 100644 --- a/release/deployment/helm-chart/charts/app/bootstrap/init/rmq/init-subscription/subscriptions.cfg +++ b/release/deployment/helm-chart/charts/app/bootstrap/init/rmq/init-subscription/subscriptions.cfg @@ -6,4 +6,4 @@ expt_online_eval_result_event=online_eval_result_local_test_cg evaluator_record_correction_event=evaluator_record_correction_local_test_cg trace_ingestion_event=collector_rmq_receiver trace_annotation_event=trace_annotation_event_cg -stone_cozeloop_evaluation_expt_turn_result_filter=stone_cozeloop_evaluation_expt_turn_result_filter_cg \ No newline at end of file +cozeloop_evaluation_expt_turn_result_filter=cozeloop_evaluation_expt_turn_result_filter_cg \ No newline at end of file