@Override public void serialize(Label label, JsonGenerator generator, SerializerProvider provider) throws IOException { generator.writeString(label.toString()); } }
@Override public void serialize(Label label, JsonGenerator generator, SerializerProvider provider) throws IOException { generator.writeString(label.toString()); } }
mutexRepository.createExclusion(baseID, pairID); eventLog.postEvent(new ExperimentChangeEvent(user, baseExp, "mutex", null, pairExp.getLabel() == null ? null : pairExp.getLabel().toString())); } catch (RepositoryException rExp) { LOGGER.error("Unable to store data in repository: ", rExp);
LOGGER.debug("Experiment ({}) is part of given ExperimentBatch....", experiment.getLabel()); String labelStr = experiment.getLabel().toString(); Experiment.Label label = Experiment.Label.valueOf(labelStr); Assignment assignment = null;
newExperiment.getEndTime(), DRAFT.name(), newExperiment.getLabel().toString(), newExperiment.getApplicationName().toString(), NOW, batchStmt.add(experimentLabelIndexAccessor.insertOrUpdateStatementBy(newExperiment.getId().getRawID(), NOW, newExperiment.getStartTime(), newExperiment.getEndTime(), DRAFT.name(), newExperiment.getApplicationName().toString(), newExperiment.getLabel().toString()));
experiment.getEndTime(), experiment.getState().name(), experiment.getLabel().toString(), experiment.getApplicationName().toString(), NOW,
List results = newTransaction().select(SQL, appName.toString(), experimentLabel.toString(), State.DELETED.toString());
} catch (BucketDistributionNotFetchableException e) { LOGGER.error("Error obtaining the Bucket List from {} for user_id {}, for experiment: {} due to {}", assignmentDecorator.getClass().getSimpleName(), userID, experiment.getLabel().toString(), e); } finally {
.getExperimentId().getRawID(); String experimentLabel = entry.getExperimentLabel() == null ? "" : entry.getExperimentLabel().toString(); String bucketLabel = entry.getBucketLabel() == null ? "" : entry .getBucketLabel().toString();
eventJson.put("experimentLabel", experimentLabel != null ? experimentLabel.toString(): null); eventJson.put("userID", assignment != null && assignment.getUserID() != null ? assignment.getUserID().toString(): null);
@Override public Experiment updateExperiment(Experiment experiment) throws RepositoryException { validator.validateExperiment(experiment); final String SQL = "update experiment " + "set description=?, sampling_percent=?, state=?, " + "label=?, start_time=?, end_time=?, app_name=? " + "where id=?"; int rowCount = newTransaction().update( SQL, experiment.getDescription() != null ? experiment.getDescription() : "", experiment.getSamplingPercent(), experiment.getState().toString(), experiment.getLabel().toString(), experiment.getStartTime(), experiment.getEndTime(), experiment.getApplicationName().toString(), experiment.getID()); if (rowCount > 1) { throw new RepositoryException("Concurrent updates; please retry"); } if (rowCount < 1) { throw new RepositoryException("No rows were updated"); } return experiment; }
: "", newExperiment.getSamplingPercent(), newExperiment.getLabel().toString(), newExperiment.getStartTime(), newExperiment.getEndTime(),
/** * {@inheritDoc} */ protected Experiment internalGetExperiment(Application.Name appName, Experiment.Label experimentLabel) { LOGGER.debug("Getting experiment by app {} with label {} ", new Object[]{appName, experimentLabel}); Preconditions.checkNotNull(appName, "Parameter \"appName\" cannot be null"); Preconditions.checkNotNull(experimentLabel, "Parameter \"experimentLabel\" cannot be null"); Experiment experiment = null; try { ExperimentByAppNameLabel experimentAppLabel = experimentLabelIndexAccessor .getExperimentBy(appName.toString(), experimentLabel.toString()).one(); if (experimentAppLabel != null) { com.intuit.wasabi.repository.cassandra.pojo.Experiment experimentPojo = experimentAccessor .getExperimentById(experimentAppLabel.getId()).one(); experiment = ExperimentHelper.makeExperiment(experimentPojo); } } catch (Exception e) { LOGGER.error("Error while getting experiment by app {} with label {} ", new Object[]{appName, experimentLabel}, e); throw new RepositoryException("Could not retrieve experiment \"" + appName + "\".\"" + experimentLabel + "\"", e); } LOGGER.debug("Returning experiment {}", experiment); return experiment; }
/** * {@inheritDoc} */ @Override public void deleteExclusion(Experiment.ID expID_1, Experiment.ID expID_2, UserInfo user) { Experiment exp_1 = experiments.getExperiment(expID_1); Experiment exp_2 = experiments.getExperiment(expID_2); // Check that expID_1 is a valid experiment if (exp_1 == null) { throw new ExperimentNotFoundException(expID_1); } // Check that expID_2 is a valid experiment if (exp_2 == null) { throw new ExperimentNotFoundException(expID_2); } mutexRepository.deleteExclusion(expID_1, expID_2); eventLog.postEvent(new ExperimentChangeEvent(user, exp_1, "mutex", exp_2.getLabel().toString(), null)); LOGGER.info("event=EXPERIMENT_METADATA_CHANGE, message=MUTUAL_EXCLUSION_DELETED, applicationName={}, configuration=[experiment1={}, experiment2={}]", exp_1.getApplicationName(), exp_1.getLabel(), exp_2.getLabel()); }
protected void updateExperimentLabelIndex(Experiment.ID experimentID, Application.Name appName, Experiment.Label experimentLabel, Date startTime, Date endTime, Experiment.State state) { LOGGER.debug("update experiment label index experiment id {} app {} label {} " + " start time {} end time {} state {} ", new Object[]{experimentID, appName, experimentLabel, startTime, endTime, state}); if (state == Experiment.State.TERMINATED || state == Experiment.State.DELETED) { removeExperimentLabelIndex(appName, experimentLabel); return; } try { // Note that this timestamp gets serialized as mulliseconds from // the epoch, so timezone is irrelevant final Date NOW = new Date(); experimentLabelIndexAccessor.insertOrUpdateBy(experimentID.getRawID(), NOW, startTime, endTime, state.name(), appName.toString(), experimentLabel.toString()); } catch (Exception e) { LOGGER.debug("Error while updating experiment label index experiment id {} app {} label {} " + " start time {} end time {} state {} ", new Object[]{experimentID, appName, experimentLabel, startTime, endTime, state}, e); throw new RepositoryException("Could not index experiment \"" + experimentID + "\"", e); } }
protected void removeExperimentLabelIndex(Application.Name appName, Experiment.Label experimentLabel) { LOGGER.debug("Removing experiment label index for app {}, label {} ", new Object[]{ appName, experimentLabel}); try { experimentLabelIndexAccessor.deleteBy(appName.toString(), experimentLabel.toString()); } catch (Exception e) { LOGGER.error("Error while removing experiment label index for app {}, label {} ", new Object[]{ appName, experimentLabel}, e); throw new RepositoryException("Could not remove index for " + "experiment \"" + appName + "\".\"" + experimentLabel + "\"", e); } }