Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch active experiment id for given experiment label #417

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ protected Experiment getExperiment(Application.Name applicationName, Experiment.
if (prioritizedExperimentListOptional.isPresent()) {
//Iterate as per experiment priority and look for the matching experiment by their label
for (PrioritizedExperiment prioritizedExperiment : prioritizedExperimentListOptional.get().getPrioritizedExperiments()) {
if (experimentLabel.equals(prioritizedExperiment.getLabel())) {
if (experimentLabel.equals(prioritizedExperiment.getLabel()) && prioritizedExperiment.getState().isActiveState()) {
//Upon match, get the complete experiment object from cache
result = metadataCache.getExperimentById(prioritizedExperiment.getID()).orElse(null);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,24 @@ protected Experiment internalGetExperiment(Application.Name appName,
Experiment experiment = null;

try {
ExperimentByAppNameLabel experimentAppLabel = experimentLabelIndexAccessor
.getExperimentBy(appName.toString(),
experimentLabel.toString()).one();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, then value fetched in this method are cached by wasabi. Did you notice one()? That means, it will fetch only 1 experiment label if there are 2.


if (experimentAppLabel != null) {
com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo = experimentAccessor
.getExperimentById(experimentAppLabel.getId()).one();
experiment = ExperimentHelper.makeExperiment(experimentPojo);
Result<ExperimentByAppNameLabel> result = experimentLabelIndexAccessor
.getExperimentBy(appName.toString(),
experimentLabel.toString());
for(ExperimentByAppNameLabel experimentAppLabel: result.all()){
if (experimentAppLabel != null) {
// Need to iterate here as well
com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo = experimentAccessor
.getExperimentById(experimentAppLabel.getId()).one();
experiment = ExperimentHelper.makeExperiment(experimentPojo);
if(experiment.getState().isActiveState()){
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will return only the experiment which is active

break;
}
}
}



} catch (Exception e) {
LOGGER.error("Error while getting experiment by app {} with label {} ", new Object[]{appName, experimentLabel}, e);

Expand Down