Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions optimizely/decision_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,14 @@ def get_variation(
}

# Check to see if user has a decision available for the given experiment
if user_profile_tracker is not None and not ignore_user_profile:
# CMAB experiments are excluded from UPS (sticky bucketing) because CMAB decisions
# are dynamic and should not be persisted across the experiment lifetime.
is_cmab_experiment = bool(experiment.cmab) if hasattr(experiment, 'cmab') else False
if is_cmab_experiment:
message = f'Skipping UPS lookup and save for CMAB experiment "{experiment.key}".'
self.logger.info(message)
decide_reasons.append(message)
elif user_profile_tracker is not None and not ignore_user_profile:
variation = self.get_stored_variation(project_config, experiment, user_profile_tracker.get_user_profile())
if variation:
message = f'Returning previously activated variation ID "{variation}" of experiment ' \
Expand Down Expand Up @@ -529,7 +536,8 @@ def get_variation(
self.logger.info(message)
decide_reasons.append(message)
# Store this new decision and return the variation for the user
if user_profile_tracker is not None and not ignore_user_profile:
# Skip UPS save for CMAB experiments since their decisions are dynamic
if user_profile_tracker is not None and not ignore_user_profile and not is_cmab_experiment:
try:
user_profile_tracker.update_user_profile(experiment, variation)
except:
Expand Down
Loading