Exemplo n.º 1
0
class GitTypeSchema(BaseCamelSchema):
    url = RefOrObject(fields.Str(allow_none=True))
    revision = RefOrObject(fields.Str(allow_none=True))

    @staticmethod
    def schema_config():
        return V1GitType
Exemplo n.º 2
0
class HyperoptSchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True,
                      validate=validate.Equal(V1MatrixKind.HYPEROPT))
    max_iterations = RefOrObject(fields.Int(allow_none=True))
    algorithm = fields.Str(allow_none=True,
                           validate=validate.OneOf(["tpe", "rand", "anneal"]))
    params = fields.Dict(keys=fields.Str(),
                         values=fields.Nested(HpParamSchema),
                         required=True)
    num_runs = RefOrObject(fields.Int(required=True,
                                      validate=validate.Range(min=1)),
                           required=True)
    seed = RefOrObject(fields.Int(allow_none=True))
    concurrency = RefOrObject(fields.Int(allow_none=True))
    container = SwaggerField(
        cls=k8s_schemas.V1Container,
        defaults={"name": MAIN_JOB_CONTAINER},
        allow_none=True,
    )
    early_stopping = fields.List(fields.Nested(EarlyStoppingSchema),
                                 allow_none=True)

    @staticmethod
    def schema_config():
        return V1Hyperopt
Exemplo n.º 3
0
class EventSchema(BaseCamelSchema):
    name = RefOrObject(fields.Str(allow_none=True))
    kind = RefOrObject(fields.Str(allow_none=True))

    @staticmethod
    def schema_config():
        return V1EventType
Exemplo n.º 4
0
class ImageSchema(BaseCamelSchema):
    name = RefOrObject(fields.Str(allow_none=True))
    connection = RefOrObject(fields.Str(allow_none=True))

    @staticmethod
    def schema_config():
        return V1ImageType
Exemplo n.º 5
0
class BayesSchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True,
                      validate=validate.Equal(V1MatrixKind.BAYES))
    utility_function = fields.Nested(UtilityFunctionSchema, allow_none=True)
    num_initial_runs = RefOrObject(fields.Int(), required=True)
    max_iterations = RefOrObject(fields.Int(validate=validate.Range(min=1)))
    metric = fields.Nested(OptimizationMetricSchema, required=True)
    params = fields.Dict(keys=fields.Str(),
                         values=fields.Nested(HpParamSchema),
                         required=True)
    seed = RefOrObject(fields.Int(allow_none=True))
    concurrency = fields.Int(allow_none=True)
    container = SwaggerField(
        cls=k8s_schemas.V1Container,
        defaults={"name": MAIN_JOB_CONTAINER},
        allow_none=True,
    )
    early_stopping = fields.Nested(EarlyStoppingSchema,
                                   many=True,
                                   allow_none=True)

    @staticmethod
    def schema_config():
        return V1Bayes

    @validates_schema
    def validate_matrix(self, data, **kwargs):
        """Validates matrix data and creates the config objects"""
        validate_matrix(data.get("params"))
Exemplo n.º 6
0
class GcsTypeSchema(BaseCamelSchema):
    bucket = RefOrObject(fields.Str(allow_none=True))
    blob = RefOrObject(fields.Str(allow_none=True))

    @staticmethod
    def schema_config():
        return V1GcsType
Exemplo n.º 7
0
class ContainerResourcesSchema(BaseSchema):
    limits = RefOrObject(fields.Dict(allow_none=True))
    requests = RefOrObject(fields.Dict(allow_none=True))

    @staticmethod
    def schema_config():
        return ContainerResourcesConfig
Exemplo n.º 8
0
class HyperbandSchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True,
                      validate=validate.Equal(V1MatrixKind.HYPERBAND))
    params = fields.Dict(keys=fields.Str(),
                         values=fields.Nested(HpParamSchema),
                         allow_none=True)
    max_iterations = RefOrObject(fields.Int(validate=validate.Range(min=1)))
    eta = RefOrObject(fields.Float(validate=validate.Range(min=0)))
    resource = fields.Nested(OptimizationResourceSchema)
    metric = fields.Nested(OptimizationMetricSchema)
    resume = RefOrObject(fields.Boolean(allow_none=True))
    seed = RefOrObject(fields.Int(allow_none=True))
    concurrency = fields.Int(allow_none=True)
    container = SwaggerField(
        cls=k8s_schemas.V1Container,
        defaults={"name": MAIN_JOB_CONTAINER},
        allow_none=True,
    )
    early_stopping = fields.Nested(EarlyStoppingSchema,
                                   many=True,
                                   allow_none=True)

    @staticmethod
    def schema_config():
        return V1Hyperband
