From a8f3df8492cc9db0d7b7b8ca1b5c86409284ccd4 Mon Sep 17 00:00:00 2001 From: kerrlabajo Date: Thu, 16 May 2024 19:36:06 +0800 Subject: [PATCH] Fix where manual live tailing was specifically set to only one user --- Functions/TrainingJobHandler.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Functions/TrainingJobHandler.cs b/Functions/TrainingJobHandler.cs index 0cbb338..5f9a312 100644 --- a/Functions/TrainingJobHandler.cs +++ b/Functions/TrainingJobHandler.cs @@ -151,10 +151,12 @@ private async Task CheckTrainingJobStatus(AmazonSageMakerClient amazonSageMakerC { if (trainingDetails.SecondaryStatusTransitions.Any() && trainingDetails.SecondaryStatusTransitions.Last().Status == "Training") { - string logStreamName = await GetLatestLogStream(cloudWatchLogsClient, "/aws/sagemaker/TrainingJobs", trainingJobName); + string logGroupName = "/aws/sagemaker/TrainingJobs"; + + string logStreamName = await GetLatestLogStream(cloudWatchLogsClient, logGroupName, trainingJobName); if (!string.IsNullOrEmpty(logStreamName)) { - await StartLiveTail(cloudWatchLogsClient, "arn:aws:logs:ap-southeast-1:905418164808:log-group:/aws/sagemaker/TrainingJobs:", logStreamName); + await StartLiveTail(cloudWatchLogsClient, $"arn:aws:logs:{UserConnectionInfo.Region}:{UserConnectionInfo.AccountId}:log-group:{logGroupName}:", logStreamName); } }