Skip to content
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

Merged

Conversation

yrudman
Copy link
Contributor

@yrudman yrudman commented Apr 13, 2018

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

@yrudman yrudman force-pushed the link-task-and-queued-metric-capture-command branch 2 times, most recently from 82f0cdc to 5421247 Compare April 17, 2018 00:56
@yrudman yrudman changed the title [WIP] Initialize MiqQueue.miq_task_id column when queuing metric capture task Initialize MiqQueue.miq_task_id column when queuing metric capture task Apr 17, 2018
@yrudman
Copy link
Contributor Author

yrudman commented Apr 17, 2018

\cc @kbrock @agrare

@miq-bot miq-bot removed the wip label Apr 17, 2018
@@ -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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@yrudman yrudman force-pushed the link-task-and-queued-metric-capture-command branch from c44ea86 to 374a2e5 Compare April 18, 2018 10:02
@agrare agrare self-assigned this Apr 18, 2018
@@ -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
Copy link
Member

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.

Copy link
Contributor Author

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
@yrudman yrudman force-pushed the link-task-and-queued-metric-capture-command branch from 374a2e5 to 8bd560b Compare April 18, 2018 10:23
@miq-bot
Copy link
Member

miq-bot commented Apr 18, 2018

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
2 files checked, 0 offenses detected
Everything looks fine. ⭐

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@agrare agrare merged commit 51f97d4 into ManageIQ:master Apr 18, 2018
@agrare agrare added this to the Sprint 84 Ending Apr 23, 2018 milestone Apr 18, 2018
@yrudman yrudman deleted the link-task-and-queued-metric-capture-command branch April 18, 2018 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants