Skip to content

Commit

Permalink
chore: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
niliayu committed Oct 22, 2024
1 parent b9d10f2 commit bd2c6d9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 32 deletions.
8 changes: 0 additions & 8 deletions python/lib/sift_py/ingestion/config/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, cast

from loguru import logger
from typing_extensions import Self

from sift_py.ingestion.channel import (
Expand Down Expand Up @@ -221,13 +220,6 @@ def _from_yaml(
}
)

if rule.get("asset_names") or rule.get("tag_names"):
logger.warning(
f"Rule '{rule['name']}' has an 'asset_names' or 'tag_names' field, which is not allowed when defining rules in a telemetry config."
"Please remove the 'asset_names' or 'tag_names' field from the rule, or create the rule outside of telemetry config."
"Proceeding, but the 'asset_names' and 'tag_names' fields will be ignored."
)

expression = rule.get("expression", "")
rule_client_key = rule.get("rule_client_key", "")
if isinstance(expression, str):
Expand Down
23 changes: 0 additions & 23 deletions python/lib/sift_py/ingestion/config/telemetry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import pytest
import yaml
from loguru import logger
from pytest_mock import MockerFixture, MockFixture

import sift_py.ingestion.config.telemetry
Expand All @@ -27,14 +26,6 @@
_mock_path = _mock_path_imp(sift_py.ingestion.config.telemetry)


@pytest.fixture
def caplog(caplog):
"""Needed to capture loguru logs per: https://github.com/Delgan/loguru/pull/572"""
handler_id = logger.add(caplog.handler, format="{message}")
yield caplog
logger.remove(handler_id)


def test_telemetry_config_load_from_yaml(mocker: MockFixture):
raw_yaml_config = cast(Dict[Any, Any], yaml.safe_load(TEST_YAML_CONFIG_STR))
yaml_config = _validate_yaml(raw_yaml_config)
Expand Down Expand Up @@ -316,20 +307,6 @@ def test_telemetry_config_validations_flows_with_same_name():
)


def test_telemetry_config_validations_not_allowed_fields(mocker: MockerFixture, caplog):
raw_yaml_config = cast(Dict[Any, Any], yaml.safe_load(NOT_ALLOWED_FIELDS_IN_TELEMETRY_CONFIG))
yaml_config = _validate_yaml(raw_yaml_config)

mock_read_and_validate = mocker.patch(_mock_path(read_and_validate))
mock_read_and_validate.return_value = yaml_config

TelemetryConfig.try_from_yaml(Path())
assert (
"Please remove the 'asset_names' or 'tag_names' field from the rule, or create the rule outside of telemetry config."
in caplog.text
)


TEST_YAML_CONFIG_STR = """
asset_name: LunarVehicle426
ingestion_client_key: lunar_vehicle_426
Expand Down
1 change: 0 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ keywords = [
dependencies = [
"grpcio~=1.64",
"npTDMS~=1.9",
"loguru~=0.7",
"PyYAML~=6.0",
"pandas~=2.0",
"protobuf~=5.26",
Expand Down

0 comments on commit bd2c6d9

Please sign in to comment.