python_modules/dagster/dagster/core/types/decorator.py
def as_dagster_type(
    existing_type,
    name=None,
    description=None,
    input_schema=None,
    output_schema=None,
    serialization_strategy=None,
    storage_plugins=None,
):
    '''
    Takes a python cls and creates a type for it in the Dagster domain.

    Args:
        existing_type (cls)
            The python type you want to project in to the Dagster type system.
        name (Optional[str]):
        description (Optiona[str]):
        input_schema (Optional[InputSchema]):
            An instance of a class that inherits from :py:class:`InputSchema` that
            can map config data to a value of this type.

        output_schema (Optiona[OutputSchema]):
            An instance of a class that inherits from :py:class:`OutputSchema` that
            can map config data to persisting values of this type.

        serialization_strategy (Optional[SerializationStrategy]):
            The default behavior for how to serialize this value for
            persisting between execution steps.

        storage_plugins (Optional[Dict[RunStorageMode, TypeStoragePlugin]]):
            Storage type specific overrides for the serialization strategy.
            This allows for storage specific optimzations such as effecient
            distributed storage on S3.
    '''
    check.type_param(existing_type, 'existing_type')
    check.opt_str_param(name, 'name')
    check.opt_str_param(description, 'description')
    check.opt_inst_param(input_schema, 'input_schema', InputSchema)
    check.opt_inst_param(output_schema, 'output_schema', OutputSchema)
    check.opt_inst_param(serialization_strategy, 'serialization_strategy', SerializationStrategy)
    storage_plugins = check.opt_dict_param(storage_plugins, 'storage_plugins')

    if serialization_strategy is None:
        serialization_strategy = PickleSerializationStrategy()

    name = existing_type.__name__ if name is None else name

    return _decorate_as_dagster_type(
        existing_type,
        key=name,
        name=name,
        description=description,
        input_schema=input_schema,
        output_schema=output_schema,
        serialization_strategy=serialization_strategy,
        storage_plugins=storage_plugins,
    )
def as_dagster_type(
    existing_type,
    name=None,
    description=None,
    input_schema=None,
    output_schema=None,
    serialization_strategy=None,
    storage_plugins=None,
):
    '''
    Takes a python cls and creates a type for it in the Dagster domain.

    Args:
        existing_type (cls)
            The python type you want to project in to the Dagster type system.
        name (Optional[str]):
        description (Optiona[str]):
        input_schema (Optional[InputSchema]):
            An instance of a class that inherits from :py:class:`InputSchema` that
            can map config data to a value of this type.

        output_schema (Optiona[OutputSchema]):
            An instance of a class that inherits from :py:class:`OutputSchema` that
            can map config data to persisting values of this type.

        serialization_strategy (Optional[SerializationStrategy]):
            The default behavior for how to serialize this value for
            persisting between execution steps.

        storage_plugins (Optional[Dict[RunStorageMode, TypeStoragePlugin]]):
            Storage type specific overrides for the serialization strategy.
            This allows for storage specific optimzations such as effecient
            distributed storage on S3.
    '''
    check.type_param(existing_type, 'existing_type')
    check.opt_str_param(name, 'name')
    check.opt_str_param(description, 'description')
    check.opt_inst_param(input_schema, 'input_schema', InputSchema)
    check.opt_inst_param(output_schema, 'output_schema', OutputSchema)
    check.opt_inst_param(serialization_strategy, 'serialization_strategy', SerializationStrategy)
    storage_plugins = check.opt_dict_param(storage_plugins, 'storage_plugins')

    if serialization_strategy is None:
        serialization_strategy = PickleSerializationStrategy()

    name = existing_type.__name__ if name is None else name

    return _decorate_as_dagster_type(
        existing_type,
        key=name,
        name=name,
        description=description,
        input_schema=input_schema,
        output_schema=output_schema,
        serialization_strategy=serialization_strategy,
        storage_plugins=storage_plugins,
    )
Takes a python cls and creates a type for it in the Dagster domain.

    Args:
        existing_type (cls)
            The python type you want to project in to the Dagster type system.
        name (Optional[str]):
        description (Optiona[str]):
        input_schema (Optional[InputSchema]):
            An instance of a class that inherits from :py:class:`InputSchema` that
            can map config data to a value of this type.

        output_schema (Optiona[OutputSchema]):
            An instance of a class that inherits from :py:class:`OutputSchema` that
            can map config data to persisting values of this type.

        serialization_strategy (Optional[SerializationStrategy]):
            The default behavior for how to serialize this value for
            persisting between execution steps.

        storage_plugins (Optional[Dict[RunStorageMode, TypeStoragePlugin]]):
            Storage type specific overrides for the serialization strategy.
            This allows for storage specific optimzations such as effecient
            distributed storage on S3.