Skip to content

Commit

Permalink
float argument must be a string or a number (#762)
Browse files Browse the repository at this point in the history
* Use saft_float to parse

* Bump version

* Add tests
  • Loading branch information
elic-eon authored Jan 23, 2024
1 parent b630645 commit 1ccaa9c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions metaphor/azure_data_factory/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
)
from metaphor.common.event_util import ENTITY_TYPES
from metaphor.common.logger import get_logger, json_dump_to_debug_file
from metaphor.common.utils import unique_list
from metaphor.common.utils import safe_float, unique_list
from metaphor.models.crawler_run_metadata import Platform
from metaphor.models.metadata_change_event import (
ActivityDependency,
Expand Down Expand Up @@ -539,7 +539,7 @@ def _extract_pipeline_metadata(
pipeline_name, df_client, factory
)
if last_pipeline_run:
last_duration_in_ms = float(last_pipeline_run.duration_in_ms) # type: ignore
last_duration_in_ms = safe_float(last_pipeline_run.duration_in_ms) # type: ignore
invoked_by: DfModels.PipelineRunInvokedBy = last_pipeline_run.invoked_by # type: ignore
last_invoke_type = invoked_by.invoked_by_type
last_run_message = last_pipeline_run.message
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metaphor-connectors"
version = "0.13.109"
version = "0.13.110"
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 <[email protected]>"]
Expand Down
17 changes: 16 additions & 1 deletion tests/azure_data_factory/test_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,22 @@ def mock_list_pipelines(factory_name, resource_group_name):
mock_client.pipelines.list_by_factory.side_effect = mock_list_pipelines

def mock_get_pipeline_runs(factory_name, resource_group_name, filter_parameters):
return DfModels.PipelineRunsQueryResponse(value=[])
return DfModels.PipelineRunsQueryResponse(
value=[
DfModels.PipelineRun.deserialize(
{
"runId": "run-id",
"runGroupId": "run-group-id",
"isLatest": True,
"pipelineName": "pipeline-1",
"invokedBy": {
"name": "foo",
"id": "[email protected]",
},
}
)
]
)

mock_client.pipeline_runs.query_by_factory.side_effect = mock_get_pipeline_runs
mock_client.pipeline_runs._serialize.body.side_effect = lambda _1, _2: {
Expand Down

0 comments on commit 1ccaa9c

Please sign in to comment.