Skip to content

Commit 7e0f2bd

Browse files
Show Array Node MetaData (#863)
* add ArrayNodes to types Signed-off-by: Jan Fiedler <jan@union.ai> * update WorkflowGraph Signed-off-by: Jan Fiedler <jan@union.ai> * update execution types Signed-off-by: Jan Fiedler <jan@union.ai> * update createExecutionArray Signed-off-by: Jan Fiedler <jan@union.ai> * prevent nullref Signed-off-by: Carina Ursu <carina@union.ai> * update codecov-action Signed-off-by: Carina Ursu <carina@union.ai> --------- Signed-off-by: Jan Fiedler <jan@union.ai> Signed-off-by: Carina Ursu <carina@union.ai> Co-authored-by: Carina Ursu <carina@union.ai>
1 parent 34edde1 commit 7e0f2bd

File tree

6 files changed

+56
-19
lines changed

6 files changed

+56
-19
lines changed

.github/workflows/checks.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ jobs:
3737
run: yarn install --immutable
3838
- name: Run tests and generate coverage
3939
run: make test_unit_codecov
40-
- uses: codecov/codecov-action@v1
40+
- uses: codecov/codecov-action@v3
4141
with:
42+
token: ${{ secrets.CODECOV_TOKEN }}
4243
files: .coverage/coverage-final.json
43-
fail_ci_if_error: true
44+
fail_ci_if_error: false
4445

4546
lint_project:
4647
runs-on: ubuntu-latest
@@ -68,13 +69,7 @@ jobs:
6869
release:
6970
name: Generate Release
7071
if: ${{ (github.event_name != 'pull_request') && (needs.extract_branch.outputs.branch == 'master') }}
71-
needs:
72-
[
73-
unit_tests_with_coverage,
74-
lint_project,
75-
build_docker_image,
76-
extract_branch,
77-
]
72+
needs: [unit_tests_with_coverage, lint_project, build_docker_image, extract_branch]
7873
runs-on: ubuntu-latest
7974
steps:
8075
- name: Checkout

packages/oss-console/src/components/Executions/contextProvider/NodeExecutionDetails/createExecutionArray.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Identifier } from '../../../../models/Common/types';
77
import { CompiledTask } from '../../../../models/Task/types';
88
import { dNode } from '../../../../models/Graph/types';
99
import { isEndNode, isStartNode } from '../../../../models/Node/utils';
10+
import { getTaskTypeFromCompiledNode } from '../../../WorkflowGraph/utils';
1011

1112
interface NodeExecutionInfo extends NodeExecutionDetails {
1213
scopedId?: string;
@@ -104,6 +105,16 @@ export const getNodeDetails = (
104105
};
105106
}
106107

108+
if (compiledNode?.arrayNode) {
109+
returnVal = {
110+
...returnVal,
111+
displayType:
112+
returnVal.displayType !== NodeExecutionDisplayType.Unknown
113+
? returnVal.displayType
114+
: NodeExecutionDisplayType.ArrayNode,
115+
};
116+
}
117+
107118
return returnVal;
108119
};
109120

@@ -119,6 +130,13 @@ export const getNodeDetailsFromTask = (node: dNode, task?: CompiledTask): NodeEx
119130
displayType: taskType ?? NodeExecutionDisplayType.Unknown,
120131
};
121132

133+
if (node.value?.arrayNode) {
134+
returnVal = {
135+
...returnVal,
136+
displayType: NodeExecutionDisplayType.ArrayNode,
137+
};
138+
}
139+
122140
if (node.value?.workflowNode) {
123141
const { workflowNode } = node.value;
124142
const info = workflowNode.launchplanRef ?? workflowNode.subWorkflowRef;
@@ -160,7 +178,7 @@ export const getNodeExecutionDetails = (
160178
node: dNode,
161179
tasks: CompiledTask[] = [],
162180
): NodeExecutionInfo => {
163-
const templateName = node?.value?.taskNode?.referenceId?.name ?? node.name;
164-
const task = tasks.find((t) => t.template.id.name === templateName);
181+
const taskNode = node?.value?.arrayNode?.node?.taskNode || node?.value?.taskNode;
182+
const task = getTaskTypeFromCompiledNode(taskNode!, tasks);
165183
return getNodeDetailsFromTask(node, task);
166184
};

packages/oss-console/src/components/Executions/types.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
NodeExecution,
3-
NodeExecutionClosure,
4-
NodeExecutionMetadata,
5-
WorkflowNodeMetadata,
6-
} from '../../models/Execution/types';
1+
import { NodeExecution, NodeExecutionMetadata } from '../../models/Execution/types';
72
import { TaskTemplate } from '../../models/Task/types';
83

