From e7f9dbdd0fb4914854e2777e7fcc1fc40e3cbb21 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Tue, 18 Mar 2025 16:52:07 +0700 Subject: [PATCH] fix(lcm): Fixing and add more logs for export and import objects failure when different domains --- .../lcm/actions/import_object_collections.rb | 2 +- .../actions/synchronize_dataset_mappings.rb | 2 +- lib/gooddata/models/project.rb | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/gooddata/lcm/actions/import_object_collections.rb b/lib/gooddata/lcm/actions/import_object_collections.rb index c99d883b1..f0806e63b 100644 --- a/lib/gooddata/lcm/actions/import_object_collections.rb +++ b/lib/gooddata/lcm/actions/import_object_collections.rb @@ -31,7 +31,7 @@ def call(params) client = params.gdc_gd_client development_client = params.development_client - number_of_threads = Integer(params.number_of_threads || '10') + number_of_threads = Integer(params.number_of_threads || '8') params.synchronize.peach(number_of_threads) do |info| from = info.from diff --git a/lib/gooddata/lcm/actions/synchronize_dataset_mappings.rb b/lib/gooddata/lcm/actions/synchronize_dataset_mappings.rb index f2bf4be5a..8658829f4 100644 --- a/lib/gooddata/lcm/actions/synchronize_dataset_mappings.rb +++ b/lib/gooddata/lcm/actions/synchronize_dataset_mappings.rb @@ -48,7 +48,7 @@ def call(params) client = params.gdc_gd_client development_client = params.development_client - number_of_threads = Integer(params.number_of_threads || '10') + number_of_threads = Integer(params.number_of_threads || '8') params.synchronize.peach(number_of_threads) do |info| from_project = info.from diff --git a/lib/gooddata/models/project.rb b/lib/gooddata/models/project.rb index cecf71cb4..be2b4037e 100644 --- a/lib/gooddata/models/project.rb +++ b/lib/gooddata/models/project.rb @@ -1434,9 +1434,13 @@ def objects_export(objs, options = {}) :crossDataCenterExport => '1' } } - result = client.post("#{md['maintenance']}/partialmdexport", export_payload) + export_uri = "/gdc/md/#{pid}/maintenance/partialmdexport" + GoodData.gd_logger.info("Project export action=objects_export, project_id=#{pid}, uri=#{export_uri}, export_status=start, export_objs=#{export_payload}") if GoodData.gd_logger + + result = client.post(export_uri, export_payload) polling_url = result['partialMDArtifact']['status']['uri'] token = result['partialMDArtifact']['token'] + GoodData.gd_logger.info("Project export action=objects_export, project_id=#{pid}, uri=#{polling_url}, export_status=polling") if GoodData.gd_logger polling_result = client.poll_on_response(polling_url, options) do |body| body['wTaskStatus'] && body['wTaskStatus']['status'] == 'RUNNING' @@ -1445,6 +1449,9 @@ def objects_export(objs, options = {}) messages = GoodData::Helpers.interpolate_error_messages(polling_result['wTaskStatus']['messages']).join(' ') fail ObjectsExportError, "Exporting objects failed with messages. #{messages}" end + + GoodData.gd_logger.info("Project export action=objects_export, project_id=#{pid}, export_status=success") if GoodData.gd_logger + token end @@ -1467,8 +1474,12 @@ def objects_import(token, options = {}) } } - result = client.post("#{md['maintenance']}/partialmdimport", import_payload) + import_uri = "/gdc/md/#{pid}/maintenance/partialmdimport" + GoodData.gd_logger.info("Project import action=objects_import, project_id=#{pid}, uri=#{import_uri}, import_status=start") if GoodData.gd_logger + + result = client.post(import_uri, import_payload) polling_url = result['uri'] + GoodData.gd_logger.info("Project import action=objects_import, project_id=#{pid}, uri=#{polling_url}, import_status=polling") if GoodData.gd_logger polling_result = client.poll_on_response(polling_url, options) do |body| body['wTaskStatus'] && body['wTaskStatus']['status'] == 'RUNNING' @@ -1478,6 +1489,9 @@ def objects_import(token, options = {}) messages = GoodData::Helpers.interpolate_error_messages(polling_result['wTaskStatus']['messages']).join(' ') fail ObjectsImportError, "Importing objects failed with messages. #{messages}" end + + GoodData.gd_logger.info("Project import action=objects_import, project_id=#{pid}, uri=#{import_uri}, import_status=success") if GoodData.gd_logger + true end