Exemple #1
0
class RemoteDaskEnvironmentSchema(ObjectSchema):
    class Meta:
        object_class = RemoteDaskEnvironment

    address = fields.String()
    labels = SortedList(fields.String())
    metadata = JSONCompatible(allow_none=True)
Exemple #2
0
class RemoteEnvironmentSchema(ObjectSchema):
    class Meta:
        object_class = RemoteEnvironment

    executor = fields.String(allow_none=True)
    executor_kwargs = fields.Dict(allow_none=True)
    labels = SortedList(fields.String())
    metadata = JSONCompatible(allow_none=True)
Exemple #3
0
class DaskKubernetesEnvironmentSchema(ObjectSchema):
    class Meta:
        object_class = DaskKubernetesEnvironment

    docker_secret = fields.String(allow_none=True)
    labels = SortedList(fields.String())
    metadata = JSONCompatible(allow_none=True)
    private_registry = fields.Boolean(allow_none=False)
    min_workers = fields.Int()
    max_workers = fields.Int()
Exemple #4
0
class ParameterSchema(TaskMethodsMixin, ObjectSchema):
    class Meta:
        object_class = lambda: prefect.core.parameter.Parameter  # type: ignore
        exclude_fields = ["type", "outputs", "slug"]

    type = fields.Function(lambda task: to_qualified_name(type(task)),
                           lambda x: x)
    name = fields.String(required=True)
    slug = fields.String(allow_none=True)
    default = JSONCompatible(allow_none=True)
    required = fields.Boolean(allow_none=True)
    tags = SortedList(fields.String())
    outputs = fields.Method("load_outputs", allow_none=True)
Exemple #5
0
class TaskSchema(TaskMethodsMixin, ObjectSchema):
    class Meta:
        object_class = lambda: prefect.core.Task
        exclude_fields = ["type", "inputs", "outputs"]

    type = fields.Function(lambda task: to_qualified_name(type(task)),
                           lambda x: x)
    name = fields.String(allow_none=True)
    slug = fields.String(allow_none=True)
    description = fields.String(allow_none=True)
    tags = SortedList(fields.String())
    max_retries = fields.Integer(allow_none=True)
    retry_delay = fields.TimeDelta(allow_none=True)
    inputs = fields.Method("load_inputs", allow_none=True)
    outputs = fields.Method("load_outputs", allow_none=True)
    timeout = fields.Integer(allow_none=True)
    trigger = StatefulFunctionReference(
        valid_functions=[
            prefect.triggers.all_finished,
            prefect.triggers.manual_only,
            prefect.triggers.always_run,
            prefect.triggers.all_successful,
            prefect.triggers.all_failed,
            prefect.triggers.any_successful,
            prefect.triggers.any_failed,
            prefect.triggers.some_failed,
            prefect.triggers.some_successful,
        ],
        # don't reject custom functions, just leave them as strings
        reject_invalid=False,
        allow_none=True,
    )
    skip_on_upstream_skip = fields.Boolean(allow_none=True)
    cache_for = fields.TimeDelta(allow_none=True)
    cache_key = fields.String(allow_none=True)
    cache_validator = StatefulFunctionReference(
        valid_functions=[
            prefect.engine.cache_validators.never_use,
            prefect.engine.cache_validators.duration_only,
            prefect.engine.cache_validators.all_inputs,
            prefect.engine.cache_validators.all_parameters,
            prefect.engine.cache_validators.partial_inputs_only,
            prefect.engine.cache_validators.partial_parameters_only,
        ],
        # don't reject custom functions, just leave them as strings
        reject_invalid=False,
        allow_none=True,
    )
    auto_generated = fields.Boolean(allow_none=True)
Exemple #6
0
class CustomEnvironmentSchema(ObjectSchema):
    class Meta:
        object_class = lambda: Environment
        exclude_fields = ["type"]

    labels = SortedList(fields.String())
    metadata = JSONCompatible(allow_none=True)

    type = fields.Function(
        lambda environment: to_qualified_name(type(environment)), lambda x: x
    )

    @post_load
    def create_object(self, data: dict, **kwargs: Any) -> Environment:
        """
        Because we cannot deserialize a custom class, we return an empty
        Base Environment with the appropriate labels.
        """
        return Environment(labels=data.get("labels"), metadata=data.get("metadata"))
Exemple #7
0
class RunConfigSchemaBase(ObjectSchema):
    labels = SortedList(fields.String())
Exemple #8
0
class RunConfigSchemaBase(ObjectSchema):
    env = fields.Dict(keys=fields.String(), allow_none=True)
    labels = SortedList(fields.String())
Exemple #9
0
 class Schema(marshmallow.Schema):
     lst = SortedList(marshmallow.fields.String())
Exemple #10
0
class KubernetesJobEnvironmentSchema(ObjectSchema):
    class Meta:
        object_class = KubernetesJobEnvironment

    labels = SortedList(fields.String())
    metadata = JSONCompatible(allow_none=True)
Exemple #11
0
class FargateTaskEnvironmentSchema(ObjectSchema):
    class Meta:
        object_class = FargateTaskEnvironment

    labels = SortedList(fields.String())
    metadata = JSONCompatible(allow_none=True)