Exemplo n.º 9
0
class ResourceRequirementsSchema(BaseSchema):
    limits = RefOrObject(fields.Dict(allow_none=True))
    requests = RefOrObject(fields.Dict(allow_none=True))

    @staticmethod
    def schema_config():
        return ResourceRequirementsConfig
Exemplo n.º 10
0
class AuthTypeSchema(BaseCamelSchema):
    user = RefOrObject(fields.Str(), required=True)
    password = RefOrObject(fields.Str(), required=True)

    @staticmethod
    def schema_config():
        return V1AuthType
Exemplo n.º 11
0
class ArtifactsTypeSchema(BaseCamelSchema):
    files = RefOrObject(fields.List(StrOrList(), allow_none=True))
    dirs = RefOrObject(fields.List(StrOrList(), allow_none=True))
    workers = RefOrObject(fields.Int(allow_none=True))

    @staticmethod
    def schema_config():
        return V1ArtifactsType
Exemplo n.º 12
0
class WasbTypeSchema(BaseCamelSchema):
    container = RefOrObject(fields.Str(allow_none=True))
    storage_account = RefOrObject(fields.Str(allow_none=True))
    path = RefOrObject(fields.Str(allow_none=True))

    @staticmethod
    def schema_config():
        return V1WasbType
Exemplo n.º 13
0
class UriTypeSchema(BaseCamelSchema):
    user = RefOrObject(fields.Str(required=True))
    password = RefOrObject(fields.Str(required=True))
    host = RefOrObject(fields.Str(required=True))

    @staticmethod
    def schema_config():
        return V1UriType
Exemplo n.º 14
0
class TruncationStoppingPolicySchema(BaseSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("truncation"))
    percent = RefOrObject(fields.Float(), required=True)
    evaluation_interval = RefOrObject(fields.Int(), required=True)

    @staticmethod
    def schema_config():
        return TruncationStoppingPolicyConfig
Exemplo n.º 15
0
class MedianStoppingPolicySchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("median"))
    evaluation_interval = RefOrObject(fields.Int(), required=True)
    min_interval = RefOrObject(fields.Int(allow_none=True))
    min_samples = RefOrObject(fields.Int(allow_none=True))

    @staticmethod
    def schema_config():
        return V1MedianStoppingPolicy
Exemplo n.º 16
0
class FailureEarlyStoppingSchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True,
                      validate=validate.Equal("failure_early_stopping"))
    percent = RefOrObject(fields.Float(), required=True)
    evaluation_interval = RefOrObject(fields.Int(), required=True)

    @staticmethod
    def schema_config():
        return V1FailureEarlyStopping
Exemplo n.º 17
0
class ArtifactsTypeSchema(BaseCamelSchema):
    connection = RefOrObject(fields.Str(allow_none=True))
    files = RefOrObject(fields.List(fields.Str(), allow_none=True))
    dirs = RefOrObject(fields.List(fields.Str(), allow_none=True))
    init = RefOrObject(fields.Bool(allow_none=True))
    workers = RefOrObject(fields.Int(allow_none=True))

    @staticmethod
    def schema_config():
        return V1ArtifactsType
Exemplo n.º 18
0
class CronScheduleSchema(BaseSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("cron"))
    start_at = RefOrObject(fields.LocalDateTime(allow_none=True))
    end_at = RefOrObject(fields.LocalDateTime(allow_none=True))
    cron = RefOrObject(fields.String(required=True))
    depends_on_past = RefOrObject(fields.Bool(allow_none=True))

    @staticmethod
    def schema_config():
        return CronScheduleConfig
Exemplo n.º 19
0
class RepeatableScheduleSchema(BaseSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("repeatable"))
    limit = RefOrObject(fields.Int(required=True,
                                   validate=validate.Range(min=1)),
                        required=True)
    depends_on_past = RefOrObject(fields.Bool(allow_none=True), required=True)

    @staticmethod
    def schema_config():
        return RepeatableScheduleConfig
Exemplo n.º 20
0
class IntervalScheduleSchema(BaseSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("interval"))
    start_at = RefOrObject(fields.LocalDateTime(required=True), required=True)
    end_at = RefOrObject(fields.LocalDateTime(allow_none=True))
    frequency = RefOrObject(fields.TimeDelta(required=True), required=True)
    depends_on_past = RefOrObject(fields.Bool(allow_none=True))

    @staticmethod
    def schema_config():
        return IntervalScheduleConfig
