From c7555bca30194e4be35788ebb60d726faf5153b9 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 #8142 --- backend/core/runner/run_task.go | 7 +++++++ env.example | 2 ++ 2 files changed, 9 insertions(+) diff --git a/backend/core/runner/run_task.go b/backend/core/runner/run_task.go index 9a57d21c8d3..f8735af3203 100644 --- a/backend/core/runner/run_task.go +++ b/backend/core/runner/run_task.go @@ -351,6 +351,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}, } @@ -378,6 +381,10 @@ func UpdateProgressDetail(basicRes context.BasicRes, taskId uint64, progressDeta // reset finished records progressDetail.FinishedRecords = 0 } + if skipSubtaskProgressUpdate { + basicRes.GetLogger().Info("skip subtask progress update") + 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