Skip to content

Commit

Permalink
Replace EitherIdConfig with EitherId
Browse files Browse the repository at this point in the history
  • Loading branch information
asahaf committed Dec 12, 2023
1 parent e198742 commit dfe403f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cognite/extractorutils/configtools/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class _CogniteMetricsConfig:
external_id_prefix: str
asset_name: Optional[str]
asset_external_id: Optional[str]
data_set: Optional[EitherIdConfig]
data_set: Optional[EitherId]

push_interval: TimeIntervalConfig = TimeIntervalConfig("30s")

Expand Down
8 changes: 5 additions & 3 deletions cognite/extractorutils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self):
from cognite.client import CogniteClient
from cognite.client.data_classes import Asset, Datapoints, DatapointsArray, TimeSeries
from cognite.client.exceptions import CogniteDuplicatedError
from cognite.extractorutils.configtools.elements import EitherIdConfig
from cognite.extractorutils.util import EitherId

from .util import ensure_time_series

Expand Down Expand Up @@ -342,7 +342,7 @@ def __init__(
external_id_prefix: str,
push_interval: int,
asset: Optional[Asset] = None,
data_set: Optional[EitherIdConfig] = None,
data_set: Optional[EitherId] = None,
thread_name: Optional[str] = None,
cancellation_token: Event = Event(),
):
Expand Down Expand Up @@ -378,7 +378,9 @@ def _init_cdf(self) -> None:

data_set_id = None
if self.data_set:
dataset = self.cdf_client.data_sets.retrieve(id=self.data_set.id, external_id=self.data_set.external_id)
dataset = self.cdf_client.data_sets.retrieve(
id=self.data_set.internal_id, external_id=self.data_set.external_id
)
if dataset:
data_set_id = dataset.id

Expand Down
4 changes: 2 additions & 2 deletions schema/metrics_config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"default": 30
},
"data-set": {
"description": "Data set the metrics timeseries created under",
"$ref": "either_id.schema.json"
"type": "string",
"description": "Data set the metrics timeseries created under"
}
}
},
Expand Down

0 comments on commit dfe403f

Please sign in to comment.