Exemplo n.º 21
0
class TunerSchema(BaseCamelSchema):
    hub_ref = fields.Str(required=True)
    queue = RefOrObject(fields.Str(allow_none=True))
    presets = RefOrObject(fields.List(fields.Str(allow_none=True)))
    params = fields.Dict(
        keys=fields.Str(), values=fields.Nested(ParamSchema), allow_none=True
    )

    @staticmethod
    def schema_config():
        return V1Tuner
Exemplo n.º 22
0
class FileTypeSchema(BaseCamelSchema):
    content = RefOrObject(fields.Str(), required=True)
    filename = RefOrObject(fields.Str(allow_none=True))
    kind = RefOrObject(
        fields.Str(allow_none=True,
                   validate=validate.OneOf(V1ArtifactKind.allowable_values)))
    chmod = RefOrObject(fields.Str(allow_none=True))

    @staticmethod
    def schema_config():
        return V1FileType
Exemplo n.º 23
0
class JoinSchema(BaseCamelSchema):
    query = fields.Str(required=True)
    sort = fields.Str(allow_none=True)
    limit = RefOrObject(fields.Int(allow_none=True))
    offset = RefOrObject(fields.Int(allow_none=True))
    params = fields.Dict(keys=fields.Str(),
                         values=fields.Nested(JoinParamSchema),
                         allow_none=True)

    @staticmethod
    def schema_config():
        return V1Join
Exemplo n.º 24
0
class MetricEarlyStoppingSchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("metric_early_stopping"))
    metric = RefOrObject(fields.Str(), required=True)
    value = RefOrObject(fields.Float(), required=True)
    optimization = RefOrObject(
        fields.Str(validate=validate.OneOf(V1Optimization.VALUES)), required=True
    )
    policy = fields.Nested(StoppingPolicySchema, allow_none=True)

    @staticmethod
    def schema_config():
        return V1MetricEarlyStopping
Exemplo n.º 25
0
class MappingSchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True,
                      validate=validate.Equal(V1MatrixKind.MAPPING))
    values = RefOrObject(fields.List(fields.Dict(), required=True),
                         required=True)
    concurrency = RefOrObject(fields.Int(allow_none=True))
    early_stopping = fields.List(fields.Nested(EarlyStoppingSchema),
                                 allow_none=True)

    @staticmethod
    def schema_config():
        return V1Mapping
Exemplo n.º 26
0
class RandomSearchSchema(BaseSchema):
    kind = fields.Str(allow_none=True,
                      validate=validate.Equal("random_search"))
    matrix = fields.Dict(keys=fields.Str(),
                         values=fields.Nested(MatrixSchema),
                         required=True)
    n_experiments = RefOrObject(
        fields.Int(allow_none=True, validate=validate.Range(min=1)))
    seed = RefOrObject(fields.Int(allow_none=True))

    @staticmethod
    def schema_config():
        return RandomSearchConfig
Exemplo n.º 27
0
class HyperbandSchema(BaseSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("hyperband"))
    matrix = fields.Dict(keys=fields.Str(),
                         values=fields.Nested(MatrixSchema),
                         allow_none=True)
    max_iter = RefOrObject(fields.Int(validate=validate.Range(min=1)))
    eta = RefOrObject(fields.Float(validate=validate.Range(min=0)))
    resource = fields.Nested(ResourceSchema)
    metric = fields.Nested(SearchMetricSchema)
    resume = RefOrObject(fields.Boolean(allow_none=True))
    seed = RefOrObject(fields.Int(allow_none=True))

    @staticmethod
    def schema_config():
        return HyperbandConfig
Exemplo n.º 28
0
class ExactTimeScheduleSchema(BaseSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("exact_time"))
    start_at = RefOrObject(fields.LocalDateTime(required=True), required=True)

    @staticmethod
    def schema_config():
        return ExactTimeScheduleConfig
Exemplo n.º 29
0
class RaySchema(BaseCamelSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal(V1RunKind.RAY))
    spec = RefOrObject(fields.Raw(required=True))

    @staticmethod
    def schema_config():
        return V1Ray
Exemplo n.º 30
0
class SparkSchema(BaseSchema):
    kind = fields.Str(allow_none=True, validate=validate.Equal("spark"))
    spec = RefOrObject(fields.Raw(required=True))

    @staticmethod
    def schema_config():
        return SparkConfig