-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for timed out active tasks #15231
Changes from all commits
032d422
6f3f8fa
0e49537
7f70cc5
942405c
8051e5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,17 @@ class MiqTask < ApplicationRecord | |
t.grouping(Arel::Nodes::Case.new(t[:state]).when(STATE_FINISHED).then(t[:status]).else(t[:state])) | ||
end) | ||
|
||
scope :active, -> { where(:state => STATE_ACTIVE) } | ||
scope :no_associated_job, -> { where.not("id IN (SELECT miq_task_id from jobs)") } | ||
scope :timed_out, -> { where("updated_on < ?", Time.now.utc - ::Settings.task.active_task_timeout.to_i_with_method) } | ||
|
||
def self.update_status_for_timed_out_active_tasks | ||
MiqTask.active.timed_out.no_associated_job.find_each do |task| | ||
task.update_status(STATE_FINISHED, STATUS_ERROR, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still confused by the STATUS_ERROR. We should fix this in a followup so the UI displays timed out tasks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i will look at it |
||
"Task [#{task.id}] timed out - not active for more than #{::Settings.task.active_task_timeout}") | ||
end | ||
end | ||
|
||
def active? | ||
![STATE_QUEUED, STATE_FINISHED].include?(state) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1129,6 +1129,8 @@ | |
:max_parallel_scans_per_host: 1 | ||
:max_qitems_per_scan_request: 0 | ||
:watchdog_interval: 1.minute | ||
:task: | ||
:active_task_timeout: 6.hours | ||
:ui: | ||
:mark_translated_strings: false | ||
:webservices: | ||
|
@@ -1299,6 +1301,7 @@ | |
:session_timeout_interval: 30.seconds | ||
:storage_file_collection_interval: 1.days | ||
:storage_file_collection_time_utc: 21600 | ||
:task_timeout_check_frequency: 1.hour | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what's are the correct numbers here... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. me too ❓ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
:vm_retired_interval: 10.minutes | ||
:yum_update_check: 12.hours | ||
:ui_worker: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yrudman have you tested that rufus supports ActiveSupport::TimeWithZone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've done manual testing: leaving active records in DB and restarting server - works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.