@@ -413,7 +413,15 @@ def get_variation(
413413 - 'error': Boolean indicating if an error occurred during the decision process.
414414 """
415415 user_id = user_context .user_id
416- if options :
416+
417+ if experiment .cmab :
418+ # CMAB experiments are excluded from user profile storage to allow dynamic decision-making
419+ ignore_user_profile = True
420+ self .logger .debug (
421+ f'Skipping user profile service for CMAB experiment "{ experiment .key } ". '
422+ f'CMAB decisions are dynamic and not stored for sticky bucketing.'
423+ )
424+ elif options :
417425 ignore_user_profile = OptimizelyDecideOption .IGNORE_USER_PROFILE_SERVICE in options
418426 else :
419427 ignore_user_profile = False
@@ -529,18 +537,11 @@ def get_variation(
529537 self .logger .info (message )
530538 decide_reasons .append (message )
531539 # Store this new decision and return the variation for the user
532- # CMAB experiments are excluded from user profile storage to allow dynamic decision-making
533540 if user_profile_tracker is not None and not ignore_user_profile :
534- if not experiment .cmab :
535- try :
536- user_profile_tracker .update_user_profile (experiment , variation )
537- except :
538- self .logger .exception (f'Unable to save user profile for user "{ user_id } ".' )
539- else :
540- self .logger .debug (
541- f'Skipping user profile update for CMAB experiment "{ experiment .key } ". '
542- f'CMAB decisions are dynamic and not stored for sticky bucketing.'
543- )
541+ try :
542+ user_profile_tracker .update_user_profile (experiment , variation )
543+ except :
544+ self .logger .exception (f'Unable to save user profile for user "{ user_id } ".' )
544545 return {
545546 'cmab_uuid' : cmab_uuid ,
546547 'error' : False ,
0 commit comments