-
Notifications
You must be signed in to change notification settings - Fork 897
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
Initialize MiqQueue.miq_task_id column when queuing metric capture task #17301
Initialize MiqQueue.miq_task_id column when queuing metric capture task #17301
Conversation
82f0cdc
to
5421247
Compare
@@ -110,6 +110,9 @@ def perf_capture_queue(interval_name, options = {}) | |||
nil | |||
end | |||
end | |||
# main reason for setting miq_task_id is to initializes MiqTask.started_on column when message delivered. | |||
# there is no harm to update miq_task_id twice (if job is still running) | |||
queued_item.update_attributes(:miq_task_id => task_id) if task_id |
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 can you set the task_id in block instead? Since put_or_update already does create or update_attributes.
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.
👍
c44ea86
to
374a2e5
Compare
@@ -355,6 +355,13 @@ def verify_perf_capture_queue(last_perf_capture_on, total_queue_items) | |||
verify_perf_capture_queue(last_perf_capture_on, 11) | |||
end | |||
end | |||
|
|||
it "links supplied miq_task with queued item which allow to initialize MiqTask#started_on attribute" do | |||
MiqQueue.delete_all |
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.
This is weird, I see it is this way in the rest of these tests so I won't hold this up. IMO these should be in different contexts so we don't have to clear database records.
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.
yes, agreed, it does look strange
…erride existing value if second task created for the already queued request. Having MiqQueue#miq_task_id column initialized will allow automaticly populate MiqTask_started_on when queed metric capture command delivered. It become possible after merginghttps://github.com/ManageIQ/pull/17015. related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1543289
374a2e5
to
8bd560b
Compare
Checked commits yrudman/manageiq@0861aee~...8bd560b with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
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.
LGTM
This PR will allow to automatically initialize
MiqTask.started_on
field when queued command to perform metric capture delivered.This PR is follow-up to #17015
related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1543289
@miq-bot add-label core, enhancement