cognite-neat 0.88.2__py3-none-any.whl → 0.89.0__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.
Potentially problematic release.
This version of cognite-neat might be problematic. Click here for more details.
- cognite/neat/_version.py +1 -1
- cognite/neat/constants.py +3 -0
- cognite/neat/graph/__init__.py +0 -3
- cognite/neat/graph/extractors/_mock_graph_generator.py +2 -1
- cognite/neat/graph/loaders/_base.py +3 -3
- cognite/neat/graph/loaders/_rdf2asset.py +24 -25
- cognite/neat/graph/loaders/_rdf2dms.py +20 -15
- cognite/neat/issues/__init__.py +1 -3
- cognite/neat/issues/_base.py +261 -71
- cognite/neat/issues/errors/__init__.py +73 -0
- cognite/neat/issues/errors/_external.py +67 -0
- cognite/neat/issues/errors/_general.py +35 -0
- cognite/neat/issues/errors/_properties.py +62 -0
- cognite/neat/issues/errors/_resources.py +111 -0
- cognite/neat/issues/errors/_workflow.py +36 -0
- cognite/neat/issues/formatters.py +1 -1
- cognite/neat/issues/warnings/__init__.py +66 -0
- cognite/neat/issues/warnings/_external.py +40 -0
- cognite/neat/issues/warnings/_general.py +29 -0
- cognite/neat/issues/warnings/_models.py +92 -0
- cognite/neat/issues/warnings/_properties.py +44 -0
- cognite/neat/issues/warnings/_resources.py +55 -0
- cognite/neat/issues/warnings/user_modeling.py +113 -0
- cognite/neat/rules/_shared.py +53 -2
- cognite/neat/rules/analysis/_base.py +1 -1
- cognite/neat/rules/exporters/_base.py +7 -18
- cognite/neat/rules/exporters/_rules2dms.py +17 -20
- cognite/neat/rules/exporters/_rules2excel.py +9 -16
- cognite/neat/rules/exporters/_rules2ontology.py +77 -64
- cognite/neat/rules/exporters/_rules2yaml.py +6 -9
- cognite/neat/rules/exporters/_validation.py +11 -96
- cognite/neat/rules/importers/_base.py +9 -58
- cognite/neat/rules/importers/_dms2rules.py +188 -135
- cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +48 -35
- cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +36 -45
- cognite/neat/rules/importers/_dtdl2rules/spec.py +7 -0
- cognite/neat/rules/importers/_rdf/_imf2rules/_imf2classes.py +8 -4
- cognite/neat/rules/importers/_rdf/_imf2rules/_imf2metadata.py +3 -3
- cognite/neat/rules/importers/_rdf/_imf2rules/_imf2properties.py +18 -11
- cognite/neat/rules/importers/_rdf/_imf2rules/_imf2rules.py +12 -19
- cognite/neat/rules/importers/_rdf/_inference2rules.py +14 -37
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2classes.py +1 -0
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2properties.py +1 -0
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +9 -20
- cognite/neat/rules/importers/_rdf/_shared.py +4 -4
- cognite/neat/rules/importers/_spreadsheet2rules.py +46 -97
- cognite/neat/rules/importers/_yaml2rules.py +32 -58
- cognite/neat/rules/models/__init__.py +21 -5
- cognite/neat/rules/models/_base_input.py +162 -0
- cognite/neat/rules/models/{_base.py → _base_rules.py} +1 -12
- cognite/neat/rules/models/_rdfpath.py +4 -4
- cognite/neat/rules/models/{_types/_field.py → _types.py} +5 -10
- cognite/neat/rules/models/asset/__init__.py +5 -2
- cognite/neat/rules/models/asset/_rules.py +3 -23
- cognite/neat/rules/models/asset/_rules_input.py +40 -115
- cognite/neat/rules/models/asset/_validation.py +14 -10
- cognite/neat/rules/models/data_types.py +150 -44
- cognite/neat/rules/models/dms/__init__.py +19 -7
- cognite/neat/rules/models/dms/_exporter.py +102 -34
- cognite/neat/rules/models/dms/_rules.py +65 -162
- cognite/neat/rules/models/dms/_rules_input.py +186 -254
- cognite/neat/rules/models/dms/_schema.py +87 -78
- cognite/neat/rules/models/dms/_serializer.py +44 -3
- cognite/neat/rules/models/dms/_validation.py +106 -68
- cognite/neat/rules/models/domain.py +52 -1
- cognite/neat/rules/models/entities/__init__.py +63 -0
- cognite/neat/rules/models/entities/_constants.py +73 -0
- cognite/neat/rules/models/entities/_loaders.py +76 -0
- cognite/neat/rules/models/entities/_multi_value.py +67 -0
- cognite/neat/rules/models/{entities.py → entities/_single_value.py} +74 -232
- cognite/neat/rules/models/entities/_types.py +86 -0
- cognite/neat/rules/models/{wrapped_entities.py → entities/_wrapped.py} +1 -1
- cognite/neat/rules/models/information/__init__.py +10 -2
- cognite/neat/rules/models/information/_rules.py +10 -22
- cognite/neat/rules/models/information/_rules_input.py +57 -204
- cognite/neat/rules/models/information/_validation.py +48 -25
- cognite/neat/rules/transformers/__init__.py +21 -0
- cognite/neat/rules/transformers/_base.py +81 -0
- cognite/neat/rules/{models/information/_converter.py → transformers/_converters.py} +217 -21
- cognite/neat/rules/transformers/_map_onto.py +97 -0
- cognite/neat/rules/transformers/_pipelines.py +61 -0
- cognite/neat/rules/transformers/_verification.py +136 -0
- cognite/neat/{graph/stores → store}/_provenance.py +10 -1
- cognite/neat/utils/auxiliary.py +2 -35
- cognite/neat/utils/cdf/data_classes.py +20 -0
- cognite/neat/utils/regex_patterns.py +6 -0
- cognite/neat/utils/text.py +17 -0
- cognite/neat/workflows/base.py +4 -4
- cognite/neat/workflows/cdf_store.py +3 -3
- cognite/neat/workflows/steps/data_contracts.py +1 -1
- cognite/neat/workflows/steps/lib/current/graph_extractor.py +3 -3
- cognite/neat/workflows/steps/lib/current/graph_loader.py +2 -2
- cognite/neat/workflows/steps/lib/current/graph_store.py +1 -1
- cognite/neat/workflows/steps/lib/current/rules_exporter.py +116 -47
- cognite/neat/workflows/steps/lib/current/rules_importer.py +30 -28
- cognite/neat/workflows/steps/lib/current/rules_validator.py +5 -6
- cognite/neat/workflows/steps/lib/io/io_steps.py +5 -5
- cognite/neat/workflows/steps_registry.py +4 -5
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.89.0.dist-info}/METADATA +1 -1
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.89.0.dist-info}/RECORD +105 -106
- cognite/neat/exceptions.py +0 -145
- cognite/neat/graph/exceptions.py +0 -90
- cognite/neat/issues/errors/external.py +0 -21
- cognite/neat/issues/errors/properties.py +0 -75
- cognite/neat/issues/errors/resources.py +0 -123
- cognite/neat/issues/errors/schema.py +0 -0
- cognite/neat/issues/neat_warnings/__init__.py +0 -2
- cognite/neat/issues/neat_warnings/identifier.py +0 -27
- cognite/neat/issues/neat_warnings/models.py +0 -22
- cognite/neat/issues/neat_warnings/properties.py +0 -77
- cognite/neat/issues/neat_warnings/resources.py +0 -125
- cognite/neat/rules/issues/__init__.py +0 -22
- cognite/neat/rules/issues/base.py +0 -63
- cognite/neat/rules/issues/dms.py +0 -549
- cognite/neat/rules/issues/fileread.py +0 -197
- cognite/neat/rules/issues/ontology.py +0 -298
- cognite/neat/rules/issues/spreadsheet.py +0 -563
- cognite/neat/rules/issues/spreadsheet_file.py +0 -151
- cognite/neat/rules/issues/tables.py +0 -72
- cognite/neat/rules/models/_constants.py +0 -1
- cognite/neat/rules/models/_types/__init__.py +0 -19
- cognite/neat/rules/models/asset/_converter.py +0 -4
- cognite/neat/rules/models/dms/_converter.py +0 -145
- cognite/neat/workflows/_exceptions.py +0 -41
- /cognite/neat/{graph/stores → store}/__init__.py +0 -0
- /cognite/neat/{graph/stores → store}/_base.py +0 -0
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.89.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.89.0.dist-info}/WHEEL +0 -0
- {cognite_neat-0.88.2.dist-info → cognite_neat-0.89.0.dist-info}/entry_points.txt +0 -0
|
@@ -5,11 +5,13 @@ from typing import ClassVar
|
|
|
5
5
|
from cognite.client import CogniteClient
|
|
6
6
|
from cognite.client.data_classes.data_modeling import DataModelId
|
|
7
7
|
|
|
8
|
+
from cognite.neat.issues.errors import WorkflowStepNotInitializedError
|
|
8
9
|
from cognite.neat.issues.formatters import FORMATTER_BY_NAME
|
|
9
10
|
from cognite.neat.rules import importers
|
|
11
|
+
from cognite.neat.rules._shared import InputRules
|
|
10
12
|
from cognite.neat.rules.models import RoleTypes
|
|
11
13
|
from cognite.neat.rules.models.entities import DataModelEntity, DMSUnknownEntity
|
|
12
|
-
from cognite.neat.
|
|
14
|
+
from cognite.neat.rules.transformers import ImporterPipeline
|
|
13
15
|
from cognite.neat.workflows.model import FlowMessage, StepExecutionStatus
|
|
14
16
|
from cognite.neat.workflows.steps.data_contracts import MultiRuleData
|
|
15
17
|
from cognite.neat.workflows.steps.step_model import Configurable, Step
|
|
@@ -55,7 +57,7 @@ class ExcelToRules(Step):
|
|
|
55
57
|
|
|
56
58
|
def run(self, flow_message: FlowMessage) -> (FlowMessage, MultiRuleData): # type: ignore[syntax, override]
|
|
57
59
|
if self.configs is None or self.data_store_path is None:
|
|
58
|
-
raise
|
|
60
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
59
61
|
|
|
60
62
|
file_name = self.configs.get("File name", None)
|
|
61
63
|
full_path = flow_message.payload.get("full_path", None) if flow_message.payload else None
|
|
@@ -70,17 +72,17 @@ class ExcelToRules(Step):
|
|
|
70
72
|
|
|
71
73
|
# if role is None, it will be inferred from the rules file
|
|
72
74
|
role = self.configs.get("Role")
|
|
73
|
-
role_enum = None
|
|
75
|
+
role_enum: RoleTypes | None = None
|
|
74
76
|
if role != "infer" and role is not None:
|
|
75
77
|
role_enum = RoleTypes[role]
|
|
76
78
|
|
|
77
|
-
excel_importer = importers.ExcelImporter(rules_file_path)
|
|
78
|
-
|
|
79
|
+
excel_importer = importers.ExcelImporter[InputRules](rules_file_path)
|
|
80
|
+
result = ImporterPipeline.try_verify(excel_importer, role_enum)
|
|
79
81
|
|
|
80
|
-
if rules is None:
|
|
82
|
+
if result.rules is None:
|
|
81
83
|
output_dir = self.config.staging_path
|
|
82
84
|
report_writer = FORMATTER_BY_NAME[self.configs["Report formatter"]]()
|
|
83
|
-
report_writer.write_to_file(issues, file_or_dir_path=output_dir)
|
|
85
|
+
report_writer.write_to_file(result.issues, file_or_dir_path=output_dir)
|
|
84
86
|
report_file = report_writer.default_file_name
|
|
85
87
|
error_text = (
|
|
86
88
|
"<p></p>"
|
|
@@ -91,7 +93,7 @@ class ExcelToRules(Step):
|
|
|
91
93
|
|
|
92
94
|
output_text = "Rules validation passed successfully!"
|
|
93
95
|
|
|
94
|
-
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(rules)
|
|
96
|
+
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(result.rules)
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
class OntologyToRules(Step):
|
|
@@ -124,7 +126,7 @@ class OntologyToRules(Step):
|
|
|
124
126
|
|
|
125
127
|
def run(self, flow_message: FlowMessage) -> (FlowMessage, MultiRuleData): # type: ignore[syntax, override]
|
|
126
128
|
if self.configs is None or self.data_store_path is None:
|
|
127
|
-
raise
|
|
129
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
128
130
|
|
|
129
131
|
file_name = self.configs.get("File name", None)
|
|
130
132
|
full_path = flow_message.payload.get("full_path", None) if flow_message.payload else None
|
|
@@ -144,12 +146,12 @@ class OntologyToRules(Step):
|
|
|
144
146
|
role_enum = RoleTypes[role]
|
|
145
147
|
|
|
146
148
|
ontology_importer = importers.OWLImporter(filepath=rules_file_path)
|
|
147
|
-
|
|
149
|
+
result = ImporterPipeline.try_verify(ontology_importer, role_enum)
|
|
148
150
|
|
|
149
|
-
if rules is None:
|
|
151
|
+
if result.rules is None:
|
|
150
152
|
output_dir = self.config.staging_path
|
|
151
153
|
report_writer = FORMATTER_BY_NAME[self.configs["Report formatter"]]()
|
|
152
|
-
report_writer.write_to_file(issues, file_or_dir_path=output_dir)
|
|
154
|
+
report_writer.write_to_file(result.issues, file_or_dir_path=output_dir)
|
|
153
155
|
report_file = report_writer.default_file_name
|
|
154
156
|
error_text = (
|
|
155
157
|
"<p></p>"
|
|
@@ -160,7 +162,7 @@ class OntologyToRules(Step):
|
|
|
160
162
|
|
|
161
163
|
output_text = "Rules validation passed successfully!"
|
|
162
164
|
|
|
163
|
-
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(rules)
|
|
165
|
+
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(result.rules)
|
|
164
166
|
|
|
165
167
|
|
|
166
168
|
class IMFToRules(Step):
|
|
@@ -193,7 +195,7 @@ class IMFToRules(Step):
|
|
|
193
195
|
|
|
194
196
|
def run(self, flow_message: FlowMessage) -> (FlowMessage, MultiRuleData): # type: ignore[syntax, override]
|
|
195
197
|
if self.configs is None or self.data_store_path is None:
|
|
196
|
-
raise
|
|
198
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
197
199
|
|
|
198
200
|
file_name = self.configs.get("File name", None)
|
|
199
201
|
|
|
@@ -215,12 +217,12 @@ class IMFToRules(Step):
|
|
|
215
217
|
role_enum = RoleTypes[role]
|
|
216
218
|
|
|
217
219
|
ontology_importer = importers.IMFImporter(filepath=rules_file_path)
|
|
218
|
-
|
|
220
|
+
result = ImporterPipeline.try_verify(ontology_importer, role_enum)
|
|
219
221
|
|
|
220
|
-
if rules is None:
|
|
222
|
+
if result.rules is None:
|
|
221
223
|
output_dir = self.config.staging_path
|
|
222
224
|
report_writer = FORMATTER_BY_NAME[self.configs["Report formatter"]]()
|
|
223
|
-
report_writer.write_to_file(issues, file_or_dir_path=output_dir)
|
|
225
|
+
report_writer.write_to_file(result.issues, file_or_dir_path=output_dir)
|
|
224
226
|
report_file = report_writer.default_file_name
|
|
225
227
|
error_text = (
|
|
226
228
|
"<p></p>"
|
|
@@ -231,7 +233,7 @@ class IMFToRules(Step):
|
|
|
231
233
|
|
|
232
234
|
output_text = "Rules validation passed successfully!"
|
|
233
235
|
|
|
234
|
-
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(rules)
|
|
236
|
+
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(result.rules)
|
|
235
237
|
|
|
236
238
|
|
|
237
239
|
class DMSToRules(Step):
|
|
@@ -271,7 +273,7 @@ class DMSToRules(Step):
|
|
|
271
273
|
|
|
272
274
|
def run(self, cdf_client: CogniteClient) -> (FlowMessage, MultiRuleData): # type: ignore[syntax, override]
|
|
273
275
|
if self.configs is None or self.data_store_path is None:
|
|
274
|
-
raise
|
|
276
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
275
277
|
|
|
276
278
|
datamodel_id_str = self.configs.get("Data model id")
|
|
277
279
|
if datamodel_id_str is None:
|
|
@@ -305,12 +307,12 @@ class DMSToRules(Step):
|
|
|
305
307
|
if role != "infer" and role is not None:
|
|
306
308
|
role_enum = RoleTypes[role]
|
|
307
309
|
|
|
308
|
-
|
|
310
|
+
result = ImporterPipeline.try_verify(dms_importer, role_enum)
|
|
309
311
|
|
|
310
|
-
if rules is None:
|
|
312
|
+
if result.rules is None:
|
|
311
313
|
output_dir = self.config.staging_path
|
|
312
314
|
report_writer = FORMATTER_BY_NAME[self.configs["Report formatter"]]()
|
|
313
|
-
report_writer.write_to_file(issues, file_or_dir_path=output_dir)
|
|
315
|
+
report_writer.write_to_file(result.issues, file_or_dir_path=output_dir)
|
|
314
316
|
report_file = report_writer.default_file_name
|
|
315
317
|
error_text = (
|
|
316
318
|
"<p></p>"
|
|
@@ -321,7 +323,7 @@ class DMSToRules(Step):
|
|
|
321
323
|
|
|
322
324
|
output_text = "Rules import and validation passed successfully!"
|
|
323
325
|
|
|
324
|
-
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(rules)
|
|
326
|
+
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(result.rules)
|
|
325
327
|
|
|
326
328
|
|
|
327
329
|
class RulesInferenceFromRdfFile(Step):
|
|
@@ -360,7 +362,7 @@ class RulesInferenceFromRdfFile(Step):
|
|
|
360
362
|
|
|
361
363
|
def run(self, flow_message: FlowMessage) -> (FlowMessage, MultiRuleData): # type: ignore[syntax, override]
|
|
362
364
|
if self.configs is None or self.data_store_path is None:
|
|
363
|
-
raise
|
|
365
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
364
366
|
|
|
365
367
|
file_path = self.configs.get("File path", None)
|
|
366
368
|
full_path = flow_message.payload.get("full_path", None) if flow_message.payload else None
|
|
@@ -388,12 +390,12 @@ class RulesInferenceFromRdfFile(Step):
|
|
|
388
390
|
inference_importer = importers.InferenceImporter.from_rdf_file(
|
|
389
391
|
rdf_file_path, max_number_of_instance=max_number_of_instance
|
|
390
392
|
)
|
|
391
|
-
|
|
393
|
+
result = ImporterPipeline.try_verify(inference_importer, role_enum)
|
|
392
394
|
|
|
393
|
-
if rules is None:
|
|
395
|
+
if result.rules is None:
|
|
394
396
|
output_dir = self.config.staging_path
|
|
395
397
|
report_writer = FORMATTER_BY_NAME[self.configs["Report formatter"]]()
|
|
396
|
-
report_writer.write_to_file(issues, file_or_dir_path=output_dir)
|
|
398
|
+
report_writer.write_to_file(result.issues, file_or_dir_path=output_dir)
|
|
397
399
|
report_file = report_writer.default_file_name
|
|
398
400
|
error_text = (
|
|
399
401
|
"<p></p>"
|
|
@@ -404,4 +406,4 @@ class RulesInferenceFromRdfFile(Step):
|
|
|
404
406
|
|
|
405
407
|
output_text = "Rules validation passed successfully!"
|
|
406
408
|
|
|
407
|
-
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(rules)
|
|
409
|
+
return FlowMessage(output_text=output_text), MultiRuleData.from_rules(result.rules)
|
|
@@ -6,11 +6,10 @@ from typing import ClassVar
|
|
|
6
6
|
from cognite.client import CogniteClient
|
|
7
7
|
|
|
8
8
|
from cognite.neat.issues import NeatIssueList
|
|
9
|
-
from cognite.neat.issues.errors
|
|
9
|
+
from cognite.neat.issues.errors import ResourceNotFoundError, WorkflowStepNotInitializedError
|
|
10
10
|
from cognite.neat.issues.formatters import FORMATTER_BY_NAME
|
|
11
11
|
from cognite.neat.rules.models import DMSRules, SchemaCompleteness
|
|
12
12
|
from cognite.neat.utils.cdf.loaders import ViewLoader
|
|
13
|
-
from cognite.neat.workflows._exceptions import StepNotInitialized
|
|
14
13
|
from cognite.neat.workflows.model import FlowMessage, StepExecutionStatus
|
|
15
14
|
from cognite.neat.workflows.steps.data_contracts import MultiRuleData
|
|
16
15
|
from cognite.neat.workflows.steps.step_model import Configurable, Step
|
|
@@ -42,7 +41,7 @@ class ValidateRulesAgainstCDF(Step):
|
|
|
42
41
|
|
|
43
42
|
def run(self, rules: MultiRuleData, cdf_client: CogniteClient) -> FlowMessage: # type: ignore[override, syntax]
|
|
44
43
|
if self.configs is None or self.data_store_path is None:
|
|
45
|
-
raise
|
|
44
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
46
45
|
|
|
47
46
|
if not isinstance(rules.dms, DMSRules):
|
|
48
47
|
return FlowMessage(
|
|
@@ -64,17 +63,17 @@ class ValidateRulesAgainstCDF(Step):
|
|
|
64
63
|
missing_spaces = [
|
|
65
64
|
error.identifier
|
|
66
65
|
for error in errors
|
|
67
|
-
if isinstance(error,
|
|
66
|
+
if isinstance(error, ResourceNotFoundError) and error.resource_type == "Space"
|
|
68
67
|
]
|
|
69
68
|
missing_views = [
|
|
70
69
|
error.identifier
|
|
71
70
|
for error in errors
|
|
72
|
-
if isinstance(error,
|
|
71
|
+
if isinstance(error, ResourceNotFoundError) and error.resource_type == "View"
|
|
73
72
|
]
|
|
74
73
|
missing_containers = [
|
|
75
74
|
error.identifier
|
|
76
75
|
for error in errors
|
|
77
|
-
if isinstance(error,
|
|
76
|
+
if isinstance(error, ResourceNotFoundError) and error.resource_type == "Container"
|
|
78
77
|
]
|
|
79
78
|
|
|
80
79
|
retrieved_spaces = cdf_client.data_modeling.spaces.retrieve(missing_spaces).as_write()
|
|
@@ -6,7 +6,7 @@ from typing import ClassVar
|
|
|
6
6
|
import requests
|
|
7
7
|
from cognite.client import CogniteClient
|
|
8
8
|
|
|
9
|
-
from cognite.neat.
|
|
9
|
+
from cognite.neat.issues.errors import WorkflowStepNotInitializedError
|
|
10
10
|
from cognite.neat.workflows.model import FlowMessage, StepExecutionStatus
|
|
11
11
|
from cognite.neat.workflows.steps.step_model import Configurable, Step
|
|
12
12
|
|
|
@@ -51,7 +51,7 @@ class DownloadFileFromGitHub(Step):
|
|
|
51
51
|
|
|
52
52
|
def run(self) -> FlowMessage: # type: ignore[override, syntax]
|
|
53
53
|
if self.configs is None or self.data_store_path is None:
|
|
54
|
-
raise
|
|
54
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
55
55
|
github_filepath = self.configs["github.filepath"]
|
|
56
56
|
github_personal_token = self.configs["github.personal_token"]
|
|
57
57
|
github_owner = self.configs["github.owner"]
|
|
@@ -136,7 +136,7 @@ class UploadFileToGitHub(Step):
|
|
|
136
136
|
|
|
137
137
|
def run(self) -> FlowMessage: # type: ignore[override, syntax]
|
|
138
138
|
if self.configs is None or self.data_store_path is None:
|
|
139
|
-
raise
|
|
139
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
140
140
|
github_filepath = self.configs["github.filepath"]
|
|
141
141
|
github_personal_token = self.configs["github.personal_token"]
|
|
142
142
|
github_owner = self.configs["github.owner"]
|
|
@@ -210,7 +210,7 @@ class DownloadFileFromCDF(Step):
|
|
|
210
210
|
|
|
211
211
|
def run(self, cdf_client: CogniteClient) -> FlowMessage: # type: ignore[override, syntax]
|
|
212
212
|
if self.configs is None or self.data_store_path is None:
|
|
213
|
-
raise
|
|
213
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
214
214
|
|
|
215
215
|
output_dir = self.data_store_path / Path(self.configs["local.storage_dir"])
|
|
216
216
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -244,7 +244,7 @@ class UploadFileToCDF(Step):
|
|
|
244
244
|
|
|
245
245
|
def run(self, cdf_client: CogniteClient) -> FlowMessage: # type: ignore[override, syntax]
|
|
246
246
|
if self.configs is None or self.data_store_path is None:
|
|
247
|
-
raise
|
|
247
|
+
raise WorkflowStepNotInitializedError(type(self).__name__)
|
|
248
248
|
full_local_file_path = (
|
|
249
249
|
self.data_store_path / Path(self.configs["local.storage_dir"]) / self.configs["local.file_name"]
|
|
250
250
|
)
|
|
@@ -14,8 +14,7 @@ import cognite.neat.workflows.steps.lib.current
|
|
|
14
14
|
import cognite.neat.workflows.steps.lib.io
|
|
15
15
|
from cognite.neat.app.monitoring.metrics import NeatMetricsCollector
|
|
16
16
|
from cognite.neat.config import Config
|
|
17
|
-
from cognite.neat.
|
|
18
|
-
from cognite.neat.workflows._exceptions import ConfigurationNotSet
|
|
17
|
+
from cognite.neat.issues.errors import WorkflowConfigurationNotSetError, WorkFlowMissingDataError
|
|
19
18
|
from cognite.neat.workflows.model import FlowMessage, WorkflowConfigs
|
|
20
19
|
from cognite.neat.workflows.steps.step_model import Configurable, DataContract, Step
|
|
21
20
|
|
|
@@ -71,7 +70,7 @@ class StepsRegistry:
|
|
|
71
70
|
|
|
72
71
|
def load_workflow_step_classes(self, workflow_name: str):
|
|
73
72
|
if not self.data_store_path:
|
|
74
|
-
raise
|
|
73
|
+
raise WorkflowConfigurationNotSetError("data_store_path")
|
|
75
74
|
workflow_steps_path = Path(self.data_store_path) / "workflows" / workflow_name
|
|
76
75
|
if workflow_steps_path.exists():
|
|
77
76
|
self.load_custom_step_classes(workflow_steps_path, scope="workflow")
|
|
@@ -164,9 +163,9 @@ class StepsRegistry:
|
|
|
164
163
|
missing_data.append(parameter.annotation.__name__)
|
|
165
164
|
continue
|
|
166
165
|
if not is_valid:
|
|
167
|
-
raise
|
|
166
|
+
raise WorkFlowMissingDataError(step_name, frozenset(missing_data))
|
|
168
167
|
return step_obj.run(*input_data)
|
|
169
|
-
raise
|
|
168
|
+
raise WorkFlowMissingDataError(step_name, frozenset({}))
|
|
170
169
|
|
|
171
170
|
def get_list_of_steps(self) -> list[StepMetadata]:
|
|
172
171
|
steps: list[StepMetadata] = []
|