Skip to content

resource

cast_serialize_pixi_settings(v)

Validate current value, and enrich it with default values.

Source code in fractal_server/app/schemas/v2/resource.py
29
30
31
32
33
34
35
36
37
def cast_serialize_pixi_settings(
    v: dict[NonEmptyStr, Any],
) -> dict[NonEmptyStr, Any]:
    """
    Validate current value, and enrich it with default values.
    """
    if v != {}:
        v = TasksPixiSettings(**v).model_dump()
    return v

cast_serialize_resource(_data)

Cast/serialize round-trip for Resource data.

We use @validate_call because ResourceCreate is a Union type and it cannot be instantiated directly.

Return

Serialized version of a valid resource object.

Source code in fractal_server/app/schemas/v2/resource.py
126
127
128
129
130
131
132
133
134
135
136
137
@validate_call
def cast_serialize_resource(_data: ResourceCreate) -> dict[str, Any]:
    """
    Cast/serialize round-trip for `Resource` data.

    We use `@validate_call` because `ResourceCreate` is a `Union` type and it
    cannot be instantiated directly.

    Return:
        Serialized version of a valid resource object.
    """
    return _data.model_dump()