Skip to content

Commit

Permalink
feat: python local evaluation implementation (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgiori authored Dec 20, 2024
1 parent 883a3f3 commit 9201cb5
Show file tree
Hide file tree
Showing 37 changed files with 1,844 additions and 2,044 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.7
python-version: 3.8

- name: Install dependencies
run: python -m pip install build setuptools wheel twine amplitude_analytics parameterized python-dotenv~=0.21.1 python-semantic-release==7.34.6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.7
python-version: 3.8

- name: Install dependencies
run: python -m pip install build setuptools wheel twine amplitude_analytics parameterized
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/test-arm.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
environment: Unit Test
strategy:
matrix:
python-version: [ "3.7" ]
python-version: [ "3.8" ]
steps:
- name: Checkout source code
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
parameterized~=0.9.0
python-dotenv~=0.21.1
requests~=2.31.0
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
amplitude_analytics~=1.1.1
amplitude_analytics~=1.1.1
dataclasses-json~=0.6.7
10 changes: 5 additions & 5 deletions src/amplitude_experiment/deployment/deployment_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def __update_flag_configs(self):
self.logger.warning(f'Failed to fetch flag configs: {e}')
raise e

flag_keys = {flag['key'] for flag in flag_configs}
self.flag_config_storage.remove_if(lambda f: f['key'] not in flag_keys)
flag_keys = {flag.key for flag in flag_configs}
self.flag_config_storage.remove_if(lambda f: f.key not in flag_keys)

if not self.cohort_loader:
for flag_config in flag_configs:
self.logger.debug(f"Putting non-cohort flag {flag_config['key']}")
self.logger.debug(f"Putting non-cohort flag {flag_config.key}")
self.flag_config_storage.put_flag_config(flag_config)
return

Expand All @@ -83,11 +83,11 @@ def __update_flag_configs(self):
# iterate through new flag configs and check if their required cohorts exist
for flag_config in flag_configs:
cohort_ids = get_all_cohort_ids_from_flag(flag_config)
self.logger.debug(f"Storing flag {flag_config['key']}")
self.logger.debug(f"Storing flag {flag_config.key}")
self.flag_config_storage.put_flag_config(flag_config)
missing_cohorts = cohort_ids - updated_cohort_ids
if missing_cohorts:
self.logger.warning(f"Flag {flag_config['key']} - failed to load cohorts: {missing_cohorts}")
self.logger.warning(f"Flag {flag_config.key} - failed to load cohorts: {missing_cohorts}")

# delete unused cohorts
self._delete_unused_cohorts()
Expand Down
Empty file.
Loading

0 comments on commit 9201cb5

Please sign in to comment.