@mat3ra/wode 2025.10.1-0
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.
- package/.babelrc +17 -0
- package/LICENSE.md +15 -0
- package/README.md +164 -0
- package/assets/subworkflows/deepmd/deepmd.yml +31 -0
- package/assets/subworkflows/deepmd/espresso_cp_md.yml +16 -0
- package/assets/subworkflows/espresso/average_electrostatic_potential_find_minima.yml +27 -0
- package/assets/subworkflows/espresso/average_electrostatic_potential_via_band_structure.yml +67 -0
- package/assets/subworkflows/espresso/band_gap.yml +21 -0
- package/assets/subworkflows/espresso/band_gap_hse_dos.yml +30 -0
- package/assets/subworkflows/espresso/band_structure.yml +26 -0
- package/assets/subworkflows/espresso/band_structure_dos.yml +34 -0
- package/assets/subworkflows/espresso/band_structure_hse.yml +30 -0
- package/assets/subworkflows/espresso/band_structure_magn.yml +31 -0
- package/assets/subworkflows/espresso/band_structure_soc.yml +30 -0
- package/assets/subworkflows/espresso/dielectric_tensor.yml +35 -0
- package/assets/subworkflows/espresso/dos.yml +24 -0
- package/assets/subworkflows/espresso/electronic_density_mesh.yml +19 -0
- package/assets/subworkflows/espresso/esm.yml +14 -0
- package/assets/subworkflows/espresso/esm_relax.yml +14 -0
- package/assets/subworkflows/espresso/espresso_extract_kpoints.yml +16 -0
- package/assets/subworkflows/espresso/espresso_xml_get_qpt_irr.yml +12 -0
- package/assets/subworkflows/espresso/fixed_cell_relaxation.yml +16 -0
- package/assets/subworkflows/espresso/gw_band_structure_band_gap_full_frequency.yml +22 -0
- package/assets/subworkflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +22 -0
- package/assets/subworkflows/espresso/hubbard_u_hp.yml +21 -0
- package/assets/subworkflows/espresso/kpoint_convergence.yml +86 -0
- package/assets/subworkflows/espresso/neb.yml +16 -0
- package/assets/subworkflows/espresso/ph_init_qpoints.yml +14 -0
- package/assets/subworkflows/espresso/ph_single_irr_qpt.yml +14 -0
- package/assets/subworkflows/espresso/phonon_dispersions.yml +29 -0
- package/assets/subworkflows/espresso/phonon_dos.yml +29 -0
- package/assets/subworkflows/espresso/phonon_dos_dispersion.yml +34 -0
- package/assets/subworkflows/espresso/phonon_reduce.yml +29 -0
- package/assets/subworkflows/espresso/post_processor.yml +14 -0
- package/assets/subworkflows/espresso/pre_processor.yml +14 -0
- package/assets/subworkflows/espresso/pw_scf.yml +16 -0
- package/assets/subworkflows/espresso/recalculate_bands.yml +19 -0
- package/assets/subworkflows/espresso/surface_energy.yml +16 -0
- package/assets/subworkflows/espresso/total_energy.yml +16 -0
- package/assets/subworkflows/espresso/valence_band_offset_calc_from_previous_esp_vbm.yml +35 -0
- package/assets/subworkflows/espresso/variable_cell_relaxation.yml +18 -0
- package/assets/subworkflows/espresso/zero_point_energy.yml +19 -0
- package/assets/subworkflows/jupyterLab/jupyter_notebook.yml +17 -0
- package/assets/subworkflows/nwchem/total_energy.yml +16 -0
- package/assets/subworkflows/python/ml/classification_tail.yml +56 -0
- package/assets/subworkflows/python/ml/clustering_tail.yml +62 -0
- package/assets/subworkflows/python/ml/regression_tail.yml +56 -0
- package/assets/subworkflows/python/ml/train_head.yml +61 -0
- package/assets/subworkflows/python/python_script.yml +14 -0
- package/assets/subworkflows/shell/batch_espresso_pwscf.yml +14 -0
- package/assets/subworkflows/shell/hello_world.yml +14 -0
- package/assets/subworkflows/vasp/band_gap.yml +21 -0
- package/assets/subworkflows/vasp/band_structure.yml +21 -0
- package/assets/subworkflows/vasp/band_structure_dos.yml +23 -0
- package/assets/subworkflows/vasp/dos.yml +18 -0
- package/assets/subworkflows/vasp/fixed_cell_relaxation.yml +16 -0
- package/assets/subworkflows/vasp/initial_final_total_energies.yml +25 -0
- package/assets/subworkflows/vasp/kpoint_convergence.yml +89 -0
- package/assets/subworkflows/vasp/neb_subworkflow.yml +16 -0
- package/assets/subworkflows/vasp/prepare_images.yml +16 -0
- package/assets/subworkflows/vasp/recalculate_bands.yml +16 -0
- package/assets/subworkflows/vasp/surface_energy.yml +18 -0
- package/assets/subworkflows/vasp/total_energy.yml +16 -0
- package/assets/subworkflows/vasp/variable_cell_relaxation.yml +18 -0
- package/assets/subworkflows/vasp/zero_point_energy.yml +16 -0
- package/assets/workflows/deepmd/deepmd_md.yml +6 -0
- package/assets/workflows/espresso/band_gap.yml +4 -0
- package/assets/workflows/espresso/band_gap_dos_hse.yml +4 -0
- package/assets/workflows/espresso/band_structure.yml +4 -0
- package/assets/workflows/espresso/band_structure_dos.yml +4 -0
- package/assets/workflows/espresso/band_structure_hse.yml +14 -0
- package/assets/workflows/espresso/band_structure_magn.yml +7 -0
- package/assets/workflows/espresso/band_structure_soc.yml +7 -0
- package/assets/workflows/espresso/dielectric_tensor.yml +4 -0
- package/assets/workflows/espresso/dos.yml +4 -0
- package/assets/workflows/espresso/electronic_density_mesh.yml +4 -0
- package/assets/workflows/espresso/esm.yml +4 -0
- package/assets/workflows/espresso/esm_relax.yml +4 -0
- package/assets/workflows/espresso/fixed_cell_relaxation.yml +4 -0
- package/assets/workflows/espresso/gw_band_structure_band_gap_full_frequency.yml +4 -0
- package/assets/workflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +4 -0
- package/assets/workflows/espresso/hubbard_u_hp.yml +7 -0
- package/assets/workflows/espresso/kpoint_convergence.yml +4 -0
- package/assets/workflows/espresso/neb.yml +4 -0
- package/assets/workflows/espresso/phonon_dispersions.yml +4 -0
- package/assets/workflows/espresso/phonon_dos.yml +4 -0
- package/assets/workflows/espresso/phonon_dos_dispersion.yml +4 -0
- package/assets/workflows/espresso/phonon_map.yml +28 -0
- package/assets/workflows/espresso/recalculate_bands.yml +4 -0
- package/assets/workflows/espresso/surface_energy.yml +4 -0
- package/assets/workflows/espresso/total_energy.yml +4 -0
- package/assets/workflows/espresso/valence_band_offset.yml +171 -0
- package/assets/workflows/espresso/variable_cell_relaxation.yml +4 -0
- package/assets/workflows/espresso/zero_point_energy.yml +4 -0
- package/assets/workflows/jupyterLab/jupyter_notebook.yml +4 -0
- package/assets/workflows/nwchem/total_energy.yml +4 -0
- package/assets/workflows/python/ml/classification_workflow.yml +9 -0
- package/assets/workflows/python/ml/clustering_workflow.yml +9 -0
- package/assets/workflows/python/ml/regression_workflow.yml +9 -0
- package/assets/workflows/python/python_script.yml +4 -0
- package/assets/workflows/shell/batch_espresso_pwscf.yml +4 -0
- package/assets/workflows/shell/hello_world.yml +4 -0
- package/assets/workflows/vasp/band_gap.yml +4 -0
- package/assets/workflows/vasp/band_structure.yml +4 -0
- package/assets/workflows/vasp/band_structure_dos.yml +4 -0
- package/assets/workflows/vasp/dos.yml +4 -0
- package/assets/workflows/vasp/fixed_cell_relaxation.yml +4 -0
- package/assets/workflows/vasp/kpoint_convergence.yml +4 -0
- package/assets/workflows/vasp/neb.yml +8 -0
- package/assets/workflows/vasp/recalculate_bands.yml +4 -0
- package/assets/workflows/vasp/surface_energy.yml +4 -0
- package/assets/workflows/vasp/total_energy.yml +4 -0
- package/assets/workflows/vasp/variable_cell_relaxation.yml +4 -0
- package/assets/workflows/vasp/zero_point_energy.yml +4 -0
- package/build_workflows.js +65 -0
- package/dist/context/context.js +49 -0
- package/dist/context/mixins/ApplicationContextMixin.js +19 -0
- package/dist/context/mixins/JobContextMixin.js +39 -0
- package/dist/context/mixins/MaterialContextMixin.js +40 -0
- package/dist/context/mixins/MaterialsContextMixin.js +19 -0
- package/dist/context/mixins/MaterialsSetContextMixin.js +25 -0
- package/dist/context/mixins/MethodDataContextMixin.js +48 -0
- package/dist/context/mixins/WorkflowContextMixin.js +28 -0
- package/dist/context/providers/BoundaryConditionsFormDataProvider.js +86 -0
- package/dist/context/providers/CollinearMagnetizationContextProvider.js +113 -0
- package/dist/context/providers/HubbardContextProviderLegacy.js +81 -0
- package/dist/context/providers/HubbardJContextProvider.js +74 -0
- package/dist/context/providers/HubbardUContextProvider.js +77 -0
- package/dist/context/providers/HubbardVContextProvider.js +104 -0
- package/dist/context/providers/IonDynamicsContextProvider.js +62 -0
- package/dist/context/providers/MLSettingsContextProvider.js +52 -0
- package/dist/context/providers/MLTrainTestSplitContextProvider.js +48 -0
- package/dist/context/providers/NEBFormDataProvider.js +38 -0
- package/dist/context/providers/NonCollinearMagnetizationContextProvider.js +253 -0
- package/dist/context/providers/PlanewaveCutoffsContextProvider.js +67 -0
- package/dist/context/providers/PointsGridFormDataProvider.js +272 -0
- package/dist/context/providers/PointsPathFormDataProvider.js +155 -0
- package/dist/context/providers/by_application/ExecutableContextProvider.js +17 -0
- package/dist/context/providers/by_application/espresso/QENEBContextProvider.js +60 -0
- package/dist/context/providers/by_application/espresso/QEPWXContextProvider.js +149 -0
- package/dist/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +84 -0
- package/dist/context/providers/by_application/vasp/VASPContextProvider.js +64 -0
- package/dist/context/providers/by_application/vasp/VASPNEBContextProvider.js +56 -0
- package/dist/context/providers/settings.js +37 -0
- package/dist/context/providers.js +199 -0
- package/dist/enums.js +65 -0
- package/dist/index.js +64 -0
- package/dist/patch.js +19 -0
- package/dist/subworkflows/convergence/factory.js +35 -0
- package/dist/subworkflows/convergence/non_uniform_kgrid.js +31 -0
- package/dist/subworkflows/convergence/parameter.js +70 -0
- package/dist/subworkflows/convergence/uniform_kgrid.js +26 -0
- package/dist/subworkflows/convergence.js +189 -0
- package/dist/subworkflows/create.js +285 -0
- package/dist/subworkflows/dynamic/espresso/getQpointIrrep.js +34 -0
- package/dist/subworkflows/dynamic/index.js +19 -0
- package/dist/subworkflows/dynamic/surfaceEnergy.js +67 -0
- package/dist/subworkflows/index.js +19 -0
- package/dist/subworkflows/subworkflow.js +279 -0
- package/dist/units/assertion.js +37 -0
- package/dist/units/assignment.js +42 -0
- package/dist/units/base.js +91 -0
- package/dist/units/builders/AssertionUnitConfigBuilder.js +34 -0
- package/dist/units/builders/AssignmentUnitConfigBuilder.js +41 -0
- package/dist/units/builders/ExecutionUnitConfigBuilder.js +67 -0
- package/dist/units/builders/IOUnitConfigBuilder.js +54 -0
- package/dist/units/builders/UnitConfigBuilder.js +79 -0
- package/dist/units/builders/index.js +18 -0
- package/dist/units/condition.js +52 -0
- package/dist/units/execution.js +222 -0
- package/dist/units/factory.js +53 -0
- package/dist/units/index.js +82 -0
- package/dist/units/io.js +148 -0
- package/dist/units/map.js +38 -0
- package/dist/units/processing.js +41 -0
- package/dist/units/reduce.js +24 -0
- package/dist/units/subworkflow.js +23 -0
- package/dist/utils.js +92 -0
- package/dist/workflows/create.js +312 -0
- package/dist/workflows/default.js +41 -0
- package/dist/workflows/index.js +108 -0
- package/dist/workflows/relaxation.js +37 -0
- package/dist/workflows/workflow.js +303 -0
- package/package.json +94 -0
- package/src/context/context.js +47 -0
- package/src/context/mixins/ApplicationContextMixin.js +19 -0
- package/src/context/mixins/JobContextMixin.js +36 -0
- package/src/context/mixins/MaterialContextMixin.js +41 -0
- package/src/context/mixins/MaterialsContextMixin.js +18 -0
- package/src/context/mixins/MaterialsSetContextMixin.js +24 -0
- package/src/context/mixins/MethodDataContextMixin.js +48 -0
- package/src/context/mixins/WorkflowContextMixin.js +25 -0
- package/src/context/providers/BoundaryConditionsFormDataProvider.js +80 -0
- package/src/context/providers/CollinearMagnetizationContextProvider.js +117 -0
- package/src/context/providers/HubbardContextProviderLegacy.js +75 -0
- package/src/context/providers/HubbardJContextProvider.js +73 -0
- package/src/context/providers/HubbardUContextProvider.js +100 -0
- package/src/context/providers/HubbardVContextProvider.js +111 -0
- package/src/context/providers/IonDynamicsContextProvider.js +56 -0
- package/src/context/providers/MLSettingsContextProvider.js +48 -0
- package/src/context/providers/MLTrainTestSplitContextProvider.js +45 -0
- package/src/context/providers/NEBFormDataProvider.js +32 -0
- package/src/context/providers/NonCollinearMagnetizationContextProvider.js +269 -0
- package/src/context/providers/PlanewaveCutoffsContextProvider.js +68 -0
- package/src/context/providers/PointsGridFormDataProvider.js +285 -0
- package/src/context/providers/PointsPathFormDataProvider.js +165 -0
- package/src/context/providers/by_application/ExecutableContextProvider.js +10 -0
- package/src/context/providers/by_application/espresso/QENEBContextProvider.js +56 -0
- package/src/context/providers/by_application/espresso/QEPWXContextProvider.js +166 -0
- package/src/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +86 -0
- package/src/context/providers/by_application/vasp/VASPContextProvider.js +56 -0
- package/src/context/providers/by_application/vasp/VASPNEBContextProvider.js +46 -0
- package/src/context/providers/settings.js +38 -0
- package/src/context/providers.js +140 -0
- package/src/enums.js +65 -0
- package/src/index.js +17 -0
- package/src/patch.js +12 -0
- package/src/subworkflows/convergence/factory.js +14 -0
- package/src/subworkflows/convergence/non_uniform_kgrid.js +28 -0
- package/src/subworkflows/convergence/parameter.js +58 -0
- package/src/subworkflows/convergence/uniform_kgrid.js +22 -0
- package/src/subworkflows/convergence.js +196 -0
- package/src/subworkflows/create.js +201 -0
- package/src/subworkflows/dynamic/espresso/getQpointIrrep.js +35 -0
- package/src/subworkflows/dynamic/index.js +8 -0
- package/src/subworkflows/dynamic/surfaceEnergy.js +124 -0
- package/src/subworkflows/index.js +2 -0
- package/src/subworkflows/subworkflow.js +329 -0
- package/src/units/assertion.js +29 -0
- package/src/units/assignment.js +34 -0
- package/src/units/base.js +97 -0
- package/src/units/builders/AssertionUnitConfigBuilder.js +28 -0
- package/src/units/builders/AssignmentUnitConfigBuilder.js +36 -0
- package/src/units/builders/ExecutionUnitConfigBuilder.js +59 -0
- package/src/units/builders/IOUnitConfigBuilder.js +53 -0
- package/src/units/builders/UnitConfigBuilder.js +86 -0
- package/src/units/builders/index.js +15 -0
- package/src/units/condition.js +47 -0
- package/src/units/execution.js +263 -0
- package/src/units/factory.js +53 -0
- package/src/units/index.js +25 -0
- package/src/units/io.js +163 -0
- package/src/units/map.js +33 -0
- package/src/units/processing.js +39 -0
- package/src/units/reduce.js +17 -0
- package/src/units/subworkflow.js +15 -0
- package/src/utils.js +73 -0
- package/src/workflows/create.js +222 -0
- package/src/workflows/default.js +39 -0
- package/src/workflows/index.js +99 -0
- package/src/workflows/relaxation.js +41 -0
- package/src/workflows/workflow.js +351 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnitConfigBuilder = void 0;
|
|
7
|
+
var _utils = require("@mat3ra/utils");
|
|
8
|
+
var _underscore = _interopRequireDefault(require("underscore"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
class UnitConfigBuilder {
|
|
14
|
+
constructor({
|
|
15
|
+
name,
|
|
16
|
+
type,
|
|
17
|
+
flowchartId
|
|
18
|
+
}) {
|
|
19
|
+
this.type = type;
|
|
20
|
+
this._name = name;
|
|
21
|
+
this._head = false;
|
|
22
|
+
this._results = [];
|
|
23
|
+
this._monitors = [];
|
|
24
|
+
this._preProcessors = [];
|
|
25
|
+
this._postProcessors = [];
|
|
26
|
+
this._flowchartId = flowchartId || this.constructor.generateFlowChartId(name);
|
|
27
|
+
}
|
|
28
|
+
name(str) {
|
|
29
|
+
this._name = str;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
head(bool) {
|
|
33
|
+
this._head = bool;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
static generateFlowChartId(...args) {
|
|
37
|
+
if (this.usePredefinedIds) return _utils.Utils.uuid.getUUIDFromNamespace(...args);
|
|
38
|
+
return _utils.Utils.uuid.getUUID();
|
|
39
|
+
}
|
|
40
|
+
flowchartId(flowchartId) {
|
|
41
|
+
this._flowchartId = flowchartId;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
static _stringArrayToNamedObject(array) {
|
|
45
|
+
return array.map(name => _underscore.default.isString(name) ? {
|
|
46
|
+
name
|
|
47
|
+
} : name);
|
|
48
|
+
}
|
|
49
|
+
addPreProcessors(preProcessorNames) {
|
|
50
|
+
this._preProcessors = _underscore.default.union(this.constructor._stringArrayToNamedObject(preProcessorNames), this._preProcessors);
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
addPostProcessors(postProcessorNames) {
|
|
54
|
+
this._postProcessors = _underscore.default.union(this.constructor._stringArrayToNamedObject(postProcessorNames), this._postProcessors);
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
addResults(resultNames) {
|
|
58
|
+
this._results = _underscore.default.union(this.constructor._stringArrayToNamedObject(resultNames), this._results);
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
addMonitors(monitorNames) {
|
|
62
|
+
this._monitors = _underscore.default.union(this.constructor._stringArrayToNamedObject(monitorNames), this._monitors);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
build() {
|
|
66
|
+
return {
|
|
67
|
+
type: this.type,
|
|
68
|
+
name: this._name,
|
|
69
|
+
head: this._head,
|
|
70
|
+
results: this._results,
|
|
71
|
+
monitors: this._monitors,
|
|
72
|
+
flowchartId: this._flowchartId,
|
|
73
|
+
preProcessors: this._preProcessors,
|
|
74
|
+
postProcessors: this._postProcessors
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.UnitConfigBuilder = UnitConfigBuilder;
|
|
79
|
+
_defineProperty(UnitConfigBuilder, "usePredefinedIds", false);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.builders = void 0;
|
|
7
|
+
var _AssertionUnitConfigBuilder = require("./AssertionUnitConfigBuilder");
|
|
8
|
+
var _AssignmentUnitConfigBuilder = require("./AssignmentUnitConfigBuilder");
|
|
9
|
+
var _ExecutionUnitConfigBuilder = require("./ExecutionUnitConfigBuilder");
|
|
10
|
+
var _IOUnitConfigBuilder = require("./IOUnitConfigBuilder");
|
|
11
|
+
var _UnitConfigBuilder = require("./UnitConfigBuilder");
|
|
12
|
+
const builders = exports.builders = {
|
|
13
|
+
UnitConfigBuilder: _UnitConfigBuilder.UnitConfigBuilder,
|
|
14
|
+
AssignmentUnitConfigBuilder: _AssignmentUnitConfigBuilder.AssignmentUnitConfigBuilder,
|
|
15
|
+
AssertionUnitConfigBuilder: _AssertionUnitConfigBuilder.AssertionUnitConfigBuilder,
|
|
16
|
+
ExecutionUnitConfigBuilder: _ExecutionUnitConfigBuilder.ExecutionUnitConfigBuilder,
|
|
17
|
+
IOUnitConfigBuilder: _IOUnitConfigBuilder.IOUnitConfigBuilder
|
|
18
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ConditionUnit = void 0;
|
|
7
|
+
var _enums = require("../enums");
|
|
8
|
+
var _base = require("./base");
|
|
9
|
+
class ConditionUnit extends _base.BaseUnit {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super({
|
|
12
|
+
...ConditionUnit.getConditionConfig(),
|
|
13
|
+
...config
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static getConditionConfig() {
|
|
17
|
+
return {
|
|
18
|
+
name: _enums.UNIT_TYPES.condition,
|
|
19
|
+
type: _enums.UNIT_TYPES.condition,
|
|
20
|
+
input: [],
|
|
21
|
+
results: [],
|
|
22
|
+
preProcessors: [],
|
|
23
|
+
postProcessors: [],
|
|
24
|
+
then: undefined,
|
|
25
|
+
else: undefined,
|
|
26
|
+
statement: "true",
|
|
27
|
+
maxOccurrences: 100
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
get input() {
|
|
31
|
+
return this.prop("input");
|
|
32
|
+
}
|
|
33
|
+
get then() {
|
|
34
|
+
return this.prop("then");
|
|
35
|
+
}
|
|
36
|
+
get else() {
|
|
37
|
+
return this.prop("else");
|
|
38
|
+
}
|
|
39
|
+
get statement() {
|
|
40
|
+
return this.prop("statement");
|
|
41
|
+
}
|
|
42
|
+
get maxOccurrences() {
|
|
43
|
+
return this.prop("maxOccurrences");
|
|
44
|
+
}
|
|
45
|
+
getHashObject() {
|
|
46
|
+
return {
|
|
47
|
+
statement: this.statement,
|
|
48
|
+
maxOccurrences: this.maxOccurrences
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.ConditionUnit = ConditionUnit;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ExecutionUnit = void 0;
|
|
7
|
+
var _ade = require("@exabyte-io/ade.js");
|
|
8
|
+
var _ApplicationRegistry = _interopRequireDefault(require("@exabyte-io/ade.js/dist/js/ApplicationRegistry"));
|
|
9
|
+
var _utils = require("@mat3ra/utils");
|
|
10
|
+
var _underscore = _interopRequireDefault(require("underscore"));
|
|
11
|
+
var _base = require("./base");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
class ExecutionUnit extends _base.BaseUnit {
|
|
17
|
+
/**
|
|
18
|
+
* @override this method to provide entities from other sources
|
|
19
|
+
*/
|
|
20
|
+
_initApplication(config) {
|
|
21
|
+
this._application = _ApplicationRegistry.default.createApplication(config.application);
|
|
22
|
+
this._executable = _ApplicationRegistry.default.getExecutableByConfig(this._application.name, config.executable);
|
|
23
|
+
this._flavor = _ApplicationRegistry.default.getFlavorByConfig(this._executable, config.flavor);
|
|
24
|
+
this._templates = this._flavor ? this._flavor.inputAsTemplates : [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @override this method to provide default executable from other source
|
|
29
|
+
*/
|
|
30
|
+
_getDefaultExecutable() {
|
|
31
|
+
return _ApplicationRegistry.default.getExecutableByName(this.application.name);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @override this method to provide default flavor from other source
|
|
36
|
+
*/
|
|
37
|
+
_getDefaultFlavor() {
|
|
38
|
+
return _ApplicationRegistry.default.getFlavorByName(this.executable.name);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @override this method to provide custom templates
|
|
43
|
+
*/
|
|
44
|
+
_getTemplatesFromInput() {
|
|
45
|
+
return this.getInput().map(i => new _ade.Template(i));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @override this method to provide custom input from other sources
|
|
50
|
+
*/
|
|
51
|
+
_getInput() {
|
|
52
|
+
return this.input || _ApplicationRegistry.default.getInputAsRenderedTemplates(this.flavor, this.getCombinedContext()) || [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @override this method to provide custom input as templates
|
|
57
|
+
*/
|
|
58
|
+
_getInputAsTemplates() {
|
|
59
|
+
return _ApplicationRegistry.default.getInputAsTemplates(this.flavor);
|
|
60
|
+
}
|
|
61
|
+
_initRuntimeItems(keys, config) {
|
|
62
|
+
this._initApplication(config);
|
|
63
|
+
super._initRuntimeItems(keys);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* @summary expects an array with elements containing field [{content: "..."}]
|
|
68
|
+
*/
|
|
69
|
+
get hashFromArrayInputContent() {
|
|
70
|
+
const objectForHashing = this._getInput().map(i => {
|
|
71
|
+
return _utils.Utils.str.removeEmptyLinesFromString(_utils.Utils.str.removeCommentsFromSourceCode(i.content));
|
|
72
|
+
});
|
|
73
|
+
return _utils.Utils.hash.calculateHashFromObject(objectForHashing);
|
|
74
|
+
}
|
|
75
|
+
get name() {
|
|
76
|
+
return this.prop("name", this.flavor.name);
|
|
77
|
+
}
|
|
78
|
+
get application() {
|
|
79
|
+
return this._application;
|
|
80
|
+
}
|
|
81
|
+
get executable() {
|
|
82
|
+
return this._executable;
|
|
83
|
+
}
|
|
84
|
+
get flavor() {
|
|
85
|
+
return this._flavor;
|
|
86
|
+
}
|
|
87
|
+
get templates() {
|
|
88
|
+
return this._templates;
|
|
89
|
+
}
|
|
90
|
+
setApplication(application, omitSettingExecutable = false) {
|
|
91
|
+
this._application = application;
|
|
92
|
+
this.setProp("application", application.toJSON());
|
|
93
|
+
if (!omitSettingExecutable) {
|
|
94
|
+
this.setExecutable(this._getDefaultExecutable());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
setExecutable(executable) {
|
|
98
|
+
this._executable = executable;
|
|
99
|
+
this.setProp("executable", executable.toJSON());
|
|
100
|
+
this.setFlavor(this._getDefaultFlavor());
|
|
101
|
+
}
|
|
102
|
+
setFlavor(flavor) {
|
|
103
|
+
this._flavor = flavor;
|
|
104
|
+
this.setRuntimeItemsToDefaultValues();
|
|
105
|
+
this.setProp("flavor", flavor.toJSON());
|
|
106
|
+
this.setTemplates(this._getInputAsTemplates());
|
|
107
|
+
}
|
|
108
|
+
setTemplates(templates) {
|
|
109
|
+
this._templates = templates;
|
|
110
|
+
this.render(this.context, true);
|
|
111
|
+
}
|
|
112
|
+
setInput(input) {
|
|
113
|
+
this.setProp("input", input);
|
|
114
|
+
}
|
|
115
|
+
get defaultResults() {
|
|
116
|
+
return this.flavor.results;
|
|
117
|
+
}
|
|
118
|
+
get defaultMonitors() {
|
|
119
|
+
return this.flavor.monitors;
|
|
120
|
+
}
|
|
121
|
+
get defaultPostProcessors() {
|
|
122
|
+
return this.flavor.postProcessors;
|
|
123
|
+
}
|
|
124
|
+
get allowedResults() {
|
|
125
|
+
return this.executable.results;
|
|
126
|
+
}
|
|
127
|
+
get allowedMonitors() {
|
|
128
|
+
return this.executable.monitors;
|
|
129
|
+
}
|
|
130
|
+
get allowedPostProcessors() {
|
|
131
|
+
return this.executable.postProcessors;
|
|
132
|
+
}
|
|
133
|
+
get allContextProviders() {
|
|
134
|
+
const list = [];
|
|
135
|
+
// pass context below to keep UI changes
|
|
136
|
+
this.templates.forEach(i => list.push(...i.getContextProvidersAsClassInstances(this.getCombinedContext())));
|
|
137
|
+
return list;
|
|
138
|
+
}
|
|
139
|
+
get contextProviders() {
|
|
140
|
+
return this.allContextProviders.filter(p => p.isUnitContextProvider);
|
|
141
|
+
}
|
|
142
|
+
get input() {
|
|
143
|
+
return this.prop("input");
|
|
144
|
+
}
|
|
145
|
+
get renderingContext() {
|
|
146
|
+
return this._renderingContext || {};
|
|
147
|
+
}
|
|
148
|
+
set renderingContext(ctx) {
|
|
149
|
+
this._renderingContext = ctx;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// context to persist in toJSON
|
|
153
|
+
get storedContext() {
|
|
154
|
+
return _underscore.default.omit(this.context, ...this.constructor.omitKeys);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// context to show to users with some extra keys omitted
|
|
158
|
+
get visibleRenderingContext() {
|
|
159
|
+
return _underscore.default.omit(this.renderingContext, ...this.constructor.omitKeys);
|
|
160
|
+
}
|
|
161
|
+
static getSubworkflowContext(context) {
|
|
162
|
+
const {
|
|
163
|
+
subworkflowContext
|
|
164
|
+
} = context;
|
|
165
|
+
return subworkflowContext ? {
|
|
166
|
+
subworkflowContext
|
|
167
|
+
} : {};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Update rendering context and persistent context
|
|
171
|
+
* Note: this function is sometimes being called without passing a context!
|
|
172
|
+
* @param context
|
|
173
|
+
* @param fromTemplates
|
|
174
|
+
*/
|
|
175
|
+
render(context, fromTemplates = false) {
|
|
176
|
+
const newInput = [];
|
|
177
|
+
const newPersistentContext = {};
|
|
178
|
+
const newRenderingContext = {};
|
|
179
|
+
const renderingContext = {
|
|
180
|
+
...this.context,
|
|
181
|
+
...context
|
|
182
|
+
};
|
|
183
|
+
this.updateContext(renderingContext); // update in-memory context to properly render templates from input below
|
|
184
|
+
(fromTemplates ? this.templates : this._getTemplatesFromInput()).forEach(t => {
|
|
185
|
+
newInput.push(t.getRenderedJSON(renderingContext));
|
|
186
|
+
Object.assign(newRenderingContext, t.getDataFromProvidersForRenderingContext(renderingContext), ExecutionUnit.getSubworkflowContext(renderingContext));
|
|
187
|
+
Object.assign(newPersistentContext, t.getDataFromProvidersForPersistentContext(renderingContext), ExecutionUnit.getSubworkflowContext(renderingContext));
|
|
188
|
+
});
|
|
189
|
+
this.setInput(newInput);
|
|
190
|
+
this.renderingContext = newRenderingContext;
|
|
191
|
+
this.updatePersistentContext(newPersistentContext);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @summary Calculates hash on unit-specific fields.
|
|
196
|
+
* The meaningful fields of processing unit are operation, flavor and input at the moment.
|
|
197
|
+
*/
|
|
198
|
+
getHashObject() {
|
|
199
|
+
return {
|
|
200
|
+
...super.getHashObject(),
|
|
201
|
+
application: _utils.Utils.specific.removeTimestampableKeysFromConfig(this.application.toJSON()),
|
|
202
|
+
executable: _utils.Utils.specific.removeTimestampableKeysFromConfig(this.executable.toJSON()),
|
|
203
|
+
flavor: _utils.Utils.specific.removeTimestampableKeysFromConfig(this.flavor.toJSON()),
|
|
204
|
+
input: this.hashFromArrayInputContent
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
toJSON() {
|
|
208
|
+
return this.clean({
|
|
209
|
+
...super.toJSON(),
|
|
210
|
+
executable: this.executable.toJSON(),
|
|
211
|
+
flavor: this.flavor.toJSON(),
|
|
212
|
+
input: this._getInput(),
|
|
213
|
+
// keys below are not propagated to the parent class on initialization of a new unit unless explicitly given
|
|
214
|
+
name: this.name
|
|
215
|
+
// TODO: figure out the problem with storing context below
|
|
216
|
+
// context: this.storedContext,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.ExecutionUnit = ExecutionUnit;
|
|
221
|
+
// keys to be omitted during toJSON
|
|
222
|
+
_defineProperty(ExecutionUnit, "omitKeys", ["job", "workflow", "material", "materials", "model", "methodData", "hasRelaxation"]);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnitFactory = void 0;
|
|
7
|
+
var _enums = require("../enums");
|
|
8
|
+
var _assertion = require("./assertion");
|
|
9
|
+
var _assignment = require("./assignment");
|
|
10
|
+
var _base = require("./base");
|
|
11
|
+
var _condition = require("./condition");
|
|
12
|
+
var _execution = require("./execution");
|
|
13
|
+
var _io = require("./io");
|
|
14
|
+
var _map = require("./map");
|
|
15
|
+
var _processing = require("./processing");
|
|
16
|
+
var _subworkflow = require("./subworkflow");
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
class UnitFactory {
|
|
21
|
+
static create(config) {
|
|
22
|
+
switch (config.type) {
|
|
23
|
+
case _enums.UNIT_TYPES.execution:
|
|
24
|
+
return new this.ExecutionUnit(config);
|
|
25
|
+
case _enums.UNIT_TYPES.assignment:
|
|
26
|
+
return new this.AssignmentUnit(config);
|
|
27
|
+
case _enums.UNIT_TYPES.condition:
|
|
28
|
+
return new this.ConditionUnit(config);
|
|
29
|
+
case _enums.UNIT_TYPES.io:
|
|
30
|
+
return new this.IOUnit(config);
|
|
31
|
+
case _enums.UNIT_TYPES.processing:
|
|
32
|
+
return new this.ProcessingUnit(config);
|
|
33
|
+
case _enums.UNIT_TYPES.map:
|
|
34
|
+
return new this.MapUnit(config);
|
|
35
|
+
case _enums.UNIT_TYPES.subworkflow:
|
|
36
|
+
return new this.SubworkflowUnit(config);
|
|
37
|
+
case _enums.UNIT_TYPES.assertion:
|
|
38
|
+
return new this.AssertionUnit(config);
|
|
39
|
+
default:
|
|
40
|
+
return new this.BaseUnit(config);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.UnitFactory = UnitFactory;
|
|
45
|
+
_defineProperty(UnitFactory, "AssertionUnit", _assertion.AssertionUnit);
|
|
46
|
+
_defineProperty(UnitFactory, "AssignmentUnit", _assignment.AssignmentUnit);
|
|
47
|
+
_defineProperty(UnitFactory, "BaseUnit", _base.BaseUnit);
|
|
48
|
+
_defineProperty(UnitFactory, "ConditionUnit", _condition.ConditionUnit);
|
|
49
|
+
_defineProperty(UnitFactory, "ExecutionUnit", _execution.ExecutionUnit);
|
|
50
|
+
_defineProperty(UnitFactory, "IOUnit", _io.IOUnit);
|
|
51
|
+
_defineProperty(UnitFactory, "MapUnit", _map.MapUnit);
|
|
52
|
+
_defineProperty(UnitFactory, "ProcessingUnit", _processing.ProcessingUnit);
|
|
53
|
+
_defineProperty(UnitFactory, "SubworkflowUnit", _subworkflow.SubworkflowUnit);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AssertionUnit", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _assertion.AssertionUnit;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "AssignmentUnit", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _assignment.AssignmentUnit;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "BaseUnit", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _base.BaseUnit;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "ConditionUnit", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _condition.ConditionUnit;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "ExecutionUnit", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _execution.ExecutionUnit;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "IOUnit", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _io.IOUnit;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "MapUnit", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _map.MapUnit;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "ProcessingUnit", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _processing.ProcessingUnit;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "ReduceUnit", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _reduce.ReduceUnit;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "SubworkflowUnit", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _subworkflow.SubworkflowUnit;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "UnitFactory", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _factory.UnitFactory;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var _assertion = require("./assertion");
|
|
73
|
+
var _assignment = require("./assignment");
|
|
74
|
+
var _base = require("./base");
|
|
75
|
+
var _condition = require("./condition");
|
|
76
|
+
var _execution = require("./execution");
|
|
77
|
+
var _factory = require("./factory");
|
|
78
|
+
var _io = require("./io");
|
|
79
|
+
var _map = require("./map");
|
|
80
|
+
var _processing = require("./processing");
|
|
81
|
+
var _reduce = require("./reduce");
|
|
82
|
+
var _subworkflow = require("./subworkflow");
|
package/dist/units/io.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.IOUnit = void 0;
|
|
7
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
|
+
var _enums = require("../enums");
|
|
9
|
+
var _base = require("./base");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
class IOUnit extends _base.BaseUnit {
|
|
12
|
+
/**
|
|
13
|
+
* IO Unit Builder for Object Storage sources.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} config - config object with other parameters:
|
|
16
|
+
* @param {String} config.name - the name of the unit this builder is creating
|
|
17
|
+
* @param {String} config.subtype - "input", "output", or "dataframe"
|
|
18
|
+
* @param {Object} config.input - input containing information on the file to download
|
|
19
|
+
* @param {Boolean} config.enableRender - Whether to use Jinja templating at runtime
|
|
20
|
+
*/
|
|
21
|
+
constructor(config) {
|
|
22
|
+
super({
|
|
23
|
+
...IOUnit.getIOConfig(),
|
|
24
|
+
...config
|
|
25
|
+
});
|
|
26
|
+
this.initialize(config);
|
|
27
|
+
}
|
|
28
|
+
static getIOConfig() {
|
|
29
|
+
return {
|
|
30
|
+
name: _enums.UNIT_TYPES.io,
|
|
31
|
+
type: _enums.UNIT_TYPES.io,
|
|
32
|
+
subtype: "input"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
initialize(config) {
|
|
36
|
+
this._materials = [];
|
|
37
|
+
this._defaultTargets = ["band_gaps:direct", "band_gaps:indirect"];
|
|
38
|
+
this._features = _lodash.default.get(config, "input.0.endpoint_options.data.features", []);
|
|
39
|
+
this._targets = _lodash.default.get(config, "input.0.endpoint_options.data.targets", this._defaultTargets);
|
|
40
|
+
this._ids = _lodash.default.get(config, "input.0.endpoint_options.data.ids", []);
|
|
41
|
+
this._jobId = null;
|
|
42
|
+
}
|
|
43
|
+
get materials() {
|
|
44
|
+
return this._materials || [];
|
|
45
|
+
}
|
|
46
|
+
get defaultTargets() {
|
|
47
|
+
return this._defaultTargets;
|
|
48
|
+
}
|
|
49
|
+
get features() {
|
|
50
|
+
return this._features;
|
|
51
|
+
}
|
|
52
|
+
get featuresWithoutId() {
|
|
53
|
+
return this.features.filter(x => x !== _enums.IO_ID_COLUMN);
|
|
54
|
+
}
|
|
55
|
+
get availableFeatures() {
|
|
56
|
+
const {
|
|
57
|
+
materials
|
|
58
|
+
} = this;
|
|
59
|
+
return _lodash.default.uniq(_lodash.default.flatten(materials.map(x => _lodash.default.keys(x.propertiesDict()))).concat(this.features));
|
|
60
|
+
}
|
|
61
|
+
get availableFeaturesWithoutId() {
|
|
62
|
+
return this.availableFeatures.filter(feature => feature !== _enums.IO_ID_COLUMN);
|
|
63
|
+
}
|
|
64
|
+
get targets() {
|
|
65
|
+
return this._targets;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @summary Checks whether selected features contain only IO_ID_COLUMN ('exabyteId').
|
|
70
|
+
* Used to identify that no features are selected yet (features set always contains ID_COLUMN)
|
|
71
|
+
*/
|
|
72
|
+
get onlyIdFeatureSelected() {
|
|
73
|
+
return _lodash.default.isEmpty(_lodash.default.without(this.features, _enums.IO_ID_COLUMN));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @summary Returns object with targets as key and arrays of appropriate values.
|
|
78
|
+
* E.g. {'band_gap:indirect': [0.1, 0.3], 'pressure': [100, undefined]}
|
|
79
|
+
*/
|
|
80
|
+
get valuesByTarget() {
|
|
81
|
+
const values = this.dataGridValues;
|
|
82
|
+
const result = {};
|
|
83
|
+
this.targets.forEach(target => {
|
|
84
|
+
result[target] = values.map(v => v[target]);
|
|
85
|
+
});
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
get dataFrameConfig() {
|
|
89
|
+
return {
|
|
90
|
+
subtype: "dataFrame",
|
|
91
|
+
source: "api",
|
|
92
|
+
input: [{
|
|
93
|
+
endpoint: "dataframe",
|
|
94
|
+
endpoint_options: {
|
|
95
|
+
method: "POST",
|
|
96
|
+
data: {
|
|
97
|
+
targets: this._targets,
|
|
98
|
+
features: this._features,
|
|
99
|
+
ids: this._ids,
|
|
100
|
+
jobId: this._jobId
|
|
101
|
+
},
|
|
102
|
+
headers: {},
|
|
103
|
+
params: {}
|
|
104
|
+
}
|
|
105
|
+
}]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
get isDataFrame() {
|
|
109
|
+
return this.prop("subtype") === "dataFrame";
|
|
110
|
+
}
|
|
111
|
+
setMaterials(materials) {
|
|
112
|
+
this._materials = materials;
|
|
113
|
+
this._ids = materials.map(m => m.exabyteId);
|
|
114
|
+
}
|
|
115
|
+
addFeature(feature) {
|
|
116
|
+
// only add if not already present
|
|
117
|
+
if (this._features.indexOf(feature) === -1) this._features.push(feature);
|
|
118
|
+
}
|
|
119
|
+
removeFeature(feature) {
|
|
120
|
+
if (this.featuresWithoutId.length === 1) {
|
|
121
|
+
throw new Error("At least one feature is required");
|
|
122
|
+
}
|
|
123
|
+
this._features = this._features.filter(x => feature !== x && x !== _enums.IO_ID_COLUMN);
|
|
124
|
+
}
|
|
125
|
+
addTarget(target) {
|
|
126
|
+
if (this._targets.indexOf(target) === -1) this._targets.push(target);
|
|
127
|
+
}
|
|
128
|
+
removeTarget(target) {
|
|
129
|
+
if (this._targets.length === 1) {
|
|
130
|
+
throw new Error("At least one target is required");
|
|
131
|
+
}
|
|
132
|
+
this._targets = this._targets.filter(x => target !== x);
|
|
133
|
+
}
|
|
134
|
+
hasFeature(feature) {
|
|
135
|
+
return this._features.indexOf(feature) > -1;
|
|
136
|
+
}
|
|
137
|
+
hasTarget(target) {
|
|
138
|
+
return this._targets.indexOf(target) > -1;
|
|
139
|
+
}
|
|
140
|
+
toJSON() {
|
|
141
|
+
const config = this.isDataFrame ? this.dataFrameConfig : {};
|
|
142
|
+
return this.clean({
|
|
143
|
+
...super.toJSON(),
|
|
144
|
+
...config
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.IOUnit = IOUnit;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultMapConfig = exports.MapUnit = void 0;
|
|
7
|
+
var _enums = require("../enums");
|
|
8
|
+
var _base = require("./base");
|
|
9
|
+
const defaultMapConfig = exports.defaultMapConfig = {
|
|
10
|
+
name: _enums.UNIT_TYPES.map,
|
|
11
|
+
type: _enums.UNIT_TYPES.map,
|
|
12
|
+
workflowId: "",
|
|
13
|
+
input: {
|
|
14
|
+
target: "MAP_DATA",
|
|
15
|
+
scope: "global",
|
|
16
|
+
name: "",
|
|
17
|
+
values: [],
|
|
18
|
+
useValues: false
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
class MapUnit extends _base.BaseUnit {
|
|
22
|
+
constructor(config) {
|
|
23
|
+
super({
|
|
24
|
+
...defaultMapConfig,
|
|
25
|
+
...config
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
get input() {
|
|
29
|
+
return this.prop("input");
|
|
30
|
+
}
|
|
31
|
+
get workflowId() {
|
|
32
|
+
return this.prop("workflowId");
|
|
33
|
+
}
|
|
34
|
+
setWorkflowId(id) {
|
|
35
|
+
this.setProp("workflowId", id);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.MapUnit = MapUnit;
|