94
export interface ExecutionPhaseConstants {
@@ -15,6 +10,7 @@ export interface ExecutionPhaseConstants {
1510
}
1611

1712
export enum NodeExecutionDisplayType {
13+
ArrayNode = 'Array Node',
1814
MapTask = 'Map Task',
1915
BatchHiveTask = 'Hive Batch Task',
2016
BranchNode = 'Branch Node',

packages/oss-console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { DISPLAY_NAME_END, DISPLAY_NAME_START } from '../flytegraph/ReactFlow/ut
66
import { createDebugLogger } from '../../common/log';
77
import { dTypes, dEdge, dNode } from '../../models/Graph/types';
88
import { startNodeId, endNodeId } from '../../models/Node/constants';
9-
import { CompiledNode, ConnectionSet, TaskNode } from '../../models/Node/types';
9+
import { ArrayNode, CompiledNode, ConnectionSet, TaskNode } from '../../models/Node/types';
1010
import { CompiledTask } from '../../models/Task/types';
1111
import { CompiledWorkflow, CompiledWorkflowClosure } from '../../models/Workflow/types';
1212
import { isStartOrEndNode } from '../../models/Node/utils';
@@ -81,6 +81,7 @@ const createDNode = ({
8181
gateNode: compiledNode.gateNode,
8282
level: parentDNode?.level !== undefined ? parentDNode.level + 1 : 0,
8383
...nodeMetadata,
84+
...(compiledNode.arrayNode ? { arrayNode: compiledNode.arrayNode } : {}),
8485
...(compiledNode.workflowNode ? { workflowNode: compiledNode.workflowNode } : {}),
8586
...(compiledNode.gateNode ? { gateNode: compiledNode.gateNode } : {}),
8687
...(compiledNode.branchNode ? { taskNode: compiledNode.taskNode } : {}),
@@ -247,6 +248,21 @@ const parseNode = ({
247248
compiledWorkflowClosure,
248249
});
249250
}
251+
} else if (node?.arrayNode) {
252+
const arrayNode = (node.arrayNode as ArrayNode).node;
253+
const taskNode = arrayNode.taskNode as TaskNode;
254+
const taskType: CompiledTask = getTaskTypeFromCompiledNode(
255+
taskNode,
256+
compiledWorkflowClosure.tasks,
257+
) as CompiledTask;
258+
dNode = createDNode({
259+
compiledNode: node,
260+
parentDNode: root,
261+
taskTemplate: taskType,
262+
nodeMetadataMap,
263+
staticExecutionIdsMap,
264+
compiledWorkflowClosure,
265+
});
250266
} else if (node.taskNode) {
251267
const taskNode = node.taskNode as TaskNode;
252268
const taskType: CompiledTask = getTaskTypeFromCompiledNode(

packages/oss-console/src/components/WorkflowGraph/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ export const getSubWorkflowFromId = (
100100
};
101101

102102
export const getTaskTypeFromCompiledNode = (taskNode: TaskNode, tasks: CompiledTask[]) => {
103+
if (!taskNode?.referenceId) {
104+
return undefined;
105+
}
103106
for (let i = 0; i < tasks.length; i++) {
104107
const compiledTask: CompiledTask = tasks[i];
105108
const taskTemplate: TaskTemplate = compiledTask.template;
@@ -108,7 +111,7 @@ export const getTaskTypeFromCompiledNode = (taskNode: TaskNode, tasks: CompiledT
108111
return compiledTask;
109112
}
110113
}
111-
return null;
114+
return undefined;
112115
};
113116

114117
export const getNodeNameFromDag = (dagData: dNode, nodeId: string) => {

packages/oss-console/src/models/Node/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ export type WorkflowNode = Core.IWorkflowNode;
66
/** A graph node indicating a branching decision. */
77
export type BranchNode = Core.IBranchNode;
88

9+
/** A graph node indicating a Array Node. */
10+
export interface ArrayNode extends Core.IArrayNode {
11+
node: CompiledNode;
12+
parallelism?: number;
13+
minSuccesses?: number;
14+
minSuccessRatio?: number;
15+
}
16+
917
/** A graph node indicating a task to be executed. This is the most common
1018
* node type in a Flyte graph.
1119
*/
@@ -30,6 +38,7 @@ export interface CompiledNode extends Core.INode {
3038
inputs?: Binding[];
3139
metadata?: CompiledNodeMetadata;
3240
outputAliases?: Alias[];
41+
arrayNode?: ArrayNode;
3342
taskNode?: TaskNode;
3443
upstreamNodeIds?: string[];
3544
workflowNode?: WorkflowNode;

0 commit comments

Comments
 (0)