a7272b7309b6d53e70afe7c19dc3ca383962261a,mlflow/store/sqlalchemy_store.py,SqlAlchemyStore,create_experiment,#SqlAlchemyStore#Any#Any#,140

Before Change


        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)

After Change


        if name is None or name == "":
            raise MlflowException("Invalid experiment name", INVALID_PARAMETER_VALUE)

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

            return experiment.experiment_id

    def _list_experiments(self, session, ids=None, names=None, view_type=ViewType.ACTIVE_ONLY):
        stages = LifecycleStage.view_type_to_stages(view_type)
        conditions = [SqlExperiment.lifecycle_stage.in_(stages)]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: mlflow/mlflow
Commit Name: a7272b7309b6d53e70afe7c19dc3ca383962261a
Time: 2019-03-13
Author: 39497902+dbczumar@users.noreply.github.com
File Name: mlflow/store/sqlalchemy_store.py
Class Name: SqlAlchemyStore
Method Name: create_experiment


Project Name: pfnet/optuna
Commit Name: 5685e22e05c353aec54e8cd12e4a646cde0ef0e4
Time: 2020-10-21
Author: keisuke.umezawa@gmail.com
File Name: optuna/storages/_rdb/storage.py
Class Name: RDBStorage
Method Name: _check_and_set_param_distribution


Project Name: biolab/orange3
Commit Name: ce3c375ad366e131b76c70e5d99dbd2af7c9cedf
Time: 2014-03-04
Author: lan.zagar@fri.uni-lj.si
File Name: Orange/tests/sql/base.py
Class Name:
Method Name: create_iris