Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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"))
Exemple #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
Exemple #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
Exemple #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
class ResourceRequirementsSchema(BaseSchema):
    limits = RefOrObject(fields.Dict(allow_none=True))
    requests = RefOrObject(fields.Dict(allow_none=True))

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

    @staticmethod
    def schema_config():
        return V1AuthType
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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