cognite-toolkit 0.7.18__py3-none-any.whl → 0.7.20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -219,9 +219,16 @@ class UploadableAssetCentricIO(
219
219
  security_category_names.add(security_category_external_id)
220
220
  self.client.lookup.security_categories.id(list(security_category_names))
221
221
 
222
- def row_to_resource(
223
- self, source_id: str, row: dict[str, JsonVal], selector: AssetCentricSelector | None = None
224
- ) -> T_ResourceRequest:
222
+ def rows_to_data(
223
+ self, rows: list[tuple[str, dict[str, JsonVal]]], selector: AssetCentricSelector | None = None
224
+ ) -> Sequence[UploadItem[T_ResourceRequest]]:
225
+ # We need to populate caches for any external IDs used in the rows before converting to resources.
226
+ # Thus, we override this method instead of row_to_resource, and reuse the json_to_resource method that
227
+ # does the cache population.
228
+ return self.json_chunk_to_data([(source_id, self.row_to_json(row)) for source_id, row in rows])
229
+
230
+ @classmethod
231
+ def row_to_json(cls, row: dict[str, JsonVal]) -> dict[str, JsonVal]:
225
232
  metadata: dict[str, JsonVal] = {}
226
233
  cleaned_row: dict[str, JsonVal] = {}
227
234
  for key, value in row.items():
@@ -232,7 +239,14 @@ class UploadableAssetCentricIO(
232
239
  cleaned_row[key] = value
233
240
  if metadata:
234
241
  cleaned_row["metadata"] = metadata
235
- return self.json_to_resource(cleaned_row)
242
+ return cleaned_row
243
+
244
+ def row_to_resource(
245
+ self, source_id: str, row: dict[str, JsonVal], selector: AssetCentricSelector | None = None
246
+ ) -> T_ResourceRequest:
247
+ raise NotImplementedError(
248
+ f"This method should not be called. {type(self).__name__} overrides rows_to_data instead."
249
+ )
236
250
 
237
251
 
238
252
  class AssetIO(UploadableAssetCentricIO[Asset, AssetWrite]):
@@ -303,6 +317,9 @@ class AssetIO(UploadableAssetCentricIO[Asset, AssetWrite]):
303
317
  asset_subtree_external_ids=asset_subtree_external_ids,
304
318
  data_set_external_ids=data_set_external_ids,
305
319
  aggregated_properties=["child_count", "path", "depth"],
320
+ # We cannot use partitions here as it is not thread safe. This spawn multiple threads
321
+ # that are not shut down until all data is downloaded. We need to be able to abort.
322
+ partitions=None,
306
323
  ):
307
324
  self._collect_dependencies(asset_list, selector)
308
325
  yield Page(worker_id="main", items=asset_list)
@@ -423,6 +440,9 @@ class FileMetadataIO(AssetCentricIO[FileMetadata]):
423
440
  limit=limit,
424
441
  asset_subtree_external_ids=asset_subtree_external_ids,
425
442
  data_set_external_ids=data_set_external_ids,
443
+ # We cannot use partitions here as it is not thread safe. This spawn multiple threads
444
+ # that are not shut down until all data is downloaded. We need to be able to abort.
445
+ partitions=None,
426
446
  ):
427
447
  self._collect_dependencies(file_list, selector)
428
448
  yield Page(worker_id="main", items=file_list)
@@ -470,6 +490,9 @@ class TimeSeriesIO(UploadableAssetCentricIO[TimeSeries, TimeSeriesWrite]):
470
490
  limit=limit,
471
491
  asset_subtree_external_ids=asset_subtree_external_ids,
472
492
  data_set_external_ids=data_set_external_ids,
493
+ # We cannot use partitions here as it is not thread safe. This spawn multiple threads
494
+ # that are not shut down until all data is downloaded. We need to be able to abort.
495
+ partitions=None,
473
496
  ):
474
497
  self._collect_dependencies(ts_list, selector)
475
498
  yield Page(worker_id="main", items=ts_list)
@@ -597,6 +620,9 @@ class EventIO(UploadableAssetCentricIO[Event, EventWrite]):
597
620
  limit=limit,
598
621
  asset_subtree_external_ids=asset_subtree_external_ids,
599
622
  data_set_external_ids=data_set_external_ids,
623
+ # We cannot use partitions here as it is not thread safe. This spawn multiple threads
624
+ # that are not shut down until all data is downloaded. We need to be able to abort.
625
+ partitions=None,
600
626
  ):
601
627
  self._collect_dependencies(event_list, selector)
602
628
  yield Page(worker_id="main", items=event_list)
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.7.18
15
+ image: cognite/toolkit:0.7.20
16
16
  env:
17
17
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
18
18
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -10,7 +10,7 @@ jobs:
10
10
  environment: dev
11
11
  name: Deploy Dry Run
12
12
  container:
13
- image: cognite/toolkit:0.7.18
13
+ image: cognite/toolkit:0.7.20
14
14
  env:
15
15
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
16
16
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -4,7 +4,7 @@ default_env = "<DEFAULT_ENV_PLACEHOLDER>"
4
4
  [modules]
5
5
  # This is the version of the modules. It should not be changed manually.
6
6
  # It will be updated by the 'cdf modules upgrade' command.
7
- version = "0.7.18"
7
+ version = "0.7.20"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.18"
1
+ __version__ = "0.7.20"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.18
3
+ Version: 0.7.20
4
4
  Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
5
5
  Project-URL: Homepage, https://docs.cognite.com/cdf/deploy/cdf_toolkit/
6
6
  Project-URL: Changelog, https://github.com/cognitedata/toolkit/releases
@@ -1,6 +1,6 @@
1
1
  cognite_toolkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  cognite_toolkit/_cdf.py,sha256=sefGD2JQuOTBZhEqSj_ECbNZ7nTRN4AwGwX1pSUhoow,5636
3
- cognite_toolkit/_version.py,sha256=vVEAGXrQny527lFZaiZOphUeWZVJTDThg2Wd7GndISQ,23
3
+ cognite_toolkit/_version.py,sha256=k_NYgI0xLUB_dPJL4N6BdDmPFD0V9fwqtEqrNG-_EGQ,23
4
4
  cognite_toolkit/config.dev.yaml,sha256=M33FiIKdS3XKif-9vXniQ444GTZ-bLXV8aFH86u9iUQ,332
5
5
  cognite_toolkit/_cdf_tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  cognite_toolkit/_cdf_tk/cdf_toml.py,sha256=VSWV9h44HusWIaKpWgjrOMrc3hDoPTTXBXlp6-NOrIM,9079
@@ -245,7 +245,7 @@ cognite_toolkit/_cdf_tk/resource_classes/robotics/map.py,sha256=j77z7CzCMiMj8r94
245
245
  cognite_toolkit/_cdf_tk/storageio/__init__.py,sha256=h5Wr4i7zNIgsslrsRJxmp7ls4bNRKl0uZzQ7GLRMP7g,1920
246
246
  cognite_toolkit/_cdf_tk/storageio/_annotations.py,sha256=JI_g18_Y9S7pbc9gm6dZMyo3Z-bCndJXF9C2lOva0bQ,4848
247
247
  cognite_toolkit/_cdf_tk/storageio/_applications.py,sha256=VlTRHqp8jVu16SW7LtrN05BNYZHSPtJ_wf9EsBAAsvE,16419
248
- cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=GZZSQ8NLCP8tSQKOc8BUb2NCZAvw_BoCVcA1Og7vnIs,30821
248
+ cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=TirKLSNPoLqKjczsw0djWAsR0VvopwmU23aUxrBOJN8,32464
249
249
  cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=ElvqhIEBnhcz0yY1Ds164wVN0_7CFNK-uT0-z7LcR9U,13067
250
250
  cognite_toolkit/_cdf_tk/storageio/_data_classes.py,sha256=s3TH04BJ1q7rXndRhEbVMEnoOXjxrGg4n-w9Z5uUL-o,3480
251
251
  cognite_toolkit/_cdf_tk/storageio/_datapoints.py,sha256=xE1YgoP98-mJjIeF5536KwChzhVY90KYl-bW5sRVhFQ,20206
@@ -305,13 +305,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
305
305
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
306
306
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
307
307
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
308
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=Ym7FR_Mbrl1EC7wXQ6P_br2UYyfHk5Oq0pQF-gE_JxM,667
309
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=raQvE-Lx-wG7Yz6HMRhoz2mOUHMPI68tnwe-HAUxZ9g,2430
310
- cognite_toolkit/_resources/cdf.toml,sha256=OiQxNj_IPRUKEc-03_YlDLhOKGHNdF3PD6324l8rQeY,475
308
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=sVWo0P7uvKyz1D1mrYhdiRak7DOy0o8GxTNtAR3tNrg,667
309
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=nLRRf5K6lur4MsjQPl3wSLMTFb4vAf8MBeAmq8bFBok,2430
310
+ cognite_toolkit/_resources/cdf.toml,sha256=V0xczqShauGTujzM49gbP9aLYGTWf4SWo7ZDWDWkxEM,475
311
311
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
312
312
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
313
- cognite_toolkit-0.7.18.dist-info/METADATA,sha256=eTZI2zmt24BAaHrc_JaO35k1P0jmLZ5hte2Xz84CsiM,4501
314
- cognite_toolkit-0.7.18.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
315
- cognite_toolkit-0.7.18.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
316
- cognite_toolkit-0.7.18.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
317
- cognite_toolkit-0.7.18.dist-info/RECORD,,
313
+ cognite_toolkit-0.7.20.dist-info/METADATA,sha256=ouWrKIy9SwM_KVNSweTz9FxFNOmODdelIly77qGRhy0,4501
314
+ cognite_toolkit-0.7.20.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
315
+ cognite_toolkit-0.7.20.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
316
+ cognite_toolkit-0.7.20.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
317
+ cognite_toolkit-0.7.20.dist-info/RECORD,,