Skip to content

Commit 249e0d6

Browse files
author
Piyush Adlakha
committed
Bug fix for getting dataframes in TrainingJobAnalytics.
1 parent 5d88412 commit 249e0d6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/sagemaker/analytics.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class TrainingJobAnalytics(AnalyticsMetricsBase):
199199
"""Fetch training curve data from CloudWatch Metrics for a specific training job.
200200
"""
201201

202-
CLOUDWATCH_NAMESPACE = '/aws/sagemaker/HyperParameterTuningJobs'
202+
CLOUDWATCH_NAMESPACE = '/aws/sagemaker/TrainingJobs'
203203

204204
def __init__(self, training_job_name, metric_names=None, sagemaker_session=None):
205205
"""Initialize a ``TrainingJobAnalytics`` instance.
@@ -246,7 +246,12 @@ def _determine_timeinterval(self):
246246
"""
247247
description = self._sage_client.describe_training_job(TrainingJobName=self.name)
248248
start_time = description[u'TrainingStartTime'] # datetime object
249-
end_time = description.get(u'TrainingEndTime', datetime.datetime.utcnow())
249+
# Incrementing end time by 1 min since cloud watch drops seconds before finding the logs.
250+
# This results in logs being searched in the time range in which the correct log line was not present.
251+
# Example - Log time - 2018-10-22 08:25:55
252+
# Here calculated end time would also be 2018-10-22 08:25:55 (without 1 min addition)
253+
# CW will consider end time as 2018-10-22 08:25 and will not be able to search the correct log.
254+
end_time = description.get(u'TrainingEndTime', datetime.datetime.utcnow()) + datetime.timedelta(minutes=1)
250255
return {
251256
'start_time': start_time,
252257
'end_time': end_time,

0 commit comments

Comments
 (0)