cognite-neat 0.103.1__py3-none-any.whl → 0.105.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/_client/_api/data_modeling_loaders.py +83 -23
- cognite/neat/_client/_api/schema.py +2 -1
- cognite/neat/_client/data_classes/neat_sequence.py +261 -0
- cognite/neat/_client/data_classes/schema.py +5 -1
- cognite/neat/_client/testing.py +33 -0
- cognite/neat/_constants.py +56 -0
- cognite/neat/_graph/extractors/_classic_cdf/_base.py +6 -5
- cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +225 -11
- cognite/neat/_graph/extractors/_mock_graph_generator.py +2 -2
- cognite/neat/_graph/loaders/_rdf2dms.py +13 -2
- cognite/neat/_graph/transformers/__init__.py +3 -1
- cognite/neat/_graph/transformers/_base.py +109 -1
- cognite/neat/_graph/transformers/_classic_cdf.py +6 -1
- cognite/neat/_graph/transformers/_prune_graph.py +103 -47
- cognite/neat/_graph/transformers/_rdfpath.py +41 -17
- cognite/neat/_graph/transformers/_value_type.py +188 -151
- cognite/neat/_issues/__init__.py +0 -2
- cognite/neat/_issues/_base.py +54 -43
- cognite/neat/_issues/warnings/__init__.py +4 -1
- cognite/neat/_issues/warnings/_general.py +7 -0
- cognite/neat/_issues/warnings/_resources.py +12 -1
- cognite/neat/_rules/_shared.py +18 -34
- cognite/neat/_rules/exporters/_base.py +28 -2
- cognite/neat/_rules/exporters/_rules2dms.py +39 -1
- cognite/neat/_rules/exporters/_rules2excel.py +13 -2
- cognite/neat/_rules/exporters/_rules2instance_template.py +4 -0
- cognite/neat/_rules/exporters/_rules2ontology.py +13 -1
- cognite/neat/_rules/exporters/_rules2yaml.py +4 -0
- cognite/neat/_rules/importers/_base.py +9 -0
- cognite/neat/_rules/importers/_dms2rules.py +80 -57
- cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +5 -2
- cognite/neat/_rules/importers/_rdf/_base.py +10 -8
- cognite/neat/_rules/importers/_rdf/_imf2rules.py +4 -0
- cognite/neat/_rules/importers/_rdf/_inference2rules.py +7 -0
- cognite/neat/_rules/importers/_rdf/_owl2rules.py +4 -0
- cognite/neat/_rules/importers/_spreadsheet2rules.py +17 -8
- cognite/neat/_rules/importers/_yaml2rules.py +21 -7
- cognite/neat/_rules/models/_base_input.py +1 -1
- cognite/neat/_rules/models/_base_rules.py +9 -1
- cognite/neat/_rules/models/dms/_rules.py +4 -0
- cognite/neat/_rules/models/dms/_rules_input.py +9 -0
- cognite/neat/_rules/models/entities/_wrapped.py +10 -5
- cognite/neat/_rules/models/information/_rules.py +4 -0
- cognite/neat/_rules/models/information/_rules_input.py +9 -0
- cognite/neat/_rules/models/mapping/_classic2core.py +2 -5
- cognite/neat/_rules/models/mapping/_classic2core.yaml +239 -38
- cognite/neat/_rules/transformers/__init__.py +13 -6
- cognite/neat/_rules/transformers/_base.py +41 -65
- cognite/neat/_rules/transformers/_converters.py +404 -234
- cognite/neat/_rules/transformers/_mapping.py +93 -72
- cognite/neat/_rules/transformers/_verification.py +50 -38
- cognite/neat/_session/_base.py +32 -121
- cognite/neat/_session/_inspect.py +5 -3
- cognite/neat/_session/_mapping.py +17 -105
- cognite/neat/_session/_prepare.py +138 -268
- cognite/neat/_session/_read.py +39 -195
- cognite/neat/_session/_set.py +6 -30
- cognite/neat/_session/_show.py +40 -21
- cognite/neat/_session/_state.py +49 -107
- cognite/neat/_session/_to.py +44 -33
- cognite/neat/_shared.py +23 -2
- cognite/neat/_store/_provenance.py +3 -82
- cognite/neat/_store/_rules_store.py +368 -10
- cognite/neat/_store/exceptions.py +23 -0
- cognite/neat/_utils/graph_transformations_report.py +36 -0
- cognite/neat/_utils/rdf_.py +8 -0
- cognite/neat/_utils/reader/_base.py +27 -0
- cognite/neat/_utils/spreadsheet.py +5 -4
- cognite/neat/_version.py +1 -1
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/METADATA +3 -2
- cognite_neat-0.105.0.dist-info/RECORD +179 -0
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/WHEEL +1 -1
- cognite/neat/_app/api/__init__.py +0 -0
- cognite/neat/_app/api/asgi/metrics.py +0 -4
- cognite/neat/_app/api/configuration.py +0 -98
- cognite/neat/_app/api/context_manager/__init__.py +0 -3
- cognite/neat/_app/api/context_manager/manager.py +0 -16
- cognite/neat/_app/api/data_classes/__init__.py +0 -0
- cognite/neat/_app/api/data_classes/rest.py +0 -59
- cognite/neat/_app/api/explorer.py +0 -66
- cognite/neat/_app/api/routers/configuration.py +0 -25
- cognite/neat/_app/api/routers/crud.py +0 -102
- cognite/neat/_app/api/routers/metrics.py +0 -10
- cognite/neat/_app/api/routers/workflows.py +0 -224
- cognite/neat/_app/api/utils/__init__.py +0 -0
- cognite/neat/_app/api/utils/data_mapping.py +0 -17
- cognite/neat/_app/api/utils/logging.py +0 -26
- cognite/neat/_app/api/utils/query_templates.py +0 -92
- cognite/neat/_app/main.py +0 -17
- cognite/neat/_app/monitoring/__init__.py +0 -0
- cognite/neat/_app/monitoring/metrics.py +0 -69
- cognite/neat/_app/ui/index.html +0 -1
- cognite/neat/_app/ui/neat-app/.gitignore +0 -23
- cognite/neat/_app/ui/neat-app/README.md +0 -70
- cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -14
- cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -116
- cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -112
- cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -34
- cognite/neat/_app/ui/neat-app/build/index.html +0 -1
- cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/build/manifest.json +0 -25
- cognite/neat/_app/ui/neat-app/build/robots.txt +0 -3
- cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -2
- cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -1
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -3
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -88
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -1
- cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
- cognite/neat/_app/ui/neat-app/package-lock.json +0 -18306
- cognite/neat/_app/ui/neat-app/package.json +0 -62
- cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -116
- cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -112
- cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -34
- cognite/neat/_app/ui/neat-app/public/index.html +0 -43
- cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/public/manifest.json +0 -25
- cognite/neat/_app/ui/neat-app/public/robots.txt +0 -3
- cognite/neat/_app/ui/neat-app/src/App.css +0 -38
- cognite/neat/_app/ui/neat-app/src/App.js +0 -17
- cognite/neat/_app/ui/neat-app/src/App.test.js +0 -8
- cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -70
- cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -43
- cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -124
- cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -63
- cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -511
- cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -36
- cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -56
- cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -60
- cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -112
- cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -67
- cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -79
- cognite/neat/_app/ui/neat-app/src/index.css +0 -13
- cognite/neat/_app/ui/neat-app/src/index.js +0 -13
- cognite/neat/_app/ui/neat-app/src/logo.svg +0 -1
- cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -13
- cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -5
- cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -388
- cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -61
- cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -184
- cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -180
- cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -570
- cognite/neat/_app/ui/neat-app/tsconfig.json +0 -27
- cognite/neat/_rules/transformers/_pipelines.py +0 -70
- cognite/neat/_workflows/__init__.py +0 -17
- cognite/neat/_workflows/base.py +0 -590
- cognite/neat/_workflows/cdf_store.py +0 -393
- cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -89
- cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -66
- cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -65
- cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -67
- cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
- cognite/neat/_workflows/manager.py +0 -292
- cognite/neat/_workflows/model.py +0 -203
- cognite/neat/_workflows/steps/__init__.py +0 -0
- cognite/neat/_workflows/steps/data_contracts.py +0 -109
- cognite/neat/_workflows/steps/lib/__init__.py +0 -0
- cognite/neat/_workflows/steps/lib/current/__init__.py +0 -6
- cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -100
- cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -51
- cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -48
- cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -537
- cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -398
- cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -106
- cognite/neat/_workflows/steps/lib/io/__init__.py +0 -1
- cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -393
- cognite/neat/_workflows/steps/step_model.py +0 -79
- cognite/neat/_workflows/steps_registry.py +0 -218
- cognite/neat/_workflows/tasks.py +0 -18
- cognite/neat/_workflows/triggers.py +0 -169
- cognite/neat/_workflows/utils.py +0 -19
- cognite_neat-0.103.1.dist-info/RECORD +0 -275
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,570 +0,0 @@
|
|
|
1
|
-
import { useCallback, useRef } from 'react';
|
|
2
|
-
import ReactFlow, {
|
|
3
|
-
MiniMap,
|
|
4
|
-
Controls,
|
|
5
|
-
Background,
|
|
6
|
-
useNodesState,
|
|
7
|
-
useEdgesState,
|
|
8
|
-
addEdge,
|
|
9
|
-
Node,
|
|
10
|
-
updateEdge,
|
|
11
|
-
Panel,
|
|
12
|
-
NodeChange,
|
|
13
|
-
EdgeChange,
|
|
14
|
-
} from 'reactflow';
|
|
15
|
-
// 👇 you need to import the reactflow styles
|
|
16
|
-
|
|
17
|
-
import LinearProgress from '@mui/material/LinearProgress';
|
|
18
|
-
import { Typography } from '@mui/material';
|
|
19
|
-
import Stack from '@mui/material/Stack';
|
|
20
|
-
import { styled } from '@mui/material/styles';
|
|
21
|
-
import Paper from '@mui/material/Paper';
|
|
22
|
-
import FormControl from '@mui/material/FormControl';
|
|
23
|
-
import InputLabel from '@mui/material/InputLabel';
|
|
24
|
-
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
|
25
|
-
import { Box } from '@mui/system';
|
|
26
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import 'reactflow/dist/style.css';
|
|
30
|
-
import Button from '@mui/material/Button';
|
|
31
|
-
import { useState, useEffect } from 'react';
|
|
32
|
-
|
|
33
|
-
import { StepRegistry, UIConfig, WorkflowDefinition, WorkflowStepDefinition, WorkflowSystemComponent} from 'types/WorkflowTypes';
|
|
34
|
-
import { getNeatApiRootUrl, getSelectedWorkflowName, setSelectedWorkflowName } from 'components/Utils';
|
|
35
|
-
import WorkflowExecutionReport from 'components/WorkflowExecutionReport';
|
|
36
|
-
import ConfigView from './ConfigView';
|
|
37
|
-
import OverviewComponentEditorDialog from 'components/OverviewComponentEditorDialog';
|
|
38
|
-
import StepEditorDialog from 'components/StepEditorDialog';
|
|
39
|
-
import WorkflowMetadataDialog from 'components/WorkflowMetadataDialog';
|
|
40
|
-
import WorkflowDeleteDialog from 'components/WorkflowDeleteDialog';
|
|
41
|
-
import WorkflowImportExportDialog from 'components/WorkflowImportExportDialog';
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export interface ExecutionLog {
|
|
45
|
-
id: string;
|
|
46
|
-
label: string;
|
|
47
|
-
state: string;
|
|
48
|
-
elapsed_time: number;
|
|
49
|
-
timestamp: string;
|
|
50
|
-
error: string;
|
|
51
|
-
output_text: string;
|
|
52
|
-
data: any;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface WorkflowStats {
|
|
56
|
-
state: string;
|
|
57
|
-
elapsed_time: number;
|
|
58
|
-
last_error: string;
|
|
59
|
-
execution_log: ExecutionLog[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const Item = styled(Paper)(({ theme }) => ({
|
|
63
|
-
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff',
|
|
64
|
-
...theme.typography.body2,
|
|
65
|
-
padding: theme.spacing(1),
|
|
66
|
-
textAlign: 'left',
|
|
67
|
-
color: theme.palette.text.secondary,
|
|
68
|
-
}));
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export default function WorkflowView() {
|
|
73
|
-
const neatApiRootUrl = getNeatApiRootUrl();
|
|
74
|
-
const edgeUpdateSuccessful = useRef(true);
|
|
75
|
-
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
76
|
-
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
77
|
-
const [workflowStats, setWorkflowStats] = useState<WorkflowStats>();
|
|
78
|
-
const [timerInterval, setTimerInterval] = useState(null);
|
|
79
|
-
const [workflowDefinitions, setWorkflowDefinitions] = useState<WorkflowDefinition>();
|
|
80
|
-
const [selectedWorkflow, setSelectedWorkflow] = useState<string>(getSelectedWorkflowName());
|
|
81
|
-
const [listOfWorkflows, setListOfWorkflows] = useState<string[]>([]);
|
|
82
|
-
const [viewType, setViewType] = useState<string>("steps");
|
|
83
|
-
const [dialogOpen, setDialogOpen] = useState(false);
|
|
84
|
-
const [workflowMetadataDialogOpen, setWorkflowMetadataDialogOpen] = useState(false);
|
|
85
|
-
const [openOverviewComponentEditorDialog, setOpenOverviewComponentEditorDialog] = useState(false);
|
|
86
|
-
const [selectedStep, setSelectedStep] = useState<WorkflowStepDefinition>();
|
|
87
|
-
const [selectedComponent, setSelectedComponent] = useState<WorkflowSystemComponent>();
|
|
88
|
-
const [fileContent, setFileContent] = useState('');
|
|
89
|
-
const [stepRegistry, setStepRegistry] = useState<StepRegistry>();
|
|
90
|
-
const [editState, setEditState] = useState<string>("");
|
|
91
|
-
const [loading , setLoading] = useState<boolean>(false);
|
|
92
|
-
const [errorText, setErrorText] = useState<string>("");
|
|
93
|
-
const [packageLink, setPackageLink] = useState<string>("");
|
|
94
|
-
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
loadListOfWorkflows();
|
|
97
|
-
loadRegisteredSteps();
|
|
98
|
-
if (getSelectedWorkflowName())
|
|
99
|
-
loadWorkflowDefinitions(getSelectedWorkflowName());
|
|
100
|
-
else
|
|
101
|
-
setEditState("Please select one of provided workflows or create new one");
|
|
102
|
-
}, []);
|
|
103
|
-
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
syncWorkflowDefToNodesAndEdges(viewType);
|
|
106
|
-
|
|
107
|
-
console.dir(workflowDefinitions);
|
|
108
|
-
startStatePolling(selectedWorkflow);
|
|
109
|
-
}, [workflowDefinitions]);
|
|
110
|
-
|
|
111
|
-
const startStatePolling = (workflowName:string) => {
|
|
112
|
-
if (timerInterval) {
|
|
113
|
-
clearInterval(timerInterval);
|
|
114
|
-
}
|
|
115
|
-
let newTimerInterval = setInterval(() => {
|
|
116
|
-
loadWorkflowStats(workflowName);
|
|
117
|
-
}, 2000);
|
|
118
|
-
setTimerInterval(newTimerInterval);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const stopStatePolling = () => {
|
|
122
|
-
clearInterval(timerInterval);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const loadListOfWorkflows = () => {
|
|
126
|
-
const url = neatApiRootUrl + "/api/workflow/workflows";
|
|
127
|
-
fetch(url).then((response) => response.json()).then((data) => {
|
|
128
|
-
setListOfWorkflows(data.workflows);
|
|
129
|
-
}).catch((error) => {
|
|
130
|
-
console.error('Error:', error);
|
|
131
|
-
}).finally(() => { });
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const loadWorkflowDefinitions = (workflowName: string = "") => {
|
|
135
|
-
if (workflowName == "")
|
|
136
|
-
workflowName = selectedWorkflow;
|
|
137
|
-
const url = neatApiRootUrl + "/api/workflow/workflow-definition/" + workflowName;
|
|
138
|
-
fetch(url).then((response) => {
|
|
139
|
-
if(response.ok)
|
|
140
|
-
return response.json()
|
|
141
|
-
else
|
|
142
|
-
setErrorText("Workflow definition can't be loaded . Error:"+response.statusText+", code:"+response.status);
|
|
143
|
-
return null
|
|
144
|
-
}).then((data) => {
|
|
145
|
-
if (!data) {
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
const workflows = WorkflowDefinition.fromJSON(data.definition);
|
|
149
|
-
setWorkflowDefinitions(workflows);
|
|
150
|
-
setEditState("");
|
|
151
|
-
setErrorText("");
|
|
152
|
-
// loadWorkflowStats(workflowName);
|
|
153
|
-
}).catch ((error) => {
|
|
154
|
-
setErrorText(error.message);
|
|
155
|
-
}).finally(() => { });
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const loadRegisteredSteps = () => {
|
|
159
|
-
const url = neatApiRootUrl + "/api/workflow/registered-steps";
|
|
160
|
-
fetch(url).then((response) => response.json()).then((data) => {
|
|
161
|
-
const steps = StepRegistry.fromJSON(data.steps);
|
|
162
|
-
setStepRegistry(steps);
|
|
163
|
-
}).catch ((error) => {
|
|
164
|
-
console.error('Error:', error);
|
|
165
|
-
}).finally(() => { });
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const filterStats = (stats: WorkflowStats) => {
|
|
171
|
-
|
|
172
|
-
console.dir(stats)
|
|
173
|
-
// detelete all log RUNNING entries that have both RUNNING and COMPLETED entries for the same step
|
|
174
|
-
if (stats.execution_log == null)
|
|
175
|
-
return stats;
|
|
176
|
-
|
|
177
|
-
const filteredLog = stats.execution_log!.filter((log, index) => {
|
|
178
|
-
if (log.state == "STARTED") {
|
|
179
|
-
const nextLog = stats.execution_log[index + 1];
|
|
180
|
-
if (nextLog && nextLog.state == "COMPLETED" && nextLog.id == log.id)
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
return true;
|
|
184
|
-
})
|
|
185
|
-
stats.execution_log = filteredLog;
|
|
186
|
-
return stats;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const enrichWorkflowStats = (stats: WorkflowStats) => {
|
|
190
|
-
|
|
191
|
-
// set labels from workflow definition
|
|
192
|
-
for (let i = 0; i < stats.execution_log.length; i++) {
|
|
193
|
-
const log = stats.execution_log[i];
|
|
194
|
-
if (workflowDefinitions != null){
|
|
195
|
-
const step = workflowDefinitions.getStepById(log.id);
|
|
196
|
-
if (step)
|
|
197
|
-
log.label = step.label;
|
|
198
|
-
}else {
|
|
199
|
-
log.label ="";
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return stats;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const loadWorkflowStats = (workflowName: string = "") => {
|
|
206
|
-
if (workflowName == "")
|
|
207
|
-
workflowName = selectedWorkflow;
|
|
208
|
-
const url = neatApiRootUrl + "/api/workflow/stats/" + workflowName;
|
|
209
|
-
setErrorText("");
|
|
210
|
-
fetch(url).then((response) => {
|
|
211
|
-
if (!response.ok) {
|
|
212
|
-
setErrorText("Workflow state can't be saved . Error code :"+response.status+", message :"+response.statusText);
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
return response.json()
|
|
216
|
-
}).then((data) => {
|
|
217
|
-
if(!data)
|
|
218
|
-
return;
|
|
219
|
-
const enrichedStats = enrichWorkflowStats(data);
|
|
220
|
-
setWorkflowStats(enrichedStats);
|
|
221
|
-
if (data.state == "RUNNING") {
|
|
222
|
-
// startStatePolling();
|
|
223
|
-
} else if (data.state == "COMPLETED" || data.state == "FAILED") {
|
|
224
|
-
// stopStatePolling();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
}).catch((error) => {
|
|
228
|
-
setErrorText("Workflow state can't be fetched from API , most likely backend is not running")
|
|
229
|
-
console.error('Error:', error);
|
|
230
|
-
})
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const startWorkflow = () => {
|
|
234
|
-
const url = neatApiRootUrl + "/api/workflow/start";
|
|
235
|
-
const params = { name: selectedWorkflow, config: "", start_step: "" };
|
|
236
|
-
fetch(url, {
|
|
237
|
-
method: "post", body: JSON.stringify(params), headers: {
|
|
238
|
-
'Content-Type': 'application/json;charset=utf-8'
|
|
239
|
-
}
|
|
240
|
-
}).then((response) => response.json()).then((data) => {
|
|
241
|
-
console.dir(data)
|
|
242
|
-
setWorkflowStats(data);
|
|
243
|
-
startStatePolling(selectedWorkflow);
|
|
244
|
-
loadWorkflowStats();
|
|
245
|
-
}).catch((error) => {
|
|
246
|
-
setErrorText(error.message);
|
|
247
|
-
console.error('Error:', error);
|
|
248
|
-
})
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const saveWorkflow = () => {
|
|
252
|
-
console.dir(nodes);
|
|
253
|
-
syncNodesAndEdgesToWorkflowDef();
|
|
254
|
-
let wdef = workflowDefinitions;
|
|
255
|
-
console.dir(wdef);
|
|
256
|
-
setLoading(true);
|
|
257
|
-
setErrorText("");
|
|
258
|
-
const url = neatApiRootUrl + "/api/workflow/workflow-definition/" + selectedWorkflow;
|
|
259
|
-
fetch(url, {
|
|
260
|
-
method: "post", body: wdef.serializeToJson(), headers: {
|
|
261
|
-
'Content-Type': 'application/json;charset=utf-8'
|
|
262
|
-
}
|
|
263
|
-
}).then((response) => {
|
|
264
|
-
if (!response.ok) {
|
|
265
|
-
setErrorText("Workflow can't be saved . Error code :"+response.status+", message :"+response.statusText);
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
return response.json()
|
|
269
|
-
}
|
|
270
|
-
).then((data) => {
|
|
271
|
-
if(!data)
|
|
272
|
-
return;
|
|
273
|
-
console.dir(data)
|
|
274
|
-
setLoading(false);
|
|
275
|
-
setEditState("");
|
|
276
|
-
}
|
|
277
|
-
).catch((error) => {
|
|
278
|
-
console.error('Error:', error);
|
|
279
|
-
setErrorText(error);
|
|
280
|
-
})
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
const syncNodesAndEdgesToWorkflowDef = () => {
|
|
284
|
-
if (workflowDefinitions) {
|
|
285
|
-
workflowDefinitions.updatePositions(nodes);
|
|
286
|
-
if (viewType == "system")
|
|
287
|
-
workflowDefinitions.updateSystemComponentTransitions(edges);
|
|
288
|
-
else
|
|
289
|
-
workflowDefinitions.updateStepTransitions(edges);
|
|
290
|
-
} else {
|
|
291
|
-
console.error("workflowDefinitions is null");
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const syncWorkflowDefToNodesAndEdges = (viewType:string) => {
|
|
297
|
-
if (!workflowDefinitions)
|
|
298
|
-
return;
|
|
299
|
-
switch (viewType) {
|
|
300
|
-
case 'steps':
|
|
301
|
-
setNodes(workflowDefinitions.convertStepsToNodes());
|
|
302
|
-
setEdges(workflowDefinitions.convertStepsToEdges());
|
|
303
|
-
break;
|
|
304
|
-
case 'system':
|
|
305
|
-
setNodes(workflowDefinitions.convertSystemComponentsToNodes());
|
|
306
|
-
setEdges(workflowDefinitions.convertSystemComponentsToEdges());
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const reloadWorkflows = () => {
|
|
312
|
-
const url = neatApiRootUrl + "/api/workflow/reload-single-workflow/"+selectedWorkflow;
|
|
313
|
-
fetch(url, {
|
|
314
|
-
method: "post", body: "", headers: {
|
|
315
|
-
'Content-Type': 'application/json;charset=utf-8'
|
|
316
|
-
}
|
|
317
|
-
}).then((response) => response.json()).then((data) => {
|
|
318
|
-
loadWorkflowDefinitions();
|
|
319
|
-
loadListOfWorkflows();
|
|
320
|
-
}
|
|
321
|
-
).catch((error) => {
|
|
322
|
-
console.error('Error:', error);
|
|
323
|
-
})
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const switchToWorkflow = (workflowName: string) => {
|
|
328
|
-
setSelectedWorkflowName(workflowName);
|
|
329
|
-
setSelectedWorkflow(workflowName);
|
|
330
|
-
loadWorkflowDefinitions(workflowName);
|
|
331
|
-
setViewType("steps");
|
|
332
|
-
syncWorkflowDefToNodesAndEdges("steps");
|
|
333
|
-
startStatePolling(workflowName);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const handleWorkflowSelectorChange = (event: SelectChangeEvent) => {
|
|
337
|
-
switchToWorkflow(event.target.value);
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
const handleViewTypeChange = (
|
|
341
|
-
event: React.MouseEvent<HTMLElement>,
|
|
342
|
-
newViewType: string,
|
|
343
|
-
) => {
|
|
344
|
-
|
|
345
|
-
setViewType(newViewType);
|
|
346
|
-
syncWorkflowDefToNodesAndEdges(newViewType);
|
|
347
|
-
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const onConnect = useCallback((params) => {
|
|
351
|
-
|
|
352
|
-
setEdges((eds) => addEdge(params, eds))
|
|
353
|
-
syncNodesAndEdgesToWorkflowDef();
|
|
354
|
-
setEditState("Unsaved");
|
|
355
|
-
}, [setEdges]);
|
|
356
|
-
|
|
357
|
-
const onEdgeUpdateStart = useCallback(() => {
|
|
358
|
-
|
|
359
|
-
edgeUpdateSuccessful.current = false;
|
|
360
|
-
}, []);
|
|
361
|
-
|
|
362
|
-
const onEdgeUpdate = useCallback((oldEdge, newConnection) => {
|
|
363
|
-
|
|
364
|
-
edgeUpdateSuccessful.current = true;
|
|
365
|
-
setEdges((els) => updateEdge(oldEdge, newConnection, els));
|
|
366
|
-
setEditState("Unsaved");
|
|
367
|
-
}, [setEdges]);
|
|
368
|
-
|
|
369
|
-
const onEdgeUpdateEnd = useCallback((_, edge) => {
|
|
370
|
-
|
|
371
|
-
if (!edgeUpdateSuccessful.current) {
|
|
372
|
-
setEdges((eds) => eds.filter((e) => e.id !== edge.id));
|
|
373
|
-
syncNodesAndEdgesToWorkflowDef();
|
|
374
|
-
}
|
|
375
|
-
setEditState("Unsaved");
|
|
376
|
-
|
|
377
|
-
edgeUpdateSuccessful.current = true;
|
|
378
|
-
}, [setEdges]);
|
|
379
|
-
|
|
380
|
-
const onNodeClick = useCallback((event, node) => {
|
|
381
|
-
|
|
382
|
-
console.dir(node);
|
|
383
|
-
handleDialogClickOpen(node.id, viewType);
|
|
384
|
-
}, [workflowDefinitions, viewType]);
|
|
385
|
-
|
|
386
|
-
const onAddStep = (() => {
|
|
387
|
-
|
|
388
|
-
setEditState("Unsaved");
|
|
389
|
-
const ui_config = new UIConfig();
|
|
390
|
-
ui_config.pos_x = Math.round(window.innerWidth * 0.3);
|
|
391
|
-
ui_config.pos_y = Math.round(window.innerHeight * 0.3);
|
|
392
|
-
if (viewType == "steps") {
|
|
393
|
-
const step = new WorkflowStepDefinition();
|
|
394
|
-
step.id = "step_" + Math.floor(Math.random() * 1000000);
|
|
395
|
-
step.label = "New step";
|
|
396
|
-
step.ui_config = ui_config;
|
|
397
|
-
step.stype = "stdstep";
|
|
398
|
-
workflowDefinitions.steps.push(step);
|
|
399
|
-
} else {
|
|
400
|
-
const systemComponent = new WorkflowSystemComponent();
|
|
401
|
-
systemComponent.id = "system_comp_" + Math.floor(Math.random() * 1000000);
|
|
402
|
-
systemComponent.label = "New component";
|
|
403
|
-
systemComponent.ui_config = ui_config;
|
|
404
|
-
if (workflowDefinitions.system_components == null)
|
|
405
|
-
workflowDefinitions.system_components = [];
|
|
406
|
-
workflowDefinitions.system_components.push(systemComponent);
|
|
407
|
-
}
|
|
408
|
-
syncWorkflowDefToNodesAndEdges(viewType);
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
const handleDialogClickOpen = (id: string, viewType: string) => {
|
|
412
|
-
|
|
413
|
-
if (viewType == "steps") {
|
|
414
|
-
setSelectedStep(workflowDefinitions.getStepById(id));
|
|
415
|
-
setDialogOpen(true);
|
|
416
|
-
} else {
|
|
417
|
-
setSelectedComponent(workflowDefinitions.getSystemComponentById(id));
|
|
418
|
-
setOpenOverviewComponentEditorDialog(true);
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
const handleDialogClose = (step:WorkflowStepDefinition,action:string) => {
|
|
423
|
-
setDialogOpen(false);
|
|
424
|
-
switch (action) {
|
|
425
|
-
case "delete":
|
|
426
|
-
workflowDefinitions.deleteStep(selectedStep.id);
|
|
427
|
-
syncWorkflowDefToNodesAndEdges(viewType);
|
|
428
|
-
setEditState("Unsaved");
|
|
429
|
-
break;
|
|
430
|
-
case "save":
|
|
431
|
-
workflowDefinitions.updateStep(selectedStep.id, step);
|
|
432
|
-
setSelectedStep(step);
|
|
433
|
-
syncWorkflowDefToNodesAndEdges(viewType);
|
|
434
|
-
setEditState("Unsaved");
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
const solutionComponentEditorDialogHandler = (component: WorkflowSystemComponent,action: string) => {
|
|
440
|
-
|
|
441
|
-
console.dir(component)
|
|
442
|
-
switch (action) {
|
|
443
|
-
case "save":
|
|
444
|
-
workflowDefinitions.updateSystemComponent(selectedComponent.id, component);
|
|
445
|
-
setSelectedComponent(component);
|
|
446
|
-
syncWorkflowDefToNodesAndEdges(viewType);
|
|
447
|
-
break;
|
|
448
|
-
case "delete":
|
|
449
|
-
workflowDefinitions.deleteSystemComponent(component.id);
|
|
450
|
-
syncWorkflowDefToNodesAndEdges(viewType);
|
|
451
|
-
break;
|
|
452
|
-
}
|
|
453
|
-
setEditState("Unsaved");
|
|
454
|
-
setOpenOverviewComponentEditorDialog(false);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
const handleCreateWorkflow = (wdef:WorkflowDefinition,action: string) => {
|
|
458
|
-
// send workflowMeta to backend
|
|
459
|
-
console.dir(wdef);
|
|
460
|
-
if (action != "save")
|
|
461
|
-
return;
|
|
462
|
-
|
|
463
|
-
const url = neatApiRootUrl + "/api/workflow/create";
|
|
464
|
-
fetch(url, {
|
|
465
|
-
method: "post", body: wdef.serializeToJson(), headers: {
|
|
466
|
-
'Content-Type': 'application/json;charset=utf-8'
|
|
467
|
-
}
|
|
468
|
-
}).then((response) => response.json()).then((data) => {
|
|
469
|
-
switchToWorkflow(wdef.name);
|
|
470
|
-
window.location.reload();
|
|
471
|
-
}
|
|
472
|
-
).catch((error) => {
|
|
473
|
-
console.error('Error:', error);
|
|
474
|
-
})
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
const onNodesChangeN = useCallback((nodeChanges: NodeChange[]) => {
|
|
479
|
-
|
|
480
|
-
// console.dir(nodeChanges);
|
|
481
|
-
onNodesChange(nodeChanges);
|
|
482
|
-
syncNodesAndEdgesToWorkflowDef();
|
|
483
|
-
// setEditState("Unsaved");
|
|
484
|
-
}, [workflowDefinitions,nodes,edges]);
|
|
485
|
-
|
|
486
|
-
const onEdgesChangeN = useCallback((edgeChanges: EdgeChange[]) => {
|
|
487
|
-
|
|
488
|
-
console.dir(edgeChanges);
|
|
489
|
-
onEdgesChange(edgeChanges);
|
|
490
|
-
syncNodesAndEdgesToWorkflowDef();
|
|
491
|
-
// setEditState("Unsaved");
|
|
492
|
-
}, [workflowDefinitions,nodes,edges]);
|
|
493
|
-
|
|
494
|
-
return (
|
|
495
|
-
<div style={{ height: '85vh', width: '97vw' }}>
|
|
496
|
-
<Box>
|
|
497
|
-
<FormControl sx={{ width: 300, marginBottom: 2 }}>
|
|
498
|
-
<InputLabel id="workflowSelectorLabel">Selector</InputLabel>
|
|
499
|
-
<Select
|
|
500
|
-
labelId="workflowSelectorLabel"
|
|
501
|
-
id="workflowSelector"
|
|
502
|
-
value={selectedWorkflow}
|
|
503
|
-
size='small'
|
|
504
|
-
label="Query template"
|
|
505
|
-
onChange={handleWorkflowSelectorChange}
|
|
506
|
-
>
|
|
507
|
-
{
|
|
508
|
-
listOfWorkflows && listOfWorkflows.map((item, i) => (
|
|
509
|
-
<MenuItem value={item} key={item}>{item} </MenuItem>
|
|
510
|
-
))
|
|
511
|
-
}
|
|
512
|
-
</Select>
|
|
513
|
-
</FormControl>
|
|
514
|
-
<WorkflowMetadataDialog open = {workflowMetadataDialogOpen} onClose={handleCreateWorkflow}/>
|
|
515
|
-
<WorkflowDeleteDialog name={selectedWorkflow} onDelete = {()=> loadListOfWorkflows()}/>
|
|
516
|
-
|
|
517
|
-
</Box>
|
|
518
|
-
{ editState && (<Typography color={"red"} variant="overline"> {editState} </Typography> ) }
|
|
519
|
-
{ errorText && (<Typography color={"red"} variant="caption"> Error messages : {errorText} </Typography> ) }
|
|
520
|
-
{ loading &&( <LinearProgress />) }
|
|
521
|
-
{(viewType == "system" || viewType == "steps") && (
|
|
522
|
-
<Stack direction="row" spacing={1} justifyContent="left"
|
|
523
|
-
alignItems="left">
|
|
524
|
-
<Item>
|
|
525
|
-
<OverviewComponentEditorDialog open={openOverviewComponentEditorDialog} component={selectedComponent} onClose={solutionComponentEditorDialogHandler} />
|
|
526
|
-
<StepEditorDialog open={dialogOpen} step={selectedStep} workflowName={selectedWorkflow} stepRegistry={stepRegistry} workflowDefinitions={workflowDefinitions} onClose={handleDialogClose} />
|
|
527
|
-
|
|
528
|
-
<div style={{ height: '75vh', width: '70vw' }}>
|
|
529
|
-
<ReactFlow
|
|
530
|
-
nodes={nodes}
|
|
531
|
-
edges={edges}
|
|
532
|
-
onNodeClick={onNodeClick}
|
|
533
|
-
onNodesChange={onNodesChangeN}
|
|
534
|
-
onEdgesChange={onEdgesChangeN}
|
|
535
|
-
onEdgeUpdate={onEdgeUpdate}
|
|
536
|
-
onEdgeUpdateStart={onEdgeUpdateStart}
|
|
537
|
-
onEdgeUpdateEnd={onEdgeUpdateEnd}
|
|
538
|
-
onConnect={onConnect}
|
|
539
|
-
>
|
|
540
|
-
<MiniMap />
|
|
541
|
-
<Controls />
|
|
542
|
-
<Background />
|
|
543
|
-
<Panel position="bottom-center">
|
|
544
|
-
{viewType == "system" && (<Button variant="outlined" onClick={onAddStep}>Add solution component</Button>)}
|
|
545
|
-
{viewType == "steps" && (<Button variant="outlined" onClick={onAddStep}>Add workflow step</Button>)}
|
|
546
|
-
</Panel>
|
|
547
|
-
</ReactFlow>
|
|
548
|
-
|
|
549
|
-
<Button variant="outlined" onClick={ () => {saveWorkflow(); startWorkflow()} } sx={{ marginTop: 2, marginRight: 1 }}>Start workflow</Button>
|
|
550
|
-
<Button variant="outlined" onClick={saveWorkflow} sx={{ marginTop: 2, marginRight: 1 }}>Save workflow</Button>
|
|
551
|
-
<Button variant="outlined" onClick={reloadWorkflows} sx={{ marginTop: 2, marginRight: 1 }} >Reload</Button>
|
|
552
|
-
<WorkflowImportExportDialog onDownloaded = {()=> reloadWorkflows()} />
|
|
553
|
-
|
|
554
|
-
</div>
|
|
555
|
-
|
|
556
|
-
</Item>
|
|
557
|
-
<Item >
|
|
558
|
-
<WorkflowExecutionReport report={workflowStats} />
|
|
559
|
-
</Item>
|
|
560
|
-
</Stack>
|
|
561
|
-
)}
|
|
562
|
-
{viewType == "configurations" && (
|
|
563
|
-
<ConfigView></ConfigView>
|
|
564
|
-
)}
|
|
565
|
-
|
|
566
|
-
</div>
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
);
|
|
570
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"display": "Create React App",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"compilerOptions": {
|
|
7
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
8
|
-
"module": "esnext",
|
|
9
|
-
"target": "es2015",
|
|
10
|
-
|
|
11
|
-
"baseUrl": "src",
|
|
12
|
-
"allowJs": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"forceConsistentCasingInFileNames": true,
|
|
16
|
-
"isolatedModules": true,
|
|
17
|
-
"jsx": "react-jsx",
|
|
18
|
-
"moduleResolution": "node",
|
|
19
|
-
"noEmit": true,
|
|
20
|
-
"noFallthroughCasesInSwitch": true,
|
|
21
|
-
"resolveJsonModule": true,
|
|
22
|
-
"skipLibCheck": true,
|
|
23
|
-
"strict": false
|
|
24
|
-
},
|
|
25
|
-
"include": ["src"]
|
|
26
|
-
|
|
27
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
from collections.abc import Iterable
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
3
|
-
|
|
4
|
-
from cognite.neat._issues.errors import NeatValueError
|
|
5
|
-
from cognite.neat._rules._shared import InputRules, MaybeRules, VerifiedRules
|
|
6
|
-
from cognite.neat._rules.models import VERIFIED_RULES_BY_ROLE, RoleTypes
|
|
7
|
-
|
|
8
|
-
from ._base import RulesPipeline, RulesTransformer
|
|
9
|
-
from ._converters import ConvertToRules
|
|
10
|
-
from ._verification import VerifyAnyRules
|
|
11
|
-
|
|
12
|
-
if TYPE_CHECKING:
|
|
13
|
-
from cognite.neat._rules.importers import BaseImporter
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ImporterPipeline(RulesPipeline[InputRules, VerifiedRules]):
|
|
17
|
-
"""This is a standard pipeline that verifies, convert and return the rules from the importer."""
|
|
18
|
-
|
|
19
|
-
def __init__(
|
|
20
|
-
self,
|
|
21
|
-
importer: "BaseImporter[InputRules]",
|
|
22
|
-
items: Iterable[RulesTransformer[InputRules, VerifiedRules]] | None = None,
|
|
23
|
-
) -> None:
|
|
24
|
-
super().__init__(items or [])
|
|
25
|
-
self._importer = importer
|
|
26
|
-
|
|
27
|
-
@classmethod
|
|
28
|
-
def _create_pipeline(
|
|
29
|
-
cls, importer: "BaseImporter[InputRules]", role: RoleTypes | None = None
|
|
30
|
-
) -> "ImporterPipeline":
|
|
31
|
-
items: list[RulesTransformer] = [VerifyAnyRules(errors="continue", validate=True)]
|
|
32
|
-
if role is not None:
|
|
33
|
-
out_cls = VERIFIED_RULES_BY_ROLE[role]
|
|
34
|
-
items.append(ConvertToRules(out_cls))
|
|
35
|
-
return cls(importer, items)
|
|
36
|
-
|
|
37
|
-
@classmethod
|
|
38
|
-
def try_verify(cls, importer: "BaseImporter", role: RoleTypes | None = None) -> MaybeRules[VerifiedRules]:
|
|
39
|
-
"""This is a standard pipeline that verifies, convert and return the rules from the importer.
|
|
40
|
-
|
|
41
|
-
Args:
|
|
42
|
-
importer: The importer to use.
|
|
43
|
-
role: The type of rules to convert to. If None, the rules will not be converted.
|
|
44
|
-
|
|
45
|
-
Returns:
|
|
46
|
-
The verified rules.
|
|
47
|
-
"""
|
|
48
|
-
return cls._create_pipeline(importer, role).try_execute()
|
|
49
|
-
|
|
50
|
-
@classmethod
|
|
51
|
-
def verify(cls, importer: "BaseImporter", role: RoleTypes | None = None) -> VerifiedRules:
|
|
52
|
-
"""Verify the rules."""
|
|
53
|
-
return cls._create_pipeline(importer, role).execute()
|
|
54
|
-
|
|
55
|
-
def try_execute(self) -> MaybeRules[VerifiedRules]:
|
|
56
|
-
"""Try to execute the pipeline from importer to rules."""
|
|
57
|
-
rules = self._importer.to_rules()
|
|
58
|
-
return self.try_transform(rules)
|
|
59
|
-
|
|
60
|
-
def execute(self) -> VerifiedRules:
|
|
61
|
-
"""Execute the pipeline from importer to rules."""
|
|
62
|
-
rules = self._importer.to_rules()
|
|
63
|
-
out = self.transform(rules)
|
|
64
|
-
if isinstance(out, MaybeRules) and out.rules is None:
|
|
65
|
-
raise out.issues.as_errors("Failed to convert rules")
|
|
66
|
-
|
|
67
|
-
rules = out.get_rules()
|
|
68
|
-
if rules is None:
|
|
69
|
-
raise NeatValueError("Rules is missing cannot convert")
|
|
70
|
-
return rules
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from cognite.neat._workflows.base import BaseWorkflow
|
|
2
|
-
from cognite.neat._workflows.manager import WorkflowManager
|
|
3
|
-
from cognite.neat._workflows.model import (
|
|
4
|
-
FlowMessage,
|
|
5
|
-
WorkflowFullStateReport,
|
|
6
|
-
WorkflowStepDefinition,
|
|
7
|
-
WorkflowStepEvent,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"BaseWorkflow",
|
|
12
|
-
"FlowMessage",
|
|
13
|
-
"WorkflowFullStateReport",
|
|
14
|
-
"WorkflowManager",
|
|
15
|
-
"WorkflowStepDefinition",
|
|
16
|
-
"WorkflowStepEvent",
|
|
17
|
-
]
|