cognite-toolkit 0.7.30__py3-none-any.whl → 0.7.51__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.
- cognite_toolkit/_cdf.py +5 -6
- cognite_toolkit/_cdf_tk/apps/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/apps/_core_app.py +7 -1
- cognite_toolkit/_cdf_tk/apps/_download_app.py +2 -2
- cognite_toolkit/_cdf_tk/apps/_dump_app.py +1 -1
- cognite_toolkit/_cdf_tk/apps/_import_app.py +41 -0
- cognite_toolkit/_cdf_tk/apps/_migrate_app.py +183 -8
- cognite_toolkit/_cdf_tk/builders/_function.py +81 -9
- cognite_toolkit/_cdf_tk/builders/_raw.py +1 -1
- cognite_toolkit/_cdf_tk/client/_resource_base.py +187 -0
- cognite_toolkit/_cdf_tk/client/_toolkit_client.py +44 -12
- cognite_toolkit/_cdf_tk/client/api/agents.py +107 -0
- cognite_toolkit/_cdf_tk/client/api/annotations.py +129 -0
- cognite_toolkit/_cdf_tk/client/api/assets.py +130 -0
- cognite_toolkit/_cdf_tk/client/api/containers.py +132 -0
- cognite_toolkit/_cdf_tk/client/api/data_models.py +137 -0
- cognite_toolkit/_cdf_tk/client/api/datasets.py +141 -0
- cognite_toolkit/_cdf_tk/client/api/events.py +129 -0
- cognite_toolkit/_cdf_tk/client/api/extraction_pipelines.py +148 -0
- cognite_toolkit/_cdf_tk/client/api/filemetadata.py +176 -0
- cognite_toolkit/_cdf_tk/client/api/function_schedules.py +115 -0
- cognite_toolkit/_cdf_tk/client/api/functions.py +113 -0
- cognite_toolkit/_cdf_tk/client/api/graphql_data_models.py +167 -0
- cognite_toolkit/_cdf_tk/client/api/groups.py +121 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_destinations.py +131 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_jobs.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_mappings.py +129 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_sources.py +136 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractors.py +23 -0
- cognite_toolkit/_cdf_tk/client/api/infield.py +40 -35
- cognite_toolkit/_cdf_tk/client/api/instances.py +139 -0
- cognite_toolkit/_cdf_tk/client/api/labels.py +125 -0
- cognite_toolkit/_cdf_tk/client/api/{canvas.py → legacy/canvas.py} +16 -8
- cognite_toolkit/_cdf_tk/client/api/{charts.py → legacy/charts.py} +1 -1
- cognite_toolkit/_cdf_tk/client/api/{extended_data_modeling.py → legacy/extended_data_modeling.py} +1 -1
- cognite_toolkit/_cdf_tk/client/api/{extended_files.py → legacy/extended_files.py} +2 -2
- cognite_toolkit/_cdf_tk/client/api/{extended_functions.py → legacy/extended_functions.py} +9 -9
- cognite_toolkit/_cdf_tk/client/api/{extended_raw.py → legacy/extended_raw.py} +1 -1
- cognite_toolkit/_cdf_tk/client/api/{extended_timeseries.py → legacy/extended_timeseries.py} +5 -2
- cognite_toolkit/_cdf_tk/client/api/legacy/location_filters.py +112 -0
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/__init__.py +8 -0
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/capabilities.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/data_postprocessing.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/frames.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/locations.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/maps.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/robots.py +2 -2
- cognite_toolkit/_cdf_tk/client/api/legacy/search_config.py +53 -0
- cognite_toolkit/_cdf_tk/client/api/location_filters.py +140 -75
- cognite_toolkit/_cdf_tk/client/api/migration.py +2 -3
- cognite_toolkit/_cdf_tk/client/api/project.py +9 -8
- cognite_toolkit/_cdf_tk/client/api/raw.py +204 -0
- cognite_toolkit/_cdf_tk/client/api/relationships.py +133 -0
- cognite_toolkit/_cdf_tk/client/api/robotics.py +19 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_capabilities.py +127 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_data_postprocessing.py +138 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_frames.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_locations.py +127 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_maps.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_robots.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/search.py +2 -2
- cognite_toolkit/_cdf_tk/client/api/search_config.py +83 -31
- cognite_toolkit/_cdf_tk/client/api/security_categories.py +94 -0
- cognite_toolkit/_cdf_tk/client/api/sequences.py +133 -0
- cognite_toolkit/_cdf_tk/client/api/simulator_models.py +154 -0
- cognite_toolkit/_cdf_tk/client/api/simulators.py +8 -0
- cognite_toolkit/_cdf_tk/client/api/spaces.py +117 -0
- cognite_toolkit/_cdf_tk/client/api/streams.py +68 -56
- cognite_toolkit/_cdf_tk/client/api/three_d.py +385 -34
- cognite_toolkit/_cdf_tk/client/api/timeseries.py +137 -0
- cognite_toolkit/_cdf_tk/client/api/token.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/transformations.py +146 -0
- cognite_toolkit/_cdf_tk/client/api/views.py +139 -0
- cognite_toolkit/_cdf_tk/client/api/workflow_triggers.py +128 -0
- cognite_toolkit/_cdf_tk/client/api/workflow_versions.py +138 -0
- cognite_toolkit/_cdf_tk/client/api/workflows.py +119 -0
- cognite_toolkit/_cdf_tk/client/cdf_client/__init__.py +10 -0
- cognite_toolkit/_cdf_tk/client/cdf_client/api.py +358 -0
- cognite_toolkit/_cdf_tk/client/cdf_client/responses.py +38 -0
- cognite_toolkit/_cdf_tk/{utils → client}/http_client/__init__.py +30 -0
- cognite_toolkit/_cdf_tk/{utils → client}/http_client/_client.py +26 -16
- cognite_toolkit/_cdf_tk/{utils → client}/http_client/_data_classes.py +18 -2
- cognite_toolkit/_cdf_tk/client/http_client/_data_classes2.py +151 -0
- cognite_toolkit/_cdf_tk/client/http_client/_exception.py +13 -0
- cognite_toolkit/_cdf_tk/client/http_client/_item_classes.py +118 -0
- cognite_toolkit/_cdf_tk/{utils → client}/http_client/_tracker.py +5 -2
- cognite_toolkit/_cdf_tk/client/request_classes/base.py +19 -0
- cognite_toolkit/_cdf_tk/client/request_classes/filters.py +113 -0
- cognite_toolkit/_cdf_tk/client/request_classes/graphql.py +28 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/__init__.py +0 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/agent.py +130 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/annotation.py +79 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/apm_config.py +128 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/asset.py +47 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/charts_data.py +1 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/cognite_file.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/__init__.py +168 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_constraints.py +37 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_container.py +50 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_model.py +73 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_types.py +116 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_indexes.py +26 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_instance.py +154 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_references.py +86 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_space.py +26 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view.py +143 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view_property.py +152 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/dataset.py +35 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/event.py +40 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/extraction_pipeline.py +59 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/filemetadata.py +52 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/function.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/function_schedule.py +65 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/graphql_data_model.py +40 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/__init__.py +187 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/_constants.py +2 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/acls.py +653 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/capability.py +56 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/group.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/scopes.py +166 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_destination.py +34 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_job.py +134 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_mapping.py +72 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/__init__.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_auth.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_base.py +26 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_certificate.py +20 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_eventhub.py +31 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_kafka.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_mqtt.py +36 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_rest.py +49 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py +59 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/infield.py +1 -1
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/instance_api.py +53 -14
- cognite_toolkit/_cdf_tk/client/resource_classes/label.py +27 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/legacy/__init__.py +0 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/canvas.py +48 -15
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/charts.py +1 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/location_filter.py +84 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/raw.py +44 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/relationship.py +49 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/resource_view_mapping.py +38 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/__init__.py +37 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_capability.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_common.py +34 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_data_post_processing.py +49 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_frame.py +46 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_location.py +36 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_map.py +65 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_robot.py +58 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/search_config.py +54 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/securitycategory.py +24 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/sequence.py +45 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/sequence_rows.py +56 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/simulator_model.py +50 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/streamlit_.py +71 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/streams.py +9 -26
- cognite_toolkit/_cdf_tk/client/resource_classes/three_d.py +135 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/timeseries.py +52 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/transformation.py +140 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/workflow.py +27 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/workflow_trigger.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/workflow_version.py +155 -0
- cognite_toolkit/_cdf_tk/client/testing.py +54 -17
- cognite_toolkit/_cdf_tk/commands/__init__.py +1 -0
- cognite_toolkit/_cdf_tk/commands/_migrate/command.py +103 -108
- cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +29 -16
- cognite_toolkit/_cdf_tk/commands/_migrate/creators.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py +38 -6
- cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +262 -36
- cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py +1 -0
- cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_migrate/issues.py +39 -38
- cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +227 -8
- cognite_toolkit/_cdf_tk/commands/_profile.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_purge.py +14 -16
- cognite_toolkit/_cdf_tk/commands/_upload.py +1 -1
- cognite_toolkit/_cdf_tk/commands/build_cmd.py +12 -2
- cognite_toolkit/_cdf_tk/commands/build_v2/__init__.py +0 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/_module_parser.py +138 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/_modules_parser.py +163 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/build_cmd.py +228 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/build_parameters.py +71 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_modules.py +27 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_resource.py +22 -0
- cognite_toolkit/_cdf_tk/commands/dump_resource.py +4 -4
- cognite_toolkit/_cdf_tk/commands/pull.py +97 -2
- cognite_toolkit/_cdf_tk/commands/run.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/__init__.py +16 -6
- cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +9 -5
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +6 -2
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py +70 -89
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/fieldops.py +34 -25
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py +50 -59
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/function.py +14 -2
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/industrial_tool.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/location.py +4 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/migration.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +6 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/relationship.py +5 -4
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/simulators.py +122 -0
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/streams.py +15 -31
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/timeseries.py +42 -47
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +49 -14
- cognite_toolkit/_cdf_tk/data_classes/__init__.py +3 -0
- cognite_toolkit/_cdf_tk/data_classes/_issues.py +36 -0
- cognite_toolkit/_cdf_tk/data_classes/_module_directories.py +2 -1
- cognite_toolkit/_cdf_tk/data_classes/_module_toml.py +1 -0
- cognite_toolkit/_cdf_tk/data_classes/_tracking_info.py +4 -0
- cognite_toolkit/_cdf_tk/feature_flags.py +8 -0
- cognite_toolkit/_cdf_tk/resource_classes/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/resource_classes/capabilities.py +6 -0
- cognite_toolkit/_cdf_tk/resource_classes/search_config.py +1 -1
- cognite_toolkit/_cdf_tk/resource_classes/simulator_model.py +17 -0
- cognite_toolkit/_cdf_tk/resource_classes/workflow_version.py +173 -5
- cognite_toolkit/_cdf_tk/storageio/_applications.py +53 -15
- cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +117 -107
- cognite_toolkit/_cdf_tk/storageio/_base.py +3 -1
- cognite_toolkit/_cdf_tk/storageio/_datapoints.py +7 -7
- cognite_toolkit/_cdf_tk/storageio/_file_content.py +65 -56
- cognite_toolkit/_cdf_tk/storageio/_instances.py +1 -1
- cognite_toolkit/_cdf_tk/storageio/_raw.py +1 -1
- cognite_toolkit/_cdf_tk/storageio/logger.py +162 -0
- cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py +10 -1
- cognite_toolkit/_cdf_tk/storageio/selectors/_three_d.py +34 -0
- cognite_toolkit/_cdf_tk/tk_warnings/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/tk_warnings/fileread.py +20 -0
- cognite_toolkit/_cdf_tk/utils/__init__.py +11 -1
- cognite_toolkit/_cdf_tk/utils/cdf.py +1 -1
- cognite_toolkit/_cdf_tk/utils/interactive_select.py +53 -4
- cognite_toolkit/_cdf_tk/utils/modules.py +7 -0
- cognite_toolkit/_cdf_tk/utils/pip_validator.py +96 -0
- cognite_toolkit/_cdf_tk/utils/useful_types.py +4 -7
- cognite_toolkit/_cdf_tk/utils/useful_types2.py +14 -0
- cognite_toolkit/_cdf_tk/validation.py +4 -0
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/METADATA +13 -3
- cognite_toolkit-0.7.51.dist-info/RECORD +445 -0
- {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/WHEEL +2 -2
- cognite_toolkit/_cdf_tk/client/api/robotics/__init__.py +0 -3
- cognite_toolkit/_cdf_tk/client/data_classes/api_classes.py +0 -17
- cognite_toolkit/_cdf_tk/client/data_classes/base.py +0 -87
- cognite_toolkit/_cdf_tk/client/data_classes/three_d.py +0 -47
- cognite_toolkit/_cdf_tk/prototypes/import_app.py +0 -41
- cognite_toolkit/_cdf_tk/utils/http_client/_data_classes2.py +0 -187
- cognite_toolkit/_cdf_tk/utils/http_client/_exception.py +0 -4
- cognite_toolkit-0.7.30.dist-info/RECORD +0 -316
- /cognite_toolkit/_cdf_tk/client/{data_classes → api/legacy}/__init__.py +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{dml.py → legacy/dml.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{fixed_transformations.py → legacy/fixed_transformations.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/api.py +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/utlis.py +0 -0
- /cognite_toolkit/_cdf_tk/{prototypes/commands → client/request_classes}/__init__.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/capabilities.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/apm_config_v1.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extendable_cognite_file.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_filemetadata.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_filemetdata.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_timeseries.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/functions.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/graphql_data_models.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/instances.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/location_filters.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/migration.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/pending_instances_ids.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/project.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/raw.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/robotics.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/search_config.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/sequences.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/streamlit_.py +0 -0
- /cognite_toolkit/_cdf_tk/{prototypes/commands/import_.py → commands/_import_cmd.py} +0 -0
- {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/entry_points.txt +0 -0
|
@@ -4,20 +4,19 @@ from typing import Any, final
|
|
|
4
4
|
from cognite.client.data_classes.capabilities import Capability, StreamsAcl
|
|
5
5
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
6
6
|
|
|
7
|
-
from cognite_toolkit._cdf_tk.client.
|
|
7
|
+
from cognite_toolkit._cdf_tk.client.resource_classes.identifiers import ExternalId
|
|
8
|
+
from cognite_toolkit._cdf_tk.client.resource_classes.streams import (
|
|
8
9
|
StreamRequest,
|
|
9
10
|
StreamResponse,
|
|
10
|
-
StreamResponseList,
|
|
11
11
|
)
|
|
12
12
|
from cognite_toolkit._cdf_tk.cruds._base_cruds import ResourceCRUD
|
|
13
13
|
from cognite_toolkit._cdf_tk.resource_classes import StreamYAML
|
|
14
|
-
from cognite_toolkit._cdf_tk.utils.http_client import ToolkitAPIError
|
|
15
14
|
|
|
16
15
|
from .datamodel import ContainerCRUD
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
@final
|
|
20
|
-
class StreamCRUD(ResourceCRUD[
|
|
19
|
+
class StreamCRUD(ResourceCRUD[ExternalId, StreamRequest, StreamResponse]):
|
|
21
20
|
folder_name = "streams"
|
|
22
21
|
resource_cls = StreamResponse
|
|
23
22
|
resource_write_cls = StreamRequest
|
|
@@ -32,14 +31,14 @@ class StreamCRUD(ResourceCRUD[str, StreamRequest, StreamResponse]):
|
|
|
32
31
|
return "streams"
|
|
33
32
|
|
|
34
33
|
@classmethod
|
|
35
|
-
def get_id(cls, item: StreamRequest | StreamResponse | dict) ->
|
|
34
|
+
def get_id(cls, item: StreamRequest | StreamResponse | dict) -> ExternalId:
|
|
36
35
|
if isinstance(item, dict):
|
|
37
|
-
return item["externalId"]
|
|
38
|
-
return item.external_id
|
|
36
|
+
return ExternalId(external_id=item["externalId"])
|
|
37
|
+
return ExternalId(external_id=item.external_id)
|
|
39
38
|
|
|
40
39
|
@classmethod
|
|
41
|
-
def dump_id(cls, id:
|
|
42
|
-
return
|
|
40
|
+
def dump_id(cls, id: ExternalId) -> dict[str, Any]:
|
|
41
|
+
return id.dump()
|
|
43
42
|
|
|
44
43
|
@classmethod
|
|
45
44
|
def get_required_capability(
|
|
@@ -55,30 +54,15 @@ class StreamCRUD(ResourceCRUD[str, StreamRequest, StreamResponse]):
|
|
|
55
54
|
)
|
|
56
55
|
return StreamsAcl(actions, StreamsAcl.Scope.All())
|
|
57
56
|
|
|
58
|
-
def create(self, items: Sequence[StreamRequest]) ->
|
|
59
|
-
|
|
60
|
-
return StreamResponseList(created)
|
|
57
|
+
def create(self, items: Sequence[StreamRequest]) -> list[StreamResponse]:
|
|
58
|
+
return self.client.streams.create(items)
|
|
61
59
|
|
|
62
|
-
def retrieve(self, ids: SequenceNotStr[
|
|
63
|
-
|
|
64
|
-
for _id in ids:
|
|
65
|
-
try:
|
|
66
|
-
_resp = self.client.streams.retrieve(_id)
|
|
67
|
-
except ToolkitAPIError:
|
|
68
|
-
continue
|
|
69
|
-
if _resp is not None:
|
|
70
|
-
retrieved.append(_resp)
|
|
71
|
-
return StreamResponseList(retrieved)
|
|
60
|
+
def retrieve(self, ids: SequenceNotStr[ExternalId]) -> list[StreamResponse]:
|
|
61
|
+
return self.client.streams.retrieve(list(ids), ignore_unknown_ids=True)
|
|
72
62
|
|
|
73
|
-
def delete(self, ids: SequenceNotStr[
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
try:
|
|
77
|
-
self.client.streams.delete(_id)
|
|
78
|
-
except ToolkitAPIError:
|
|
79
|
-
continue
|
|
80
|
-
count += 1
|
|
81
|
-
return count
|
|
63
|
+
def delete(self, ids: SequenceNotStr[ExternalId]) -> int:
|
|
64
|
+
self.client.streams.delete(list(ids), ignore_unknown_ids=True)
|
|
65
|
+
return len(ids)
|
|
82
66
|
|
|
83
67
|
def _iterate(
|
|
84
68
|
self,
|
|
@@ -2,16 +2,13 @@ import json
|
|
|
2
2
|
from collections.abc import Hashable, Iterable, Sequence
|
|
3
3
|
from itertools import zip_longest
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import Any, Literal,
|
|
5
|
+
from typing import Any, Literal, final
|
|
6
6
|
|
|
7
7
|
from cognite.client.data_classes import (
|
|
8
8
|
DatapointSubscription,
|
|
9
9
|
DatapointSubscriptionList,
|
|
10
10
|
DataPointSubscriptionUpdate,
|
|
11
11
|
DataPointSubscriptionWrite,
|
|
12
|
-
TimeSeries,
|
|
13
|
-
TimeSeriesList,
|
|
14
|
-
TimeSeriesWrite,
|
|
15
12
|
)
|
|
16
13
|
from cognite.client.data_classes.capabilities import (
|
|
17
14
|
Capability,
|
|
@@ -23,6 +20,9 @@ from cognite.client.data_classes.datapoints_subscriptions import TimeSeriesIDLis
|
|
|
23
20
|
from cognite.client.exceptions import CogniteAPIError, CogniteNotFoundError
|
|
24
21
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
25
22
|
|
|
23
|
+
from cognite_toolkit._cdf_tk.client.request_classes.filters import ClassicFilter
|
|
24
|
+
from cognite_toolkit._cdf_tk.client.resource_classes.identifiers import ExternalId, InternalOrExternalId
|
|
25
|
+
from cognite_toolkit._cdf_tk.client.resource_classes.timeseries import TimeSeriesRequest, TimeSeriesResponse
|
|
26
26
|
from cognite_toolkit._cdf_tk.constants import MAX_TIMESTAMP_MS, MIN_TIMESTAMP_MS
|
|
27
27
|
from cognite_toolkit._cdf_tk.cruds._base_cruds import ResourceContainerCRUD, ResourceCRUD
|
|
28
28
|
from cognite_toolkit._cdf_tk.exceptions import (
|
|
@@ -41,11 +41,11 @@ from .data_organization import DataSetsCRUD
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
@final
|
|
44
|
-
class TimeSeriesCRUD(ResourceContainerCRUD[
|
|
44
|
+
class TimeSeriesCRUD(ResourceContainerCRUD[ExternalId, TimeSeriesRequest, TimeSeriesResponse]):
|
|
45
45
|
item_name = "datapoints"
|
|
46
46
|
folder_name = "timeseries"
|
|
47
|
-
resource_cls =
|
|
48
|
-
resource_write_cls =
|
|
47
|
+
resource_cls = TimeSeriesResponse
|
|
48
|
+
resource_write_cls = TimeSeriesRequest
|
|
49
49
|
yaml_cls = TimeSeriesYAML
|
|
50
50
|
kind = "TimeSeries"
|
|
51
51
|
dependencies = frozenset({DataSetsCRUD, GroupAllScopedCRUD, AssetCRUD})
|
|
@@ -57,7 +57,7 @@ class TimeSeriesCRUD(ResourceContainerCRUD[str, TimeSeriesWrite, TimeSeries]):
|
|
|
57
57
|
|
|
58
58
|
@classmethod
|
|
59
59
|
def get_required_capability(
|
|
60
|
-
cls, items: Sequence[
|
|
60
|
+
cls, items: Sequence[TimeSeriesRequest] | None, read_only: bool
|
|
61
61
|
) -> Capability | list[Capability]:
|
|
62
62
|
if not items and items is not None:
|
|
63
63
|
return []
|
|
@@ -72,22 +72,22 @@ class TimeSeriesCRUD(ResourceContainerCRUD[str, TimeSeriesWrite, TimeSeries]):
|
|
|
72
72
|
return TimeSeriesAcl(actions, scope)
|
|
73
73
|
|
|
74
74
|
@classmethod
|
|
75
|
-
def get_id(cls, item:
|
|
75
|
+
def get_id(cls, item: TimeSeriesRequest | TimeSeriesResponse | dict) -> ExternalId:
|
|
76
76
|
if isinstance(item, dict):
|
|
77
|
-
return item["externalId"]
|
|
77
|
+
return ExternalId(external_id=item["externalId"])
|
|
78
78
|
if item.external_id is None:
|
|
79
79
|
raise ToolkitRequiredValueError("TimeSeries must have external_id set.")
|
|
80
|
-
return item.external_id
|
|
80
|
+
return ExternalId(external_id=item.external_id)
|
|
81
81
|
|
|
82
82
|
@classmethod
|
|
83
|
-
def get_internal_id(cls, item:
|
|
83
|
+
def get_internal_id(cls, item: TimeSeriesResponse | dict) -> int:
|
|
84
84
|
if isinstance(item, dict):
|
|
85
85
|
return item["id"]
|
|
86
86
|
return item.id
|
|
87
87
|
|
|
88
88
|
@classmethod
|
|
89
|
-
def dump_id(cls, id:
|
|
90
|
-
return
|
|
89
|
+
def dump_id(cls, id: ExternalId) -> dict[str, Any]:
|
|
90
|
+
return id.dump()
|
|
91
91
|
|
|
92
92
|
@classmethod
|
|
93
93
|
def get_dependent_items(cls, item: dict) -> Iterable[tuple[type[ResourceCRUD], Hashable]]:
|
|
@@ -97,9 +97,9 @@ class TimeSeriesCRUD(ResourceContainerCRUD[str, TimeSeriesWrite, TimeSeries]):
|
|
|
97
97
|
for security_category in item["securityCategoryNames"]:
|
|
98
98
|
yield SecurityCategoryCRUD, security_category
|
|
99
99
|
if "assetExternalId" in item:
|
|
100
|
-
yield AssetCRUD, item["assetExternalId"]
|
|
100
|
+
yield AssetCRUD, ExternalId(external_id=item["assetExternalId"])
|
|
101
101
|
|
|
102
|
-
def load_resource(self, resource: dict[str, Any], is_dry_run: bool = False) ->
|
|
102
|
+
def load_resource(self, resource: dict[str, Any], is_dry_run: bool = False) -> TimeSeriesRequest:
|
|
103
103
|
if ds_external_id := resource.pop("dataSetExternalId", None):
|
|
104
104
|
resource["dataSetId"] = self.client.lookup.data_sets.id(ds_external_id, is_dry_run)
|
|
105
105
|
if security_categories_names := resource.pop("securityCategoryNames", []):
|
|
@@ -108,10 +108,10 @@ class TimeSeriesCRUD(ResourceContainerCRUD[str, TimeSeriesWrite, TimeSeries]):
|
|
|
108
108
|
)
|
|
109
109
|
if asset_external_id := resource.pop("assetExternalId", None):
|
|
110
110
|
resource["assetId"] = self.client.lookup.assets.id(asset_external_id, is_dry_run)
|
|
111
|
-
return
|
|
111
|
+
return TimeSeriesRequest.model_validate(resource)
|
|
112
112
|
|
|
113
|
-
def dump_resource(self, resource:
|
|
114
|
-
dumped = resource.
|
|
113
|
+
def dump_resource(self, resource: TimeSeriesResponse, local: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
114
|
+
dumped = resource.as_request_resource().dump()
|
|
115
115
|
if data_set_id := dumped.pop("dataSetId", None):
|
|
116
116
|
dumped["dataSetExternalId"] = self.client.lookup.data_sets.external_id(data_set_id)
|
|
117
117
|
if security_categories := dumped.pop("securityCategories", []):
|
|
@@ -120,53 +120,48 @@ class TimeSeriesCRUD(ResourceContainerCRUD[str, TimeSeriesWrite, TimeSeries]):
|
|
|
120
120
|
dumped["assetExternalId"] = self.client.lookup.assets.external_id(asset_id)
|
|
121
121
|
return dumped
|
|
122
122
|
|
|
123
|
-
def create(self, items: Sequence[
|
|
124
|
-
return self.client.
|
|
123
|
+
def create(self, items: Sequence[TimeSeriesRequest]) -> list[TimeSeriesResponse]:
|
|
124
|
+
return self.client.tool.timeseries.create(items)
|
|
125
125
|
|
|
126
|
-
def retrieve(self, ids: SequenceNotStr[
|
|
127
|
-
|
|
128
|
-
return self.client.time_series.retrieve_multiple(
|
|
129
|
-
ids=internal_ids, external_ids=external_ids, ignore_unknown_ids=True
|
|
130
|
-
)
|
|
126
|
+
def retrieve(self, ids: SequenceNotStr[ExternalId]) -> list[TimeSeriesResponse]:
|
|
127
|
+
return self.client.tool.timeseries.retrieve(list(ids), ignore_unknown_ids=True)
|
|
131
128
|
|
|
132
|
-
def update(self, items: Sequence[
|
|
133
|
-
return self.client.
|
|
129
|
+
def update(self, items: Sequence[TimeSeriesRequest]) -> list[TimeSeriesResponse]:
|
|
130
|
+
return self.client.tool.timeseries.update(items, mode="replace")
|
|
134
131
|
|
|
135
|
-
def delete(self, ids: SequenceNotStr[
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return len(
|
|
132
|
+
def delete(self, ids: SequenceNotStr[InternalOrExternalId]) -> int:
|
|
133
|
+
if not ids:
|
|
134
|
+
return 0
|
|
135
|
+
self.client.tool.timeseries.delete(list(ids), ignore_unknown_ids=True)
|
|
136
|
+
return len(ids)
|
|
140
137
|
|
|
141
138
|
def _iterate(
|
|
142
139
|
self,
|
|
143
140
|
data_set_external_id: str | None = None,
|
|
144
141
|
space: str | None = None,
|
|
145
142
|
parent_ids: list[Hashable] | None = None,
|
|
146
|
-
) -> Iterable[
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
) -> Iterable[TimeSeriesResponse]:
|
|
144
|
+
filter_ = ClassicFilter.from_asset_subtree_and_data_sets(data_set_id=data_set_external_id)
|
|
145
|
+
for timeseries in self.client.tool.timeseries.iterate(filter=filter_, limit=None):
|
|
146
|
+
yield from timeseries
|
|
150
147
|
|
|
151
|
-
def count(self, ids:
|
|
148
|
+
def count(self, ids: SequenceNotStr[ExternalId]) -> int:
|
|
152
149
|
datapoints = self.client.time_series.data.retrieve(
|
|
153
|
-
external_id=
|
|
150
|
+
external_id=[id.external_id for id in ids],
|
|
154
151
|
start=MIN_TIMESTAMP_MS,
|
|
155
152
|
end=MAX_TIMESTAMP_MS + 1,
|
|
156
153
|
aggregates="count",
|
|
157
154
|
granularity="1000d",
|
|
158
155
|
ignore_unknown_ids=True,
|
|
159
156
|
)
|
|
160
|
-
return sum(sum(data.count or []) for data in datapoints)
|
|
157
|
+
return sum(sum(data.count or []) for data in datapoints)
|
|
161
158
|
|
|
162
|
-
def drop_data(self, ids: SequenceNotStr[
|
|
159
|
+
def drop_data(self, ids: SequenceNotStr[ExternalId]) -> int:
|
|
163
160
|
count = self.count(ids)
|
|
164
|
-
existing = self.client.
|
|
165
|
-
|
|
166
|
-
).as_external_ids()
|
|
167
|
-
for external_id in existing:
|
|
161
|
+
existing = self.client.tool.timeseries.retrieve(list(ids), ignore_unknown_ids=True)
|
|
162
|
+
for ts in existing:
|
|
168
163
|
self.client.time_series.data.delete_range(
|
|
169
|
-
external_id=external_id, start=MIN_TIMESTAMP_MS, end=MAX_TIMESTAMP_MS + 1
|
|
164
|
+
external_id=ts.external_id, start=MIN_TIMESTAMP_MS, end=MAX_TIMESTAMP_MS + 1
|
|
170
165
|
)
|
|
171
166
|
return count
|
|
172
167
|
|
|
@@ -219,7 +214,7 @@ class DatapointSubscriptionCRUD(
|
|
|
219
214
|
if "dataSetExternalId" in item:
|
|
220
215
|
yield DataSetsCRUD, item["dataSetExternalId"]
|
|
221
216
|
for timeseries_id in item.get("timeSeriesIds", []):
|
|
222
|
-
yield TimeSeriesCRUD, timeseries_id
|
|
217
|
+
yield TimeSeriesCRUD, ExternalId(external_id=timeseries_id)
|
|
223
218
|
|
|
224
219
|
@classmethod
|
|
225
220
|
def get_required_capability(
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
# limitations under the License.
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
import random
|
|
30
|
+
import time
|
|
29
31
|
import warnings
|
|
30
32
|
from collections import defaultdict
|
|
31
33
|
from collections.abc import Callable, Hashable, Iterable, Sequence
|
|
@@ -63,7 +65,7 @@ from rich import print
|
|
|
63
65
|
from rich.console import Console
|
|
64
66
|
|
|
65
67
|
from cognite_toolkit._cdf_tk.client import ToolkitClient
|
|
66
|
-
from cognite_toolkit._cdf_tk.client.
|
|
68
|
+
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.raw import RawDatabase, RawTable
|
|
67
69
|
from cognite_toolkit._cdf_tk.constants import BUILD_FOLDER_ENCODING
|
|
68
70
|
from cognite_toolkit._cdf_tk.cruds._base_cruds import ResourceCRUD
|
|
69
71
|
from cognite_toolkit._cdf_tk.exceptions import (
|
|
@@ -427,25 +429,58 @@ class TransformationCRUD(ResourceCRUD[str, TransformationWrite, Transformation])
|
|
|
427
429
|
raise error from e
|
|
428
430
|
raise e
|
|
429
431
|
except CogniteAPIError as e:
|
|
430
|
-
if "Failed to bind session using nonce
|
|
431
|
-
|
|
432
|
-
f"Failed to create {len(chunk)} transformations in a batch due to nonce binding error. "
|
|
433
|
-
"Trying to recover by creating them one by one."
|
|
434
|
-
).print_warning(console=self.console)
|
|
435
|
-
# Retry one by one
|
|
436
|
-
for item in chunk:
|
|
437
|
-
recovered = self._execute_in_batches(items=[item], api_call=api_call)
|
|
438
|
-
results.extend(recovered)
|
|
439
|
-
if self.console:
|
|
440
|
-
self.console.print(
|
|
441
|
-
f" [bold green]RECOVERED:[/] Successfully created {len(chunk)} transformations one by one."
|
|
442
|
-
)
|
|
432
|
+
if "Failed to bind session using nonce" in e.message and len(chunk) > 1:
|
|
433
|
+
results.extend(self._execute_one_by_one(chunk, api_call))
|
|
443
434
|
else:
|
|
444
435
|
raise
|
|
445
436
|
else:
|
|
446
437
|
results.extend(chunk_results)
|
|
447
438
|
return results
|
|
448
439
|
|
|
440
|
+
def _execute_one_by_one(
|
|
441
|
+
self,
|
|
442
|
+
chunk: Sequence[TransformationWrite],
|
|
443
|
+
api_call: Callable[[Sequence[TransformationWrite]], TransformationList],
|
|
444
|
+
) -> TransformationList:
|
|
445
|
+
MediumSeverityWarning(
|
|
446
|
+
f"Failed to create {len(chunk)} transformations in a batch due to nonce binding error. "
|
|
447
|
+
"Trying to recover by creating them one by one."
|
|
448
|
+
).print_warning(console=self.client.console)
|
|
449
|
+
# Retry one by one
|
|
450
|
+
failed_ids: list[str] = []
|
|
451
|
+
success_count = 0
|
|
452
|
+
delay = 0.3
|
|
453
|
+
self._sleep_with_jitter(delay, delay + 0.3)
|
|
454
|
+
results = TransformationList([])
|
|
455
|
+
for item in chunk:
|
|
456
|
+
try:
|
|
457
|
+
recovered = api_call([item])
|
|
458
|
+
except CogniteAPIError as e:
|
|
459
|
+
if "Failed to bind session using nonce" in e.message:
|
|
460
|
+
failed_ids.append(item.external_id or "<missing>")
|
|
461
|
+
self._sleep_with_jitter(delay, delay + 0.3)
|
|
462
|
+
else:
|
|
463
|
+
raise
|
|
464
|
+
else:
|
|
465
|
+
results.extend(recovered)
|
|
466
|
+
success_count += 1
|
|
467
|
+
message = f" [bold]RECOVERY COMPLETE:[/] Successfully created {success_count:,} transformations"
|
|
468
|
+
if failed_ids:
|
|
469
|
+
message += f", failed to create {len(failed_ids):,} transformations: {humanize_collection(failed_ids)}"
|
|
470
|
+
else:
|
|
471
|
+
message += "."
|
|
472
|
+
if failed_ids:
|
|
473
|
+
HighSeverityWarning(message).print_warning(include_timestamp=True, console=self.client.console)
|
|
474
|
+
else:
|
|
475
|
+
self.client.console.print(message)
|
|
476
|
+
return results
|
|
477
|
+
|
|
478
|
+
@staticmethod
|
|
479
|
+
def _sleep_with_jitter(base_delay: float, max_delay: float) -> None:
|
|
480
|
+
"""Sleeps for a random duration between base_delay and max_delay (inclusive)."""
|
|
481
|
+
sleep_time = random.uniform(base_delay, max_delay)
|
|
482
|
+
time.sleep(sleep_time)
|
|
483
|
+
|
|
449
484
|
def _update_nonce(self, items: Sequence[TransformationWrite]) -> None:
|
|
450
485
|
for item in items:
|
|
451
486
|
if not item.external_id:
|
|
@@ -29,6 +29,7 @@ from ._deploy_results import (
|
|
|
29
29
|
ResourceDeployResult,
|
|
30
30
|
UploadDeployResult,
|
|
31
31
|
)
|
|
32
|
+
from ._issues import Issue, IssueList
|
|
32
33
|
from ._module_directories import ModuleDirectories, ModuleLocation
|
|
33
34
|
from ._module_resources import ModuleResources
|
|
34
35
|
from ._packages import Package, Packages
|
|
@@ -56,6 +57,8 @@ __all__ = [
|
|
|
56
57
|
"DeployResults",
|
|
57
58
|
"Environment",
|
|
58
59
|
"InitConfigYAML",
|
|
60
|
+
"Issue",
|
|
61
|
+
"IssueList",
|
|
59
62
|
"ModuleDirectories",
|
|
60
63
|
"ModuleLocation",
|
|
61
64
|
"ModuleResources",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from collections import UserList
|
|
3
|
+
|
|
4
|
+
if sys.version_info >= (3, 11):
|
|
5
|
+
from typing import Self
|
|
6
|
+
else:
|
|
7
|
+
from typing_extensions import Self
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
from cognite_toolkit._cdf_tk.tk_warnings import ToolkitWarning, WarningList
|
|
12
|
+
|
|
13
|
+
MODULE_ISSUE_CODE = "MOD"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Issue(BaseModel):
|
|
17
|
+
"""Base class for all issues"""
|
|
18
|
+
|
|
19
|
+
code: str
|
|
20
|
+
message: str | None = Field(default=None)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# temporary adapter to manage existing warnings
|
|
24
|
+
class IssueList(UserList[Issue]):
|
|
25
|
+
"""List of build issues."""
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def from_warning_list(cls, warning_list: WarningList[ToolkitWarning]) -> Self:
|
|
29
|
+
"""Create a IssueList from a WarningList."""
|
|
30
|
+
return cls([Issue(code="WARN", message=warning.get_message()) for warning in warning_list])
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ModuleLoadingIssue(Issue):
|
|
34
|
+
"""Issue with the loading of a module folder."""
|
|
35
|
+
|
|
36
|
+
code: str = "MOD_001"
|
|
@@ -8,7 +8,8 @@ from pathlib import Path
|
|
|
8
8
|
from typing import Any, SupportsIndex, overload
|
|
9
9
|
|
|
10
10
|
from cognite_toolkit._cdf_tk.constants import INDEX_PATTERN
|
|
11
|
-
from cognite_toolkit._cdf_tk.utils import calculate_directory_hash
|
|
11
|
+
from cognite_toolkit._cdf_tk.utils.hashing import calculate_directory_hash
|
|
12
|
+
from cognite_toolkit._cdf_tk.utils.modules import iterate_modules, resource_folder_from_path
|
|
12
13
|
|
|
13
14
|
from ._module_toml import ModuleToml
|
|
14
15
|
|
|
@@ -32,6 +32,10 @@ class CommandTrackingInfo(BaseModel):
|
|
|
32
32
|
downloaded_library_ids: set[str] = Field(default_factory=set, alias="downloadedLibraryIds")
|
|
33
33
|
downloaded_package_ids: set[str] = Field(default_factory=set, alias="downloadedPackageIds")
|
|
34
34
|
downloaded_module_ids: set[str] = Field(default_factory=set, alias="downloadedModuleIds")
|
|
35
|
+
function_validation_count: int = Field(default=0, alias="functionValidationCount")
|
|
36
|
+
function_validation_failures: int = Field(default=0, alias="functionValidationFailures")
|
|
37
|
+
function_validation_credential_errors: int = Field(default=0, alias="functionValidationCredentialErrors")
|
|
38
|
+
function_validation_time_ms: int = Field(default=0, alias="functionValidationTimeMs")
|
|
35
39
|
|
|
36
40
|
def to_dict(self) -> dict[str, Any]:
|
|
37
41
|
"""Convert the tracking info to a dictionary for Mixpanel.
|
|
@@ -61,6 +61,14 @@ class Flags(Enum):
|
|
|
61
61
|
visible=True,
|
|
62
62
|
description="Enables extended upload to support uploading individual files",
|
|
63
63
|
)
|
|
64
|
+
SIMULATORS = FlagMetadata(
|
|
65
|
+
visible=True,
|
|
66
|
+
description="Enables the support for simulator model resources",
|
|
67
|
+
)
|
|
68
|
+
FUNCTION_REQUIREMENTS_VALIDATION = FlagMetadata(
|
|
69
|
+
visible=True,
|
|
70
|
+
description="Enables validation of function requirements.txt during build using pip dry-run",
|
|
71
|
+
)
|
|
64
72
|
|
|
65
73
|
def is_enabled(self) -> bool:
|
|
66
74
|
return FeatureFlag.is_enabled(self)
|
|
@@ -40,6 +40,7 @@ from .robotics import RobotCapabilityYAML, RobotDataPostProcessingYAML, RobotFra
|
|
|
40
40
|
from .search_config import SearchConfigYAML
|
|
41
41
|
from .securitycategories import SecurityCategoriesYAML
|
|
42
42
|
from .sequence import SequenceRowYAML, SequenceYAML
|
|
43
|
+
from .simulator_model import SimulatorModelYAML
|
|
43
44
|
from .space import SpaceYAML
|
|
44
45
|
from .streamlit_ import StreamlitYAML
|
|
45
46
|
from .streams import StreamYAML
|
|
@@ -94,6 +95,7 @@ __all__ = [
|
|
|
94
95
|
"SecurityCategoriesYAML",
|
|
95
96
|
"SequenceRowYAML",
|
|
96
97
|
"SequenceYAML",
|
|
98
|
+
"SimulatorModelYAML",
|
|
97
99
|
"SpaceYAML",
|
|
98
100
|
"StreamYAML",
|
|
99
101
|
"StreamlitYAML",
|
|
@@ -510,6 +510,12 @@ class LegacyGenericsAcl(Capability):
|
|
|
510
510
|
scope: AllScope
|
|
511
511
|
|
|
512
512
|
|
|
513
|
+
class SimulatorsAcl(Capability):
|
|
514
|
+
_capability_name = "simulatorsAcl"
|
|
515
|
+
actions: list[Literal["READ", "WRITE", "DELETE", "RUN", "MANAGE"]]
|
|
516
|
+
scope: AllScope | DataSetScope
|
|
517
|
+
|
|
518
|
+
|
|
513
519
|
class StreamsAcl(Capability):
|
|
514
520
|
_capability_name = "streamsAcl"
|
|
515
521
|
actions: list[Literal["READ", "CREATE", "DELETE"]]
|
|
@@ -2,7 +2,7 @@ from typing import ClassVar
|
|
|
2
2
|
|
|
3
3
|
from pydantic import Field
|
|
4
4
|
|
|
5
|
-
from cognite_toolkit._cdf_tk.client.
|
|
5
|
+
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.search_config import SearchConfigWrite
|
|
6
6
|
|
|
7
7
|
from .base import BaseModelResource, ToolkitResource
|
|
8
8
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
|
|
3
|
+
from .base import ToolkitResource
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SimulatorModelYAML(ToolkitResource):
|
|
7
|
+
"""Simulator model YAML resource class.
|
|
8
|
+
|
|
9
|
+
Based on: https://api-docs.cognite.com/20230101/tag/Simulator-Models/operation/create_simulator_model_simulators_models_post
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
external_id: str = Field(description="External ID of the simulator model.", min_length=1, max_length=255)
|
|
13
|
+
simulator_external_id: str = Field(description="External id of the simulator.", min_length=1, max_length=50)
|
|
14
|
+
name: str = Field(description="The name of the simulator model.", min_length=1, max_length=50)
|
|
15
|
+
description: str | None = Field(None, description="Description of the simulator model.", max_length=500)
|
|
16
|
+
data_set_external_id: str = Field(description="The external ID of the dataset this simulator model belongs to.")
|
|
17
|
+
type: str = Field(description="The type of the simulator model.", min_length=1, max_length=50)
|