From 7992c1c2dff31c702b1d2d7b4cbbb972522e30fb Mon Sep 17 00:00:00 2001 From: Mars Lan Date: Tue, 9 Jan 2024 05:08:24 -0800 Subject: [PATCH] Map MC's MISCONFIGURED status to UNKNOWN --- metaphor/monte_carlo/extractor.py | 2 +- pyproject.toml | 2 +- tests/monte_carlo/expected.json | 26 +++++++++++++++++++++++++- tests/monte_carlo/test_extractor.py | 20 ++++++++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/metaphor/monte_carlo/extractor.py b/metaphor/monte_carlo/extractor.py index b029702c..f893ce5c 100644 --- a/metaphor/monte_carlo/extractor.py +++ b/metaphor/monte_carlo/extractor.py @@ -43,7 +43,7 @@ "ERROR": DataMonitorStatus.ERROR, "IN_PROGRESS": DataMonitorStatus.UNKNOWN, "NO_STATUS": DataMonitorStatus.UNKNOWN, - "MISCONFIGURED": DataMonitorStatus.ERROR, + "MISCONFIGURED": DataMonitorStatus.UNKNOWN, "IN_TRAINING": DataMonitorStatus.UNKNOWN, } diff --git a/pyproject.toml b/pyproject.toml index 6b14a2e9..07c16690 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "metaphor-connectors" -version = "0.13.101" +version = "0.13.102" license = "Apache-2.0" description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app." authors = ["Metaphor "] diff --git a/tests/monte_carlo/expected.json b/tests/monte_carlo/expected.json index 7d291c68..b62aed55 100644 --- a/tests/monte_carlo/expected.json +++ b/tests/monte_carlo/expected.json @@ -7,7 +7,7 @@ "lastRun": "2023-06-23T03:54:35.817000+00:00", "owner": "yi@metaphor.io", "severity": "UNKNOWN", - "status": "ERROR", + "status": "UNKNOWN", "targets": [], "title": "auto_monitor_name_cd5b69bd-e465-4545-b3f9-a5d507ea766c", "url": "https://getmontecarlo.com/monitors/e0dc143e-dd8a-4cb9-b4cc-dedec715d955" @@ -53,5 +53,29 @@ "name": "db.metaphor.test2", "platform": "SNOWFLAKE" } + }, + { + "dataQuality": { + "monitors": [ + { + "description": "Field Health for all fields in db:metaphor.test3", + "lastRun": "2023-06-23T03:54:35.817000+00:00", + "owner": "yi@metaphor.io", + "severity": "UNKNOWN", + "status": "ERROR", + "targets": [], + "title": "auto_monitor_name_18637195-a3c4-416e-a3e2-a89cc10adbc8", + "url": "https://getmontecarlo.com/monitors/2c156c8d-ab4a-432f-b8bb-f9ea9f31ed3d" + } + ], + "provider": "MONTE_CARLO", + "url": "https://getmontecarlo.com/assets/MCON++6418a1e2-9718-4413-9d2b-6a354e01ddf8++a19e22b4-7659-4064-8fd4-8d6122fabe1c++table++db:metaphor.test3/custom-monitors" + }, + "id": "DATASET~EC9202BF4193DCE73F8EF04D5CAEAF75", + "logicalId": { + "account": "snow", + "name": "db.metaphor.test3", + "platform": "SNOWFLAKE" + } } ] diff --git a/tests/monte_carlo/test_extractor.py b/tests/monte_carlo/test_extractor.py index 355558ed..d21aab5e 100644 --- a/tests/monte_carlo/test_extractor.py +++ b/tests/monte_carlo/test_extractor.py @@ -37,6 +37,12 @@ async def test_extractor(mock_pycarlo_client: MagicMock, test_root_dir: str): "warehouse": {"connection_type": "SNOWFLAKE"}, } }, + { + "node": { + "mcon": "MCON++6418a1e2-9718-4413-9d2b-6a354e01ddf8++a19e22b4-7659-4064-8fd4-8d6122fabe1c++table++db:metaphor.test3", + "warehouse": {"connection_type": "SNOWFLAKE"}, + } + }, ], "page_info": { "end_corsor": "cursor", @@ -74,6 +80,20 @@ async def test_extractor(mock_pycarlo_client: MagicMock, test_root_dir: str): "creatorId": "yi@metaphor.io", "prevExecutionTime": "2023-06-23T03:54:35.817000+00:00", }, + { + "uuid": "2c156c8d-ab4a-432f-b8bb-f9ea9f31ed3d", + "name": "auto_monitor_name_18637195-a3c4-416e-a3e2-a89cc10adbc8", + "description": "Field Health for all fields in db:metaphor.test3", + "entities": ["db:metaphor.test3"], + "entityMcons": [ + "MCON++6418a1e2-9718-4413-9d2b-6a354e01ddf8++a19e22b4-7659-4064-8fd4-8d6122fabe1c++table++db:metaphor.test3" + ], + "severity": None, + "monitorStatus": "ERROR", + "monitorFields": None, + "creatorId": "yi@metaphor.io", + "prevExecutionTime": "2023-06-23T03:54:35.817000+00:00", + }, ] }, ]