Skip to content

Commit

Permalink
fix(ui): request task logs only if pod was created
Browse files Browse the repository at this point in the history
Signed-off-by: arpechenin <arpechenin@avito.ru>
  • Loading branch information
ntny authored and arpechenin committed Dec 11, 2024
1 parent 0eb67e1 commit d429840
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions frontend/src/components/tabs/RuntimeNodeDetailsV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,17 @@ async function getLogsInfo(execution: Execution, runId?: string): Promise<Map<st
return logsInfo; // Early return if it is from cache.
}

try {
logsDetails = await Apis.getPodLogs(runId!, podName, podNameSpace, createdAt);
logsInfo.set(LOGS_DETAILS, logsDetails);
} catch (err) {
let errMsg = await errorToMessage(err);
logsBannerMessage = 'Failed to retrieve pod logs.';
logsInfo.set(LOGS_BANNER_MESSAGE, logsBannerMessage);
logsBannerAdditionalInfo = 'Error response: ' + errMsg;
logsInfo.set(LOGS_BANNER_ADDITIONAL_INFO, logsBannerAdditionalInfo);
if(podName && podName !== '') {
try {
logsDetails = await Apis.getPodLogs(runId!, podName, podNameSpace, createdAt);
logsInfo.set(LOGS_DETAILS, logsDetails);
} catch (err) {
let errMsg = await errorToMessage(err);
logsBannerMessage = 'Failed to retrieve pod logs.';
logsInfo.set(LOGS_BANNER_MESSAGE, logsBannerMessage);
logsBannerAdditionalInfo = 'Error response: ' + errMsg;
logsInfo.set(LOGS_BANNER_ADDITIONAL_INFO, logsBannerAdditionalInfo);
}
}
return logsInfo;
}
Expand Down

0 comments on commit d429840

Please sign in to comment.