Skip to content

Commit 397bacd

Browse files
[AI-FSSDK] [FSSDK-12337] Add ExperimentTypes constants for type field
- Add ExperimentTypes enum in helpers/enums.py with AB, MAB, CMAB, FEATURE_ROLLOUT - Use ExperimentTypes.FEATURE_ROLLOUT constant in config parsing instead of raw string
1 parent ff06d05 commit 397bacd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

optimizely/helpers/enums.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ class DecisionSources:
102102
HOLDOUT: Final = 'holdout'
103103

104104

105+
class ExperimentTypes:
106+
AB: Final = 'a/b'
107+
MAB: Final = 'mab'
108+
CMAB: Final = 'cmab'
109+
FEATURE_ROLLOUT: Final = 'feature_rollout'
110+
111+
105112
class Errors:
106113
INVALID_ATTRIBUTE: Final = 'Provided attribute is not in datafile.'
107114
INVALID_ATTRIBUTE_FORMAT: Final = 'Attributes provided are in an invalid format.'

optimizely/project_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def __init__(self, datafile: str | bytes, logger: Logger, error_handler: Any):
237237
everyone_else_variation = self._get_everyone_else_variation(feature)
238238
if everyone_else_variation is not None:
239239
for experiment in rules:
240-
if getattr(experiment, 'type', None) == 'feature_rollout':
240+
if getattr(experiment, 'type', None) == enums.ExperimentTypes.FEATURE_ROLLOUT:
241241
experiment.variations.append(everyone_else_variation)
242242
experiment.trafficAllocation.append({
243243
'entityId': everyone_else_variation['id'],

0 commit comments

Comments
 (0)