Skip to content

Commit

Permalink
References to async_enabled should be asyncEnabled.
Browse files Browse the repository at this point in the history
This commit fixes some misreferences to the asyncEnabled
property which were using async_enabled instead.
  • Loading branch information
jfrancoa committed Jun 20, 2024
1 parent 4701b7a commit 51afc99
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion integration_v3/test_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def client(request):
if opts.get("cluster"):
port = 8087
for _, c in enumerate(schema["classes"]):
c["replicationConfig"] = {"factor": 2, "async_enabled": False}
c["replicationConfig"] = {"factor": 2, "asyncEnabled": False}

client = weaviate.Client(f"http://localhost:{port}")
client.schema.delete_all()
Expand Down
19 changes: 8 additions & 11 deletions integration_v3/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,19 @@ def test_create_class_with_implicit_and_explicit_replication_config(
},
],
}
if replicationFactor is None:
expected_factor = 1
if asyncEnabled is None:
expected_async_enabled = False
else:
expected_factor = replicationFactor
single_class["replicationConfig"] = {
"factor": replicationFactor,
"async_enabled": asyncEnabled,
}

expected_factor = 1 if replicationFactor == None else replicationFactor
expected_async_enabled = False if asyncEnabled == None else asyncEnabled
single_class["replicationConfig"] = {
"factor": replicationFactor,
"asyncEnabled": asyncEnabled,
}

client.schema.create_class(single_class)
created_class = client.schema.get("Barbecue")
assert created_class["class"] == "Barbecue"
assert created_class["replicationConfig"]["factor"] == expected_factor
assert created_class["replicationConfig"].get("async_enabled") == expected_async_enabled
assert created_class["replicationConfig"].get("asyncEnabled", False) == expected_async_enabled

client.schema.delete_class("Barbecue")

Expand Down
2 changes: 1 addition & 1 deletion mock_tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def test_return_from_bind_module(
"invertedIndexConfig": ii_config,
"multiTenancyConfig": config.multi_tenancy()._to_dict(),
"vectorizer": "multi2vec-bind",
"replicationConfig": {"factor": 2, "async_enabled": False},
"replicationConfig": {"factor": 2, "asyncEnabled": False},
"moduleConfig": {"multi2vec-bind": {}},
}
weaviate_auth_mock.expect_request("/v1/schema/TestBindCollection").respond_with_json(
Expand Down
8 changes: 4 additions & 4 deletions weaviate/collections/classes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ class _ShardingConfigCreate(_ConfigCreateModel):

class _ReplicationConfigCreate(_ConfigCreateModel):
factor: Optional[int]
async_enabled: Optional[bool]
asyncEnabled: Optional[bool]


class _ReplicationConfigUpdate(_ConfigUpdateModel):
factor: Optional[int]
async_enabled: Optional[bool]
asyncEnabled: Optional[bool]


class _BM25ConfigCreate(_ConfigCreateModel):
Expand Down Expand Up @@ -1789,7 +1789,7 @@ def replication(
`async_enabled`
Enabled async replication.
"""
return _ReplicationConfigCreate(factor=factor, async_enabled=async_enabled)
return _ReplicationConfigCreate(factor=factor, asyncEnabled=async_enabled)

@staticmethod
def sharding(
Expand Down Expand Up @@ -1997,7 +1997,7 @@ def replication(
`async_enabled`
Enable async replication.
"""
return _ReplicationConfigUpdate(factor=factor, async_enabled=async_enabled)
return _ReplicationConfigUpdate(factor=factor, asyncEnabled=async_enabled)

@staticmethod
def multi_tenancy(
Expand Down
2 changes: 1 addition & 1 deletion weaviate/collections/classes/config_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _collection_config_from_json(schema: Dict[str, Any]) -> _CollectionConfig:
references=_references_from_config(schema) if schema.get("properties") is not None else [],
replication_config=_ReplicationConfig(
factor=schema["replicationConfig"]["factor"],
async_enabled=schema["replicationConfig"].get("async_enabled"),
async_enabled=schema["replicationConfig"]["asyncEnabled"],
),
reranker_config=__get_rerank_config(schema),
sharding_config=(
Expand Down
4 changes: 2 additions & 2 deletions weaviate/schema/crud_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def get(self, class_name: Optional[str] = None) -> dict:
"vectorizer": "text2vec-contextionary",
"replicationConfig": {
"factor": 1,
"async_enabled": false
"asyncEnabled": false
}
}
]
Expand Down Expand Up @@ -547,7 +547,7 @@ def get(self, class_name: Optional[str] = None) -> dict:
"vectorizer": "text2vec-contextionary",
"replicationConfig": {
"factor": 1,
"async_enabled": false
"asyncEnabled": false
}
}
Expand Down

0 comments on commit 51afc99

Please sign in to comment.