Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Saravanan Balasubramanian <[email protected]>
  • Loading branch information
sarabala1979 committed Jul 29, 2023
1 parent 4f6d21c commit 50fcf44
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions numaprom/udf/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from numaprom.entities import PayloadFactory
from numaprom.entities import Status, StreamPayload, Header
from numaprom.tools import msg_forward
from numaprom.metrics import inc_redis_conn_success, inc_inference_count
from numaprom.metrics import inc_redis_conn_success, inc_inference_count, inc_redis_conn_failed
from numaprom.watcher import ConfigManager


Expand Down Expand Up @@ -89,7 +89,7 @@ def inference(_: list[str], datum: Datum) -> bytes:
)
payload.set_header(Header.STATIC_INFERENCE)
payload.set_status(Status.RUNTIME_ERROR)
inc_redis_conn_success(_VERTEX)
inc_redis_conn_failed(_VERTEX)
return orjson.dumps(payload, option=orjson.OPT_SERIALIZE_NUMPY)

inc_redis_conn_success(_VERTEX)
Expand Down
3 changes: 2 additions & 1 deletion numaprom/udf/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def _publish(final_score: float, payload: StreamPayload) -> list[bytes]:
unified_anomaly, anomalies = __save_to_redis(
payload=payload, final_score=final_score, recreate=True, unified_config=unified_config
)
inc_redis_conn_success(_VERTEX)
else:
inc_redis_conn_success(_VERTEX)

# If the unified anomaly is -1, we don't want to publish it
if unified_anomaly >= 0:
Expand Down
4 changes: 2 additions & 2 deletions numaprom/udf/threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def threshold(_: list[str], datum: Datum) -> list[tuple[str, bytes]]:
(TRAIN_VTX_KEY, orjson.dumps(train_payload)),
(POSTPROC_VTX_KEY, _get_static_thresh_payload(payload, metric_config)),
]

inc_redis_conn_success(_VERTEX)
else:
inc_redis_conn_success(_VERTEX)

if not thresh_artifact:
LOGGER.info(
Expand Down
4 changes: 2 additions & 2 deletions numaprom/udf/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def window(_: list[str], datum: Datum) -> bytes | None:
elements = __aggregate_window(
unique_key, msg["timestamp"], value, win_size, buff_size, recreate=True
)
inc_redis_conn_success(_VERTEX)
else:
inc_redis_conn_failed(_VERTEX)
else:
inc_redis_conn_success(_VERTEX)

# Drop message if no of elements is less than sequence length needed
if len(elements) < win_size:
Expand Down

0 comments on commit 50fcf44

Please sign in to comment.