Beispiel #1
0
    def to_flyte_idl(self) -> _idl_parameter_ranges.ParameterRanges:
        """

        :rtype: _idl_parameter_ranges.ParameterRanges
        """
        converted = {}
        for k, v in self._parameter_range_map.items():
            if isinstance(v, IntegerParameterRange):
                converted[k] = _idl_parameter_ranges.ParameterRangeOneOf(
                    integer_parameter_range=v.to_flyte_idl())
            elif isinstance(v, ContinuousParameterRange):
                converted[k] = _idl_parameter_ranges.ParameterRangeOneOf(
                    continuous_parameter_range=v.to_flyte_idl())
            elif isinstance(v, CategoricalParameterRange):
                converted[k] = _idl_parameter_ranges.ParameterRangeOneOf(
                    categorical_parameter_range=v.to_flyte_idl())
            else:
                raise user.FlyteTypeException(
                    received_type=type(v),
                    expected_type=type(Union[IntegerParameterRange,
                                             ContinuousParameterRange,
                                             CategoricalParameterRange]),
                )

        return _idl_parameter_ranges.ParameterRanges(
            parameter_range_map=converted, )
Beispiel #2
0
    def to_flyte_idl(self) -> _idl_parameter_ranges.ParameterRanges:
        converted = {}
        for k, v in self._parameter_range_map.items():
            if isinstance(v, IntegerParameterRange):
                converted[k] = _idl_parameter_ranges.ParameterRangeOneOf(
                    integer_parameter_range=v.to_flyte_idl())
            elif isinstance(v, ContinuousParameterRange):
                converted[k] = _idl_parameter_ranges.ParameterRangeOneOf(
                    continuous_parameter_range=v.to_flyte_idl())
            else:
                converted[k] = _idl_parameter_ranges.ParameterRangeOneOf(
                    categorical_parameter_range=v.to_flyte_idl())

        return _idl_parameter_ranges.ParameterRanges(
            parameter_range_map=converted, )