if name is None or name == "":
raise MlflowException("Invalid experiment name", INVALID_PARAMETER_VALUE)
new_session = self.SessionMaker()
try:
experiment = SqlExperiment(
name=name, lifecycle_stage=LifecycleStage.ACTIVE,
artifact_location=artifact_location
)
new_session.add(experiment)
if not artifact_location:
// this requires a double write. The first one to generate an autoincrement-ed ID
eid = new_session.query(SqlExperiment).filter_by(name=name).first().experiment_id
experiment.artifact_location = self._get_artifact_location(eid)
new_session.commit()
except sqlalchemy.exc.IntegrityError as e:
new_session.rollback()
raise MlflowException("Experiment(name={}) already exists. "
"Error: {}".format(name, str(e)), RESOURCE_ALREADY_EXISTS)