Skip to content

Commit 0436f09

Browse files
author
Krithika Sundararajan
authored
doc: Update doc on switchback experiment (#78)
* Update doc on switchback experiment * Update treatment validation test case * Fix formatting * Update PyYaml library * Update Python version in Github workflows * Fix lint error
1 parent 6cc63a5 commit 0436f09

File tree

6 files changed

+59
-9
lines changed

6 files changed

+59
-9
lines changed

.github/workflows/xp.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
id: setup-python
4040
uses: actions/setup-python@v2
4141
with:
42-
python-version: "3.7"
42+
python-version: "3.10"
4343
architecture: x64
4444
- name: Install dependencies
4545
run: make install-python-ci-dependencies
@@ -185,7 +185,7 @@ jobs:
185185
id: setup-python
186186
uses: actions/setup-python@v2
187187
with:
188-
python-version: "3.7"
188+
python-version: "3.10"
189189
architecture: x64
190190

191191
- name: Install dependencies

docs/concepts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ XP support various experiment types.
5656

5757
- **A/B Experiments** - Treatment assignment is randomized on the unit supplied in the request and one of the treatments in the experiment will be chosen at random, accounting for the traffic allocation for each treatment.
5858
- **Switchback Experiments** - The main idea behind switchback experiments is that the experiment engine switches back and forth between the control and treatment configurations, per configured time interval. In XP, switchback experiments can have one or more treatments and the engine cycles through them, selecting one treatment for all requests in every time interval.
59-
- **Randomized Switchback Experiments** - This is a hybrid between the A/B experiments and Switchbacks. These experiments are Switchbacks by nature (they have a time interval). In addition, they can have a traffic allocation on each of the treatments. Thus, at every new interval, the selection of the treatment is not cyclical, but randomized. In the default mode, all requests in a given time interval will still receive the same treatment. However, it is also possible to vary this.
59+
- **Randomized Switchback Experiments** - This is a hybrid between the A/B experiments and Switchbacks. These experiments are Switchbacks by nature (they have a time interval). In addition, they can have a traffic allocation on each of the treatments. Thus, at every new interval, the selection of the treatment is not cyclical, but randomized. All requests in a given time interval will receive the same treatment.
6060

6161
#### Experiment Hierarchy
6262

tests/e2e/test_validate_treatment.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
from xp_client import XPClient
22

33

4-
def test_validate_valid_treatment_with_url(xp_client: XPClient):
4+
def test_validate_valid_treatment_with_url(xp_client: XPClient, httpserver):
5+
# Start test server for external validation endpoint
6+
httpserver.expect_request("/external", method="POST").respond_with_json({})
7+
58
data = {
6-
"validation_url": "http://www.mocky.io/v2/5e4cacd4310000e1cad8c073",
9+
"validation_url": httpserver.url_for("/external"),
710
"data": {"field1": "abc", "field2": "def", "field3": {"field4": 0.1}},
811
}
912

tests/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
PyYAML==5.4.1
1+
PyYAML==6.0.1
22
google-cloud-pubsub==2.7.0
33
requests==2.26.0
4+
pytest-httpserver==1.0.10
45
python-dotenv==0.19.0
56
s2cell==1.4.0
67
pytz==2021.1

treatment-service/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/caraml-dev/mlp v1.7.7-0.20230428104022-779530aec912
99
github.com/caraml-dev/xp/clients v0.0.0-00010101000000-000000000000
1010
github.com/caraml-dev/xp/common v0.0.0
11-
github.com/confluentinc/confluent-kafka-go v1.8.2
11+
github.com/confluentinc/confluent-kafka-go v1.9.2
1212
github.com/deepmap/oapi-codegen v1.11.0
1313
github.com/getkin/kin-openapi v0.94.0
1414
github.com/go-chi/chi/v5 v5.0.7

0 commit comments

Comments
 (0)