...
num_buckets: defaults to 2, specify how many buckets you want users to be broken into.
experiment_id: defaults to None, specify a unique int for your experiment on your installation of Open edX – this is only necessary to define if you want to use the
enrollment_start
feature below.use_course_aware_bucketing: defaults to True. If True, then a given user can hash into different buckets for different courses. If False, then any given user will hash to the same default bucket across all course-runs.
Choosing a unique experiment ID
Again, this is only necessary if you use some of the more advanced features like enrollment_start
. But if you want to ensure you are picking an experiment ID that is not taken yet, run the following command on the read replica:
Code Block | ||
---|---|---|
| ||
select distinct experiment_id from experiments_experimentdata
union
select distinct experiment_id from experiments_experimentkeyvalue
order by experiment_id; |
That will tell you all the currently-in-use experiment IDs.
Usage
Code Block | ||
---|---|---|
| ||
bucket = EXAMPLE_FLAG.get_bucket(course_key) if bucket == 1: # variant 1 path elif bucket == 2: # variant 2 path else: # control path |
...