Esempio n. 1
0
    def create_run(self, experiment_id, user_id, start_time, tags):
        with self.ManagedSessionMaker() as session:
            experiment = self.get_experiment(experiment_id)
            self._check_experiment_is_active(experiment)

            run_id = uuid.uuid4().hex
            artifact_location = posixpath.join(
                experiment.artifact_location, run_id,
                SqlAlchemyStore.ARTIFACTS_FOLDER_NAME)
            run = SqlRun(name="",
                         artifact_uri=artifact_location,
                         run_uuid=run_id,
                         experiment_id=experiment_id,
                         source_type=SourceType.to_string(SourceType.UNKNOWN),
                         source_name="",
                         entry_point_name="",
                         user_id=user_id,
                         status=RunStatus.to_string(RunStatus.RUNNING),
                         start_time=start_time,
                         end_time=None,
                         source_version="",
                         lifecycle_stage=LifecycleStage.ACTIVE)

            tags_dict = {}
            for tag in tags:
                tags_dict[tag.key] = tag.value
            run.tags = [
                SqlTag(key=key, value=value)
                for key, value in tags_dict.items()
            ]
            self._save_to_db(objs=run, session=session)

            return run.to_mlflow_entity()
Esempio n. 2
0
    def create_run(self, experiment_id, user_id, run_name, source_type, source_name,
                   entry_point_name, start_time, source_version, tags, parent_run_id):
        experiment = self.get_experiment(experiment_id)

        if experiment.lifecycle_stage != LifecycleStage.ACTIVE:
            raise MlflowException('Experiment id={} must be active'.format(experiment_id),
                                  INVALID_STATE)

        run_uuid = uuid.uuid4().hex
        artifact_location = build_path(experiment.artifact_location, run_uuid,
                                       SqlAlchemyStore.ARTIFACTS_FOLDER_NAME)
        run = SqlRun(name=run_name or "", artifact_uri=artifact_location, run_uuid=run_uuid,
                     experiment_id=experiment_id, source_type=SourceType.to_string(source_type),
                     source_name=source_name, entry_point_name=entry_point_name,
                     user_id=user_id, status=RunStatus.to_string(RunStatus.RUNNING),
                     start_time=start_time, end_time=None,
                     source_version=source_version, lifecycle_stage=LifecycleStage.ACTIVE)

        for tag in tags:
            run.tags.append(SqlTag(key=tag.key, value=tag.value))
        if parent_run_id:
            run.tags.append(SqlTag(key=MLFLOW_PARENT_RUN_ID, value=parent_run_id))
        if run_name:
            run.tags.append(SqlTag(key=MLFLOW_RUN_NAME, value=run_name))

        self._save_to_db([run])

        return run.to_mlflow_entity()
Esempio n. 3
0
    def create_run(self, experiment_id, user_id, run_name, source_type,
                   source_name, entry_point_name, start_time, source_version,
                   tags, parent_run_id):
        with self.ManagedSessionMaker() as session:
            experiment = self.get_experiment(experiment_id)

            if experiment.lifecycle_stage != LifecycleStage.ACTIVE:
                raise MlflowException(
                    'Experiment id={} must be active'.format(experiment_id),
                    INVALID_STATE)

            run_uuid = uuid.uuid4().hex
            artifact_location = build_path(
                experiment.artifact_location, run_uuid,
                SqlAlchemyStore.ARTIFACTS_FOLDER_NAME)
            run = SqlRun(name=run_name or "",
                         artifact_uri=artifact_location,
                         run_uuid=run_uuid,
                         experiment_id=experiment_id,
                         source_type=SourceType.to_string(source_type),
                         source_name=source_name,
                         entry_point_name=entry_point_name,
                         user_id=user_id,
                         status=RunStatus.to_string(RunStatus.RUNNING),
                         start_time=start_time,
                         end_time=None,
                         source_version=source_version,
                         lifecycle_stage=LifecycleStage.ACTIVE)

            tags_dict = {}
            for tag in tags:
                tags_dict[tag.key] = tag.value
            if parent_run_id:
                tags_dict[MLFLOW_PARENT_RUN_ID] = parent_run_id
            if run_name:
                tags_dict[MLFLOW_RUN_NAME] = run_name
            run.tags = [
                SqlTag(key=key, value=value)
                for key, value in tags_dict.items()
            ]
            self._save_to_db(objs=run, session=session)

            return run.to_mlflow_entity()
Esempio n. 4
0
    def create_run(self, experiment_id, user_id, run_name, source_type, source_name,
                   entry_point_name, start_time, source_version, tags, parent_run_id):
        _ = parent_run_id
        experiment = self.get_experiment(experiment_id)

        if experiment.lifecycle_stage != Experiment.ACTIVE_LIFECYCLE:
            raise MlflowException('Experiment id={} must be active'.format(experiment_id),
                                  INVALID_STATE)
        status = RunStatus.to_string(RunStatus.RUNNING)
        run_uuid = uuid.uuid4().hex
        run = SqlRun(name=run_name, artifact_uri=None, run_uuid=run_uuid,
                     experiment_id=experiment_id, source_type=source_type,
                     source_name=source_name, entry_point_name=entry_point_name,
                     user_id=user_id, status=status, start_time=start_time, end_time=None,
                     source_version=source_version, lifecycle_stage=RunInfo.ACTIVE_LIFECYCLE)

        for tag in tags:
            run.tags.append(SqlTag(key=tag.key, value=tag.value))
        self._save_to_db([run])

        return run.to_mlflow_entity()