builder.withAllocationPercent(newPct); builder.withState(newState); builder.withControl(buck.isControl()); builder.withDescription(buck.getDescription()); newBuckets.addBucket(builder.build());
(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")) .withPayload((String) bucketMap.get("payload")) .build();
Bucket newBucket = Bucket.from(newBucketEntity).withExperimentID(experimentID).build();
bucket = builder.build();
if (bucket != null) { Bucket newBucket = Bucket.newInstance(experimentID, bucketLabel) .withAllocationPercent(bucket.getAllocationPercent()) .withControl(bucket.isControl()) .withDescription(bucket.getDescription()) .withPayload(bucket.getPayload()) .withState(bucket.getState()) .build(); cassandraRepository.createBucket(newBucket);
builder.withControl(updates.isControl()); changeData = new Bucket.BucketAuditInfo("is_control", bucket.isControl().toString(), updates.isControl().toString()); changeList.add(changeData); builder.withAllocationPercent(updates.getAllocationPercent()); changeData = new Bucket.BucketAuditInfo("allocation", bucket.getAllocationPercent().toString(), updates.getAllocationPercent().toString()); builder.withDescription(updates.getDescription()); changeData = new Bucket.BucketAuditInfo("description", bucket.getDescription(), updates.getDescription()); changeList.add(changeData); builder.withPayload(updates.getPayload()); changeData = new Bucket.BucketAuditInfo("payload", bucket.getPayload(), updates.getPayload()); changeList.add(changeData);
/** * {@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; }
public static Builder newInstance(Experiment.ID experimentID, Bucket.Label label) { return new Builder(experimentID, label); }
public static Builder from(Bucket bucket) { return new Builder(bucket); }
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; }
public static Builder from(Bucket bucket) { return new Builder(bucket); }
public static Builder newInstance(Experiment.ID experimentID, Bucket.Label label) { return new Builder(experimentID, label); }