Skip to content

Commit

Permalink
fix: remove add_metadata
Browse files Browse the repository at this point in the history
Signed-off-by: s0nicboOm <[email protected]>
  • Loading branch information
s0nicboOm committed Sep 13, 2023
1 parent b30b808 commit 25ba2bc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 0 additions & 2 deletions numalogic/udfs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

redis_client = get_redis_client_from_conf(pipeline_conf.redis_conf)

Check warning on line 18 in numalogic/udfs/__main__.py

View check run for this annotation

Codecov / codecov/patch

numalogic/udfs/__main__.py#L18

Added line #L18 was not covered by tests

for key in redis_client.scan_iter("*"):
redis_client.delete(key)
if __name__ == "__main__":
set_logger()
step = sys.argv[1]
Expand Down
3 changes: 0 additions & 3 deletions numalogic/udfs/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ def get_data(self, original=False) -> npt.NDArray[float]:
def get_metadata(self, key: str) -> dict[str, Any]:
return copy(self.metadata[key])

def add_metadata(self, data: dict[str, Any]):
self.metadata.update(data)

def __str__(self) -> str:
return (
f'"StreamPayload(header={self.header}, status={self.status}, '
Expand Down
6 changes: 5 additions & 1 deletion numalogic/udfs/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ def _load_artifact(
skeys,
dkeys,
)
if artifact.metadata and "artifact_versions" in artifact.metadata:
if (
artifact.metadata
and "artifact_versions" in artifact.metadata
and "artifact_versions" not in payload.metadata
):
payload = replace(
payload,
metadata={
Expand Down
1 change: 0 additions & 1 deletion tests/udfs/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class TestInferenceUDF(unittest.TestCase):
def setUp(self) -> None:
self.udf = InferenceUDF(REDIS_CLIENT)
self.udf.register_conf("conf1", StreamConf(config_id="conf1"))
print(self.udf.get_conf("conf1"))

@patch.object(
RedisRegistry,
Expand Down
6 changes: 2 additions & 4 deletions tests/udfs/test_postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ def test_postprocess_infer_model_stale(self):
data = deepcopy(DATA)
data["status"] = Status.ARTIFACT_STALE
data["header"] = Header.MODEL_INFERENCE
print(
self.registry.save(
KEYS, ["StdDevThreshold"], StdDevThreshold().fit(np.asarray([[0, 1], [1, 2]]))
)
self.registry.save(
KEYS, ["StdDevThreshold"], StdDevThreshold().fit(np.asarray([[0, 1], [1, 2]]))
)
msg = self.udf(KEYS, Datum(keys=KEYS, value=orjson.dumps(data), **DATUM_KW))
self.assertEqual(2, len(msg))
Expand Down

0 comments on commit 25ba2bc

Please sign in to comment.