<commit_before>from mlflow.entities.run_status import RunStatus
from mlflow.entities._mlflow_object import _MLflowObject
from mlflow.entities.lifecycle_stage import LifecycleStage
from mlflow.exceptions import MlflowException

from mlflow.protos.service_pb2 import RunInfo as ProtoRunInfo
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE


def check_run_is_active(run_info):
    if run_info.lifecycle_stage != LifecycleStage.ACTIVE:
        raise MlflowException(
            "The run {} must be in 'active' lifecycle_stage.".format(run_info.run_id),
            error_code=INVALID_PARAMETER_VALUE,
        )


def check_run_is_deleted(run_info):
    if run_info.lifecycle_stage != LifecycleStage.DELETED:
        raise MlflowException(
            "The run {} must be in 'deleted' lifecycle_stage.".format(run_info.run_id),
            error_code=INVALID_PARAMETER_VALUE,
        )


class searchable_attribute(property):
    # Wrapper class over property to designate some of the properties as searchable
    # run attributes
    pass


class orderable_attribute(property):
    # Wrapper class over property to designate some of the properties as orderable
    # run attributes
    pass


class RunInfo(_MLflowObject):
    """
    Metadata about a run.
    """

    def __init__(
        self,
        run_uuid,
        experiment_id,
        user_id,
        status,
        start_time,
        end_time,
        lifecycle_stage,
        artifact_uri=None,
        run_id=None,
    ):
        if run_uuid is None:
            raise Exception("run_uuid cannot be None")
        if experiment_id is None:
            raise Exception("experiment_id cannot be None")
        if user_id is None:
            raise Exception("user_id cannot be None")
        if status is None:
            raise Exception("status cannot be None")
        if start_time is None:
            raise Exception("start_time cannot be None")
        actual_run_id = run_id or run_uuid
        if actual_run_id is None:
            raise Exception("run_id and run_uuid cannot both be None")
        self._run_uuid = actual_run_id
        self._run_id = actual_run_id
        self._experiment_id = experiment_id
        self._user_id = user_id
        self._status = status
        self._start_time = start_time
        self._end_time = end_time
        self._lifecycle_stage = lifecycle_stage
        self._artifact_uri = artifact_uri

    def __eq__(self, other):
        if type(other) is type(self):
            # TODO deep equality here?
            return self.__dict__ == other.__dict__
        return False

    def _copy_with_overrides(self, status=None, end_time=None, lifecycle_stage=None):
        """A copy of the RunInfo with certain attributes modified."""
        proto = self.to_proto()<commit_msg>Remove run_uuid is None check (#6547)<commit_after>from mlflow.entities.run_status import RunStatus
from mlflow.entities._mlflow_object import _MLflowObject
from mlflow.entities.lifecycle_stage import LifecycleStage
from mlflow.exceptions import MlflowException

from mlflow.protos.service_pb2 import RunInfo as ProtoRunInfo
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE


def check_run_is_active(run_info):
    if run_info.lifecycle_stage != LifecycleStage.ACTIVE:
        raise MlflowException(
            "The run {} must be in 'active' lifecycle_stage.".format(run_info.run_id),
            error_code=INVALID_PARAMETER_VALUE,
        )


def check_run_is_deleted(run_info):
    if run_info.lifecycle_stage != LifecycleStage.DELETED:
        raise MlflowException(
            "The run {} must be in 'deleted' lifecycle_stage.".format(run_info.run_id),
            error_code=INVALID_PARAMETER_VALUE,
        )


class searchable_attribute(property):
    # Wrapper class over property to designate some of the properties as searchable
    # run attributes
    pass


class orderable_attribute(property):
    # Wrapper class over property to designate some of the properties as orderable
    # run attributes
    pass


class RunInfo(_MLflowObject):
    """
    Metadata about a run.
    """

    def __init__(
        self,
        run_uuid,
        experiment_id,
        user_id,
        status,
        start_time,
        end_time,
        lifecycle_stage,
        artifact_uri=None,
        run_id=None,
    ):
        if experiment_id is None:
            raise Exception("experiment_id cannot be None")
        if user_id is None:
            raise Exception("user_id cannot be None")
        if status is None:
            raise Exception("status cannot be None")
        if start_time is None:
            raise Exception("start_time cannot be None")
        actual_run_id = run_id or run_uuid
        if actual_run_id is None:
            raise Exception("run_id and run_uuid cannot both be None")
        self._run_uuid = actual_run_id
        self._run_id = actual_run_id
        self._experiment_id = experiment_id
        self._user_id = user_id
        self._status = status
        self._start_time = start_time
        self._end_time = end_time
        self._lifecycle_stage = lifecycle_stage
        self._artifact_uri = artifact_uri

    def __eq__(self, other):
        if type(other) is type(self):
            # TODO deep equality here?
            return self.__dict__ == other.__dict__
        return False

    def _copy_with_overrides(self, status=None, end_time=None, lifecycle_stage=None):
        """A copy of the RunInfo with certain attributes modified."""
        proto = self.to_proto()
{'fraction_non_alphanumeric': 0.06491164803461955, 'fraction_numerical': 0.00144248106743599, 'mean_word_length': 2.6613861386138615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6059269', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1584, 'n_words': 444}