Skip to content

Commit

Permalink
chore: dparent null in alt paths (#775)
Browse files Browse the repository at this point in the history
Signed-off-by: Carina Ursu <carina@union.ai>
  • Loading branch information
ursucarina authored Jun 16, 2023
1 parent 3184646 commit 4783c39
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/console/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flyteorg/console",
"version": "0.0.37",
"version": "0.0.38",
"description": "Flyteconsole main app module",
"main": "./dist/index.js",
"module": "./lib/index.js",
Expand Down
29 changes: 22 additions & 7 deletions packages/console/src/components/Executions/nodeExecutionQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,25 @@ export function makeNodeExecutionAndTasksQuery(
id: NodeExecutionIdentifier,
queryClient: QueryClient,
dynamicParentNodeId?: string,
): QueryInput<WorkflowNodeExecution> {
) {
return {
queryKey: [QueryType.NodeExecutionAndTasks, id],
queryFn: async () => {
// step 1: Fetch the Node execution
const nodeExecutionPure = await getNodeExecution(id);

const dynamicParent = dynamicParentNodeId
? await getNodeExecution({ ...id, nodeId: dynamicParentNodeId })
: null;

// step 2: Fetch the task executions and attach them to the node execution
const workflowNodeExecution = (await getTaskExecutions(
queryClient,
nodeExecutionPure,
)) as WorkflowNodeExecution;

if (!workflowNodeExecution) {
return {} as WorkflowNodeExecution;
return [{} as WorkflowNodeExecution];
}

workflowNodeExecution.scopedId = workflowNodeExecution?.id?.nodeId;
Expand Down Expand Up @@ -111,11 +115,22 @@ export function makeNodeExecutionAndTasksQuery(
),
);

return {
...workflowNodeExecution,
taskExecutions: tasksExecutionData,
nodeExecutionData,
} as WorkflowNodeExecution;
const final = [
{
...workflowNodeExecution,
taskExecutions: tasksExecutionData,
nodeExecutionData,
} as WorkflowNodeExecution,
];

if (dynamicParent) {
final.push({
...(dynamicParent as WorkflowNodeExecution),
scopedId: dynamicParentNodeId,
});
}

return final;
},
};
}
Expand Down
4 changes: 3 additions & 1 deletion packages/console/src/components/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export const checkForDynamicExecutions = (allExecutions, staticExecutions) => {
const result = {};
for (const parentId in parentsToFetch) {
const execution = executionsByNodeId[parentId];
result[execution.scopedId] = execution;
if (execution) {
result[execution.scopedId] = execution;
}
}
return result;
};
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"@flyteorg/common": "^0.0.4",
"@flyteorg/console": "^0.0.37",
"@flyteorg/console": "^0.0.38",
"long": "^4.0.0",
"protobufjs": "~6.11.3",
"react-ga4": "^1.4.1",
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ __metadata:
resolution: "@flyteconsole/client-app@workspace:website"
dependencies:
"@flyteorg/common": ^0.0.4
"@flyteorg/console": ^0.0.37
"@flyteorg/console": ^0.0.38
"@types/long": ^3.0.32
long: ^4.0.0
protobufjs: ~6.11.3
Expand Down Expand Up @@ -2059,7 +2059,7 @@ __metadata:
languageName: unknown
linkType: soft

"@flyteorg/console@^0.0.37, @flyteorg/console@workspace:packages/console":
"@flyteorg/console@^0.0.38, @flyteorg/console@workspace:packages/console":
version: 0.0.0-use.local
resolution: "@flyteorg/console@workspace:packages/console"
dependencies:
Expand Down

0 comments on commit 4783c39

Please sign in to comment.