Cognite replicator fails to replicate asset data with inconsistent behaviour


Badge +6

The cognite replicator fails to replicate asset data and the behaviour is inconsistent. It worked yesterday and not working today. Note that all resource types like time series, events and datapoints are replicated consistently. I am getting below error while replicating the asset data.Please see attached screenshot for the successful run of the asset replication yesterday

Traceback (most recent call last):
  File "/Users/j.subhash.parandekar/oid-replicator/oid_replicator/cognite_replicate.py", line 84, in <module>
    assets.replicate(SOURCE_CLIENT, DEST_CLIENT, config=cognite_config,
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cognite/replicator/assets.py", line 324, in replicate
    src_dst_ids_assets = create_hierarchy(
                         ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cognite/replicator/assets.py", line 220, in create_hierarchy
    updated_assets = replication.retry(dst_client.assets.update, update_assets)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cognite/replicator/replication.py", line 319, in retry
    ret = function(objects, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cognite/client/_api/assets.py", line 538, in update
    return self._update_multiple(list_cls=AssetList, resource_cls=Asset, update_cls=AssetUpdate, items=item)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cognite/client/_api_client.py", line 758, in _update_multiple
    tasks_summary.raise_compound_exception_if_failed_tasks(
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cognite/client/utils/_concurrency.py", line 76, in raise_compound_exception_if_failed_tasks
    collect_exc_info_and_raise(
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cognite/client/utils/_concurrency.py", line 108, in collect_exc_info_and_raise
    raise CogniteAPIError(
cognite.client.exceptions.CogniteAPIError: Invalid field - items[0].update.datasetid.set - expected a long but got an array | code: 400 | X-Request-ID: ac067e7b-d8cc-9283-a7e6-62b9e6afe01c
The API Failed to process some items.
Successful (2xx): []
Unknown (5xx): []
Failed (4xx): [1144050463316077, 4148623287642920, 1882135436164531, 5911123499378600, 7955744232784247, 287345704458248, 8807221094166180, 8651200964674695, 3664493689926014, 801934130293075, 8798491450705490, 7932857675958193, 3615431934683459, 2084388875774393, 8677074594882041, 1315518904746919, 3932171455505042, 8266004921553812, 7815177322310592, 198361104075849, 5586165301800838, 186638044492327, 6261942585312728]

The code snippet is as per below

# Config

BATCH_SIZE = 2000 # this is the max size of a batch to be posted

NUM_THREADS = 10 # this is the max number of threads to be used

TIMEOUT = 3600 # 60 min

cognite_config = {

"dataset_support": True,

"client_timeout": TIMEOUT,

"client_name": "cognite-replicator",

"log_level": "DEBUG",

"delete_if_removed_in_source": True,

"delete_if_not_replicated": True,

"datapoints_start": "10d-ago",

"datapoints_end": "now",

}

assets.replicate(SOURCE_CLIENT, DEST_CLIENT, config=cognite_config,

subtree_max_depth=SUBTREE_LEVEL, subtree_external_ids=SUBTREE_EXTERNAL_ID)


2 replies

Userlevel 3
Badge

Thank you for the feedback, we will look into it and try to replicate the issue

Userlevel 3
Badge

Hi, we have a released a new version (1.2.4)

Let me know if you still have an issue or if that is fixed

Reply