@@ -298,11 +298,7 @@ def process_organization(
298298 gd_config : GoodDataConfig ,
299299 organization : Optional [GoodDataConfigOrganization ] = None ,
300300) -> None :
301- if args .method == "dbt_cloud_run" :
302- dbt_cloud_run (args , logger , gd_config .all_model_ids )
303- elif args .method == "dbt_cloud_stats" :
304- dbt_cloud_stats (args , logger , gd_config .all_model_ids , args .environment_id )
305- elif args .method == "upload_notification" :
301+ if args .method == "upload_notification" :
306302 dbt_profiles = DbtProfiles (args )
307303 # Caches are invalidated only per data source, not per data product
308304 upload_notification (logger , sdk_wrapper .sdk , dbt_profiles .data_source_id )
@@ -343,17 +339,22 @@ def main() -> None:
343339 logger .info ("Start" )
344340 with open (args .gooddata_config ) as fp :
345341 gd_config = GoodDataConfig .from_dict (yaml .safe_load (fp ))
346-
347- if args .gooddata_profiles :
348- logger .info (f"Process multiple organizations profiles={ args .gooddata_profiles } " )
349- for organization in gd_config .organizations :
350- if organization .gooddata_profile in args .gooddata_profiles :
351- sdk_wrapper = GoodDataSdkWrapper (args , logger , profile = organization .gooddata_profile )
352- logger .info (f"Process organization profile={ organization .gooddata_profile } " )
353- process_organization (args , logger , sdk_wrapper , gd_config , organization )
342+ # dbt cloud tasks must run only once, not for each organization
343+ if args .method == "dbt_cloud_run" :
344+ dbt_cloud_run (args , logger , gd_config .all_model_ids )
345+ elif args .method == "dbt_cloud_stats" :
346+ dbt_cloud_stats (args , logger , gd_config .all_model_ids , args .environment_id )
354347 else :
355- sdk_wrapper = GoodDataSdkWrapper (args , logger )
356- logger .info (f"Process single organization from env vars host={ args .gooddata_host } " )
357- process_organization (args , logger , sdk_wrapper , gd_config )
348+ if args .gooddata_profiles :
349+ logger .info (f"Process multiple organizations profiles={ args .gooddata_profiles } " )
350+ for organization in gd_config .organizations :
351+ if organization .gooddata_profile in args .gooddata_profiles :
352+ sdk_wrapper = GoodDataSdkWrapper (args , logger , profile = organization .gooddata_profile )
353+ logger .info (f"Process organization profile={ organization .gooddata_profile } " )
354+ process_organization (args , logger , sdk_wrapper , gd_config , organization )
355+ else :
356+ sdk_wrapper = GoodDataSdkWrapper (args , logger )
357+ logger .info (f"Process single organization from env vars host={ args .gooddata_host } " )
358+ process_organization (args , logger , sdk_wrapper , gd_config )
358359
359360 logger .info ("End" )
0 commit comments