builder.withAllocationPercent(updates.getAllocationPercent()); changeData = new Bucket.BucketAuditInfo("allocation", bucket.getAllocationPercent().toString(), updates.getAllocationPercent().toString());
(String) bucketMap.get("label")); Bucket returnBuck = Bucket.newInstance(experimentID, label) .withAllocationPercent((Double) bucketMap.get("allocation_percent")) .withDescription((String) bucketMap.get("description")) .withControl((Boolean) bucketMap.get("is_control"))
/** * {@inheritDoc} */ @Override public BucketList adjustAllocationPercentages(Experiment experiment, Bucket newBucket) { double remainingAlloc = 1. - newBucket.getAllocationPercent(); BucketList bucketList = buckets.getBuckets(experiment.getID(), false /* don't check experiment again */); BucketList newBuckets = new BucketList(); for (Bucket bucket : bucketList.getBuckets()) { if (bucket.getLabel().equals(newBucket.getLabel())) { continue; } double newAlloc = roundToTwo(remainingAlloc * bucket.getAllocationPercent()); LOGGER.debug("Add Bucket: setting allocation percentage for bucket " + bucket.getLabel() + " in experiment " + experiment.getID() + " to: " + newAlloc); Bucket.Builder builder = Bucket.from(bucket).withAllocationPercent(newAlloc); Bucket updatedBucket = builder.build(); newBuckets.addBucket(updatedBucket); if (!Experiment.State.DRAFT.equals(experiment.getState()) && Double.compare(bucket.getAllocationPercent(), updatedBucket.getAllocationPercent()) != 0) { // this is a system event, so no user needed eventLog.postEvent(new BucketChangeEvent(experiment, updatedBucket, "allocation", String.valueOf(bucket.getAllocationPercent()), String.valueOf(updatedBucket.getAllocationPercent()))); } } return newBuckets; }
builder.withAllocationPercent(newPct); builder.withState(newState); builder.withControl(buck.isControl());
if (bucket != null) { Bucket newBucket = Bucket.newInstance(experimentID, bucketLabel) .withAllocationPercent(bucket.getAllocationPercent()) .withControl(bucket.isControl()) .withDescription(bucket.getDescription())
public static Bucket makeBucket( com.intuit.wasabi.repository.cassandra.pojo.Bucket bucketPojo) { Bucket bucket = Bucket.newInstance(Experiment.ID.valueOf(bucketPojo.getExperimentId()), Bucket.Label.valueOf(bucketPojo.getLabel())) .withAllocationPercent(bucketPojo.getAllocation()) .withControl(bucketPojo.isControl()) .withDescription(bucketPojo.getDescription()) .withPayload(bucketPojo.getPayload()) .withState(Bucket.State.valueOf(bucketPojo.getState())) .build(); return bucket; }