From 5d38d3629dc01f49877207579152727833b6aef2 Mon Sep 17 00:00:00 2001 From: narro wizard Date: Wed, 23 Oct 2024 14:17:11 +0800 Subject: [PATCH] feat(framework): skip to update progress of subtasks - add env SKIP_SUBTASK_PROGRESS to decide wether skip subtask progress updating to db --- backend/core/runner/run_task.go | 6 ++++++ env.example | 2 ++ 2 files changed, 8 insertions(+) diff --git a/backend/core/runner/run_task.go b/backend/core/runner/run_task.go index 8a3515768a7..84f322c7a8a 100644 --- a/backend/core/runner/run_task.go +++ b/backend/core/runner/run_task.go @@ -350,6 +350,9 @@ func RunPluginSubTasks( // UpdateProgressDetail FIXME ... func UpdateProgressDetail(basicRes context.BasicRes, taskId uint64, progressDetail *models.TaskProgressDetail, p *plugin.RunningProgress) { + cfg := basicRes.GetConfigReader() + skipSubtaskProgressUpdate := cfg.GetBool("SKIP_SUBTASK_PROGRESS") + task := &models.Task{ Model: common.Model{ID: taskId}, } @@ -377,6 +380,9 @@ func UpdateProgressDetail(basicRes context.BasicRes, taskId uint64, progressDeta // reset finished records progressDetail.FinishedRecords = 0 } + if skipSubtaskProgressUpdate { + return + } currentFinishedRecords := progressDetail.FinishedRecords currentTotalRecords := progressDetail.TotalRecords // update progress if progress is more than 1% diff --git a/env.example b/env.example index b45799356ac..44604913aa0 100755 --- a/env.example +++ b/env.example @@ -27,6 +27,8 @@ DB_URL=mysql://merico:merico@mysql:3306/lake?charset=utf8mb4&parseTime=True&loc= E2E_DB_URL=mysql://merico:merico@mysql:3306/lake_test?charset=utf8mb4&parseTime=True&loc=UTC # Silent Error Warn Info DB_LOGGING_LEVEL=Error +# Skip to update progress of subtasks, default is false (#8142) +SKIP_SUBTASK_PROGRESS=false # Lake REST API PORT=8080