From e05a5e57710a539c3971345d6a143e1fe4f2dcab Mon Sep 17 00:00:00 2001 From: "Yuan (Terry) Tang" Date: Wed, 18 Oct 2023 12:52:16 -0400 Subject: [PATCH] feat: Fall back to retrieve logs from live pods (#12024) Signed-off-by: Yuan Tang --- ui/src/app/shared/services/workflows-service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/src/app/shared/services/workflows-service.ts b/ui/src/app/shared/services/workflows-service.ts index a599fcc3e70b..313c6866c4d4 100644 --- a/ui/src/app/shared/services/workflows-service.ts +++ b/ui/src/app/shared/services/workflows-service.ts @@ -202,6 +202,7 @@ export class WorkflowsService { public getContainerLogs(workflow: Workflow, podName: string, nodeId: string, container: string, grep: string, archived: boolean): Observable { const getLogsFromArtifact = () => this.getContainerLogsFromArtifact(workflow, nodeId, container, grep, archived); + const getLogsFromCluster = () => this.getContainerLogsFromCluster(workflow, podName, container, grep); // If our workflow is archived, don't even bother inspecting the cluster for logs since it's likely // that the Workflow and associated pods have been deleted @@ -213,9 +214,9 @@ export class WorkflowsService { return from(this.isWorkflowNodePendingOrRunning(workflow, nodeId)).pipe( switchMap(isPendingOrRunning => { if (!isPendingOrRunning && this.hasArtifactLogs(workflow, nodeId, container) && container === 'main') { - return getLogsFromArtifact(); + return getLogsFromArtifact().pipe(catchError(getLogsFromCluster)); } - return this.getContainerLogsFromCluster(workflow, podName, container, grep).pipe(catchError(getLogsFromArtifact)); + return getLogsFromCluster().pipe(catchError(getLogsFromArtifact)); }) ); }