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)); }) ); }