Added io mapping for models and parameters

This commit is contained in:
Shubham Takode 2024-03-04 15:35:58 +05:30
parent bf49d855cd
commit e196169c98
4 changed files with 45 additions and 8 deletions

View File

@ -65,6 +65,8 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
this.reactFlowState.edges this.reactFlowState.edges
); );
const options: Array<PipelinesStepInputOutputMappingOptions> = []; const options: Array<PipelinesStepInputOutputMappingOptions> = [];
// add outputs from incomming nodes.
incommingNodes.forEach((node) => { incommingNodes.forEach((node) => {
if (node.data?.experimentDetails?.execution?.artifacts?.length) { if (node.data?.experimentDetails?.execution?.artifacts?.length) {
// for now we are using only artifacts of i/o mapping. // for now we are using only artifacts of i/o mapping.
@ -77,7 +79,33 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
} }
}); });
} }
if(node.data?.experimentDetails?.models?.output?.length) {
// models i/o mapping.
node.data.experimentDetails.models.output.forEach((model) => {
options.push({
...model,
stepName: node.data.name,
id: model.model.id,
type: "model",
key: model.name
}); });
});
}
});
// add pipeline parameters
if(this.selectedPipeline?.parameters?.length) {
this.selectedPipeline.parameters.forEach((param) => {
options.push({
...param,
stepName: this.selectedPipeline.name,
type: "pipeline_parameter",
key: param.name
});
})
}
this.selectedStepInputOutputOptions = options; this.selectedStepInputOutputOptions = options;
console.log(options); console.log(options);
} }
@ -96,7 +124,7 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
this.pipelineId = pipelineId; this.pipelineId = pipelineId;
setTimeout(() => { setTimeout(() => {
this.store.dispatch(getPipelineById({ id: pipelineId, name: "" })); this.store.dispatch(getPipelineById({ id: pipelineId, name: "" }));
}, 1000); });
}) })
); );

View File

@ -2,7 +2,7 @@
::ng-deep { ::ng-deep {
.option { .option {
background-color: red; // background-color: red;
span { span {
overflow: hidden; overflow: hidden;

View File

@ -30,11 +30,20 @@ export class PipelineStepInfoComponent {
@Input() set ioOptions(options: any) { @Input() set ioOptions(options: any) {
const opts = options.map((op) => { const opts = options.map((op) => {
if(op.type === "pipeline_parameter") {
return {
value: "${pipeline." + op.key +"}",
label: `${op.stepName}.${op.key}`,
type: op.type
}
} else {
return { return {
value: "${"+op.stepName+".id}."+op.key, value: "${"+op.stepName+".id}."+op.key,
label: `${op.stepName}.${op.key}`, label: `${op.stepName}.${op.key}`,
type: op.type type: op.type
} }
}
}); });
this._ioOptions = cloneDeep(opts); this._ioOptions = cloneDeep(opts);

View File

@ -19,7 +19,7 @@ import {
import { Task } from '~/business-logic/model/tasks/task'; import { Task } from '~/business-logic/model/tasks/task';
import { PipelineParametersComponent } from '@common/pipelines/pipeline-parameters/pipeline-parameters.component'; import { PipelineParametersComponent } from '@common/pipelines/pipeline-parameters/pipeline-parameters.component';
import { cloneDeep } from 'lodash-es'; import { cloneDeep, upperCase } from 'lodash-es';
import { ParamsItem } from '~/business-logic/model/tasks/paramsItem'; import { ParamsItem } from '~/business-logic/model/tasks/paramsItem';
@ -91,7 +91,7 @@ export class PipelineAddStepFormComponent implements OnChanges, OnDestroy {
this._experiments = experiments; this._experiments = experiments;
this.experimentsOptions = [ this.experimentsOptions = [
...((this.rootFiltered || experiments === null) ? [] : [this.experimentsRoot]), ...((this.rootFiltered || experiments === null) ? [] : [this.experimentsRoot]),
...(experiments ? experiments.map(experiment => ({label: experiment.name, value: experiment.id, parameters: experiment.hyperparams, otherDetails: {...experiment}})) : []) ...(experiments ? experiments.map(experiment => ({label: experiment.name + " ("+ upperCase(experiment?.status) + ")", value: experiment.id, parameters: experiment.hyperparams, otherDetails: {...experiment}})) : [])
]; ];
this.experimentsNames = this.experimentsOptions.map(experiment => experiment.label); this.experimentsNames = this.experimentsOptions.map(experiment => experiment.label);
} }