Exemplo n.º 1
0
                       True,
                       default_resource_request=default_resource_request)
env_2 = cl.Environment(2,
                       "dev-2",
                       "cluster-2",
                       False,
                       default_resource_request=default_resource_request)
ep1 = cl.VersionEndpoint("1234", 1, "running", "localhost/1", "svc-1",
                         env_1.name, env_1, "grafana.com")
ep2 = cl.VersionEndpoint("4567", 1, "running", "localhost/1", "svc-2",
                         env_2.name, env_2, "grafana.com")
rule_1 = cl.ModelEndpointRule(
    destinations=[cl.ModelEndpointRuleDestination(ep1.id, weight=100)])
rule_2 = cl.ModelEndpointRule(
    destinations=[cl.ModelEndpointRuleDestination(ep2.id, weight=100)])
mdl_endpoint_1 = cl.ModelEndpoint(1, 1, None, "serving", "localhost/1", rule_1,
                                  env_1.name, env_1)
mdl_endpoint_2 = cl.ModelEndpoint(2, 1, None, "serving", "localhost/2", rule_2,
                                  env_2.name, env_2)

config = {
    "job_config": {
        "version": "v1",
        "kind": "PredictionJob",
        "name": "job-1",
        "bigquery_source": {
            "table": "project.dataset.source_table",
            "features": ["feature_1", "feature_2"],
            "options": {
                "key": "val",
            }
        },
Exemplo n.º 2
0
mlflow_tracking_url = "http://mlflow.api.merlin.dev"
created_at = "2019-08-29T08:13:12.377Z"
updated_at = "2019-08-29T08:13:12.377Z"

default_resource_request = cl.ResourceRequest(1, 1, "100m", "128Mi")
env_1 = cl.Environment(1,
                       "dev",
                       "cluster-1",
                       True,
                       default_resource_request=default_resource_request)
env_2 = cl.Environment(2,
                       "dev-2",
                       "cluster-2",
                       False,
                       default_resource_request=default_resource_request)
mdl_endpoint_1 = cl.ModelEndpoint(1, 1, None, "serving", "localhost", None,
                                  env_1.name, env_1, created_at, updated_at)


@responses.activate
def test_get_project(mock_url, mock_oauth, use_google_oauth):
    responses.add('GET',
                  '/api/v1/projects',
                  body=f"""[{{
                        "id": 0,
                        "name": "my-project",
                        "mlflow_tracking_url": "http://mlflow.api.merlin.dev",
                        "created_at": "{created_at}",
                        "updated_at": "{updated_at}"
                      }}]""",
                  status=200,
                  content_type='application/json')