Skip to content

Commit

Permalink
feat: update bandit flow to return bandit variation if actions are em…
Browse files Browse the repository at this point in the history
…pty (#14)
  • Loading branch information
rasendubi authored Jul 19, 2024
1 parent cb236b9 commit 3422e91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
12 changes: 4 additions & 8 deletions eppo_core/src/bandits/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,11 @@ impl Configuration {
//
// This should normally never happen as it means that there's a mismatch between the
// general UFC config and bandits config.
//
// Abort evaluation and return default variant, ignoring `assignment.event` logging.
log::warn!(target: "eppo", bandit_key; "unable to find bandit configuration");
return BanditResult {
variation: default_variation.to_owned(),
variation,
action: None,
assignment_event: None,
assignment_event: assignment.event,
bandit_event: None,
};
};
Expand All @@ -116,12 +114,10 @@ impl Configuration {
else {
// We've evaluated a flag but now bandit evaluation failed. (Likely to user supplying
// empty actions, or NaN attributes.)
//
// Abort evaluation and return default variant, ignoring `assignment.event` logging.
return BanditResult {
variation: default_variation.to_owned(),
variation,
action: None,
assignment_event: None,
assignment_event: assignment.event,
bandit_event: None,
};
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"scripts": {
"test": "npm run with-server 'npm-run-all test:*'",
"test:rust": "cargo test",
"test:ruby": "cd ruby-sdk && bundle exec rspec",
"test:ruby": "cd ruby-sdk && bundle exec rake test",
"with-server": "start-server-and-test start-mock-server http://127.0.0.1:8378",
"start-mock-server": "npm start --prefix ./mock-server"
},
Expand Down
15 changes: 0 additions & 15 deletions ruby-sdk/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@ task :clean do
system 'rm *.gem'
end

test_data_dir = 'spec/test-data/'
temp_dir = "#{test_data_dir}temp/"
git_data_dir = "#{temp_dir}sdk-test-data/"
branch_name = 'main'
github_repo_link = 'https://github.com/Eppo-exp/sdk-test-data.git'
file 'test-data' do
rm_rf test_data_dir
mkdir_p temp_dir
sh "git clone -b #{branch_name} --depth 1 --single-branch "\
"#{github_repo_link} #{git_data_dir}"
cp "#{git_data_dir}rac-experiments-v3.json", test_data_dir
cp_r "#{git_data_dir}assignment-v2", test_data_dir
rm_rf temp_dir
end

RSpec::Core::RakeTask.new(:test) do |task|
root_dir = Rake.application.original_dir
task.pattern = "#{root_dir}/spec/*_spec.rb"
Expand Down

0 comments on commit 3422e91

Please sign in to comment.