Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix can't resume with overidden task name #887

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const ResumeButton: FC<ResumeButtonProps> = ({ node }) => {
nodeExecutionId={nodeExecution.id as NodeExecutionIdentifier}
showLaunchForm={showResumeForm}
setShowLaunchForm={setShowResumeForm}
nodeExecutionScopeId={nodeExecution.scopedId}
/>
) : null;
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface LaunchFormDialogProps {
setShowLaunchForm: React.Dispatch<React.SetStateAction<boolean>>;
compiledNode?: CompiledNode;
nodeExecutionId?: NodeExecutionIdentifier;
nodeExecutionScopeId?: string;
}

function getLaunchProps(id: ResourceIdentifier) {
Expand All @@ -34,6 +35,7 @@ export const LaunchFormDialog = ({
setShowLaunchForm,
compiledNode,
nodeExecutionId,
nodeExecutionScopeId,
}: LaunchFormDialogProps): JSX.Element => {
const onCancelLaunch = (_?: any) => {
setShowLaunchForm(false);
Expand All @@ -48,7 +50,7 @@ export const LaunchFormDialog = ({
const dialogOnClick = (e: React.MouseEvent<HTMLElement>) => {
e.stopPropagation();
};

console.log('kai', nodeExecutionScopeId);
return (
<Dialog
scroll="paper"
Expand All @@ -64,12 +66,13 @@ export const LaunchFormDialog = ({
onClose={onCancelLaunch}
{...getLaunchProps(id)}
/>
) : compiledNode && nodeExecutionId ? (
) : compiledNode && nodeExecutionId && nodeExecutionScopeId ? (
<ResumeForm
initialParameters={initialParameters}
nodeExecutionId={nodeExecutionId}
onClose={onCancelLaunch}
compiledNode={compiledNode}
nodeExecutionScopeId={nodeExecutionScopeId}
/>
) : null}
</Dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface ResumeFormProps extends BaseLaunchFormProps {
compiledNode: CompiledNode;
initialParameters?: TaskInitialLaunchParameters;
nodeExecutionId: NodeExecutionIdentifier;
nodeExecutionScopeId: string;
}

/** Renders the form for requesting a resume request on a gate node */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ export interface ResumeSignalFormProps extends BaseLaunchFormProps {
compiledNode: CompiledNode;
initialParameters?: TaskInitialLaunchParameters;
nodeExecutionId: NodeExecutionIdentifier;
nodeExecutionScopeId: string;
}

/** Renders the form for requesting a resume request on a gate node */
export const ResumeSignalForm: React.FC<ResumeSignalFormProps> = ({
compiledNode,
nodeExecutionId,
onClose,
nodeExecutionScopeId,
}) => {
const { formInputsRef, state, service } = useResumeFormState({
compiledNode,
Expand All @@ -41,14 +43,15 @@ export const ResumeSignalForm: React.FC<ResumeSignalFormProps> = ({
});
const { nodeExecutionsById } = useNodeExecutionsById();
const [nodeExecution, setNodeExecution] = useState<NodeExecution>(
nodeExecutionsById[nodeExecutionId.nodeId],
nodeExecutionsById[nodeExecutionScopeId],
);
window.console.log('kai', nodeExecutionScopeId, nodeExecution);
const styles = useStyles();
const baseState = state as BaseInterpretedLaunchState;
const baseService = service as BaseLaunchService;
const [isError, setIsError] = useState<boolean>(false);
const nodeExecutionDataQuery = useNodeExecutionDataQuery({
id: nodeExecution.id,
id: nodeExecution?.id,
});
// Any time the inputs change (even if it's just re-ordering), we must
// change the form key so that the inputs component will re-mount.
Expand All @@ -57,9 +60,9 @@ export const ResumeSignalForm: React.FC<ResumeSignalFormProps> = ({
}, [state.context.parsedInputs]);

useEffect(() => {
const newNodeExecution = nodeExecutionsById[nodeExecutionId.nodeId];
const newNodeExecution = nodeExecutionsById[nodeExecutionScopeId];
setNodeExecution(newNodeExecution);
}, [nodeExecutionId.nodeId]);
}, [nodeExecutionScopeId]);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ const parseWorkflow = ({
}

const templateNodeList = context.template.nodes;

/* Build Nodes from template */
for (let i = 0; i < templateNodeList.length; i++) {
const compiledNode: CompiledNode = templateNodeList[i];
Expand All @@ -475,6 +474,28 @@ const parseWorkflow = ({
};
}

/* Build failure node and add downstream connection for edges building */
const failureNode = { ...context.template.failureNode, failureNode: true };
if (failureNode && failureNode.id) {
parseNode({
node: failureNode as CompiledNode,
root,
nodeMetadataMap,
staticExecutionIdsMap,
compiledWorkflowClosure,
});
nodeMap[failureNode.id] = {
dNode: root.nodes[root.nodes.length - 1],
compiledNode: failureNode as CompiledNode,
};
if (!context.connections.downstream[startNodeId].ids.includes(failureNode.id)) {
context.connections.downstream[startNodeId].ids.push(failureNode.id);
context.connections.downstream[failureNode.id] = {
ids: [endNodeId],
};
}
}

/* Build Edges */
buildWorkflowEdges({
root,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const PausedTasksComponent: React.FC<PausedTasksComponentProps> = ({
nodeExecutionId={nodeExecutionsById[selectedNode.scopedId].id}
showLaunchForm={showResumeForm}
setShowLaunchForm={setShowResumeForm}
nodeExecutionScopeId={selectedNode.scopedId}
/>
) : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ const ReactFlowGateNodeInner = ({ data }: RFNode) => {
nodeExecutionId={nodeExecution?.id}
showLaunchForm={showResumeForm}
setShowLaunchForm={setShowResumeForm}
nodeExecutionScopeId={nodeExecution?.scopedId}
/>
)}
</div>
Expand Down