Skip to content

Commit

Permalink
feat: Fall back to retrieve logs from live pods (argoproj#12024)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Tang <[email protected]>
  • Loading branch information
terrytangyuan authored and jiachengxu committed Mar 8, 2024
1 parent 4efba1b commit af86f61
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/src/app/shared/services/workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class WorkflowsService {

public getContainerLogs(workflow: Workflow, podName: string, nodeId: string, container: string, grep: string, archived: boolean): Observable<LogEntry> {
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
Expand All @@ -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));
})
);
}
Expand Down

0 comments on commit af86f61

Please sign in to comment.