Skip to content

Commit

Permalink
Imroving missed task recovery logic (sodafoundation#704)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik <lynheell@gmail.com>
Co-authored-by: Ashit Kumar <akopensrc@gmail.com>
  • Loading branch information
3 people authored Sep 23, 2021
1 parent 3634b0b commit 0d83731
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion delfin/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class TelemetryCollection(object):
MAX_FAILED_JOB_RETRY_COUNT = 5
"""Default performance collection interval"""
DEF_PERFORMANCE_COLLECTION_INTERVAL = 900
DEF_PERFORMANCE_HISTORY_ON_RESCHEDULE = 300
DEF_PERFORMANCE_HISTORY_ON_RESCHEDULE = 1800


class TelemetryTaskStatus(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,15 @@ def schedule_job(self, task_id):
# miss any Data points due to reschedule
LOG.debug('Triggering one historic collection for job %s',
job['id'])
# Maximum supported history duration on restart
history_on_reschedule = CONF.telemetry. \
performance_history_on_reschedule
# Adjust start_time and end_time based on last_run_time
end_time = current_time * 1000
start_time = end_time - (history_on_reschedule * 1000)
start_time = job['last_run_time'] * 1000 \
if current_time - job['last_run_time'] < \
history_on_reschedule \
else (end_time - history_on_reschedule * 1000)
telemetry = PerformanceCollectionTask()
telemetry.collect(self.ctx, self.storage_id,
self.args,
Expand Down

0 comments on commit 0d83731

Please sign in to comment.